mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Files specific to Visual Age C for OS/2 -- by Jeff Rush
This commit is contained in:
parent
0ba48ba172
commit
50d4cc2f1d
6 changed files with 4846 additions and 0 deletions
135
PC/os2vacpp/config.c
Normal file
135
PC/os2vacpp/config.c
Normal file
|
@ -0,0 +1,135 @@
|
|||
/* -*- 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 contains the table of built-in modules.
|
||||
See init_builtin() in import.c. */
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
extern void initarray();
|
||||
extern void initaudioop();
|
||||
extern void initbinascii();
|
||||
extern void initcmath();
|
||||
extern void initerrno();
|
||||
extern void initimageop();
|
||||
extern void initmath();
|
||||
extern void initmd5();
|
||||
extern void initnew();
|
||||
extern void initnt();
|
||||
extern void initos2();
|
||||
extern void initoperator();
|
||||
extern void initposix();
|
||||
extern void initregex();
|
||||
extern void initreop();
|
||||
extern void initrgbimg();
|
||||
extern void initrotor();
|
||||
extern void initsignal();
|
||||
extern void initselect();
|
||||
extern void init_socket();
|
||||
extern void initsoundex();
|
||||
extern void initstrop();
|
||||
extern void initstruct();
|
||||
extern void inittime();
|
||||
extern void initthread();
|
||||
extern void initcStringIO();
|
||||
extern void initcPickle();
|
||||
#ifdef WIN32
|
||||
extern void initmsvcrt();
|
||||
#endif
|
||||
|
||||
/* -- ADDMODULE MARKER 1 -- */
|
||||
|
||||
extern void PyMarshal_Init();
|
||||
extern void initimp();
|
||||
|
||||
struct _inittab _PyImport_Inittab[] = {
|
||||
|
||||
{"array", initarray},
|
||||
#ifdef M_I386
|
||||
{"audioop", initaudioop},
|
||||
#endif
|
||||
{"binascii", initbinascii},
|
||||
{"cmath", initcmath},
|
||||
{"errno", initerrno},
|
||||
// {"imageop", initimageop},
|
||||
{"math", initmath},
|
||||
{"md5", initmd5},
|
||||
{"new", initnew},
|
||||
#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__)
|
||||
{"nt", initnt}, /* Use the NT os functions, not posix */
|
||||
#else
|
||||
#if defined(PYOS_OS2)
|
||||
{"os2", initos2},
|
||||
#else
|
||||
{"posix", initposix},
|
||||
#endif
|
||||
#endif
|
||||
{"operator", initoperator},
|
||||
{"regex", initregex},
|
||||
{"reop", initreop},
|
||||
// {"rgbimg", initrgbimg},
|
||||
// {"rotor", initrotor},
|
||||
{"signal", initsignal},
|
||||
#ifdef USE_SOCKET
|
||||
{"_socket", init_socket},
|
||||
{"select", initselect},
|
||||
#endif
|
||||
{"soundex", initsoundex},
|
||||
{"strop", initstrop},
|
||||
{"struct", initstruct},
|
||||
{"time", inittime},
|
||||
#ifdef WITH_THREAD
|
||||
{"thread", initthread},
|
||||
#endif
|
||||
{"cStringIO", initcStringIO},
|
||||
{"cPickle", initcPickle},
|
||||
#ifdef WIN32
|
||||
{"msvcrt", initmsvcrt},
|
||||
#endif
|
||||
|
||||
/* -- 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},
|
||||
|
||||
/* Sentinel */
|
||||
{0, 0}
|
||||
};
|
630
PC/os2vacpp/config.h
Normal file
630
PC/os2vacpp/config.h
Normal file
|
@ -0,0 +1,630 @@
|
|||
#ifndef Py_CONFIG_H
|
||||
#define Py_CONFIG_H
|
||||
|
||||
/**********************************************************************
|
||||
* config.h. NOT Generated automatically by configure.
|
||||
*
|
||||
* This is a manually maintained version used for the Watcom,
|
||||
* Borland and Microsoft Visual C++ compilers on the MS Windows
|
||||
* platform, and the IBM VisualAge C/C++ compiler on the OS/2
|
||||
* platform. It is a standard part of the Python distribution.
|
||||
*
|
||||
* FILESYSTEM DEFINES:
|
||||
* The code specific to a particular way of naming files and
|
||||
* directory paths should be wrapped around one of the following
|
||||
* #defines:
|
||||
*
|
||||
* DOSFILESYS PCDOS-Style (for PCDOS, Windows and OS/2)
|
||||
* MACFILESYS Macintosh-Style
|
||||
* UNIXFILESYS Unix-Style
|
||||
* AMIGAFILESYS AmigaDOS-Style (to-be-supported)
|
||||
*
|
||||
* Because of the different compilers and operating systems in
|
||||
* use on the Intel platform, neither the compiler name nor
|
||||
* the operating system name is sufficient.
|
||||
*
|
||||
* WINDOWS DEFINES:
|
||||
* The code specific to Windows should be wrapped around one of
|
||||
* the following #defines
|
||||
*
|
||||
* MS_WIN32 - Code specific to the MS Win32 API
|
||||
* MS_WIN16 - Code specific to the old 16 bit Windows API.
|
||||
* MS_WINDOWS - Code specific to Windows, but all versions.
|
||||
* MS_COREDLL - Code if the Python core is built as a DLL.
|
||||
*
|
||||
* Note that the old defines "NT" and "WIN32" are still supported, but
|
||||
* will soon be dropped.
|
||||
*
|
||||
* Also note that neither "_M_IX86" or "_MSC_VER" should be used for
|
||||
* any purpose other than "Windows Intel x86 specific" and "Microsoft
|
||||
* compiler specific". Therefore, these should be very rare.
|
||||
*
|
||||
* OS/2 DEFINES:
|
||||
* The code specific to OS/2's Program API should be wrapped around
|
||||
*
|
||||
* __TOS_OS2__ Target Operating System, OS/2
|
||||
*
|
||||
* Any code specific to the compiler itself should be wrapped with
|
||||
*
|
||||
* __IBMC__ IBM C Compiler
|
||||
* __IBMCPP__ IBM C++ Compiler
|
||||
*
|
||||
* Note that since the VisualAge C/C++ compiler is also available
|
||||
* for the Windows platform, it may be necessary to use both a
|
||||
* __TOS_OS2__ and a __IBMC__ to select a very specific environment.
|
||||
*
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
* Some systems require special declarations for data items imported
|
||||
* or exported from dynamic link libraries. Note that the definition
|
||||
* of DL_IMPORT covers both cases. Define USE_DL_IMPORT for the client
|
||||
* of a DLL. Define USE_DL_EXPORT when making a DLL.
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
|
||||
#define HAVE_LIMITS_H
|
||||
#define HAVE_HYPOT
|
||||
#define DONT_HAVE_SIG_ALARM
|
||||
#define DONT_HAVE_SIG_PAUSE
|
||||
|
||||
#define LONG_BIT 32
|
||||
|
||||
/* Configuration Options for Finding Modules */
|
||||
#define PREFIX ""
|
||||
#define EXEC_PREFIX ""
|
||||
//#define VPATH "."
|
||||
|
||||
//#define PYTHONPATH PREFIX "/lib/python" VERSION DELIM \
|
||||
// PREFIX "/lib/python" VERSION "/test" DELIM \
|
||||
// EXEC_PREFIX "/lib/python" VERSION "/sharedmodules"
|
||||
|
||||
/***************************************************/
|
||||
/* 32-Bit IBM VisualAge C/C++ v3.0 for OS/2 */
|
||||
/* (Convert Compiler Flags into Useful Switches) */
|
||||
/***************************************************/
|
||||
#if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
||||
|
||||
#define COMPILER "[VisualAge C/C++]"
|
||||
#define PYOS_OS2 /* Define Indicator of Operating System */
|
||||
#define PYCC_VACPP /* Define Indicator of C Compiler */
|
||||
|
||||
/* Platform Filesystem */
|
||||
#define PYTHONPATH ".;.\\lib;.\\lib\\plat-os2;.\\lib\\dos_8x3;.\\lib\\lib-tk"
|
||||
#define DOSFILESYS /* OS/2 Uses the DOS File Naming Conventions */
|
||||
/* #define IMPORT_8x3_NAMES */
|
||||
|
||||
/* Platform CPU-Mode Dependencies */
|
||||
#define WORD_BIT 32 /* OS/2 is a 32-Bit Operating System */
|
||||
|
||||
typedef int mode_t;
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
typedef int pid_t;
|
||||
|
||||
#if defined(__MULTI__) /* If Compiler /Gt+ Multithread Option Enabled, */
|
||||
#define WITH_THREAD /* Then Enable Threading Throughout Python */
|
||||
#define OS2_THREADS /* And Use the OS/2 Flavor of Threads */
|
||||
#endif
|
||||
|
||||
/* Compiler Runtime Library Capabilities */
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
|
||||
/* #define VA_LIST_IS_ARRAY */
|
||||
#define HAVE_CLOCK /* We support all of the Unix clock() API */
|
||||
#define HAVE_STRFTIME /* We have a strftime() formatting function */
|
||||
#define HAVE_PUTENV /* We have a putenv() function */
|
||||
#define HAVE_SYS_SELECT_H /* We have sys/select.h (under TCP/IP dirs) */
|
||||
#define HAVE_PROTOTYPES /* Our Compiler Supports C Function Prototypes */
|
||||
|
||||
#ifdef USE_DL_EXPORT
|
||||
#define DL_IMPORT(RTYPE) RTYPE _Export
|
||||
#endif
|
||||
|
||||
#endif /* VAC++ for OS/2 */
|
||||
|
||||
/***************************************************/
|
||||
/* 32-Bit Microsoft Visual C/C++ v2.0+ for Windows */
|
||||
/* (Convert Compiler Flags into Useful Switches) */
|
||||
/***************************************************/
|
||||
#if defined(_MSC_VER) && _MSC_VER > 850
|
||||
/* Start of defines for MS_WIN32 using VC++ 2.0 and up */
|
||||
#define NT /* NT is obsolete - please use MS_WIN32 instead */
|
||||
#define MS_WIN32
|
||||
#define MS_WINDOWS
|
||||
|
||||
/* For NT the Python core is in a DLL by default. Test the
|
||||
* standard macro MS_COREDLL to find out. If you have an exception
|
||||
* you must define MS_NO_COREDLL (do not test this macro)
|
||||
*/
|
||||
#ifndef MS_NO_COREDLL
|
||||
#define MS_COREDLL /* Python core is in a DLL */
|
||||
#ifndef USE_DL_EXPORT
|
||||
#define USE_DL_IMPORT
|
||||
#endif /* !USE_DL_EXPORT */
|
||||
#endif /* !MS_NO_COREDLL */
|
||||
|
||||
#ifdef _M_IX86
|
||||
#define COMPILER "[MSC 32 bit (Intel)]"
|
||||
#else
|
||||
#define COMPILER "[MSC (Unknown)]"
|
||||
#endif
|
||||
|
||||
/* Platform Filesystem */
|
||||
#define PYTHONPATH ".\\lib;.\\lib\\plat-win;.\\lib\\lib-tk"
|
||||
#define DOSFILESYS /* Windows Uses the DOS File Naming Conventions */
|
||||
|
||||
/* Platform CPU-Mode Dependencies */
|
||||
#define WORD_BIT 32
|
||||
|
||||
typedef int pid_t;
|
||||
#define hypot _hypot
|
||||
|
||||
/* Compiler Runtime Library Capabilities */
|
||||
#pragma warning(disable:4113)
|
||||
#include <stdio.h>
|
||||
|
||||
#define HAVE_CLOCK /* We support all of the Unix clock() API */
|
||||
#define HAVE_STRFTIME /* We have a strftime() formatting function */
|
||||
#define NT_THREADS
|
||||
#define WITH_THREAD
|
||||
|
||||
#ifndef NETSCAPE_PI
|
||||
#define USE_SOCKET
|
||||
#endif
|
||||
|
||||
#ifdef USE_DL_IMPORT
|
||||
#define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE
|
||||
#endif
|
||||
|
||||
#ifdef USE_DL_EXPORT
|
||||
#define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE
|
||||
#endif
|
||||
#endif /* _MSC_VER && > 850 */
|
||||
|
||||
/***************************************************/
|
||||
/* 16-Bit Microsoft Visual C/C++ v1.5+ for Windows */
|
||||
/* (Convert Compiler Flags into Useful Switches) */
|
||||
/***************************************************/
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 850
|
||||
#define COMPILER "[MSC 16-bit]"
|
||||
#define MS_WIN16
|
||||
#define MS_WINDOWS
|
||||
|
||||
/* Platform Filesystem */
|
||||
#define PYTHONPATH ".;.\\lib;.\\lib\\win;.\\lib\\dos_8x3"
|
||||
#define IMPORT_8x3_NAMES
|
||||
#define DOSFILESYS /* Windows Uses the DOS File Naming Conventions */
|
||||
|
||||
/* Platform CPU-Mode Dependencies */
|
||||
#define WORD_BIT 16
|
||||
|
||||
typedef int pid_t;
|
||||
|
||||
/* Compiler Runtime Library Capabilities */
|
||||
#pragma warning(disable:4113)
|
||||
#define memcpy memmove /* memcpy dangerous pointer wrap in Win 3.1 */
|
||||
#define hypot _hypot
|
||||
#define SIGINT 2
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* Windows 3.1 will not tolerate any console io in a dll */
|
||||
|
||||
#ifdef _USRDLL
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define stdin ((FILE *)0)
|
||||
#define stdout ((FILE *)1)
|
||||
#define stderr ((FILE *)2)
|
||||
|
||||
#define fflush Py_fflush
|
||||
int Py_fflush(FILE *);
|
||||
|
||||
#define fgets Py_fgets
|
||||
char *Py_fgets(char *, int, FILE *);
|
||||
|
||||
#define fileno Py_fileno
|
||||
int Py_fileno(FILE *);
|
||||
|
||||
#define fprintf Py_fprintf
|
||||
int Py_fprintf(FILE *, const char *, ...);
|
||||
|
||||
#define printf Py_printf
|
||||
int Py_printf(const char *, ...);
|
||||
|
||||
#define sscanf Py_sscanf
|
||||
int Py_sscanf(const char *, const char *, ...);
|
||||
|
||||
clock_t clock();
|
||||
void _exit(int);
|
||||
void exit(int);
|
||||
int sscanf(const char *, const char *, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _USRDLL */
|
||||
|
||||
#ifndef NETSCAPE_PI
|
||||
/* use sockets, but not in a Netscape dll */
|
||||
#define USE_SOCKET
|
||||
#endif
|
||||
#endif /* MS_WIN16 */
|
||||
|
||||
/***************************************************/
|
||||
/* 32-Bit Watcom C/C++ v?.? for Windows */
|
||||
/* (Convert Compiler Flags into Useful Switches) */
|
||||
/***************************************************/
|
||||
#ifdef __WATCOMC__
|
||||
#define COMPILER "[Watcom]"
|
||||
|
||||
/* Platform Filesystem */
|
||||
#define PYTHONPATH ".;.\\lib;.\\lib\\win;.\\lib\\dos_8x3"
|
||||
#define IMPORT_8x3_NAMES
|
||||
#define DOSFILESYS /* Watcom Uses the DOS File Naming Conventions */
|
||||
|
||||
typedef int mode_t;
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
typedef int pid_t;
|
||||
|
||||
#if defined(__NT__)
|
||||
#define NT /* NT is obsolete - please use MS_WIN32 instead */
|
||||
#define MS_WIN32
|
||||
#define MS_WINDOWS
|
||||
#define NT_THREADS
|
||||
#define USE_SOCKET
|
||||
#define WITH_THREAD
|
||||
#elif defined(__WINDOWS__)
|
||||
#define MS_WIN16
|
||||
#define MS_WINDOWS
|
||||
#endif
|
||||
|
||||
#ifdef M_I386
|
||||
#define WORD_BIT 32
|
||||
#else
|
||||
#define WORD_BIT 16
|
||||
#endif
|
||||
|
||||
/* Compiler Runtime Library Capabilities */
|
||||
#include <ctype.h>
|
||||
#include <direct.h>
|
||||
|
||||
#define VA_LIST_IS_ARRAY
|
||||
#define HAVE_CLOCK
|
||||
#define HAVE_STRFTIME
|
||||
|
||||
#ifdef USE_DL_EXPORT
|
||||
#define DL_IMPORT(RTYPE) RTYPE __export
|
||||
#endif
|
||||
#endif /* __WATCOMC__ */
|
||||
|
||||
/***************************************************/
|
||||
/* 32-Bit Borland C/C++ v?.? for Windows */
|
||||
/* (Convert Compiler Flags into Useful Switches) */
|
||||
/***************************************************/
|
||||
/* The Borland compiler defines __BORLANDC__ */
|
||||
/* XXX These defines are likely incomplete, but should be easy to fix. */
|
||||
#ifdef __BORLANDC__
|
||||
#define COMPILER "[Borland]"
|
||||
|
||||
/* Platform Filesystem */
|
||||
#define PYTHONPATH ".;.\\lib;.\\lib\\win;.\\lib\\dos_8x3"
|
||||
#define IMPORT_8x3_NAMES
|
||||
#define DOSFILESYS /* Borland Uses the DOS File Naming Conventions */
|
||||
|
||||
/* Compiler Runtime Library Capabilities */
|
||||
#define HAVE_CLOCK
|
||||
#define HAVE_STRFTIME
|
||||
|
||||
#ifdef USE_DL_IMPORT
|
||||
#define DL_IMPORT(RTYPE) RTYPE __import
|
||||
#endif
|
||||
#endif /* BORLANDC */
|
||||
|
||||
/********************************/
|
||||
/* End of compilers - finish up */
|
||||
/********************************/
|
||||
|
||||
/****************************************
|
||||
* Adjustments for the Operating System
|
||||
****************************************/
|
||||
#ifdef MS_WIN32
|
||||
#define PLATFORM "win32"
|
||||
#else
|
||||
#ifdef MS_WIN16
|
||||
#define PLATFORM "win16"
|
||||
#else
|
||||
#ifdef PYOS_OS2
|
||||
#define PLATFORM "os2"
|
||||
#else
|
||||
#define PLATFORM "dos"
|
||||
#endif
|
||||
#endif /* !MS_WIN16 */
|
||||
#endif /* !MS_WIN32 */
|
||||
|
||||
/****************************************
|
||||
* Supported Features in Runtime API
|
||||
****************************************/
|
||||
|
||||
/* 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 to empty if the keyword does not work. */
|
||||
/* #define const */
|
||||
|
||||
/* Define if you have dirent.h. */
|
||||
/* #define DIRENT 1 */
|
||||
|
||||
/* Define to the type of elements in the array set by `getgroups'.
|
||||
Usually this is either `int' or `gid_t'. */
|
||||
/* #undef GETGROUPS_T */
|
||||
|
||||
/* Define to `int' if <sys/types.h> 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. */
|
||||
#define HAVE_TZNAME
|
||||
|
||||
/* Define if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef mode_t */
|
||||
|
||||
/* Define if you don't have dirent.h, but have ndir.h. */
|
||||
/* #undef NDIR */
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
/* #undef off_t */
|
||||
|
||||
/* Define to `int' if <sys/types.h> 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 <sys/types.h> doesn't define. */
|
||||
/* #undef size_t */
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you don't have dirent.h, but have sys/dir.h. */
|
||||
/* #undef SYSDIR */
|
||||
|
||||
/* Define if you don't have dirent.h, but have sys/ndir.h. */
|
||||
/* #undef SYSNDIR */
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
/* #undef TIME_WITH_SYS_TIME */
|
||||
|
||||
/* Define if your <sys/time.h> declares struct tm. */
|
||||
/* #define TM_IN_SYS_TIME 1 */
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
/* #undef uid_t */
|
||||
|
||||
/* Define if the closedir function returns void instead of int. */
|
||||
/* #undef VOID_CLOSEDIR */
|
||||
|
||||
/* Define if your <unistd.h> contains bad prototypes for exec*()
|
||||
(as it does on SGI IRIX 4.x) */
|
||||
/* #undef BAD_EXEC_PROTOTYPES */
|
||||
|
||||
/* Define if your compiler botches static forward declarations
|
||||
(as it does on SCI ODT 3.0) */
|
||||
/* #define BAD_STATIC_FORWARD 1 */
|
||||
|
||||
/* Define if getpgrp() must be called as getpgrp(0)
|
||||
and (consequently) setpgrp() as setpgrp(0, 0). */
|
||||
/* #undef GETPGRP_HAVE_ARGS */
|
||||
|
||||
/* Define this if your time.h defines altzone */
|
||||
/* #define HAVE_ALTZONE */
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#ifdef MS_WIN32
|
||||
/* Does this exist on Win16? */
|
||||
#define HAVE_PUTENV
|
||||
#endif
|
||||
|
||||
/* Define if your compiler supports function prototypes */
|
||||
#define HAVE_PROTOTYPES
|
||||
|
||||
/* Define if you can safely include both <sys/select.h> and <sys/time.h>
|
||||
(which you can't on SCO ODT 3.0). */
|
||||
/* #undef SYS_SELECT_WITH_SYS_TIME */
|
||||
|
||||
/* Define if you want to use SGI (IRIX 4) dynamic linking.
|
||||
This requires the "dl" library by Jack Jansen,
|
||||
ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z.
|
||||
Don't bother on IRIX 5, it already has dynamic linking using SunOS
|
||||
style shared libraries */
|
||||
/* #undef WITH_SGI_DL */
|
||||
|
||||
/* Define if you want to emulate SGI (IRIX 4) dynamic linking.
|
||||
This is rumoured to work on VAX (Ultrix), Sun3 (SunOS 3.4),
|
||||
Sequent Symmetry (Dynix), and Atari ST.
|
||||
This requires the "dl-dld" library,
|
||||
ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z,
|
||||
as well as the "GNU dld" library,
|
||||
ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z.
|
||||
Don't bother on SunOS 4 or 5, they already have dynamic linking using
|
||||
shared libraries */
|
||||
/* #undef WITH_DL_DLD */
|
||||
|
||||
/* Define if you want to compile in rudimentary thread support */
|
||||
/* #undef WITH_THREAD */
|
||||
|
||||
/* Define if you want to use the GNU readline library */
|
||||
/* #define WITH_READLINE 1 */
|
||||
|
||||
/* Define if you have clock. */
|
||||
/* #define HAVE_CLOCK */
|
||||
|
||||
/* Define if you have ftime. */
|
||||
#define HAVE_FTIME
|
||||
|
||||
/* Define if you have getpeername. */
|
||||
#define HAVE_GETPEERNAME
|
||||
|
||||
/* Define if you have getpgrp. */
|
||||
/* #undef HAVE_GETPGRP */
|
||||
|
||||
/* Define if you have getpid. */
|
||||
#define HAVE_GETPID
|
||||
|
||||
/* Define if you have gettimeofday. */
|
||||
/* #undef HAVE_GETTIMEOFDAY */
|
||||
|
||||
/* Define if you have getwd. */
|
||||
/* #undef HAVE_GETWD */
|
||||
|
||||
/* Define if you have lstat. */
|
||||
/* #undef HAVE_LSTAT */
|
||||
|
||||
/* Define if you have nice. */
|
||||
/* #undef HAVE_NICE */
|
||||
|
||||
/* Define if you have readlink. */
|
||||
/* #undef HAVE_READLINK */
|
||||
|
||||
/* Define if you have select. */
|
||||
/* #undef HAVE_SELECT */
|
||||
|
||||
/* Define if you have setpgid. */
|
||||
/* #undef HAVE_SETPGID */
|
||||
|
||||
/* Define if you have setpgrp. */
|
||||
/* #undef HAVE_SETPGRP */
|
||||
|
||||
/* Define if you have setsid. */
|
||||
/* #undef HAVE_SETSID */
|
||||
|
||||
/* Define if you have setvbuf. */
|
||||
#define HAVE_SETVBUF
|
||||
|
||||
/* Define if you have siginterrupt. */
|
||||
/* #undef HAVE_SIGINTERRUPT */
|
||||
|
||||
/* Define if you have symlink. */
|
||||
/* #undef HAVE_SYMLINK */
|
||||
|
||||
/* Define if you have tcgetpgrp. */
|
||||
/* #undef HAVE_TCGETPGRP */
|
||||
|
||||
/* Define if you have tcsetpgrp. */
|
||||
/* #undef HAVE_TCSETPGRP */
|
||||
|
||||
/* Define if you have times. */
|
||||
/* #undef HAVE_TIMES */
|
||||
|
||||
/* Define if you have uname. */
|
||||
/* #undef HAVE_UNAME */
|
||||
|
||||
/* Define if you have waitpid. */
|
||||
/* #undef HAVE_WAITPID */
|
||||
|
||||
/* Define if you have the <dlfcn.h> header file. */
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* Define if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
/* Define if you have the <stdarg.h> prototypes. */
|
||||
#define HAVE_STDARG_PROTOTYPES
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you have the <sys/audioio.h> header file. */
|
||||
/* #undef HAVE_SYS_AUDIOIO_H */
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
/* #define HAVE_SYS_PARAM_H 1 */
|
||||
|
||||
/* Define if you have the <sys/select.h> header file. */
|
||||
/* #define HAVE_SYS_SELECT_H 1 */
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
/* #define HAVE_SYS_TIME_H 1 */
|
||||
|
||||
/* Define if you have the <sys/times.h> header file. */
|
||||
/* #define HAVE_SYS_TIMES_H 1 */
|
||||
|
||||
/* Define if you have the <sys/un.h> header file. */
|
||||
/* #define HAVE_SYS_UN_H 1 */
|
||||
|
||||
/* Define if you have the <sys/utime.h> header file. */
|
||||
#define HAVE_SYS_UTIME_H 1
|
||||
|
||||
/* Define if you have the <sys/utsname.h> header file. */
|
||||
/* #define HAVE_SYS_UTSNAME_H 1 */
|
||||
|
||||
/* Define if you have the <thread.h> header file. */
|
||||
/* #undef HAVE_THREAD_H */
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
/* #define HAVE_UNISTD_H 1 */
|
||||
|
||||
/* Define if you have the <utime.h> header file. */
|
||||
/* #define HAVE_UTIME_H 1 */
|
||||
|
||||
/* Define if you have the dl library (-ldl). */
|
||||
/* #undef HAVE_LIBDL */
|
||||
|
||||
/* Define if you have the mpc library (-lmpc). */
|
||||
/* #undef HAVE_LIBMPC */
|
||||
|
||||
/* Define if you have the nsl library (-lnsl). */
|
||||
#define HAVE_LIBNSL 1
|
||||
|
||||
/* Define if you have the seq library (-lseq). */
|
||||
/* #undef HAVE_LIBSEQ */
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#define HAVE_LIBSOCKET 1
|
||||
|
||||
/* Define if you have the sun library (-lsun). */
|
||||
/* #undef HAVE_LIBSUN */
|
||||
|
||||
/* Define if you have the termcap library (-ltermcap). */
|
||||
/* #undef HAVE_LIBTERMCAP */
|
||||
|
||||
/* Define if you have the termlib library (-ltermlib). */
|
||||
/* #undef HAVE_LIBTERMLIB */
|
||||
|
||||
/* Define if you have the thread library (-lthread). */
|
||||
/* #undef HAVE_LIBTHREAD */
|
||||
|
||||
#endif /* !Py_CONFIG_H */
|
||||
|
488
PC/os2vacpp/getpathp.c
Normal file
488
PC/os2vacpp/getpathp.c
Normal file
|
@ -0,0 +1,488 @@
|
|||
/***********************************************************
|
||||
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.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
/* Return the initial module search path. */
|
||||
/* Used by DOS, OS/2, Windows 3.1. Works on NT too. */
|
||||
|
||||
#include "Python.h"
|
||||
#include "osdefs.h"
|
||||
|
||||
#ifdef MS_WIN32
|
||||
#include <windows.h>
|
||||
extern BOOL PyWin_IsWin32s();
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif /* HAVE_UNISTD_H */
|
||||
|
||||
/* Search in some common locations for the associated Python libraries.
|
||||
*
|
||||
* This version always returns "" for both prefix and exec_prefix.
|
||||
*
|
||||
* Py_GetPath() tries to return a sensible Python module search path.
|
||||
*
|
||||
* First, we look to see if the executable is in a subdirectory of
|
||||
* the Python build directory. We calculate the full path of the
|
||||
* directory containing the executable as progpath. We work backwards
|
||||
* along progpath and look for $dir/Modules/Setup.in, a distinctive
|
||||
* landmark. If found, we use $dir/Lib as $root. The returned
|
||||
* Python path is the compiled #define PYTHONPATH with all the initial
|
||||
* "./lib" replaced by $root.
|
||||
*
|
||||
* Otherwise, if there is a PYTHONPATH environment variable, we return that.
|
||||
*
|
||||
* Otherwise we try to find $progpath/lib/string.py, and if found, then
|
||||
* root is $progpath/lib, and we return Python path as compiled PYTHONPATH
|
||||
* with all "./lib" replaced by $root (as above).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LANDMARK
|
||||
#define LANDMARK "lib\\string.py"
|
||||
#endif
|
||||
|
||||
static char prefix[MAXPATHLEN+1];
|
||||
static char progpath[MAXPATHLEN+1];
|
||||
static char *module_search_path = NULL;
|
||||
|
||||
|
||||
static int
|
||||
is_sep(ch) /* determine if "ch" is a separator character */
|
||||
char ch;
|
||||
{
|
||||
#ifdef ALTSEP
|
||||
return ch == SEP || ch == ALTSEP;
|
||||
#else
|
||||
return ch == SEP;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
reduce(dir)
|
||||
char *dir;
|
||||
{
|
||||
int i = strlen(dir);
|
||||
while (i > 0 && !is_sep(dir[i]))
|
||||
--i;
|
||||
dir[i] = '\0';
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
exists(filename)
|
||||
char *filename;
|
||||
{
|
||||
struct stat buf;
|
||||
return stat(filename, &buf) == 0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
join(buffer, stuff)
|
||||
char *buffer;
|
||||
char *stuff;
|
||||
{
|
||||
int n, k;
|
||||
if (is_sep(stuff[0]))
|
||||
n = 0;
|
||||
else {
|
||||
n = strlen(buffer);
|
||||
if (n > 0 && !is_sep(buffer[n-1]) && n < MAXPATHLEN)
|
||||
buffer[n++] = SEP;
|
||||
}
|
||||
k = strlen(stuff);
|
||||
if (n + k > MAXPATHLEN)
|
||||
k = MAXPATHLEN - n;
|
||||
strncpy(buffer+n, stuff, k);
|
||||
buffer[n+k] = '\0';
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
search_for_prefix(argv0_path, landmark)
|
||||
char *argv0_path;
|
||||
char *landmark;
|
||||
{
|
||||
int n;
|
||||
|
||||
/* Search from argv0_path, until root is found */
|
||||
strcpy(prefix, argv0_path);
|
||||
do {
|
||||
n = strlen(prefix);
|
||||
join(prefix, landmark);
|
||||
if (exists(prefix)) {
|
||||
prefix[n] = '\0';
|
||||
return 1;
|
||||
}
|
||||
prefix[n] = '\0';
|
||||
reduce(prefix);
|
||||
} while (prefix[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef MS_WIN32
|
||||
#include "malloc.h" // for alloca - see comments below!
|
||||
extern const char *PyWin_DLLVersionString; // a string loaded from the DLL at startup.
|
||||
|
||||
|
||||
/* Load a PYTHONPATH value from the registry.
|
||||
Load from either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER.
|
||||
|
||||
Returns NULL, or a pointer that should be freed.
|
||||
*/
|
||||
|
||||
static char *
|
||||
getpythonregpath(HKEY keyBase, BOOL bWin32s)
|
||||
{
|
||||
HKEY newKey = 0;
|
||||
DWORD nameSize = 0;
|
||||
DWORD dataSize = 0;
|
||||
DWORD numEntries = 0;
|
||||
LONG rc;
|
||||
char *retval = NULL;
|
||||
char *dataBuf;
|
||||
const char keyPrefix[] = "Software\\Python\\PythonCore\\";
|
||||
const char keySuffix[] = "\\PythonPath";
|
||||
int versionLen;
|
||||
char *keyBuf;
|
||||
|
||||
// Tried to use sysget("winver") but here is too early :-(
|
||||
versionLen = strlen(PyWin_DLLVersionString);
|
||||
// alloca == no free required, but memory only local to fn.
|
||||
// also no heap fragmentation! Am I being silly?
|
||||
keyBuf = alloca(sizeof(keyPrefix)-1 + versionLen + sizeof(keySuffix)); // chars only, plus 1 NULL.
|
||||
// lots of constants here for the compiler to optimize away :-)
|
||||
memcpy(keyBuf, keyPrefix, sizeof(keyPrefix)-1);
|
||||
memcpy(keyBuf+sizeof(keyPrefix)-1, PyWin_DLLVersionString, versionLen);
|
||||
memcpy(keyBuf+sizeof(keyPrefix)-1+versionLen, keySuffix, sizeof(keySuffix)); // NULL comes with this one!
|
||||
|
||||
rc=RegOpenKey(keyBase,
|
||||
keyBuf,
|
||||
&newKey);
|
||||
if (rc==ERROR_SUCCESS) {
|
||||
RegQueryInfoKey(newKey, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&numEntries, &nameSize, &dataSize, NULL, NULL);
|
||||
}
|
||||
if (bWin32s && numEntries==0 && dataSize==0) {
|
||||
/* must hardcode for Win32s */
|
||||
numEntries = 1;
|
||||
dataSize = 511;
|
||||
}
|
||||
if (numEntries) {
|
||||
/* Loop over all subkeys. */
|
||||
/* Win32s doesnt know how many subkeys, so we do
|
||||
it twice */
|
||||
char keyBuf[MAX_PATH+1];
|
||||
int index = 0;
|
||||
int off = 0;
|
||||
for(index=0;;index++) {
|
||||
long reqdSize = 0;
|
||||
DWORD rc = RegEnumKey(newKey,
|
||||
index, keyBuf, MAX_PATH+1);
|
||||
if (rc) break;
|
||||
rc = RegQueryValue(newKey, keyBuf, NULL, &reqdSize);
|
||||
if (rc) break;
|
||||
if (bWin32s && reqdSize==0) reqdSize = 512;
|
||||
dataSize += reqdSize + 1; /* 1 for the ";" */
|
||||
}
|
||||
dataBuf = malloc(dataSize+1);
|
||||
if (dataBuf==NULL)
|
||||
return NULL; /* pretty serious? Raise error? */
|
||||
/* Now loop over, grabbing the paths.
|
||||
Subkeys before main library */
|
||||
for(index=0;;index++) {
|
||||
int adjust;
|
||||
long reqdSize = dataSize;
|
||||
DWORD rc = RegEnumKey(newKey,
|
||||
index, keyBuf,MAX_PATH+1);
|
||||
if (rc) break;
|
||||
rc = RegQueryValue(newKey,
|
||||
keyBuf, dataBuf+off, &reqdSize);
|
||||
if (rc) break;
|
||||
if (reqdSize>1) {
|
||||
/* If Nothing, or only '\0' copied. */
|
||||
adjust = strlen(dataBuf+off);
|
||||
dataSize -= adjust;
|
||||
off += adjust;
|
||||
dataBuf[off++] = ';';
|
||||
dataBuf[off] = '\0';
|
||||
dataSize--;
|
||||
}
|
||||
}
|
||||
/* Additionally, win32s doesnt work as expected, so
|
||||
the specific strlen() is required for 3.1. */
|
||||
rc = RegQueryValue(newKey, "", dataBuf+off, &dataSize);
|
||||
if (rc==ERROR_SUCCESS) {
|
||||
if (strlen(dataBuf)==0)
|
||||
free(dataBuf);
|
||||
else
|
||||
retval = dataBuf; /* caller will free */
|
||||
}
|
||||
else
|
||||
free(dataBuf);
|
||||
}
|
||||
|
||||
if (newKey)
|
||||
RegCloseKey(newKey);
|
||||
return retval;
|
||||
}
|
||||
#endif /* MS_WIN32 */
|
||||
|
||||
static void
|
||||
get_progpath()
|
||||
{
|
||||
extern char *Py_GetProgramName();
|
||||
char *path = getenv("PATH");
|
||||
char *prog = Py_GetProgramName();
|
||||
|
||||
#ifdef MS_WIN32
|
||||
if (GetModuleFileName(NULL, progpath, MAXPATHLEN))
|
||||
return;
|
||||
#endif
|
||||
if (prog == NULL || *prog == '\0')
|
||||
prog = "python";
|
||||
|
||||
/* If there is no slash in the argv0 path, then we have to
|
||||
* assume python is on the user's $PATH, since there's no
|
||||
* other way to find a directory to start the search from. If
|
||||
* $PATH isn't exported, you lose.
|
||||
*/
|
||||
#ifdef ALTSEP
|
||||
if (strchr(prog, SEP) || strchr(prog, ALTSEP))
|
||||
#else
|
||||
if (strchr(prog, SEP))
|
||||
#endif
|
||||
strcpy(progpath, prog);
|
||||
else if (path) {
|
||||
while (1) {
|
||||
char *delim = strchr(path, DELIM);
|
||||
|
||||
if (delim) {
|
||||
int len = delim - path;
|
||||
strncpy(progpath, path, len);
|
||||
*(progpath + len) = '\0';
|
||||
}
|
||||
else
|
||||
strcpy(progpath, path);
|
||||
|
||||
join(progpath, prog);
|
||||
if (exists(progpath))
|
||||
break;
|
||||
|
||||
if (!delim) {
|
||||
progpath[0] = '\0';
|
||||
break;
|
||||
}
|
||||
path = delim + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
progpath[0] = '\0';
|
||||
}
|
||||
|
||||
static void
|
||||
calculate_path()
|
||||
{
|
||||
char argv0_path[MAXPATHLEN+1];
|
||||
char *buf;
|
||||
int bufsz;
|
||||
char *pythonhome = getenv("PYTHONHOME");
|
||||
char *envpath = getenv("PYTHONPATH");
|
||||
#ifdef MS_WIN32
|
||||
char *machinepath, *userpath;
|
||||
|
||||
/* Are we running under Windows 3.1(1) Win32s? */
|
||||
if (PyWin_IsWin32s()) {
|
||||
/* Only CLASSES_ROOT is supported */
|
||||
machinepath = getpythonregpath(HKEY_CLASSES_ROOT, TRUE);
|
||||
userpath = NULL;
|
||||
} else {
|
||||
machinepath = getpythonregpath(HKEY_LOCAL_MACHINE, FALSE);
|
||||
userpath = getpythonregpath(HKEY_CURRENT_USER, FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
get_progpath();
|
||||
strcpy(argv0_path, progpath);
|
||||
reduce(argv0_path);
|
||||
if (pythonhome == NULL || *pythonhome == '\0') {
|
||||
if (search_for_prefix(argv0_path, LANDMARK))
|
||||
pythonhome = prefix;
|
||||
else
|
||||
pythonhome = NULL;
|
||||
}
|
||||
else
|
||||
strcpy(prefix, pythonhome);
|
||||
|
||||
if (envpath && *envpath == '\0')
|
||||
envpath = NULL;
|
||||
|
||||
/* We need to construct a path from the following parts:
|
||||
(1) the PYTHONPATH environment variable, if set;
|
||||
(2) for Win32, the machinepath and userpath, if set;
|
||||
(3) the PYTHONPATH config macro, with the leading "."
|
||||
of each component replaced with pythonhome, if set;
|
||||
(4) the directory containing the executable (argv0_path).
|
||||
The length calculation calculates #3 first.
|
||||
*/
|
||||
|
||||
/* Calculate size of return buffer */
|
||||
if (pythonhome != NULL) {
|
||||
char *p;
|
||||
bufsz = 1;
|
||||
for (p = PYTHONPATH; *p; p++) {
|
||||
if (*p == DELIM)
|
||||
bufsz++; /* number of DELIM plus one */
|
||||
}
|
||||
bufsz *= strlen(pythonhome);
|
||||
}
|
||||
else
|
||||
bufsz = 0;
|
||||
bufsz += strlen(PYTHONPATH);
|
||||
if (envpath != NULL)
|
||||
bufsz += strlen(envpath) + 1;
|
||||
bufsz += strlen(argv0_path) + 1;
|
||||
#ifdef MS_WIN32
|
||||
if (machinepath)
|
||||
bufsz += strlen(machinepath) + 1;
|
||||
if (userpath)
|
||||
bufsz += strlen(userpath) + 1;
|
||||
#endif
|
||||
|
||||
module_search_path = buf = malloc(bufsz);
|
||||
if (buf == NULL) {
|
||||
/* We can't exit, so print a warning and limp along */
|
||||
fprintf(stderr, "Can't malloc dynamic PYTHONPATH.\n");
|
||||
if (envpath) {
|
||||
fprintf(stderr, "Using default static $PYTHONPATH.\n");
|
||||
module_search_path = envpath;
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Using environment $PYTHONPATH.\n");
|
||||
module_search_path = PYTHONPATH;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (envpath) {
|
||||
strcpy(buf, envpath);
|
||||
buf = strchr(buf, '\0');
|
||||
*buf++ = DELIM;
|
||||
}
|
||||
#ifdef MS_WIN32
|
||||
if (machinepath) {
|
||||
strcpy(buf, machinepath);
|
||||
buf = strchr(buf, '\0');
|
||||
*buf++ = DELIM;
|
||||
}
|
||||
if (userpath) {
|
||||
strcpy(buf, userpath);
|
||||
buf = strchr(buf, '\0');
|
||||
*buf++ = DELIM;
|
||||
}
|
||||
#endif
|
||||
if (pythonhome == NULL) {
|
||||
strcpy(buf, PYTHONPATH);
|
||||
buf = strchr(buf, '\0');
|
||||
}
|
||||
else {
|
||||
char *p = PYTHONPATH;
|
||||
char *q;
|
||||
int n;
|
||||
for (;;) {
|
||||
q = strchr(p, DELIM);
|
||||
if (q == NULL)
|
||||
n = strlen(p);
|
||||
else
|
||||
n = q-p;
|
||||
if (p[0] == '.' && is_sep(p[1])) {
|
||||
strcpy(buf, pythonhome);
|
||||
buf = strchr(buf, '\0');
|
||||
p++;
|
||||
n--;
|
||||
}
|
||||
strncpy(buf, p, n);
|
||||
buf += n;
|
||||
if (q == NULL)
|
||||
break;
|
||||
*buf++ = DELIM;
|
||||
p = q+1;
|
||||
}
|
||||
}
|
||||
if (argv0_path) {
|
||||
*buf++ = DELIM;
|
||||
strcpy(buf, argv0_path);
|
||||
buf = strchr(buf, '\0');
|
||||
}
|
||||
*buf = '\0';
|
||||
}
|
||||
|
||||
|
||||
/* 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()
|
||||
{
|
||||
return Py_GetPrefix();
|
||||
}
|
||||
|
||||
char *
|
||||
Py_GetProgramFullPath()
|
||||
{
|
||||
if (!module_search_path)
|
||||
calculate_path();
|
||||
|
||||
return progpath;
|
||||
}
|
1908
PC/os2vacpp/makefile
Normal file
1908
PC/os2vacpp/makefile
Normal file
File diff suppressed because it is too large
Load diff
1310
PC/os2vacpp/makefile.omk
Normal file
1310
PC/os2vacpp/makefile.omk
Normal file
File diff suppressed because it is too large
Load diff
375
PC/os2vacpp/python.def
Normal file
375
PC/os2vacpp/python.def
Normal file
|
@ -0,0 +1,375 @@
|
|||
LIBRARY PYTHON15 INITINSTANCE TERMINSTANCE
|
||||
DESCRIPTION 'Python 1.5 Core DLL'
|
||||
PROTMODE
|
||||
DATA MULTIPLE NONSHARED
|
||||
|
||||
EXPORTS
|
||||
_Py_ZeroStruct
|
||||
_Py_NoneStruct
|
||||
_Py_TrueStruct
|
||||
Py_DebugFlag
|
||||
Py_NoSiteFlag
|
||||
Py_UseClassExceptionsFlag
|
||||
_PyParser_Grammar
|
||||
_PyThread_Started
|
||||
_PyParser_TokenNames
|
||||
Py_VerboseFlag
|
||||
PyExc_Exception
|
||||
PyExc_StandardError
|
||||
PyExc_ArithmeticError
|
||||
PyExc_LookupError
|
||||
PyExc_AttributeError
|
||||
PyExc_EOFError
|
||||
PyExc_FloatingPointError
|
||||
PyExc_IOError
|
||||
PyExc_ImportError
|
||||
PyExc_IndexError
|
||||
PyExc_KeyError
|
||||
PyExc_MemoryError
|
||||
PyExc_NameError
|
||||
PyExc_OverflowError
|
||||
PyExc_RuntimeError
|
||||
PyExc_SyntaxError
|
||||
PyExc_SystemError
|
||||
PyExc_TypeError
|
||||
PyExc_ValueError
|
||||
PyExc_ZeroDivisionError
|
||||
PyExc_KeyboardInterrupt
|
||||
PyExc_SystemExit
|
||||
PyFloat_Type
|
||||
PyInt_Type
|
||||
PyLong_Type
|
||||
PyString_Type
|
||||
PyType_Type
|
||||
PyList_Type
|
||||
PyDict_Type
|
||||
PyTuple_Type
|
||||
PyFile_Type
|
||||
PyClass_Type
|
||||
PyFunction_Type
|
||||
PyMethod_Type
|
||||
PyInstance_Type
|
||||
PyCFunction_Type
|
||||
PyModule_Type
|
||||
PyCode_Type
|
||||
PyFrame_Type
|
||||
PyRange_Type
|
||||
PyComplex_Type
|
||||
_Py_EllipsisObject
|
||||
PySlice_Type
|
||||
Py_InteractiveFlag
|
||||
PyCObject_Type
|
||||
PyOS_InputHook
|
||||
PyOS_ReadlineFunctionPointer
|
||||
|
||||
_PyObject_New
|
||||
_PyObject_NewVar
|
||||
PyObject_Compare
|
||||
PyObject_GetAttrString
|
||||
PyObject_GetAttr
|
||||
PyObject_HasAttrString
|
||||
PyObject_Hash
|
||||
PyObject_Print
|
||||
PyObject_Repr
|
||||
PyObject_Str
|
||||
PyObject_SetAttrString
|
||||
PyObject_SetAttr
|
||||
PyObject_IsTrue
|
||||
PyFloat_AsString
|
||||
PyFloat_AsDouble
|
||||
PyFloat_FromDouble
|
||||
PyInt_AsLong
|
||||
PyInt_GetMax
|
||||
PyInt_FromLong
|
||||
PyLong_AsDouble
|
||||
PyLong_FromDouble
|
||||
PyLong_AsLong
|
||||
PyLong_AsUnsignedLong
|
||||
PyLong_FromString
|
||||
PyLong_FromLong
|
||||
PyLong_FromUnsignedLong
|
||||
PyString_Format
|
||||
PyString_Size
|
||||
PyString_AsString
|
||||
PyString_Concat
|
||||
PyString_ConcatAndDel
|
||||
PyString_FromStringAndSize
|
||||
PyString_FromString
|
||||
_PyString_Resize
|
||||
|
||||
PyList_Append
|
||||
PyList_GetItem
|
||||
PyList_Size
|
||||
PyList_GetSlice
|
||||
PyList_Insert
|
||||
PyList_New
|
||||
PyList_SetItem
|
||||
PyList_SetSlice
|
||||
PyList_Sort
|
||||
PyList_Reverse
|
||||
PyList_AsTuple
|
||||
PyDict_SetItemString
|
||||
PyDict_GetItemString
|
||||
PyDict_DelItemString
|
||||
PyDict_Items
|
||||
PyDict_Keys
|
||||
PyDict_Values
|
||||
PyDict_Size
|
||||
PyDict_Clear
|
||||
PyDict_Next
|
||||
PyDict_SetItem
|
||||
PyDict_GetItem
|
||||
PyDict_DelItem
|
||||
PyDict_New
|
||||
PyTuple_GetItem
|
||||
PyTuple_Size
|
||||
PyTuple_GetSlice
|
||||
PyTuple_New
|
||||
PyTuple_SetItem
|
||||
PyFile_GetLine
|
||||
PyFile_AsFile
|
||||
PyFile_Name
|
||||
PyFile_SetBufSize
|
||||
PyFile_FromString
|
||||
PyFile_FromFile
|
||||
PyFile_SoftSpace
|
||||
PyFile_WriteObject
|
||||
PyFile_WriteString
|
||||
PyMethod_Class
|
||||
PyMethod_Function
|
||||
PyMethod_Self
|
||||
PyClass_IsSubclass
|
||||
PyClass_New
|
||||
PyMethod_New
|
||||
PyInstance_New
|
||||
PyInstance_DoBinOp
|
||||
PyFrame_New
|
||||
PyFrame_BlockPop
|
||||
PyFrame_BlockSetup
|
||||
PyFrame_FastToLocals
|
||||
PyFrame_LocalsToFast
|
||||
PyFunction_GetCode
|
||||
PyFunction_GetGlobals
|
||||
PyOS_strtol
|
||||
PyOS_strtoul
|
||||
PyFunction_New
|
||||
PyRange_New
|
||||
Py_FindMethod
|
||||
Py_FindMethodInChain
|
||||
PyCFunction_GetFunction
|
||||
PyCFunction_GetSelf
|
||||
PyCFunction_New
|
||||
PyModule_GetDict
|
||||
PyModule_GetName
|
||||
PyModule_New
|
||||
PyGrammar_AddAccelerators
|
||||
PyGrammar_FindDFA
|
||||
PyGrammar_LabelRepr
|
||||
PyNode_AddChild
|
||||
PyNode_Free
|
||||
PyNode_New
|
||||
PyParser_AddToken
|
||||
PyParser_Delete
|
||||
PyParser_New
|
||||
PyParser_ParseFile
|
||||
PyParser_ParseString
|
||||
PyToken_OneChar
|
||||
PyToken_TwoChars
|
||||
PyTokenizer_Free
|
||||
PyTokenizer_Get
|
||||
PyTokenizer_FromFile
|
||||
PyTokenizer_FromString
|
||||
PyNode_Compile
|
||||
PyCode_New
|
||||
PyEval_CallObject
|
||||
PyEval_CallObjectWithKeywords
|
||||
PyEval_EvalCode
|
||||
Py_FlushLine
|
||||
PyEval_GetBuiltins
|
||||
PyEval_GetGlobals
|
||||
PyEval_GetLocals
|
||||
PyEval_GetFrame
|
||||
PyEval_GetRestricted
|
||||
PyEval_InitThreads
|
||||
PyEval_AcquireThread
|
||||
PyEval_ReleaseThread
|
||||
PyEval_RestoreThread
|
||||
PyEval_SaveThread
|
||||
PyEval_AcquireLock
|
||||
PyEval_ReleaseLock
|
||||
PyTraceBack_Here
|
||||
PyTraceBack_Print
|
||||
PyImport_AddModule
|
||||
PyImport_Cleanup
|
||||
PyImport_GetModuleDict
|
||||
PyImport_GetMagicNumber
|
||||
PyImport_ImportModule
|
||||
PyImport_ImportModuleEx
|
||||
PyImport_Import
|
||||
PyImport_ImportFrozenModule
|
||||
PyImport_ReloadModule
|
||||
PyNumber_Coerce
|
||||
PyMarshal_Init
|
||||
Py_InitModule4
|
||||
PySys_SetArgv
|
||||
PySys_SetPath
|
||||
PySys_GetObject
|
||||
PySys_GetFile
|
||||
PySys_SetObject
|
||||
Py_CompileString
|
||||
Py_FatalError
|
||||
Py_Exit
|
||||
Py_Initialize
|
||||
Py_Finalize
|
||||
Py_IsInitialized
|
||||
PyErr_Print
|
||||
PyParser_SimpleParseFile
|
||||
PyParser_SimpleParseString
|
||||
PyRun_AnyFile
|
||||
PyRun_SimpleFile
|
||||
PyRun_SimpleString
|
||||
PyRun_File
|
||||
PyRun_String
|
||||
PyRun_InteractiveOne
|
||||
PyRun_InteractiveLoop
|
||||
PyMember_Get
|
||||
PyMember_Set
|
||||
Py_BuildValue
|
||||
Py_VaBuildValue
|
||||
PyArg_Parse
|
||||
PyArg_VaParse
|
||||
PyArg_ParseTuple
|
||||
PyArg_ParseTupleAndKeywords
|
||||
PyErr_BadArgument
|
||||
PyErr_BadInternalCall
|
||||
PyErr_Format
|
||||
PyErr_NoMemory
|
||||
PyErr_SetFromErrno
|
||||
PyErr_SetNone
|
||||
PyErr_SetString
|
||||
PyErr_SetObject
|
||||
PyErr_Occurred
|
||||
PyErr_Fetch
|
||||
PyErr_Restore
|
||||
PyErr_Clear
|
||||
PyErr_NewException
|
||||
PyOS_InitInterrupts
|
||||
PyOS_InterruptOccurred
|
||||
PyOS_GetLastModificationTime
|
||||
PyOS_Readline
|
||||
PyErr_CheckSignals
|
||||
PyErr_SetInterrupt
|
||||
PyCallable_Check
|
||||
Py_Main
|
||||
Py_GetCopyright
|
||||
Py_GetVersion
|
||||
|
||||
PyObject_CallObject
|
||||
PyObject_CallFunction
|
||||
PyObject_CallMethod
|
||||
PyObject_Type
|
||||
PyObject_Length
|
||||
PyObject_GetItem
|
||||
PyObject_SetItem
|
||||
PyNumber_Check
|
||||
PyNumber_Add
|
||||
PyNumber_Subtract
|
||||
PyNumber_Multiply
|
||||
PyNumber_Divide
|
||||
PyNumber_Remainder
|
||||
PyNumber_Divmod
|
||||
PyNumber_Power
|
||||
PyNumber_Negative
|
||||
PyNumber_Positive
|
||||
PyNumber_Absolute
|
||||
PyNumber_Invert
|
||||
PyNumber_Lshift
|
||||
PyNumber_Rshift
|
||||
PyNumber_And
|
||||
PyNumber_Xor
|
||||
PyNumber_Or
|
||||
PyNumber_Int
|
||||
PyNumber_Long
|
||||
PyNumber_Float
|
||||
PySequence_Check
|
||||
PySequence_Concat
|
||||
PySequence_Repeat
|
||||
PySequence_GetItem
|
||||
PySequence_GetSlice
|
||||
PySequence_SetItem
|
||||
PySequence_SetSlice
|
||||
PySequence_Tuple
|
||||
PySequence_Count
|
||||
PySequence_In
|
||||
PySequence_Index
|
||||
PySequence_Length
|
||||
PyMapping_Check
|
||||
PyMapping_Length
|
||||
PyMapping_HasKeyString
|
||||
PyMapping_HasKey
|
||||
PyMapping_SetItemString
|
||||
PyMapping_GetItemString
|
||||
PyComplex_FromCComplex
|
||||
PyComplex_FromDoubles
|
||||
PyComplex_RealAsDouble
|
||||
PyComplex_ImagAsDouble
|
||||
PyComplex_AsCComplex
|
||||
Py_AtExit
|
||||
Py_GetPath
|
||||
Py_GetExecPrefix
|
||||
Py_GetPrefix
|
||||
Py_GetProgramFullPath
|
||||
Py_GetProgramName
|
||||
Py_SetProgramName
|
||||
PySlice_New
|
||||
PySlice_GetIndices
|
||||
PyMarshal_WriteLongToFile
|
||||
PyMarshal_WriteObjectToFile
|
||||
PyMarshal_ReadLongFromFile
|
||||
PyMarshal_ReadObjectFromFile
|
||||
PyMarshal_ReadObjectFromString
|
||||
_Py_c_pow
|
||||
_Py_c_quot
|
||||
_Py_c_neg
|
||||
_Py_c_sum
|
||||
_Py_c_prod
|
||||
_Py_c_diff
|
||||
PyCObject_FromVoidPtr
|
||||
PyCObject_AsVoidPtr
|
||||
PyCObject_Import
|
||||
Py_GetBuildInfo
|
||||
Py_FdIsInteractive
|
||||
PyThread_start_new_thread
|
||||
PyThread_init_thread
|
||||
PyThread_get_thread_ident
|
||||
PyThread_exit_thread
|
||||
PyThread_allocate_lock
|
||||
PyThread_free_lock
|
||||
PyThread_acquire_lock
|
||||
PyThread_release_lock
|
||||
PyThread_allocate_sema
|
||||
PyThread_free_sema
|
||||
PyThread_down_sema
|
||||
PyThread_up_sema
|
||||
Py_NewInterpreter
|
||||
Py_EndInterpreter
|
||||
Py_Malloc
|
||||
Py_Realloc
|
||||
Py_Free
|
||||
PyMem_Malloc
|
||||
PyMem_Realloc
|
||||
PyMem_Free
|
||||
PyThreadState_New
|
||||
PyThreadState_Get
|
||||
PyThreadState_Swap
|
||||
PyThreadState_Clear
|
||||
PyThreadState_Delete
|
||||
PyInterpreterState_New
|
||||
PyInterpreterState_Clear
|
||||
PyInterpreterState_Delete
|
||||
|
||||
; Freezing Modules
|
||||
PyImport_FrozenModules
|
||||
Py_FrozenMain
|
||||
initimp
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue