├── README.md ├── bin └── Windows │ ├── x64 │ ├── python27.dll │ ├── python27.pdb │ ├── python27_d.dll │ └── python27_d.pdb │ └── x86 │ ├── python27.dll │ ├── python27.pdb │ ├── python27_d.dll │ └── python27_d.pdb ├── inc ├── Linux │ ├── Makefile │ ├── Modules │ │ ├── config.c │ │ ├── drawfmodule.c │ │ ├── getpath_riscos.c │ │ ├── riscosmodule.c │ │ └── swimodule.c │ ├── Python │ │ ├── dynload_riscos.c │ │ └── getcwd_riscos.c │ ├── README │ ├── pyconfig.h │ ├── sleep.c │ ├── support │ │ ├── !Boot │ │ ├── !Run │ │ ├── !Sprites │ │ ├── !Sprites22 │ │ └── AddToPath │ ├── unixstuff.c │ └── unixstuff.h ├── Python-ast.h ├── Python.h ├── Windows │ ├── VC6 │ │ ├── _bsddb.dsp │ │ ├── _ctypes.dsp │ │ ├── _ctypes_test.dsp │ │ ├── _elementtree.dsp │ │ ├── _msi.dsp │ │ ├── _multiprocessing.dsp │ │ ├── _socket.dsp │ │ ├── _sqlite3.dsp │ │ ├── _ssl.dsp │ │ ├── _ssl.mak │ │ ├── _testcapi.dsp │ │ ├── _tkinter.dsp │ │ ├── build_ssl.py │ │ ├── build_tkinter.py │ │ ├── bz2.dsp │ │ ├── make_versioninfo.dsp │ │ ├── pcbuild.dsw │ │ ├── pyexpat.dsp │ │ ├── python.dsp │ │ ├── pythoncore.dsp │ │ ├── pythonw.dsp │ │ ├── readme.txt │ │ ├── rmpyc.py │ │ ├── rt.bat │ │ ├── select.dsp │ │ ├── tcl852.patch │ │ ├── unicodedata.dsp │ │ ├── w9xpopen.dsp │ │ └── winsound.dsp │ ├── VS7.1 │ │ ├── Uninstal.wse │ │ ├── _bsddb.vcproj │ │ ├── _ctypes.vcproj │ │ ├── _ctypes_test.vcproj │ │ ├── _elementtree.vcproj │ │ ├── _msi.vcproj │ │ ├── _socket.vcproj │ │ ├── _sqlite3.vcproj │ │ ├── _ssl.mak │ │ ├── _ssl.vcproj │ │ ├── _testcapi.vcproj │ │ ├── _tkinter.vcproj │ │ ├── amd64_ml64.bat │ │ ├── build_ssl.bat │ │ ├── build_ssl.py │ │ ├── bz2.vcproj │ │ ├── db.build │ │ ├── field3.py │ │ ├── installer.bmp │ │ ├── make_buildinfo.c │ │ ├── make_buildinfo.vcproj │ │ ├── make_versioninfo.vcproj │ │ ├── pcbuild.sln │ │ ├── pyexpat.vcproj │ │ ├── python.build │ │ ├── python.iss │ │ ├── python.vcproj │ │ ├── python20.wse │ │ ├── pythoncore.vcproj │ │ ├── pythonw.vcproj │ │ ├── readme.txt │ │ ├── rmpyc.py │ │ ├── rt.bat │ │ ├── select.vcproj │ │ ├── unicodedata.vcproj │ │ ├── w9xpopen.vcproj │ │ └── winsound.vcproj │ ├── VS8.0 │ │ ├── _bsddb.vcproj │ │ ├── _bsddb44.vcproj │ │ ├── _ctypes.vcproj │ │ ├── _ctypes_test.vcproj │ │ ├── _elementtree.vcproj │ │ ├── _hashlib.vcproj │ │ ├── _msi.vcproj │ │ ├── _multiprocessing.vcproj │ │ ├── _socket.vcproj │ │ ├── _sqlite3.vcproj │ │ ├── _ssl.vcproj │ │ ├── _testcapi.vcproj │ │ ├── _tkinter.vcproj │ │ ├── bdist_wininst.vcproj │ │ ├── build.bat │ │ ├── build_env.bat │ │ ├── build_pgo.bat │ │ ├── build_ssl.bat │ │ ├── build_ssl.py │ │ ├── build_tkinter.py │ │ ├── bz2.vcproj │ │ ├── debug.vsprops │ │ ├── env.bat │ │ ├── field3.py │ │ ├── idle.bat │ │ ├── kill_python.c │ │ ├── kill_python.vcproj │ │ ├── make_buildinfo.c │ │ ├── make_buildinfo.vcproj │ │ ├── make_versioninfo.vcproj │ │ ├── pcbuild.sln │ │ ├── pginstrument.vsprops │ │ ├── pgupdate.vsprops │ │ ├── pyd.vsprops │ │ ├── pyd_d.vsprops │ │ ├── pyexpat.vcproj │ │ ├── pyproject.vsprops │ │ ├── python.vcproj │ │ ├── pythoncore.vcproj │ │ ├── pythonw.vcproj │ │ ├── release.vsprops │ │ ├── rmpyc.py │ │ ├── rt.bat │ │ ├── select.vcproj │ │ ├── sqlite3.vcproj │ │ ├── sqlite3.vsprops │ │ ├── unicodedata.vcproj │ │ ├── w9xpopen.vcproj │ │ ├── winsound.vcproj │ │ └── x64.vsprops │ ├── WinMain.c │ ├── _msi.c │ ├── _subprocess.c │ ├── _winreg.c │ ├── bdist_wininst │ │ ├── PythonPowered.bmp │ │ ├── README.txt │ │ ├── archive.h │ │ ├── extract.c │ │ ├── install.c │ │ ├── install.rc │ │ ├── resource.h │ │ ├── wininst-7.1.sln │ │ ├── wininst-7.1.vcproj │ │ ├── wininst-8.sln │ │ ├── wininst-8.vcproj │ │ ├── wininst.dsp │ │ └── wininst.dsw │ ├── config.c │ ├── dl_nt.c │ ├── dllbase_nt.txt │ ├── empty.c │ ├── errmap.h │ ├── errmap.mak │ ├── example_nt │ │ ├── example.c │ │ ├── example.sln │ │ ├── example.vcproj │ │ ├── readme.txt │ │ └── setup.py │ ├── frozen_dllmain.c │ ├── generrmap.c │ ├── getpathp.c │ ├── icons.mak │ ├── icons.rc │ ├── icons │ │ ├── baselogo.svg │ │ └── source.xar │ ├── import_nt.c │ ├── make_versioninfo.c │ ├── msvcrtmodule.c │ ├── os2emx │ │ ├── Makefile │ │ ├── README.os2emx │ │ ├── config.c │ │ ├── dlfcn.c │ │ ├── dlfcn.h │ │ ├── dllentry.c │ │ ├── getpathp.c │ │ ├── pyconfig.h │ │ ├── python27.def │ │ └── pythonpm.c │ ├── os2vacpp │ │ ├── _tkinter.def │ │ ├── config.c │ │ ├── getpathp.c │ │ ├── makefile │ │ ├── makefile.omk │ │ ├── pyconfig.h │ │ ├── python.def │ │ └── readme.txt │ ├── py.ico │ ├── pyc.ico │ ├── pycon.ico │ ├── pyconfig.h │ ├── python.mk │ ├── python_exe.rc │ ├── python_nt.h │ ├── python_nt.rc │ ├── python_nt_d.h │ ├── pythonnt_rc.h │ ├── pythonnt_rc_d.h │ ├── readme.txt │ ├── testpy.py │ ├── w9xpopen.c │ └── winsound.c ├── abstract.h ├── asdl.h ├── ast.h ├── bitset.h ├── boolobject.h ├── bufferobject.h ├── bytearrayobject.h ├── bytes_methods.h ├── bytesobject.h ├── cStringIO.h ├── cellobject.h ├── ceval.h ├── classobject.h ├── cobject.h ├── code.h ├── codecs.h ├── compile.h ├── complexobject.h ├── datetime.h ├── descrobject.h ├── dictobject.h ├── dtoa.h ├── enumobject.h ├── errcode.h ├── eval.h ├── fileobject.h ├── floatobject.h ├── frameobject.h ├── funcobject.h ├── genobject.h ├── graminit.h ├── grammar.h ├── import.h ├── intobject.h ├── intrcheck.h ├── iterobject.h ├── listobject.h ├── longintrepr.h ├── longobject.h ├── marshal.h ├── memoryobject.h ├── metagrammar.h ├── methodobject.h ├── modsupport.h ├── moduleobject.h ├── node.h ├── object.h ├── objimpl.h ├── opcode.h ├── osdefs.h ├── parsetok.h ├── patchlevel.h ├── pgen.h ├── pgenheaders.h ├── py_curses.h ├── pyarena.h ├── pycapsule.h ├── pyctype.h ├── pydebug.h ├── pyerrors.h ├── pyexpat.h ├── pyfpe.h ├── pygetopt.h ├── pymacconfig.h ├── pymactoolbox.h ├── pymath.h ├── pymem.h ├── pyport.h ├── pystate.h ├── pystrcmp.h ├── pystrtod.h ├── pythonrun.h ├── pythread.h ├── rangeobject.h ├── setobject.h ├── sliceobject.h ├── stringobject.h ├── structmember.h ├── structseq.h ├── symtable.h ├── sysmodule.h ├── timefuncs.h ├── token.h ├── traceback.h ├── tupleobject.h ├── ucnhash.h ├── unicodeobject.h ├── warnings.h └── weakrefobject.h └── lib ├── Linux └── x64 │ ├── libpython2.7.a │ └── libpython2.7.so └── Windows ├── x64 ├── python27.exp ├── python27.lib ├── python27_d.exp └── python27_d.lib └── x86 ├── python27.exp ├── python27.lib ├── python27_d.exp └── python27_d.lib /README.md: -------------------------------------------------------------------------------- 1 | python 2 | ====== 3 | 4 | Pre-compiled python libraries with includes -------------------------------------------------------------------------------- /bin/Windows/x64/python27.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x64/python27.dll -------------------------------------------------------------------------------- /bin/Windows/x64/python27.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x64/python27.pdb -------------------------------------------------------------------------------- /bin/Windows/x64/python27_d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x64/python27_d.dll -------------------------------------------------------------------------------- /bin/Windows/x64/python27_d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x64/python27_d.pdb -------------------------------------------------------------------------------- /bin/Windows/x86/python27.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x86/python27.dll -------------------------------------------------------------------------------- /bin/Windows/x86/python27.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x86/python27.pdb -------------------------------------------------------------------------------- /bin/Windows/x86/python27_d.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x86/python27_d.dll -------------------------------------------------------------------------------- /bin/Windows/x86/python27_d.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/bin/Windows/x86/python27_d.pdb -------------------------------------------------------------------------------- /inc/Linux/Modules/config.c: -------------------------------------------------------------------------------- 1 | /* -*- C -*- *********************************************** 2 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, 3 | The Netherlands. 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation, and that the names of Stichting Mathematisch 12 | Centrum or CWI or Corporation for National Research Initiatives or 13 | CNRI not be used in advertising or publicity pertaining to 14 | distribution of the software without specific, written prior 15 | permission. 16 | 17 | While CWI is the initial source for this software, a modified version 18 | is made available by the Corporation for National Research Initiatives 19 | (CNRI) at the Internet address ftp://ftp.python.org. 20 | 21 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH 22 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH 24 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 25 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 26 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 27 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 28 | PERFORMANCE OF THIS SOFTWARE. 29 | 30 | ******************************************************************/ 31 | 32 | /* Module configuration */ 33 | 34 | /* !!! !!! !!! This file is edited by the makesetup script !!! !!! !!! */ 35 | 36 | /* This file contains the table of built-in modules. 37 | See init_builtin() in import.c. */ 38 | 39 | #include "Python.h" 40 | 41 | 42 | /* -- ADDMODULE MARKER 1 -- */ 43 | 44 | extern void PyMarshal_Init(void); 45 | extern void initimp(void); 46 | extern void initgc(void); 47 | extern void initriscos(void); 48 | extern void initswi(void); 49 | 50 | struct _inittab _PyImport_Inittab[] = { 51 | 52 | {"riscos", initriscos}, 53 | 54 | /* -- ADDMODULE MARKER 2 -- */ 55 | 56 | /* This module "lives in" with marshal.c */ 57 | {"marshal", PyMarshal_Init}, 58 | 59 | /* This lives it with import.c */ 60 | {"imp", initimp}, 61 | 62 | /* These entries are here for sys.builtin_module_names */ 63 | {"__main__", NULL}, 64 | {"__builtin__", NULL}, 65 | {"sys", NULL}, 66 | {"exceptions", NULL}, 67 | 68 | /* This lives in gcmodule.c */ 69 | {"gc", initgc}, 70 | 71 | /* Sentinel */ 72 | {0, 0} 73 | }; 74 | -------------------------------------------------------------------------------- /inc/Linux/Modules/getpath_riscos.c: -------------------------------------------------------------------------------- 1 | #include "Python.h" 2 | #include "osdefs.h" 3 | 4 | static char *prefix, *exec_prefix, *progpath, *module_search_path=NULL; 5 | 6 | static void 7 | calculate_path() 8 | { 9 | char *pypath = getenv("Python$Path"); 10 | if (pypath) { 11 | int pathlen = strlen(pypath); 12 | module_search_path = malloc(pathlen + 1); 13 | if (module_search_path) 14 | strncpy(module_search_path, pypath, pathlen + 1); 15 | else { 16 | fprintf(stderr, 17 | "Not enough memory for dynamic PYTHONPATH.\n" 18 | "Using default static PYTHONPATH.\n"); 19 | } 20 | } 21 | if (!module_search_path) 22 | module_search_path = ".Lib"; 23 | prefix = ""; 24 | exec_prefix = prefix; 25 | progpath = Py_GetProgramName(); 26 | } 27 | 28 | /* External interface */ 29 | 30 | char * 31 | Py_GetPath() 32 | { 33 | if (!module_search_path) 34 | calculate_path(); 35 | return module_search_path; 36 | } 37 | 38 | char * 39 | Py_GetPrefix() 40 | { 41 | if (!module_search_path) 42 | calculate_path(); 43 | return prefix; 44 | } 45 | 46 | char * 47 | Py_GetExecPrefix() 48 | { 49 | if (!module_search_path) 50 | calculate_path(); 51 | return exec_prefix; 52 | } 53 | 54 | char * 55 | Py_GetProgramFullPath() 56 | { 57 | if (!module_search_path) 58 | calculate_path(); 59 | return progpath; 60 | } 61 | -------------------------------------------------------------------------------- /inc/Linux/Python/dynload_riscos.c: -------------------------------------------------------------------------------- 1 | /*********************************************************** 2 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, 3 | The Netherlands. 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation, and that the names of Stichting Mathematisch 12 | Centrum or CWI or Corporation for National Research Initiatives or 13 | CNRI not be used in advertising or publicity pertaining to 14 | distribution of the software without specific, written prior 15 | permission. 16 | 17 | While CWI is the initial source for this software, a modified version 18 | is made available by the Corporation for National Research Initiatives 19 | (CNRI) at the Internet address ftp://ftp.python.org. 20 | 21 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH 22 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH 24 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 25 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 26 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 27 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 28 | PERFORMANCE OF THIS SOFTWARE. 29 | 30 | ******************************************************************/ 31 | 32 | /* This module provides the necessary stubs for when dynamic loading is 33 | not present. */ 34 | 35 | #include "Python.h" 36 | #include "importdl.h" 37 | 38 | #include "dlk.h" 39 | 40 | 41 | const struct filedescr _PyImport_DynLoadFiletab[] = { 42 | {"/pyd", "rb", C_EXTENSION}, 43 | {0, 0} 44 | }; 45 | 46 | void dynload_init_dummy() 47 | { 48 | } 49 | 50 | dl_funcptr _PyImport_GetDynLoadFunc(const char *fqname, const char *shortname, 51 | char *pathname, FILE *fp) 52 | { 53 | int err; 54 | char errstr[256]; 55 | void (*init_function)(void); 56 | 57 | err = dlk_load_no_init(pathname, &init_function); 58 | if (err) { 59 | PyOS_snprintf(errstr, sizeof(errstr), "dlk failure %d", err); 60 | PyErr_SetString(PyExc_ImportError, errstr); 61 | } 62 | return init_function; 63 | } 64 | -------------------------------------------------------------------------------- /inc/Linux/Python/getcwd_riscos.c: -------------------------------------------------------------------------------- 1 | char *getcwd(char *buf, int size) 2 | { 3 | buf[0] = '\0'; 4 | return buf; 5 | } 6 | -------------------------------------------------------------------------------- /inc/Linux/README: -------------------------------------------------------------------------------- 1 | This directory contains files for the RISC OS port of Python. 2 | For more information about RISC OS see http://www.riscos.com/ . 3 | 4 | This port is currently being maintained by Dietmar Schwertberger, 5 | dietmar@schwertberger.de . 6 | 7 | On http://www.schwertberger.de you may find compiled versions and libraries 8 | as well as RISC OS specific documentation and extensions. 9 | 10 | 11 | ========================================================================== 12 | Compiling: 13 | 14 | 1. Extract Files from archive directory 'Python-...' to a directory named 15 | '!Python'. 16 | 2. Use a tool like Rename to change filenames from '*/[ch]' into '[ch].*'. 17 | 3. Create missing directories with 'amu cdirs'. 18 | 4. Build with 'amu'. 19 | 20 | I've only tested Acorn/Norcroft C/C++ 5.30 and amu. 21 | 22 | Python now uses the 32 bit libraries from Pace as well as the 32 bit 23 | version of OSLib. 24 | 25 | You will also need some additional libraries: 26 | 27 | DLK (patched version) 28 | http://www.schwertberger.de 29 | OSLib 30 | http://www.mk-net.demon.co.uk/oslib 31 | 32 | zlib (optional) 33 | ftp://ftp.freesoftware.com/pub/infozip/zlib/ 34 | expat (optional) 35 | http://sourceforge.net/projects/expat/ 36 | (makefile and config.h available from http://www.schwertberger.de/riscos_expat.zip 37 | -------------------------------------------------------------------------------- /inc/Linux/sleep.c: -------------------------------------------------------------------------------- 1 | #include "oslib/osmodule.h" 2 | #include 3 | #include "kernel.h" 4 | #include 5 | #include 6 | #include "oslib/taskwindow.h" 7 | #include "Python.h" 8 | 9 | 10 | int riscos_sleep(double delay) 11 | { 12 | os_t starttime, endtime, time; /* monotonic times (centiseconds) */ 13 | int *pollword, ret; 14 | osbool claimed; 15 | 16 | /* calculate end time */ 17 | starttime = os_read_monotonic_time(); 18 | if (starttime + 100.0*delay >INT_MAX) 19 | endtime = INT_MAX; 20 | else 21 | endtime = (os_t)(starttime + 100.0*delay); 22 | 23 | /* allocate (in RMA) and set pollword for xupcall_sleep */ 24 | pollword = osmodule_alloc(4); 25 | *pollword = 1; 26 | 27 | time = starttime; 28 | ret = 0; 29 | while ( time=starttime ) { 30 | xupcall_sleep (pollword, &claimed); 31 | if (PyErr_CheckSignals()) { 32 | ret = 1; 33 | break; 34 | } 35 | time = os_read_monotonic_time(); 36 | } 37 | 38 | /* deallocate pollword */ 39 | osmodule_free(pollword); 40 | return ret; 41 | } 42 | -------------------------------------------------------------------------------- /inc/Linux/support/!Boot: -------------------------------------------------------------------------------- 1 | set Python$Dir 2 | set PythonApp$Path . 3 | 4 | IconSprites .!Sprites 5 | 6 | .AddToPath Python$Path PythonApp:Lib 7 | .AddToPath Python$Path PythonApp:Lib.plat-riscos 8 | .AddToPath Python$Path PythonApp:Lib.site-packages 9 | set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit -wimpslot 1248k 10 | | -display 11 | set File$Type_ae5 Python 12 | 13 | | load modules for 32 bit compatibility 14 | RMEnsure UtilityModule 3.10 Error This application requires RISC OS 3.10 or later 15 | RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 RMLoad System:Modules.CallASWI 16 | RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 Error This application requires CallASWI 0.02 or later 17 | RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator 18 | RMEnsure FPEmulator 4.03 Error This application requires FPEmulator 4.03 or later 19 | RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib 20 | RMEnsure SharedCLibrary 5.34 Error This application requires SharedCLibrary 5.34 or later 21 | 22 | set Alias$Python Run .python23 %*0 -------------------------------------------------------------------------------- /inc/Linux/support/!Run: -------------------------------------------------------------------------------- 1 | .!Boot 2 | TaskWindow "python" -name "Python" -quit -display -wimpslot 1248k -------------------------------------------------------------------------------- /inc/Linux/support/!Sprites: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Linux/support/!Sprites -------------------------------------------------------------------------------- /inc/Linux/support/!Sprites22: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Linux/support/!Sprites22 -------------------------------------------------------------------------------- /inc/Linux/support/AddToPath: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Linux/support/AddToPath -------------------------------------------------------------------------------- /inc/Linux/unixstuff.c: -------------------------------------------------------------------------------- 1 | /* Fudge unix isatty and fileno for RISCOS */ 2 | 3 | #include "unixstuff.h" 4 | #include 5 | #include 6 | #include "oslib/osfile.h" 7 | 8 | int fileno(FILE *f) 9 | { return (int)f; 10 | } 11 | 12 | int isatty(int fn) 13 | { return (fn==fileno(stdin)); 14 | } 15 | 16 | bits unixtime(bits ld,bits ex) 17 | { ld&=0xFF; 18 | ld-=51; 19 | if(ex<1855547904U) ld--; 20 | ex-=1855548004U; 21 | return ex/100+42949673U*ld-ld/25; 22 | } 23 | 24 | 25 | /* from RISC OS infozip, preserves filetype in ld */ 26 | int acorntime(bits *ex, bits *ld, time_t utime) 27 | { 28 | unsigned timlo; /* 3 lower bytes of acorn file-time plus carry byte */ 29 | unsigned timhi; /* 2 high bytes of acorn file-time */ 30 | 31 | timlo = ((unsigned)utime & 0x00ffffffU) * 100 + 0x00996a00U; 32 | timhi = ((unsigned)utime >> 24); 33 | timhi = timhi * 100 + 0x0000336eU + (timlo >> 24); 34 | if (timhi & 0xffff0000U) 35 | return 1; /* calculation overflow, do not change time */ 36 | 37 | /* insert the five time bytes into loadaddr and execaddr variables */ 38 | *ex = (timlo & 0x00ffffffU) | ((timhi & 0x000000ffU) << 24); 39 | *ld = (*ld & 0xffffff00U) | ((timhi >> 8) & 0x000000ffU); 40 | 41 | return 0; /* subject to future extension to signal overflow */ 42 | } 43 | 44 | 45 | int isdir(char *fn) 46 | { int ob; 47 | if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0; 48 | switch (ob) 49 | { case osfile_IS_DIR:return 1; 50 | case osfile_IS_IMAGE:return 1; 51 | } 52 | return 0; 53 | } 54 | 55 | int isfile(char *fn) 56 | { int ob; 57 | if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0; 58 | switch (ob) 59 | { case osfile_IS_FILE:return 1; 60 | case osfile_IS_IMAGE:return 1; 61 | } 62 | return 0; 63 | } 64 | 65 | int object_exists(char *fn) 66 | { int ob; 67 | if(xosfile_read_stamped_no_path(fn,&ob,0,0,0,0,0)) return 0; 68 | switch (ob) 69 | { case osfile_IS_FILE:return 1; 70 | case osfile_IS_DIR:return 1; 71 | case osfile_IS_IMAGE:return 1; 72 | } 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /inc/Linux/unixstuff.h: -------------------------------------------------------------------------------- 1 | /* Fudge unix isatty and fileno for RISCOS */ 2 | 3 | #include 4 | #include 5 | 6 | int fileno(FILE *f); 7 | int isatty(int fn); 8 | unsigned int unixtime(unsigned int ld,unsigned int ex); 9 | int acorntime(unsigned int *ex, unsigned int *ld, time_t ut); 10 | 11 | int isdir(char *fn); 12 | int isfile(char *fn); 13 | int object_exists(char *fn); 14 | 15 | -------------------------------------------------------------------------------- /inc/Windows/VC6/_ssl.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="_ssl" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) External Target" 0x0106 6 | 7 | CFG=_ssl - Win32 Debug 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "_ssl.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "_ssl.mak" CFG="_ssl - Win32 Debug" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "_ssl - Win32 Release" (based on "Win32 (x86) External Target") 21 | !MESSAGE "_ssl - Win32 Debug" (based on "Win32 (x86) External Target") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | 29 | !IF "$(CFG)" == "_ssl - Win32 Release" 30 | 31 | # PROP BASE Use_MFC 0 32 | # PROP BASE Use_Debug_Libraries 0 33 | # PROP BASE Output_Dir "Release" 34 | # PROP BASE Intermediate_Dir "Release" 35 | # PROP BASE Cmd_Line "NMAKE /f _ssl.mak" 36 | # PROP BASE Rebuild_Opt "/a" 37 | # PROP BASE Target_File "_ssl.exe" 38 | # PROP BASE Bsc_Name "_ssl.bsc" 39 | # PROP BASE Target_Dir "" 40 | # PROP Use_MFC 0 41 | # PROP Use_Debug_Libraries 0 42 | # PROP Output_Dir "." 43 | # PROP Intermediate_Dir "x86-temp-release\_ssl" 44 | # PROP Cmd_Line "python build_ssl.py" 45 | # PROP Rebuild_Opt "-a" 46 | # PROP Target_File "_ssl.pyd" 47 | # PROP Bsc_Name "" 48 | # PROP Target_Dir "" 49 | 50 | !ELSEIF "$(CFG)" == "_ssl - Win32 Debug" 51 | 52 | # PROP BASE Use_MFC 0 53 | # PROP BASE Use_Debug_Libraries 1 54 | # PROP BASE Output_Dir "x86-temp-debug\_ssl" 55 | # PROP BASE Intermediate_Dir "x86-temp-debug\_ssl" 56 | # PROP BASE Cmd_Line "NMAKE /f _ssl.mak" 57 | # PROP BASE Rebuild_Opt "/a" 58 | # PROP BASE Target_File "_ssl_d.pyd" 59 | # PROP BASE Bsc_Name "_ssl_d.bsc" 60 | # PROP BASE Target_Dir "" 61 | # PROP Use_MFC 0 62 | # PROP Use_Debug_Libraries 1 63 | # PROP Output_Dir "." 64 | # PROP Intermediate_Dir "x86-temp-debug\_ssl" 65 | # PROP Cmd_Line "python_d -u build_ssl.py -d" 66 | # PROP Rebuild_Opt "-a" 67 | # PROP Target_File "_ssl_d.pyd" 68 | # PROP Bsc_Name "" 69 | # PROP Target_Dir "" 70 | 71 | !ENDIF 72 | 73 | # Begin Target 74 | 75 | # Name "_ssl - Win32 Release" 76 | # Name "_ssl - Win32 Debug" 77 | 78 | !IF "$(CFG)" == "_ssl - Win32 Release" 79 | 80 | !ELSEIF "$(CFG)" == "_ssl - Win32 Debug" 81 | 82 | !ENDIF 83 | 84 | # Begin Source File 85 | 86 | SOURCE=..\..\Modules\_ssl.c 87 | # End Source File 88 | # End Target 89 | # End Project 90 | -------------------------------------------------------------------------------- /inc/Windows/VC6/_ssl.mak: -------------------------------------------------------------------------------- 1 | 2 | !IFDEF DEBUG 3 | MODULE=_ssl_d.pyd 4 | TEMP_DIR=x86-temp-debug/_ssl 5 | CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32 6 | LFLAGS=/nodefaultlib:"msvcrt" 7 | !ELSE 8 | MODULE=_ssl.pyd 9 | TEMP_DIR=x86-temp-release/_ssl 10 | CFLAGS=/Ox /MD /LD /DWIN32 11 | LFLAGS= 12 | !ENDIF 13 | 14 | INCLUDES=-I ../../Include -I .. -I $(SSL_DIR)/inc32 15 | SSL_LIB_DIR=$(SSL_DIR)/out32 16 | LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib 17 | 18 | SOURCE=../../Modules/_ssl.c $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib 19 | 20 | $(MODULE): $(SOURCE) ../*.h ../../Include/*.h 21 | @if not exist "$(TEMP_DIR)/." mkdir "$(TEMP_DIR)" 22 | cl /nologo $(SOURCE) $(CFLAGS) /Fo$(TEMP_DIR)\$*.obj $(INCLUDES) /link /out:$(MODULE) $(LIBS) $(LFLAGS) 23 | -------------------------------------------------------------------------------- /inc/Windows/VC6/build_tkinter.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import subprocess 4 | 5 | TCL_MAJOR = 8 6 | TCL_MINOR = 5 7 | TCL_PATCH = 2 8 | 9 | TIX_MAJOR = 8 10 | TIX_MINOR = 4 11 | TIX_PATCH = 3 12 | 13 | def abspath(name): 14 | par = os.path.pardir 15 | return os.path.abspath(os.path.join(__file__, par, par, par, par, name)) 16 | 17 | TCL_DIR = abspath("tcl%d.%d.%d" % (TCL_MAJOR, TCL_MINOR, TCL_PATCH)) 18 | TK_DIR = abspath("tk%d.%d.%d" % (TCL_MAJOR, TCL_MINOR, TCL_PATCH)) 19 | TIX_DIR = abspath("tix%d.%d.%d" % (TIX_MAJOR, TIX_MINOR, TIX_PATCH)) 20 | OUT_DIR = abspath("tcltk") 21 | 22 | def have_args(*a): 23 | return any(s in sys.argv[1:] for s in a) 24 | 25 | def enter(dir): 26 | os.chdir(os.path.join(dir, "win")) 27 | 28 | def main(): 29 | debug = have_args("-d", "--debug") 30 | clean = have_args("clean") 31 | install = have_args("install") 32 | tcl = have_args("tcl") 33 | tk = have_args("tk") 34 | tix = have_args("tix") 35 | if not(tcl) and not(tk) and not(tix): 36 | tcl = tk = tix = True 37 | 38 | def nmake(makefile, *a): 39 | args = ["nmake", "/nologo", "/f", makefile, "DEBUG=%d" % debug] 40 | args.extend(a) 41 | subprocess.check_call(args) 42 | 43 | if tcl: 44 | enter(TCL_DIR) 45 | def nmake_tcl(*a): 46 | nmake("makefile.vc", *a) 47 | if clean: 48 | nmake_tcl("clean") 49 | elif install: 50 | nmake_tcl("install", "INSTALLDIR=" + OUT_DIR) 51 | else: 52 | nmake_tcl() 53 | 54 | if tk: 55 | enter(TK_DIR) 56 | def nmake_tk(*a): 57 | nmake("makefile.vc", "TCLDIR=" + TCL_DIR, *a) 58 | if clean: 59 | nmake_tk("clean") 60 | elif install: 61 | nmake_tk("install", "INSTALLDIR=" + OUT_DIR) 62 | else: 63 | nmake_tk() 64 | 65 | if tix: 66 | enter(TIX_DIR) 67 | def nmake_tix(*a): 68 | nmake("python.mak", 69 | "TCL_MAJOR=%d" % TCL_MAJOR, 70 | "TCL_MINOR=%d" % TCL_MINOR, 71 | "TCL_PATCH=%d" % TCL_PATCH, 72 | "MACHINE=IX86", *a) 73 | if clean: 74 | nmake_tix("clean") 75 | elif install: 76 | nmake_tix("install", "INSTALL_DIR=" + OUT_DIR) 77 | else: 78 | nmake_tix() 79 | 80 | if __name__ == '__main__': 81 | main() 82 | -------------------------------------------------------------------------------- /inc/Windows/VC6/rmpyc.py: -------------------------------------------------------------------------------- 1 | # Remove all the .pyc and .pyo files under ../Lib. 2 | 3 | 4 | def deltree(root): 5 | import os 6 | from os.path import join 7 | 8 | npyc = npyo = 0 9 | for root, dirs, files in os.walk(root): 10 | for name in files: 11 | delete = False 12 | if name.endswith('.pyc'): 13 | delete = True 14 | npyc += 1 15 | elif name.endswith('.pyo'): 16 | delete = True 17 | npyo += 1 18 | 19 | if delete: 20 | os.remove(join(root, name)) 21 | 22 | return npyc, npyo 23 | 24 | npyc, npyo = deltree("../../Lib") 25 | print npyc, ".pyc deleted,", npyo, ".pyo deleted" 26 | -------------------------------------------------------------------------------- /inc/Windows/VC6/rt.bat: -------------------------------------------------------------------------------- 1 | @rem Run Tests. Run the regression test suite. 2 | @rem Usage: rt [-d] [-O] [-q] regrtest_args 3 | @rem -d Run Debug build (python_d.exe). Else release build. 4 | @rem -O Run python.exe or python_d.exe (see -d) with -O. 5 | @rem -q "quick" -- normally the tests are run twice, the first time 6 | @rem after deleting all the .py[co] files reachable from Lib/. 7 | @rem -q runs the tests just once, and without deleting .py[co] files. 8 | @rem All leading instances of these switches are shifted off, and 9 | @rem whatever remains is passed to regrtest.py. For example, 10 | @rem rt -O -d -x test_thread 11 | @rem runs 12 | @rem python_d -O ../../lib/test/regrtest.py -x test_thread 13 | @rem twice, and 14 | @rem rt -q -g test_binascii 15 | @rem runs 16 | @rem python_d ../../lib/test/regrtest.py -g test_binascii 17 | @rem to generate the expected-output file for binascii quickly. 18 | @set _exe=python 19 | @set _qmode=no 20 | @set _dashO= 21 | @goto CheckOpts 22 | :Again 23 | @shift 24 | :CheckOpts 25 | @if "%1"=="-O" set _dashO=-O 26 | @if "%1"=="-O" goto Again 27 | @if "%1"=="-q" set _qmode=yes 28 | @if "%1"=="-q" goto Again 29 | @if "%1"=="-d" set _exe=python_d 30 | @if "%1"=="-d" goto Again 31 | @if "%_qmode%"=="yes" goto Qmode 32 | @echo Deleting .pyc/.pyo files ... 33 | @%_exe% rmpyc.py 34 | %_exe% %_dashO% -E -tt ../../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 35 | @echo About to run again without deleting .pyc/.pyo first: 36 | @pause 37 | :Qmode 38 | %_exe% %_dashO% -E -tt ../../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 39 | @set _exe= 40 | @set _qmode= 41 | @set _dashO= 42 | -------------------------------------------------------------------------------- /inc/Windows/VC6/tcl852.patch: -------------------------------------------------------------------------------- 1 | --- tcl8.5.2\generic\tcl.h Fri Jun 13 03:35:39 2008 2 | +++ tcl8.5.2\generic\tcl.h Sun Jan 4 16:52:30 2009 3 | @@ -367,7 +367,7 @@ 4 | typedef struct stati64 Tcl_StatBuf; 5 | # define TCL_LL_MODIFIER "L" 6 | # else /* __BORLANDC__ */ 7 | -# if _MSC_VER < 1400 && !defined(_M_IX86) 8 | +# if _MSC_VER < 1400 /*&& !defined(_M_IX86)*/ 9 | typedef struct _stati64 Tcl_StatBuf; 10 | # else 11 | typedef struct _stat64 Tcl_StatBuf; 12 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/_ssl.mak: -------------------------------------------------------------------------------- 1 | EXTRA_LIBS= 2 | 3 | !IFDEF DEBUG 4 | SUFFIX=_d.pyd 5 | TEMP=x86-temp-debug/ 6 | CFLAGS=/Od /Zi /MDd /LDd /DDEBUG /D_DEBUG /DWIN32 7 | SSL_LIB_DIR=$(SSL_DIR)/out32.dbg 8 | !ELSE 9 | SUFFIX=.pyd 10 | TEMP=x86-temp-release/ 11 | CFLAGS=/Ox /MD /LD /DWIN32 12 | SSL_LIB_DIR=$(SSL_DIR)/out32 13 | !ENDIF 14 | 15 | INCLUDES=-I ../../Include -I ../../PC -I $(SSL_DIR)/inc32 16 | 17 | SSL_LIBS=gdi32.lib wsock32.lib user32.lib advapi32.lib /LIBPATH:$(SSL_LIB_DIR) libeay32.lib ssleay32.lib 18 | SSL_SOURCE=../../Modules/_ssl.c 19 | 20 | HASH_LIBS=gdi32.lib user32.lib advapi32.lib /libpath:$(SSL_LIB_DIR) libeay32.lib 21 | HASH_SOURCE=../../Modules/_hashopenssl.c 22 | 23 | all: _ssl$(SUFFIX) _hashlib$(SUFFIX) 24 | 25 | # Split compile/link into two steps to better support VSExtComp 26 | _ssl$(SUFFIX): $(SSL_SOURCE) $(SSL_LIB_DIR)/libeay32.lib $(SSL_LIB_DIR)/ssleay32.lib ../../PC/*.h ../../Include/*.h 27 | @if not exist "$(TEMP)/_ssl/." mkdir "$(TEMP)/_ssl" 28 | cl /nologo /c $(SSL_SOURCE) $(CFLAGS) /Fo$(TEMP)\_ssl\$*.obj $(INCLUDES) 29 | link /nologo @<< 30 | /dll /out:_ssl$(SUFFIX) $(TEMP)\_ssl\$*.obj $(SSL_LIBS) $(EXTRA_LIBS) 31 | << 32 | 33 | _hashlib$(SUFFIX): $(HASH_SOURCE) $(SSL_LIB_DIR)/libeay32.lib ../../PC/*.h ../../Include/*.h 34 | @if not exist "$(TEMP)/_hashlib/." mkdir "$(TEMP)/_hashlib" 35 | cl /nologo /c $(HASH_SOURCE) $(CFLAGS) $(EXTRA_CFLAGS) /Fo$(TEMP)\_hashlib\$*.obj $(INCLUDES) 36 | link /nologo @<< 37 | /dll /out:_hashlib$(SUFFIX) $(HASH_LIBS) $(EXTRA_LIBS) $(TEMP)\_hashlib\$*.obj 38 | << 39 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/_ssl.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 13 | 14 | 15 | 22 | 28 | 29 | 36 | 42 | 43 | 50 | 56 | 57 | 64 | 70 | 71 | 72 | 73 | 74 | 75 | 77 | 78 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/amd64_ml64.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Try to find the AMD64 assembler and call it with the supplied arguments. 3 | 4 | set MLEXE=Microsoft Platform SDK\Bin\Win64\x86\AMD64\ml64.EXE 5 | 6 | rem For the environment variables see also 7 | rem http://msdn.microsoft.com/library/en-us/win64/win64/wow64_implementation_details.asp 8 | 9 | if exist "%ProgramFiles%\%MLEXE%" ( 10 | set ML64="%ProgramFiles%\%MLEXE%" 11 | ) else if exist "%ProgramW6432%\%MLEXE%" ( 12 | set ML64="%ProgramW6432%\%MLEXE%" 13 | ) else ( 14 | set ML64=ml64.exe 15 | ) 16 | 17 | %ML64% %* 18 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/build_ssl.bat: -------------------------------------------------------------------------------- 1 | if "%1" == "ReleaseAMD64" call "%MSSdk%\SetEnv" /XP64 /RETAIL 2 | 3 | @echo off 4 | if not defined HOST_PYTHON ( 5 | if %1 EQU Debug ( 6 | set HOST_PYTHON=python_d.exe 7 | ) ELSE ( 8 | set HOST_PYTHON=python.exe 9 | ) 10 | ) 11 | %HOST_PYTHON% build_ssl.py %1 %2 12 | 13 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/db.build: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/field3.py: -------------------------------------------------------------------------------- 1 | # An absurd workaround for the lack of arithmetic in MS's resource compiler. 2 | # After building Python, run this, then paste the output into the appropriate 3 | # part of PC\python_nt.rc. 4 | # Example output: 5 | # 6 | # * For 2.3a0, 7 | # * PY_MICRO_VERSION = 0 8 | # * PY_RELEASE_LEVEL = 'alpha' = 0xA 9 | # * PY_RELEASE_SERIAL = 1 10 | # * 11 | # * and 0*1000 + 10*10 + 1 = 101. 12 | # */ 13 | # #define FIELD3 101 14 | 15 | import sys 16 | 17 | major, minor, micro, level, serial = sys.version_info 18 | levelnum = {'alpha': 0xA, 19 | 'beta': 0xB, 20 | 'candidate': 0xC, 21 | 'final': 0xF, 22 | }[level] 23 | string = sys.version.split()[0] # like '2.3a0' 24 | 25 | print " * For %s," % string 26 | print " * PY_MICRO_VERSION = %d" % micro 27 | print " * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum)) 28 | print " * PY_RELEASE_SERIAL = %d" % serial 29 | print " *" 30 | 31 | field3 = micro * 1000 + levelnum * 10 + serial 32 | 33 | print " * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3) 34 | print " */" 35 | print "#define FIELD3", field3 36 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/installer.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/VS7.1/installer.bmp -------------------------------------------------------------------------------- /inc/Windows/VS7.1/make_buildinfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | /* This file creates the getbuildinfo.o object, by first 7 | invoking subwcrev.exe (if found), and then invoking cl.exe. 8 | As a side effect, it might generate PC\VS7.1\getbuildinfo2.c 9 | also. If this isn't a subversion checkout, or subwcrev isn't 10 | found, it compiles ..\\..\\Modules\\getbuildinfo.c instead. 11 | 12 | Currently, subwcrev.exe is found from the registry entries 13 | of TortoiseSVN. 14 | 15 | No attempt is made to place getbuildinfo.o into the proper 16 | binary directory. This isn't necessary, as this tool is 17 | invoked as a pre-link step for pythoncore, so that overwrites 18 | any previous getbuildinfo.o. 19 | 20 | */ 21 | 22 | int make_buildinfo2() 23 | { 24 | struct _stat st; 25 | HKEY hTortoise; 26 | char command[500]; 27 | DWORD type, size; 28 | if (_stat(".svn", &st) < 0) 29 | return 0; 30 | /* Allow suppression of subwcrev.exe invocation if a no_subwcrev file is present. */ 31 | if (_stat("no_subwcrev", &st) == 0) 32 | return 0; 33 | if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS && 34 | RegOpenKey(HKEY_CURRENT_USER, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS) 35 | /* Tortoise not installed */ 36 | return 0; 37 | command[0] = '"'; /* quote the path to the executable */ 38 | size = sizeof(command) - 1; 39 | if (RegQueryValueEx(hTortoise, "Directory", 0, &type, command+1, &size) != ERROR_SUCCESS || 40 | type != REG_SZ) 41 | /* Registry corrupted */ 42 | return 0; 43 | strcat(command, "bin\\subwcrev.exe"); 44 | if (_stat(command+1, &st) < 0) 45 | /* subwcrev.exe not part of the release */ 46 | return 0; 47 | strcat(command, "\" ..\\.. ..\\..\\Modules\\getbuildinfo.c getbuildinfo2.c"); 48 | puts(command); fflush(stdout); 49 | if (system(command) < 0) 50 | return 0; 51 | return 1; 52 | } 53 | 54 | int main(int argc, char*argv[]) 55 | { 56 | char command[500] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL "; 57 | int do_unlink, result; 58 | if (argc != 2) { 59 | fprintf(stderr, "make_buildinfo $(ConfigurationName)\n"); 60 | return EXIT_FAILURE; 61 | } 62 | if (strcmp(argv[1], "Release") == 0) { 63 | strcat(command, "-MD "); 64 | } 65 | else if (strcmp(argv[1], "Debug") == 0) { 66 | strcat(command, "-D_DEBUG -MDd "); 67 | } 68 | else if (strcmp(argv[1], "ReleaseItanium") == 0) { 69 | strcat(command, "-MD /USECL:MS_ITANIUM "); 70 | } 71 | else if (strcmp(argv[1], "ReleaseAMD64") == 0) { 72 | strcat(command, "-MD "); 73 | strcat(command, "-MD /USECL:MS_OPTERON "); 74 | } 75 | else { 76 | fprintf(stderr, "unsupported configuration %s\n", argv[1]); 77 | return EXIT_FAILURE; 78 | } 79 | 80 | if ((do_unlink = make_buildinfo2())) 81 | strcat(command, "getbuildinfo2.c -DSUBWCREV "); 82 | else 83 | strcat(command, "..\\..\\Modules\\getbuildinfo.c"); 84 | strcat(command, " -Fogetbuildinfo.o -I..\\..\\Include -I..\\..\\PC"); 85 | puts(command); fflush(stdout); 86 | result = system(command); 87 | if (do_unlink) 88 | unlink("getbuildinfo2.c"); 89 | if (result < 0) 90 | return EXIT_FAILURE; 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/make_buildinfo.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 19 | 30 | 32 | 40 | 42 | 44 | 46 | 48 | 50 | 52 | 54 | 56 | 58 | 60 | 61 | 67 | 75 | 77 | 86 | 88 | 90 | 92 | 94 | 96 | 98 | 100 | 102 | 104 | 106 | 107 | 108 | 109 | 110 | 111 | 115 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/python.build: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/python.iss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/VS7.1/python.iss -------------------------------------------------------------------------------- /inc/Windows/VS7.1/python20.wse: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/VS7.1/python20.wse -------------------------------------------------------------------------------- /inc/Windows/VS7.1/rmpyc.py: -------------------------------------------------------------------------------- 1 | # Remove all the .pyc and .pyo files under ../Lib. 2 | 3 | 4 | def deltree(root): 5 | import os 6 | from os.path import join 7 | 8 | npyc = npyo = 0 9 | for root, dirs, files in os.walk(root): 10 | for name in files: 11 | delete = False 12 | if name.endswith('.pyc'): 13 | delete = True 14 | npyc += 1 15 | elif name.endswith('.pyo'): 16 | delete = True 17 | npyo += 1 18 | 19 | if delete: 20 | os.remove(join(root, name)) 21 | 22 | return npyc, npyo 23 | 24 | npyc, npyo = deltree("../Lib") 25 | print npyc, ".pyc deleted,", npyo, ".pyo deleted" 26 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/rt.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Run Tests. Run the regression test suite. 3 | rem Usage: rt [-d] [-O] [-q] regrtest_args 4 | rem -d Run Debug build (python_d.exe). Else release build. 5 | rem -O Run python.exe or python_d.exe (see -d) with -O. 6 | rem -q "quick" -- normally the tests are run twice, the first time 7 | rem after deleting all the .py[co] files reachable from Lib/. 8 | rem -q runs the tests just once, and without deleting .py[co] files. 9 | rem All leading instances of these switches are shifted off, and 10 | rem whatever remains is passed to regrtest.py. For example, 11 | rem rt -O -d -x test_thread 12 | rem runs 13 | rem python_d -O ../../lib/test/regrtest.py -x test_thread 14 | rem twice, and 15 | rem rt -q -g test_binascii 16 | rem runs 17 | rem python_d ../../lib/test/regrtest.py -g test_binascii 18 | rem to generate the expected-output file for binascii quickly. 19 | rem 20 | rem Confusing: if you want to pass a comma-separated list, like 21 | rem -u network,largefile 22 | rem then you have to quote it on the rt line, like 23 | rem rt -u "network,largefile" 24 | 25 | setlocal 26 | 27 | set exe=python 28 | set qmode= 29 | set dashO= 30 | PATH %PATH%;..\..\..\tcltk\bin 31 | 32 | :CheckOpts 33 | if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts 34 | if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts 35 | if "%1"=="-d" (set exe=python_d) & shift & goto CheckOpts 36 | 37 | set cmd=%exe% %dashO% -E -tt ../../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 38 | if defined qmode goto Qmode 39 | 40 | echo Deleting .pyc/.pyo files ... 41 | %exe% rmpyc.py 42 | 43 | echo on 44 | %cmd% 45 | @echo off 46 | 47 | echo About to run again without deleting .pyc/.pyo first: 48 | pause 49 | 50 | :Qmode 51 | echo on 52 | %cmd% 53 | -------------------------------------------------------------------------------- /inc/Windows/VS7.1/w9xpopen.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 11 | 12 | 13 | 21 | 31 | 33 | 41 | 43 | 45 | 47 | 49 | 51 | 53 | 55 | 57 | 59 | 61 | 62 | 70 | 81 | 83 | 90 | 92 | 94 | 96 | 98 | 100 | 102 | 104 | 106 | 108 | 110 | 111 | 112 | 113 | 114 | 115 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem A batch program to build or rebuild a particular configuration. 3 | rem just for convenience. 4 | 5 | setlocal 6 | set platf=Win32 7 | set conf=Release 8 | set build=/build 9 | 10 | :CheckOpts 11 | if "%1"=="-c" (set conf=%2) & shift & shift & goto CheckOpts 12 | if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts 13 | if "%1"=="-r" (set build=/rebuild) & shift & goto CheckOpts 14 | 15 | set cmd=devenv pcbuild.sln %build% "%conf%|%platf%" 16 | echo %cmd% 17 | %cmd% 18 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/build_env.bat: -------------------------------------------------------------------------------- 1 | @%comspec% /k env.bat %* 2 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/build_pgo.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem A batch program to build PGO (Profile guided optimization) by first 3 | rem building instrumented binaries, then running the testsuite, and 4 | rem finally building the optimized code. 5 | rem Note, after the first instrumented run, one can just keep on 6 | rem building the PGUpdate configuration while developing. 7 | 8 | setlocal 9 | set platf=Win32 10 | 11 | rem use the performance testsuite. This is quick and simple 12 | set job1=..\..\tools\pybench\pybench.py -n 1 -C 1 --with-gc 13 | set path1=..\..\tools\pybench 14 | 15 | rem or the whole testsuite for more thorough testing 16 | set job2=..\..\lib\test\regrtest.py 17 | set path2=..\..\lib 18 | 19 | set job=%job1% 20 | set clrpath=%path1% 21 | 22 | :CheckOpts 23 | if "%1"=="-p" (set platf=%2) & shift & shift & goto CheckOpts 24 | if "%1"=="-2" (set job=%job2%) & (set clrpath=%path2%) & shift & goto CheckOpts 25 | 26 | set PGI=%platf%-pgi 27 | set PGO=%platf%-pgo 28 | 29 | @echo on 30 | rem build the instrumented version 31 | call build -p %platf% -c PGInstrument 32 | 33 | rem remove .pyc files, .pgc files and execute the job 34 | %PGI%\python.exe rmpyc.py %clrpath% 35 | del %PGI%\*.pgc 36 | %PGI%\python.exe %job% 37 | 38 | rem finally build the optimized version 39 | if exist %PGO% del /s /q %PGO% 40 | call build -p %platf% -c PGUpdate 41 | 42 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/build_ssl.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if not defined HOST_PYTHON ( 3 | if %1 EQU Debug ( 4 | set HOST_PYTHON=python_d.exe 5 | if not exist python27_d.dll exit 1 6 | ) ELSE ( 7 | set HOST_PYTHON=python.exe 8 | if not exist python27.dll exit 1 9 | ) 10 | ) 11 | %HOST_PYTHON% build_ssl.py %1 %2 %3 12 | 13 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/build_tkinter.py: -------------------------------------------------------------------------------- 1 | """Script to compile the dependencies of _tkinter 2 | 3 | Copyright (c) 2007 by Christian Heimes 4 | 5 | Licensed to PSF under a Contributor Agreement. 6 | """ 7 | 8 | import os 9 | import sys 10 | 11 | here = os.path.abspath(os.path.dirname(__file__)) 12 | par = os.path.pardir 13 | 14 | if 1: 15 | TCL = "tcl8.4.16" 16 | TK = "tk8.4.16" 17 | TIX = "tix-8.4.0" 18 | else: 19 | TCL = "tcl8.5b3" 20 | TK = "tcl8.5b3" 21 | TIX = "Tix8.4.2" 22 | 23 | ROOT = os.path.abspath(os.path.join(here, par, par, par)) 24 | # Windows 2000 compatibility: WINVER 0x0500 25 | # http://msdn2.microsoft.com/en-us/library/aa383745.aspx 26 | NMAKE = "nmake /nologo /f %s COMPILERFLAGS=-DWINVER=0x0500 %s %s" 27 | 28 | def nmake(makefile, command="", **kw): 29 | defines = ' '.join(k+'='+v for k, v in kw.items()) 30 | cmd = NMAKE % (makefile, defines, command) 31 | print("\n\n"+cmd+"\n") 32 | if os.system(cmd) != 0: 33 | raise RuntimeError(cmd) 34 | 35 | def build(platform, clean): 36 | if platform == "Win32": 37 | dest = os.path.join(ROOT, "tcltk") 38 | machine = "X86" 39 | elif platform == "x64": 40 | dest = os.path.join(ROOT, "tcltk64") 41 | machine = "X64" 42 | else: 43 | raise ValueError(platform) 44 | 45 | # TCL 46 | tcldir = os.path.join(ROOT, TCL) 47 | if 1: 48 | os.chdir(os.path.join(tcldir, "win")) 49 | if clean: 50 | nmake("makefile.vc", "clean") 51 | nmake("makefile.vc") 52 | nmake("makefile.vc", "install", INSTALLDIR=dest) 53 | 54 | # TK 55 | if 1: 56 | os.chdir(os.path.join(ROOT, TK, "win")) 57 | if clean: 58 | nmake("makefile.vc", "clean", TCLDIR=tcldir) 59 | nmake("makefile.vc", TCLDIR=tcldir) 60 | nmake("makefile.vc", "install", TCLDIR=tcldir, INSTALLDIR=dest) 61 | 62 | # TIX 63 | if 1: 64 | # python9.mak is available at http://svn.python.org 65 | os.chdir(os.path.join(ROOT, TIX, "win")) 66 | if clean: 67 | nmake("python9.mak", "clean") 68 | nmake("python9.mak", MACHINE=machine) 69 | nmake("python9.mak", "install") 70 | 71 | def main(): 72 | if len(sys.argv) < 2 or sys.argv[1] not in ("Win32", "x64"): 73 | print("%s Win32|x64" % sys.argv[0]) 74 | sys.exit(1) 75 | 76 | if "-c" in sys.argv: 77 | clean = True 78 | else: 79 | clean = False 80 | 81 | build(sys.argv[1], clean) 82 | 83 | 84 | if __name__ == '__main__': 85 | main() 86 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/debug.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/env.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | set VS8=%ProgramFiles%\Microsoft Visual Studio 8 3 | echo Build environments: x86, ia64, amd64, x86_amd64, x86_ia64 4 | echo. 5 | call "%VS8%\VC\vcvarsall.bat" %1 6 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/field3.py: -------------------------------------------------------------------------------- 1 | # An absurd workaround for the lack of arithmetic in MS's resource compiler. 2 | # After building Python, run this, then paste the output into the appropriate 3 | # part of PC\python_nt.rc. 4 | # Example output: 5 | # 6 | # * For 2.3a0, 7 | # * PY_MICRO_VERSION = 0 8 | # * PY_RELEASE_LEVEL = 'alpha' = 0xA 9 | # * PY_RELEASE_SERIAL = 1 10 | # * 11 | # * and 0*1000 + 10*10 + 1 = 101. 12 | # */ 13 | # #define FIELD3 101 14 | 15 | import sys 16 | 17 | major, minor, micro, level, serial = sys.version_info 18 | levelnum = {'alpha': 0xA, 19 | 'beta': 0xB, 20 | 'candidate': 0xC, 21 | 'final': 0xF, 22 | }[level] 23 | string = sys.version.split()[0] # like '2.3a0' 24 | 25 | print(" * For %s," % string) 26 | print(" * PY_MICRO_VERSION = %d" % micro) 27 | print(" * PY_RELEASE_LEVEL = %r = %s" % (level, hex(levelnum))) 28 | print(" * PY_RELEASE_SERIAL = %d" % serial) 29 | print(" *") 30 | 31 | field3 = micro * 1000 + levelnum * 10 + serial 32 | 33 | print(" * and %d*1000 + %d*10 + %d = %d" % (micro, levelnum, serial, field3)) 34 | print(" */") 35 | print("#define FIELD3", field3) 36 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/idle.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem start idle 3 | rem Usage: idle [-d] 4 | rem -d Run Debug build (python_d.exe). Else release build. 5 | 6 | setlocal 7 | set exe=python 8 | PATH %PATH%;..\..\..\tcltk\bin 9 | 10 | if "%1"=="-d" (set exe=python_d) & shift 11 | 12 | set cmd=%exe% ../../Lib/idlelib/idle.py %1 %2 %3 %4 %5 %6 %7 %8 %9 13 | 14 | echo on 15 | %cmd% 16 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/make_buildinfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define CMD_SIZE 500 7 | 8 | /* This file creates the getbuildinfo.o object, by first 9 | invoking subwcrev.exe (if found), and then invoking cl.exe. 10 | As a side effect, it might generate PCBuild\getbuildinfo2.c 11 | also. If this isn't a subversion checkout, or subwcrev isn't 12 | found, it compiles ..\\..\\Modules\\getbuildinfo.c instead. 13 | 14 | Currently, subwcrev.exe is found from the registry entries 15 | of TortoiseSVN. 16 | 17 | No attempt is made to place getbuildinfo.o into the proper 18 | binary directory. This isn't necessary, as this tool is 19 | invoked as a pre-link step for pythoncore, so that overwrites 20 | any previous getbuildinfo.o. 21 | 22 | */ 23 | 24 | int make_buildinfo2() 25 | { 26 | struct _stat st; 27 | HKEY hTortoise; 28 | char command[CMD_SIZE+1]; 29 | DWORD type, size; 30 | if (_stat(".svn", &st) < 0) 31 | return 0; 32 | /* Allow suppression of subwcrev.exe invocation if a no_subwcrev file is present. */ 33 | if (_stat("no_subwcrev", &st) == 0) 34 | return 0; 35 | if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS && 36 | RegOpenKey(HKEY_CURRENT_USER, "Software\\TortoiseSVN", &hTortoise) != ERROR_SUCCESS) 37 | /* Tortoise not installed */ 38 | return 0; 39 | command[0] = '"'; /* quote the path to the executable */ 40 | size = sizeof(command) - 1; 41 | if (RegQueryValueEx(hTortoise, "Directory", 0, &type, command+1, &size) != ERROR_SUCCESS || 42 | type != REG_SZ) 43 | /* Registry corrupted */ 44 | return 0; 45 | strcat_s(command, CMD_SIZE, "bin\\subwcrev.exe"); 46 | if (_stat(command+1, &st) < 0) 47 | /* subwcrev.exe not part of the release */ 48 | return 0; 49 | strcat_s(command, CMD_SIZE, "\" ..\\.. ..\\..\\Modules\\getbuildinfo.c getbuildinfo2.c"); 50 | puts(command); fflush(stdout); 51 | if (system(command) < 0) 52 | return 0; 53 | return 1; 54 | } 55 | 56 | int main(int argc, char*argv[]) 57 | { 58 | char command[500] = "cl.exe -c -D_WIN32 -DUSE_DL_EXPORT -D_WINDOWS -DWIN32 -D_WINDLL "; 59 | int do_unlink, result; 60 | if (argc != 2) { 61 | fprintf(stderr, "make_buildinfo $(ConfigurationName)\n"); 62 | return EXIT_FAILURE; 63 | } 64 | if (strcmp(argv[1], "Release") == 0) { 65 | strcat_s(command, CMD_SIZE, "-MD "); 66 | } 67 | else if (strcmp(argv[1], "Debug") == 0) { 68 | strcat_s(command, CMD_SIZE, "-D_DEBUG -MDd "); 69 | } 70 | else if (strcmp(argv[1], "ReleaseItanium") == 0) { 71 | strcat_s(command, CMD_SIZE, "-MD /USECL:MS_ITANIUM "); 72 | } 73 | else if (strcmp(argv[1], "ReleaseAMD64") == 0) { 74 | strcat_s(command, CMD_SIZE, "-MD "); 75 | strcat_s(command, CMD_SIZE, "-MD /USECL:MS_OPTERON "); 76 | } 77 | else { 78 | fprintf(stderr, "unsupported configuration %s\n", argv[1]); 79 | return EXIT_FAILURE; 80 | } 81 | 82 | if ((do_unlink = make_buildinfo2())) 83 | strcat_s(command, CMD_SIZE, "getbuildinfo2.c -DSUBWCREV "); 84 | else 85 | strcat_s(command, CMD_SIZE, "..\\..\\Modules\\getbuildinfo.c"); 86 | strcat_s(command, CMD_SIZE, " -Fogetbuildinfo.o -I..\\..\\Include -I..\\..\\PC"); 87 | puts(command); fflush(stdout); 88 | result = system(command); 89 | if (do_unlink) 90 | _unlink("getbuildinfo2.c"); 91 | if (result < 0) 92 | return EXIT_FAILURE; 93 | return 0; 94 | } 95 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/make_buildinfo.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 28 | 31 | 34 | 37 | 40 | 43 | 50 | 53 | 56 | 59 | 65 | 68 | 71 | 74 | 77 | 80 | 83 | 86 | 87 | 92 | 95 | 98 | 101 | 104 | 107 | 111 | 114 | 117 | 120 | 123 | 126 | 129 | 132 | 135 | 138 | 141 | 144 | 145 | 146 | 147 | 148 | 149 | 154 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/pginstrument.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 9 | 22 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/pgupdate.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/pyd.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 20 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/pyd_d.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 16 | 24 | 28 | 32 | 36 | 37 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/pyproject.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 9 | 24 | 35 | 39 | 43 | 47 | 51 | 55 | 59 | 63 | 67 | 71 | 75 | 79 | 83 | 87 | 91 | 95 | 99 | 103 | 107 | 111 | 112 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/release.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/rmpyc.py: -------------------------------------------------------------------------------- 1 | # Remove all the .pyc and .pyo files under ../Lib. 2 | 3 | 4 | def deltree(root): 5 | import os 6 | from os.path import join 7 | 8 | npyc = npyo = 0 9 | for root, dirs, files in os.walk(root): 10 | for name in files: 11 | delete = False 12 | if name.endswith('.pyc'): 13 | delete = True 14 | npyc += 1 15 | elif name.endswith('.pyo'): 16 | delete = True 17 | npyo += 1 18 | 19 | if delete: 20 | os.remove(join(root, name)) 21 | 22 | return npyc, npyo 23 | 24 | npyc, npyo = deltree("../../Lib") 25 | print(npyc, ".pyc deleted,", npyo, ".pyo deleted") 26 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/rt.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | rem Run Tests. Run the regression test suite. 3 | rem Usage: rt [-d] [-O] [-q] regrtest_args 4 | rem -d Run Debug build (python_d.exe). Else release build. 5 | rem -O Run python.exe or python_d.exe (see -d) with -O. 6 | rem -q "quick" -- normally the tests are run twice, the first time 7 | rem after deleting all the .py[co] files reachable from Lib/. 8 | rem -q runs the tests just once, and without deleting .py[co] files. 9 | rem All leading instances of these switches are shifted off, and 10 | rem whatever remains is passed to regrtest.py. For example, 11 | rem rt -O -d -x test_thread 12 | rem runs 13 | rem python_d -O ../lib/test/regrtest.py -x test_thread 14 | rem twice, and 15 | rem rt -q -g test_binascii 16 | rem runs 17 | rem python_d ../lib/test/regrtest.py -g test_binascii 18 | rem to generate the expected-output file for binascii quickly. 19 | rem 20 | rem Confusing: if you want to pass a comma-separated list, like 21 | rem -u network,largefile 22 | rem then you have to quote it on the rt line, like 23 | rem rt -u "network,largefile" 24 | 25 | setlocal 26 | 27 | set exe=python 28 | set qmode= 29 | set dashO= 30 | PATH %PATH%;..\..\..\tcltk\bin 31 | 32 | :CheckOpts 33 | if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts 34 | if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts 35 | if "%1"=="-d" (set exe=python_d) & shift & goto CheckOpts 36 | 37 | set cmd=%exe% %dashO% -E -tt ../../lib/test/regrtest.py %1 %2 %3 %4 %5 %6 %7 %8 %9 38 | if defined qmode goto Qmode 39 | 40 | echo Deleting .pyc/.pyo files ... 41 | %exe% rmpyc.py 42 | 43 | echo on 44 | %cmd% 45 | @echo off 46 | 47 | echo About to run again without deleting .pyc/.pyo first: 48 | pause 49 | 50 | :Qmode 51 | echo on 52 | %cmd% 53 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/sqlite3.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 14 | 15 | -------------------------------------------------------------------------------- /inc/Windows/VS8.0/x64.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 9 | 14 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /inc/Windows/WinMain.c: -------------------------------------------------------------------------------- 1 | /* Minimal main program -- everything is loaded from the library. */ 2 | 3 | #include "Python.h" 4 | 5 | #define WIN32_LEAN_AND_MEAN 6 | #include 7 | 8 | int WINAPI WinMain( 9 | HINSTANCE hInstance, /* handle to current instance */ 10 | HINSTANCE hPrevInstance, /* handle to previous instance */ 11 | LPSTR lpCmdLine, /* pointer to command line */ 12 | int nCmdShow /* show state of window */ 13 | ) 14 | { 15 | return Py_Main(__argc, __argv); 16 | } 17 | -------------------------------------------------------------------------------- /inc/Windows/_msi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/_msi.c -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/PythonPowered.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/bdist_wininst/PythonPowered.bmp -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/README.txt: -------------------------------------------------------------------------------- 1 | 2 | XXX Write description 3 | XXX Dont't forget to mention upx 4 | 5 | XXX Add pointer to this file into PC/README.txt 6 | -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/archive.h: -------------------------------------------------------------------------------- 1 | /* 2 | IMPORTANT NOTE: IF THIS FILE IS CHANGED, WININST-6.EXE MUST BE RECOMPILED 3 | WITH THE MSVC6 WININST.DSW WORKSPACE FILE MANUALLY, AND WININST-7.1.EXE MUST 4 | BE RECOMPILED WITH THE MSVC 2003.NET WININST-7.1.VCPROJ FILE MANUALLY. 5 | 6 | IF CHANGES TO THIS FILE ARE CHECKED INTO PYTHON CVS, THE RECOMPILED BINARIES 7 | MUST BE CHECKED IN AS WELL! 8 | */ 9 | 10 | #pragma pack(1) 11 | 12 | /* zip-archive headers 13 | * See: http://www.pkware.com/appnote.html 14 | */ 15 | 16 | struct eof_cdir { 17 | long tag; /* must be 0x06054b50 */ 18 | short disknum; 19 | short firstdisk; 20 | short nTotalCDirThis; 21 | short nTotalCDir; 22 | long nBytesCDir; 23 | long ofsCDir; 24 | short commentlen; 25 | }; 26 | 27 | struct cdir { 28 | long tag; /* must be 0x02014b50 */ 29 | short version_made; 30 | short version_extract; 31 | short gp_bitflag; 32 | short comp_method; 33 | short last_mod_file_time; 34 | short last_mod_file_date; 35 | long crc32; 36 | long comp_size; 37 | long uncomp_size; 38 | short fname_length; 39 | short extra_length; 40 | short comment_length; 41 | short disknum_start; 42 | short int_file_attr; 43 | long ext_file_attr; 44 | long ofs_local_header; 45 | }; 46 | 47 | struct fhdr { 48 | long tag; /* must be 0x04034b50 */ 49 | short version_needed; 50 | short flags; 51 | short method; 52 | short last_mod_file_time; 53 | short last_mod_file_date; 54 | long crc32; 55 | long comp_size; 56 | long uncomp_size; 57 | short fname_length; 58 | short extra_length; 59 | }; 60 | 61 | 62 | struct meta_data_hdr { 63 | int tag; 64 | int uncomp_size; 65 | int bitmap_size; 66 | }; 67 | 68 | #pragma pack() 69 | 70 | /* installation scheme */ 71 | 72 | typedef struct tagSCHEME { 73 | char *name; 74 | char *prefix; 75 | } SCHEME; 76 | 77 | typedef int (*NOTIFYPROC)(int code, LPSTR text, ...); 78 | 79 | extern BOOL 80 | extract_file(char *dst, char *src, int method, int comp_size, 81 | int uncomp_size, NOTIFYPROC notify); 82 | 83 | extern BOOL 84 | unzip_archive(SCHEME *scheme, char *dirname, char *data, 85 | DWORD size, NOTIFYPROC notify); 86 | 87 | extern char * 88 | map_new_file(DWORD flags, char *filename, char 89 | *pathname_part, int size, 90 | WORD wFatDate, WORD wFatTime, 91 | NOTIFYPROC callback); 92 | 93 | extern BOOL 94 | ensure_directory (char *pathname, char *new_part, 95 | NOTIFYPROC callback); 96 | 97 | /* codes for NOITIFYPROC */ 98 | #define DIR_CREATED 1 99 | #define CAN_OVERWRITE 2 100 | #define FILE_CREATED 3 101 | #define ZLIB_ERROR 4 102 | #define SYSTEM_ERROR 5 103 | #define NUM_FILES 6 104 | #define FILE_OVERWRITTEN 7 105 | 106 | -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/resource.h: -------------------------------------------------------------------------------- 1 | /* 2 | IMPORTANT NOTE: IF THIS FILE IS CHANGED, WININST-6.EXE MUST BE RECOMPILED 3 | WITH THE MSVC6 WININST.DSW WORKSPACE FILE MANUALLY, AND WININST-7.1.EXE MUST 4 | BE RECOMPILED WITH THE MSVC 2003.NET WININST-7.1.VCPROJ FILE MANUALLY. 5 | 6 | IF CHANGES TO THIS FILE ARE CHECKED INTO PYTHON CVS, THE RECOMPILED BINARIES 7 | MUST BE CHECKED IN AS WELL! 8 | */ 9 | 10 | //{{NO_DEPENDENCIES}} 11 | // Microsoft Developer Studio generated include file. 12 | // Used by install.rc 13 | // 14 | #define IDD_DIALOG1 101 15 | #define IDB_BITMAP1 103 16 | #define IDD_INTRO 107 17 | #define IDD_SELECTPYTHON 108 18 | #define IDD_INSTALLFILES 109 19 | #define IDD_FINISHED 110 20 | #define IDB_BITMAP 110 21 | #define IDC_EDIT1 1000 22 | #define IDC_TITLE 1000 23 | #define IDC_START 1001 24 | #define IDC_PROGRESS 1003 25 | #define IDC_INFO 1004 26 | #define IDC_PYTHON15 1006 27 | #define IDC_PATH 1007 28 | #define IDC_PYTHON16 1008 29 | #define IDC_INSTALL_PATH 1008 30 | #define IDC_PYTHON20 1009 31 | #define IDC_BROWSE 1010 32 | #define IDC_INTRO_TEXT 1021 33 | #define IDC_VERSIONS_LIST 1022 34 | #define IDC_BUILD_INFO 1024 35 | #define IDC_BITMAP 1025 36 | #define IDC_OTHERPYTHON 1026 37 | 38 | // Next default values for new objects 39 | // 40 | #ifdef APSTUDIO_INVOKED 41 | #ifndef APSTUDIO_READONLY_SYMBOLS 42 | #define _APS_NEXT_RESOURCE_VALUE 112 43 | #define _APS_NEXT_COMMAND_VALUE 40001 44 | #define _APS_NEXT_CONTROL_VALUE 1028 45 | #define _APS_NEXT_SYMED_VALUE 101 46 | #endif 47 | #endif 48 | -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/wininst-7.1.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wininst", "wininst-7.1.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug.ActiveCfg = Debug|Win32 13 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug.Build.0 = Debug|Win32 14 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release.ActiveCfg = Release|Win32 15 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/wininst-8.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 9.00 2 | # Visual Studio 2005 3 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wininst", "wininst-8.vcproj", "{EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}" 4 | EndProject 5 | Global 6 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 7 | Debug|Win32 = Debug|Win32 8 | Release|Win32 = Release|Win32 9 | EndGlobalSection 10 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 11 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.ActiveCfg = Debug|Win32 12 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Debug|Win32.Build.0 = Debug|Win32 13 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.ActiveCfg = Release|Win32 14 | {EB1C19C1-1F18-421E-9735-CAEE69DC6A3C}.Release|Win32.Build.0 = Release|Win32 15 | EndGlobalSection 16 | GlobalSection(SolutionProperties) = preSolution 17 | HideSolutionNode = FALSE 18 | EndGlobalSection 19 | EndGlobal 20 | -------------------------------------------------------------------------------- /inc/Windows/bdist_wininst/wininst.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "wininst"=.\wininst.dsp - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Global: 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<3> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | -------------------------------------------------------------------------------- /inc/Windows/dllbase_nt.txt: -------------------------------------------------------------------------------- 1 | In Win32, DLL's are "pre-linked" using a specified base address. 2 | When the DLL is loaded, an attempt is made to place it at 3 | that address. If that address is already in use, a new base address 4 | is selected, and the DLL subject to fixups. Apparently, these 5 | fixups are very slow, and significant performance gains can be 6 | made by selecting a good base address. 7 | 8 | This document is to allocate base addresses to core Python 9 | and Python .PYD files, to give a better change of optimal performance. 10 | This base address is passed to the linker using the /BASE 11 | command line switch. 12 | 13 | 14 | Python.exe/Pythonw.exe - 1d000000 - 1e000000 (-1) 15 | Python.dll - 1e000000 - 1e100000 (-1) 16 | 17 | Standard Extension Modules 1e100000 - 1e200000 "" 18 | - _symtable 1e100000 - 1e110000 pyd removed in 2.4 19 | - bsddb 1e180000 - 1e188000 20 | - _tkinter 1e190000 - 1e1A0000 21 | - parser 1e1A0000 - 1e1B0000 pyd removed in 2.4 22 | - zlib 1e1B0000 - 1e1C0000 23 | - winreg 1e1C0000 - 1e1D0000 pyd removed in 2.4 24 | - _socket 1e1D0000 - 1e1E0000 25 | - _sre 1e1E0000 - 1e1F0000 pyd removed in 2.4 26 | - mmap 1e1F0000 - 1e1FFFFF pyd removed in 2.4 27 | 28 | More standard extensions 1D100000 - 1e000000 29 | - pyexpat 1D100000 - 1D110000 30 | - select 1D110000 - 1D120000 31 | - unicodedata 1D120000 - 1D160000 32 | - winsound 1D160000 - 1D170000 33 | - bZ2 1D170000 - 1D180000 34 | - datetime 1D180000 - 1D190000 pyd removed in 2.4 35 | - _csv 1D190000 - 1D1A0000 pyd removed in 2.4 36 | - _ctypes 1D1A0000 - 1D1B0000 37 | 38 | Other extension modules 39 | - win32api 1e200000 - 1e220000 40 | - win32ras 1e220000 - 1e230000 41 | - win32lz 1e230000 - 1e240000 42 | - timer 1e240000 - 1e250000 43 | - mmapfile 1e250000 - 1e260000 44 | - win32pipe 1e260000 - 1e270000 45 | - avl 1e270000 - 1e270000 46 | - dbhash 1e280000 - 1e290000 47 | - win32net 1e290000 - 1e2A0000 48 | - win32security 1e2A0000 - 1e2B0000 49 | - win32print 1e2B0000 - 1e2c0000 50 | - 1e2d0000 - 1e2e0000 51 | - win32gui 1e2e0000 - 1e2f0000 52 | - _imaging 1e2f0000 - 1e300000 53 | - multiarray 1e300000 - 1e310000 54 | - win32help 1e310000 - 1e320000 55 | - win32clipboard 1e320000 - 1e330000 56 | - win2kras 1e330000 - 1e340000 57 | - pythoncom 1e340000 - 1e400000 58 | - win32ui 1e400000 - 1e500000 59 | - win32uiole 1e500000 - 1e600000 60 | - pywintypes 1e600000 - 1e700000 61 | - win32process 1e700000 - 1e800000 62 | - odbc 1e710000 - 1e720000 63 | - dbi 1e720000 - 1e730000 64 | - win32file 1e730000 - 1e740000 65 | - win32wnet 1e740000 - 1e750000 66 | - win32com.shell 1e750000 - 1e760000 67 | - win32com.internet 1e760000 - 1e770000 68 | - win32com.exchange 1e770000 - 1e780000 69 | - win32com.exchdapi 1e780000 - 1e790000 70 | - win32com.axscript 1e790000 - 1e7a0000 71 | - win32com.axdebug 1e7b0000 - 1e7c0000 72 | - win32com.adsi 1e7f0000 - 1e800000 73 | - win32event 1e810000 - 1e820000 74 | - win32evtlog 1e820000 - 1e830000 75 | - win32com.axcontrol 1e830000 - 1e840000 76 | 77 | 78 | -------------------------------------------------------------------------------- /inc/Windows/empty.c: -------------------------------------------------------------------------------- 1 | #include 2 | int __stdcall 3 | WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 4 | { 5 | return 0; 6 | } -------------------------------------------------------------------------------- /inc/Windows/errmap.h: -------------------------------------------------------------------------------- 1 | /* Generated file. Do not edit. */ 2 | int winerror_to_errno(int winerror) 3 | { 4 | switch(winerror) { 5 | case 2: return 2; 6 | case 3: return 2; 7 | case 4: return 24; 8 | case 5: return 13; 9 | case 6: return 9; 10 | case 7: return 12; 11 | case 8: return 12; 12 | case 9: return 12; 13 | case 10: return 7; 14 | case 11: return 8; 15 | case 15: return 2; 16 | case 16: return 13; 17 | case 17: return 18; 18 | case 18: return 2; 19 | case 19: return 13; 20 | case 20: return 13; 21 | case 21: return 13; 22 | case 22: return 13; 23 | case 23: return 13; 24 | case 24: return 13; 25 | case 25: return 13; 26 | case 26: return 13; 27 | case 27: return 13; 28 | case 28: return 13; 29 | case 29: return 13; 30 | case 30: return 13; 31 | case 31: return 13; 32 | case 32: return 13; 33 | case 33: return 13; 34 | case 34: return 13; 35 | case 35: return 13; 36 | case 36: return 13; 37 | case 53: return 2; 38 | case 65: return 13; 39 | case 67: return 2; 40 | case 80: return 17; 41 | case 82: return 13; 42 | case 83: return 13; 43 | case 89: return 11; 44 | case 108: return 13; 45 | case 109: return 32; 46 | case 112: return 28; 47 | case 114: return 9; 48 | case 128: return 10; 49 | case 129: return 10; 50 | case 130: return 9; 51 | case 132: return 13; 52 | case 145: return 41; 53 | case 158: return 13; 54 | case 161: return 2; 55 | case 164: return 11; 56 | case 167: return 13; 57 | case 183: return 17; 58 | case 188: return 8; 59 | case 189: return 8; 60 | case 190: return 8; 61 | case 191: return 8; 62 | case 192: return 8; 63 | case 193: return 8; 64 | case 194: return 8; 65 | case 195: return 8; 66 | case 196: return 8; 67 | case 197: return 8; 68 | case 198: return 8; 69 | case 199: return 8; 70 | case 200: return 8; 71 | case 201: return 8; 72 | case 202: return 8; 73 | case 206: return 2; 74 | case 215: return 11; 75 | case 1816: return 12; 76 | default: return EINVAL; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /inc/Windows/errmap.mak: -------------------------------------------------------------------------------- 1 | errmap.h: generrmap.exe 2 | .\generrmap.exe > errmap.h 3 | 4 | genermap.exe: generrmap.c 5 | cl generrmap.c 6 | -------------------------------------------------------------------------------- /inc/Windows/example_nt/example.c: -------------------------------------------------------------------------------- 1 | #include "Python.h" 2 | 3 | static PyObject * 4 | ex_foo(PyObject *self, PyObject *args) 5 | { 6 | printf("Hello, world\n"); 7 | Py_INCREF(Py_None); 8 | return Py_None; 9 | } 10 | 11 | static PyMethodDef example_methods[] = { 12 | {"foo", ex_foo, METH_VARARGS, "foo() doc string"}, 13 | {NULL, NULL} 14 | }; 15 | 16 | PyMODINIT_FUNC 17 | initexample(void) 18 | { 19 | Py_InitModule("example", example_methods); 20 | } 21 | -------------------------------------------------------------------------------- /inc/Windows/example_nt/example.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 8.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example", "example.vcproj", "{A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}" 3 | ProjectSection(ProjectDependencies) = postProject 4 | EndProjectSection 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | Debug = Debug 9 | Release = Release 10 | EndGlobalSection 11 | GlobalSection(ProjectConfiguration) = postSolution 12 | {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Debug.ActiveCfg = Debug|Win32 13 | {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Debug.Build.0 = Debug|Win32 14 | {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Release.ActiveCfg = Release|Win32 15 | {A0608D6F-84ED-44AE-A2A6-A3CC7F4A4030}.Release.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(ExtensibilityGlobals) = postSolution 18 | EndGlobalSection 19 | GlobalSection(ExtensibilityAddIns) = postSolution 20 | EndGlobalSection 21 | EndGlobal 22 | -------------------------------------------------------------------------------- /inc/Windows/example_nt/setup.py: -------------------------------------------------------------------------------- 1 | # This is an example of a distutils 'setup' script for the example_nt 2 | # sample. This provides a simpler way of building your extension 3 | # and means you can avoid keeping MSVC solution files etc in source-control. 4 | # It also means it should magically build with all compilers supported by 5 | # python. 6 | 7 | # USAGE: you probably want 'setup.py install' - but execute 'setup.py --help' 8 | # for all the details. 9 | 10 | # NOTE: This is *not* a sample for distutils - it is just the smallest 11 | # script that can build this. See distutils docs for more info. 12 | 13 | from distutils.core import setup, Extension 14 | 15 | example_mod = Extension('example', sources = ['example.c']) 16 | 17 | 18 | setup(name = "example", 19 | version = "1.0", 20 | description = "A sample extension module", 21 | ext_modules = [example_mod], 22 | ) 23 | -------------------------------------------------------------------------------- /inc/Windows/generrmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /* Extract the mapping of Win32 error codes to errno */ 5 | 6 | int main() 7 | { 8 | int i; 9 | printf("/* Generated file. Do not edit. */\n"); 10 | printf("int winerror_to_errno(int winerror)\n"); 11 | printf("{\n\tswitch(winerror) {\n"); 12 | for(i=1; i < 65000; i++) { 13 | _dosmaperr(i); 14 | if (errno == EINVAL) 15 | continue; 16 | printf("\t\tcase %d: return %d;\n", i, errno); 17 | } 18 | printf("\t\tdefault: return EINVAL;\n"); 19 | printf("\t}\n}\n"); 20 | } 21 | -------------------------------------------------------------------------------- /inc/Windows/icons.mak: -------------------------------------------------------------------------------- 1 | python_icon.exe: py.res empty.obj 2 | link /out:python_icon.exe /machine:x86 /subsystem:windows py.res empty.obj 3 | 4 | py.res: py.ico pyc.ico pycon.ico icons.rc 5 | rc /fo py.res icons.rc 6 | 7 | empty.obj: empty.c 8 | cl /c empty.c 9 | 10 | -------------------------------------------------------------------------------- /inc/Windows/icons.rc: -------------------------------------------------------------------------------- 1 | 101 ICON "py.ico" 2 | 102 ICON "pyc.ico" 3 | 103 ICON "pycon.ico" 4 | 5 | -------------------------------------------------------------------------------- /inc/Windows/icons/source.xar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/icons/source.xar -------------------------------------------------------------------------------- /inc/Windows/import_nt.c: -------------------------------------------------------------------------------- 1 | /******************************************************************** 2 | 3 | import_nt.c 4 | 5 | Win32 specific import code. 6 | 7 | */ 8 | 9 | #include "Python.h" 10 | #include "osdefs.h" 11 | #include 12 | #include "importdl.h" 13 | #include "malloc.h" /* for alloca */ 14 | 15 | /* a string loaded from the DLL at startup */ 16 | extern const char *PyWin_DLLVersionString; 17 | 18 | FILE *PyWin_FindRegisteredModule(const char *moduleName, 19 | struct filedescr **ppFileDesc, 20 | char *pathBuf, 21 | Py_ssize_t pathLen) 22 | { 23 | char *moduleKey; 24 | const char keyPrefix[] = "Software\\Python\\PythonCore\\"; 25 | const char keySuffix[] = "\\Modules\\"; 26 | #ifdef _DEBUG 27 | /* In debugging builds, we _must_ have the debug version 28 | * registered. 29 | */ 30 | const char debugString[] = "\\Debug"; 31 | #else 32 | const char debugString[] = ""; 33 | #endif 34 | struct filedescr *fdp = NULL; 35 | FILE *fp; 36 | HKEY keyBase = HKEY_CURRENT_USER; 37 | int modNameSize; 38 | long regStat; 39 | 40 | /* Calculate the size for the sprintf buffer. 41 | * Get the size of the chars only, plus 1 NULL. 42 | */ 43 | size_t bufSize = sizeof(keyPrefix)-1 + 44 | strlen(PyWin_DLLVersionString) + 45 | sizeof(keySuffix) + 46 | strlen(moduleName) + 47 | sizeof(debugString) - 1; 48 | /* alloca == no free required, but memory only local to fn, 49 | * also no heap fragmentation! 50 | */ 51 | moduleKey = alloca(bufSize); 52 | PyOS_snprintf(moduleKey, bufSize, 53 | "Software\\Python\\PythonCore\\%s\\Modules\\%s%s", 54 | PyWin_DLLVersionString, moduleName, debugString); 55 | 56 | assert(pathLen < INT_MAX); 57 | modNameSize = (int)pathLen; 58 | regStat = RegQueryValue(keyBase, moduleKey, pathBuf, &modNameSize); 59 | if (regStat != ERROR_SUCCESS) { 60 | /* No user setting - lookup in machine settings */ 61 | keyBase = HKEY_LOCAL_MACHINE; 62 | /* be anal - failure may have reset size param */ 63 | modNameSize = (int)pathLen; 64 | regStat = RegQueryValue(keyBase, moduleKey, 65 | pathBuf, &modNameSize); 66 | 67 | if (regStat != ERROR_SUCCESS) 68 | return NULL; 69 | } 70 | /* use the file extension to locate the type entry. */ 71 | for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { 72 | size_t extLen = strlen(fdp->suffix); 73 | assert(modNameSize >= 0); /* else cast to size_t is wrong */ 74 | if ((size_t)modNameSize > extLen && 75 | strnicmp(pathBuf + ((size_t)modNameSize-extLen-1), 76 | fdp->suffix, 77 | extLen) == 0) 78 | break; 79 | } 80 | if (fdp->suffix == NULL) 81 | return NULL; 82 | fp = fopen(pathBuf, fdp->mode); 83 | if (fp != NULL) 84 | *ppFileDesc = fdp; 85 | return fp; 86 | } 87 | -------------------------------------------------------------------------------- /inc/Windows/make_versioninfo.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "patchlevel.h" 3 | /* 4 | * This program prints out an include file containing fields required to build 5 | * the version info resource of pythonxx.dll because the resource compiler 6 | * cannot do the arithmetic. 7 | */ 8 | /* 9 | * FIELD3 is the third field of the version number. 10 | * This is what we'd like FIELD3 to be: 11 | * 12 | * #define FIELD3 (PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL) 13 | * 14 | * but that neither gives an error nor comes anywhere close to working. 15 | * 16 | * For 2.4a0, 17 | * PY_MICRO_VERSION = 0 18 | * PY_RELEASE_LEVEL = 'alpha' = 0xa 19 | * PY_RELEASE_SERIAL = 0 20 | * 21 | * gives FIELD3 = 0*1000 + 10*10 + 0 = 100 22 | */ 23 | int main(int argc, char **argv) 24 | { 25 | printf("/* This file created by make_versioninfo.exe */\n"); 26 | printf("#define FIELD3 %d\n", 27 | PY_MICRO_VERSION*1000 + PY_RELEASE_LEVEL*10 + PY_RELEASE_SERIAL); 28 | printf("#define MS_DLL_ID \"%d.%d\"\n", 29 | PY_MAJOR_VERSION, PY_MINOR_VERSION); 30 | printf("#ifndef _DEBUG\n"); 31 | printf("#define PYTHON_DLL_NAME \"python%d%d.dll\"\n", 32 | PY_MAJOR_VERSION, PY_MINOR_VERSION); 33 | printf("#else\n"); 34 | printf("#define PYTHON_DLL_NAME \"python%d%d_d.dll\"\n", 35 | PY_MAJOR_VERSION, PY_MINOR_VERSION); 36 | printf("#endif\n"); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /inc/Windows/os2emx/dlfcn.h: -------------------------------------------------------------------------------- 1 | /* -*- C -*- *********************************************** 2 | Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, 3 | The Netherlands. 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation, and that the names of Stichting Mathematisch 12 | Centrum or CWI or Corporation for National Research Initiatives or 13 | CNRI not be used in advertising or publicity pertaining to 14 | distribution of the software without specific, written prior 15 | permission. 16 | 17 | While CWI is the initial source for this software, a modified version 18 | is made available by the Corporation for National Research Initiatives 19 | (CNRI) at the Internet address ftp://ftp.python.org. 20 | 21 | STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH 22 | REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF 23 | MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH 24 | CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL 25 | DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 26 | PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 27 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 28 | PERFORMANCE OF THIS SOFTWARE. 29 | 30 | ******************************************************************/ 31 | 32 | /* This library implements dlopen() - Unix-like dynamic linking 33 | * emulation functions for OS/2 using DosLoadModule() and company. 34 | */ 35 | 36 | #ifndef _DLFCN_H 37 | #define _DLFCN_H 38 | 39 | /* load a dynamic-link library and return handle */ 40 | void *dlopen(char *filename, int flags); 41 | 42 | /* return a pointer to the `symbol' in DLL */ 43 | void *dlsym(void *handle, char *symbol); 44 | 45 | /* free dynamically-linked library */ 46 | int dlclose(void *handle); 47 | 48 | /* return a string describing last occurred dl error */ 49 | char *dlerror(void); 50 | 51 | #endif /* !_DLFCN_H */ 52 | -------------------------------------------------------------------------------- /inc/Windows/os2emx/dllentry.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This is the entry point for the Python 2.3 core DLL. 3 | */ 4 | 5 | #define NULL 0 6 | 7 | #define REF(s) extern void s(); void *____ref_##s = &s; 8 | 9 | /* Make references to imported symbols to pull them from static library */ 10 | REF(Py_Main); 11 | 12 | #include 13 | 14 | extern int _CRT_init(void); 15 | extern void _CRT_term(void); 16 | extern void __ctordtorInit(void); 17 | extern void __ctordtorTerm(void); 18 | 19 | unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag) 20 | { 21 | switch (flag) 22 | { 23 | case 0: 24 | if (_CRT_init()) 25 | return 0; 26 | __ctordtorInit(); 27 | 28 | /* Ignore fatal signals */ 29 | signal(SIGSEGV, SIG_IGN); 30 | signal(SIGFPE, SIG_IGN); 31 | 32 | return 1; 33 | 34 | case 1: 35 | __ctordtorTerm(); 36 | _CRT_term(); 37 | return 1; 38 | 39 | default: 40 | return 0; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /inc/Windows/os2vacpp/_tkinter.def: -------------------------------------------------------------------------------- 1 | LIBRARY _TKINTER INITINSTANCE TERMINSTANCE 2 | DESCRIPTION 'Python Extension DLL v1.0 for Access to Tcl/Tk Environment' 3 | PROTMODE 4 | DATA MULTIPLE NONSHARED 5 | 6 | EXPORTS 7 | init_tkinter 8 | 9 | -------------------------------------------------------------------------------- /inc/Windows/os2vacpp/config.c: -------------------------------------------------------------------------------- 1 | /* -*- C -*- *********************************************** 2 | Copyright (c) 2000, BeOpen.com. 3 | Copyright (c) 1995-2000, Corporation for National Research Initiatives. 4 | Copyright (c) 1990-1995, Stichting Mathematisch Centrum. 5 | All rights reserved. 6 | 7 | See the file "Misc/COPYRIGHT" for information on usage and 8 | redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 9 | ******************************************************************/ 10 | 11 | /* Module configuration */ 12 | 13 | /* This file contains the table of built-in modules. 14 | See init_builtin() in import.c. */ 15 | 16 | #include "Python.h" 17 | 18 | extern void initarray(void); 19 | extern void initaudioop(void); 20 | extern void initbinascii(void); 21 | extern void initcmath(void); 22 | extern void initerrno(void); 23 | extern void initimageop(void); 24 | extern void initmath(void); 25 | extern void initmd5(void); 26 | extern void initnt(void); 27 | extern void initos2(void); 28 | extern void initoperator(void); 29 | extern void initposix(void); 30 | extern void initrgbimg(void); 31 | extern void initsignal(void); 32 | extern void initselect(void); 33 | extern void init_socket(void); 34 | extern void initstrop(void); 35 | extern void initstruct(void); 36 | extern void inittime(void); 37 | extern void initthread(void); 38 | extern void initcStringIO(void); 39 | extern void initcPickle(void); 40 | extern void initpcre(void); 41 | #ifdef WIN32 42 | extern void initmsvcrt(void); 43 | #endif 44 | 45 | /* -- ADDMODULE MARKER 1 -- */ 46 | 47 | extern void PyMarshal_Init(void); 48 | extern void initimp(void); 49 | 50 | struct _inittab _PyImport_Inittab[] = { 51 | 52 | {"array", initarray}, 53 | #ifdef M_I386 54 | {"audioop", initaudioop}, 55 | #endif 56 | {"binascii", initbinascii}, 57 | {"cmath", initcmath}, 58 | {"errno", initerrno}, 59 | // {"imageop", initimageop}, 60 | {"math", initmath}, 61 | {"md5", initmd5}, 62 | #if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) 63 | {"nt", initnt}, /* Use the NT os functions, not posix */ 64 | #else 65 | #if defined(PYOS_OS2) 66 | {"os2", initos2}, 67 | #else 68 | {"posix", initposix}, 69 | #endif 70 | #endif 71 | {"operator", initoperator}, 72 | // {"rgbimg", initrgbimg}, 73 | {"signal", initsignal}, 74 | #ifdef USE_SOCKET 75 | {"_socket", init_socket}, 76 | {"select", initselect}, 77 | #endif 78 | {"strop", initstrop}, 79 | {"struct", initstruct}, 80 | {"time", inittime}, 81 | #ifdef WITH_THREAD 82 | {"thread", initthread}, 83 | #endif 84 | {"cStringIO", initcStringIO}, 85 | {"cPickle", initcPickle}, 86 | {"pcre", initpcre}, 87 | #ifdef WIN32 88 | {"msvcrt", initmsvcrt}, 89 | #endif 90 | 91 | /* -- ADDMODULE MARKER 2 -- */ 92 | 93 | /* This module "lives in" with marshal.c */ 94 | {"marshal", PyMarshal_Init}, 95 | 96 | /* This lives it with import.c */ 97 | {"imp", initimp}, 98 | 99 | /* These entries are here for sys.builtin_module_names */ 100 | {"__main__", NULL}, 101 | {"__builtin__", NULL}, 102 | {"sys", NULL}, 103 | 104 | /* Sentinel */ 105 | {0, 0} 106 | }; 107 | -------------------------------------------------------------------------------- /inc/Windows/py.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/py.ico -------------------------------------------------------------------------------- /inc/Windows/pyc.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/pyc.ico -------------------------------------------------------------------------------- /inc/Windows/pycon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/pycon.ico -------------------------------------------------------------------------------- /inc/Windows/python.mk: -------------------------------------------------------------------------------- 1 | project : n:\python\python-1.5.1\pc\wat_os2\pyth_os2.exe n:\python\python-1.& 2 | 5.1\pc\wat_dos\pyth_dos.exe .SYMBOLIC 3 | 4 | !include n:\python\python-1.5.1\pc\wat_os2\pyth_os2.mk1 5 | !include n:\python\python-1.5.1\pc\wat_dos\pyth_dos.mk1 6 | -------------------------------------------------------------------------------- /inc/Windows/python_exe.rc: -------------------------------------------------------------------------------- 1 | 1 ICON DISCARDABLE "pycon.ico" 2 | -------------------------------------------------------------------------------- /inc/Windows/python_nt.h: -------------------------------------------------------------------------------- 1 | /* This file created by make_versioninfo.exe */ 2 | #define FIELD3 3150 3 | #define MS_DLL_ID "2.7" 4 | #ifndef _DEBUG 5 | #define PYTHON_DLL_NAME "python27.dll" 6 | #else 7 | #define PYTHON_DLL_NAME "python27_d.dll" 8 | #endif 9 | -------------------------------------------------------------------------------- /inc/Windows/python_nt.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/inc/Windows/python_nt.rc -------------------------------------------------------------------------------- /inc/Windows/python_nt_d.h: -------------------------------------------------------------------------------- 1 | /* This file created by make_versioninfo.exe */ 2 | #define FIELD3 3150 3 | #define MS_DLL_ID "2.7" 4 | #ifndef _DEBUG 5 | #define PYTHON_DLL_NAME "python27.dll" 6 | #else 7 | #define PYTHON_DLL_NAME "python27_d.dll" 8 | #endif 9 | -------------------------------------------------------------------------------- /inc/Windows/pythonnt_rc.h: -------------------------------------------------------------------------------- 1 | /* This file created by make_versioninfo.exe */ 2 | #define FIELD3 3150 3 | #define MS_DLL_ID "2.7" 4 | #ifndef _DEBUG 5 | #define PYTHON_DLL_NAME "python27.dll" 6 | #else 7 | #define PYTHON_DLL_NAME "python27_d.dll" 8 | #endif 9 | -------------------------------------------------------------------------------- /inc/Windows/pythonnt_rc_d.h: -------------------------------------------------------------------------------- 1 | /* This file created by make_versioninfo.exe */ 2 | #define FIELD3 3150 3 | #define MS_DLL_ID "2.7" 4 | #ifndef _DEBUG 5 | #define PYTHON_DLL_NAME "python27.dll" 6 | #else 7 | #define PYTHON_DLL_NAME "python27_d.dll" 8 | #endif 9 | -------------------------------------------------------------------------------- /inc/Windows/testpy.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | # This is a test module for Python. It looks in the standard 4 | # places for various *.py files. If these are moved, you must 5 | # change this module too. 6 | 7 | try: 8 | import os 9 | except: 10 | print """Could not import the standard "os" module. 11 | Please check your PYTHONPATH environment variable.""" 12 | sys.exit(1) 13 | 14 | try: 15 | import symbol 16 | except: 17 | print """Could not import the standard "symbol" module. If this is 18 | a PC, you should add the dos_8x3 directory to your PYTHONPATH.""" 19 | sys.exit(1) 20 | 21 | import os 22 | 23 | for dir in sys.path: 24 | file = os.path.join(dir, "os.py") 25 | if os.path.isfile(file): 26 | test = os.path.join(dir, "test") 27 | if os.path.isdir(test): 28 | # Add the "test" directory to PYTHONPATH. 29 | sys.path = sys.path + [test] 30 | 31 | import regrtest # Standard Python tester. 32 | regrtest.main() 33 | -------------------------------------------------------------------------------- /inc/asdl.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ASDL_H 2 | #define Py_ASDL_H 3 | 4 | typedef PyObject * identifier; 5 | typedef PyObject * string; 6 | typedef PyObject * object; 7 | 8 | #ifndef __cplusplus 9 | typedef enum {false, true} bool; 10 | #endif 11 | 12 | /* It would be nice if the code generated by asdl_c.py was completely 13 | independent of Python, but it is a goal the requires too much work 14 | at this stage. So, for example, I'll represent identifiers as 15 | interned Python strings. 16 | */ 17 | 18 | /* XXX A sequence should be typed so that its use can be typechecked. */ 19 | 20 | typedef struct { 21 | int size; 22 | void *elements[1]; 23 | } asdl_seq; 24 | 25 | typedef struct { 26 | int size; 27 | int elements[1]; 28 | } asdl_int_seq; 29 | 30 | asdl_seq *asdl_seq_new(int size, PyArena *arena); 31 | asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena); 32 | 33 | #define asdl_seq_GET(S, I) (S)->elements[(I)] 34 | #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) 35 | #ifdef Py_DEBUG 36 | #define asdl_seq_SET(S, I, V) { \ 37 | int _asdl_i = (I); \ 38 | assert((S) && _asdl_i < (S)->size); \ 39 | (S)->elements[_asdl_i] = (V); \ 40 | } 41 | #else 42 | #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) 43 | #endif 44 | 45 | #endif /* !Py_ASDL_H */ 46 | -------------------------------------------------------------------------------- /inc/ast.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_AST_H 2 | #define Py_AST_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_FUNC(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags, 8 | const char *, PyArena *); 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif /* !Py_AST_H */ 14 | -------------------------------------------------------------------------------- /inc/bitset.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_BITSET_H 3 | #define Py_BITSET_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | /* Bitset interface */ 9 | 10 | #define BYTE char 11 | 12 | typedef BYTE *bitset; 13 | 14 | bitset newbitset(int nbits); 15 | void delbitset(bitset bs); 16 | #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) 17 | int addbit(bitset bs, int ibit); /* Returns 0 if already set */ 18 | int samebitset(bitset bs1, bitset bs2, int nbits); 19 | void mergebitset(bitset bs1, bitset bs2, int nbits); 20 | 21 | #define BITSPERBYTE (8*sizeof(BYTE)) 22 | #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) 23 | 24 | #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) 25 | #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) 26 | #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) 27 | #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE) 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif /* !Py_BITSET_H */ 33 | -------------------------------------------------------------------------------- /inc/boolobject.h: -------------------------------------------------------------------------------- 1 | /* Boolean object interface */ 2 | 3 | #ifndef Py_BOOLOBJECT_H 4 | #define Py_BOOLOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | typedef PyIntObject PyBoolObject; 11 | 12 | PyAPI_DATA(PyTypeObject) PyBool_Type; 13 | 14 | #define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) 15 | 16 | /* Py_False and Py_True are the only two bools in existence. 17 | Don't forget to apply Py_INCREF() when returning either!!! */ 18 | 19 | /* Don't use these directly */ 20 | PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; 21 | 22 | /* Use these macros */ 23 | #define Py_False ((PyObject *) &_Py_ZeroStruct) 24 | #define Py_True ((PyObject *) &_Py_TrueStruct) 25 | 26 | /* Macros for returning Py_True or Py_False, respectively */ 27 | #define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True 28 | #define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False 29 | 30 | /* Function to return a bool from a C long */ 31 | PyAPI_FUNC(PyObject *) PyBool_FromLong(long); 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif /* !Py_BOOLOBJECT_H */ 37 | -------------------------------------------------------------------------------- /inc/bufferobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Buffer object interface */ 3 | 4 | /* Note: the object's structure is private */ 5 | 6 | #ifndef Py_BUFFEROBJECT_H 7 | #define Py_BUFFEROBJECT_H 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | PyAPI_DATA(PyTypeObject) PyBuffer_Type; 14 | 15 | #define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type) 16 | 17 | #define Py_END_OF_BUFFER (-1) 18 | 19 | PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base, 20 | Py_ssize_t offset, Py_ssize_t size); 21 | PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, 22 | Py_ssize_t offset, 23 | Py_ssize_t size); 24 | 25 | PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size); 26 | PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size); 27 | 28 | PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif /* !Py_BUFFEROBJECT_H */ 34 | -------------------------------------------------------------------------------- /inc/bytearrayobject.h: -------------------------------------------------------------------------------- 1 | /* ByteArray object interface */ 2 | 3 | #ifndef Py_BYTEARRAYOBJECT_H 4 | #define Py_BYTEARRAYOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include 10 | 11 | /* Type PyByteArrayObject represents a mutable array of bytes. 12 | * The Python API is that of a sequence; 13 | * the bytes are mapped to ints in [0, 256). 14 | * Bytes are not characters; they may be used to encode characters. 15 | * The only way to go between bytes and str/unicode is via encoding 16 | * and decoding. 17 | * For the convenience of C programmers, the bytes type is considered 18 | * to contain a char pointer, not an unsigned char pointer. 19 | */ 20 | 21 | /* Object layout */ 22 | typedef struct { 23 | PyObject_VAR_HEAD 24 | /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ 25 | int ob_exports; /* how many buffer exports */ 26 | Py_ssize_t ob_alloc; /* How many bytes allocated */ 27 | char *ob_bytes; 28 | } PyByteArrayObject; 29 | 30 | /* Type object */ 31 | PyAPI_DATA(PyTypeObject) PyByteArray_Type; 32 | PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; 33 | 34 | /* Type check macros */ 35 | #define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) 36 | #define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) 37 | 38 | /* Direct API functions */ 39 | PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); 40 | PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); 41 | PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); 42 | PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); 43 | PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); 44 | PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); 45 | 46 | /* Macros, trading safety for speed */ 47 | #define PyByteArray_AS_STRING(self) \ 48 | (assert(PyByteArray_Check(self)), \ 49 | Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string) 50 | #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self)) 51 | 52 | PyAPI_DATA(char) _PyByteArray_empty_string[]; 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | #endif /* !Py_BYTEARRAYOBJECT_H */ 58 | -------------------------------------------------------------------------------- /inc/bytes_methods.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_BYTES_CTYPE_H 2 | #define Py_BYTES_CTYPE_H 3 | 4 | /* 5 | * The internal implementation behind PyString (bytes) and PyBytes (buffer) 6 | * methods of the given names, they operate on ASCII byte strings. 7 | */ 8 | extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); 9 | extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); 10 | extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); 11 | extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); 12 | extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); 13 | extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); 14 | extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); 15 | 16 | /* These store their len sized answer in the given preallocated *result arg. */ 17 | extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); 18 | extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); 19 | extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); 20 | extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); 21 | extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); 22 | 23 | /* Shared __doc__ strings. */ 24 | extern const char _Py_isspace__doc__[]; 25 | extern const char _Py_isalpha__doc__[]; 26 | extern const char _Py_isalnum__doc__[]; 27 | extern const char _Py_isdigit__doc__[]; 28 | extern const char _Py_islower__doc__[]; 29 | extern const char _Py_isupper__doc__[]; 30 | extern const char _Py_istitle__doc__[]; 31 | extern const char _Py_lower__doc__[]; 32 | extern const char _Py_upper__doc__[]; 33 | extern const char _Py_title__doc__[]; 34 | extern const char _Py_capitalize__doc__[]; 35 | extern const char _Py_swapcase__doc__[]; 36 | 37 | /* These are left in for backward compatibility and will be removed 38 | in 2.8/3.2 */ 39 | #define ISLOWER(c) Py_ISLOWER(c) 40 | #define ISUPPER(c) Py_ISUPPER(c) 41 | #define ISALPHA(c) Py_ISALPHA(c) 42 | #define ISDIGIT(c) Py_ISDIGIT(c) 43 | #define ISXDIGIT(c) Py_ISXDIGIT(c) 44 | #define ISALNUM(c) Py_ISALNUM(c) 45 | #define ISSPACE(c) Py_ISSPACE(c) 46 | 47 | #undef islower 48 | #define islower(c) undefined_islower(c) 49 | #undef isupper 50 | #define isupper(c) undefined_isupper(c) 51 | #undef isalpha 52 | #define isalpha(c) undefined_isalpha(c) 53 | #undef isdigit 54 | #define isdigit(c) undefined_isdigit(c) 55 | #undef isxdigit 56 | #define isxdigit(c) undefined_isxdigit(c) 57 | #undef isalnum 58 | #define isalnum(c) undefined_isalnum(c) 59 | #undef isspace 60 | #define isspace(c) undefined_isspace(c) 61 | 62 | /* These are left in for backward compatibility and will be removed 63 | in 2.8/3.2 */ 64 | #define TOLOWER(c) Py_TOLOWER(c) 65 | #define TOUPPER(c) Py_TOUPPER(c) 66 | 67 | #undef tolower 68 | #define tolower(c) undefined_tolower(c) 69 | #undef toupper 70 | #define toupper(c) undefined_toupper(c) 71 | 72 | /* this is needed because some docs are shared from the .o, not static */ 73 | #define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) 74 | 75 | #endif /* !Py_BYTES_CTYPE_H */ 76 | -------------------------------------------------------------------------------- /inc/bytesobject.h: -------------------------------------------------------------------------------- 1 | #define PyBytesObject PyStringObject 2 | #define PyBytes_Type PyString_Type 3 | 4 | #define PyBytes_Check PyString_Check 5 | #define PyBytes_CheckExact PyString_CheckExact 6 | #define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED 7 | #define PyBytes_AS_STRING PyString_AS_STRING 8 | #define PyBytes_GET_SIZE PyString_GET_SIZE 9 | #define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS 10 | 11 | #define PyBytes_FromStringAndSize PyString_FromStringAndSize 12 | #define PyBytes_FromString PyString_FromString 13 | #define PyBytes_FromFormatV PyString_FromFormatV 14 | #define PyBytes_FromFormat PyString_FromFormat 15 | #define PyBytes_Size PyString_Size 16 | #define PyBytes_AsString PyString_AsString 17 | #define PyBytes_Repr PyString_Repr 18 | #define PyBytes_Concat PyString_Concat 19 | #define PyBytes_ConcatAndDel PyString_ConcatAndDel 20 | #define _PyBytes_Resize _PyString_Resize 21 | #define _PyBytes_Eq _PyString_Eq 22 | #define PyBytes_Format PyString_Format 23 | #define _PyBytes_FormatLong _PyString_FormatLong 24 | #define PyBytes_DecodeEscape PyString_DecodeEscape 25 | #define _PyBytes_Join _PyString_Join 26 | #define PyBytes_AsStringAndSize PyString_AsStringAndSize 27 | #define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping 28 | -------------------------------------------------------------------------------- /inc/cStringIO.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_CSTRINGIO_H 2 | #define Py_CSTRINGIO_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | /* 7 | 8 | This header provides access to cStringIO objects from C. 9 | Functions are provided for calling cStringIO objects and 10 | macros are provided for testing whether you have cStringIO 11 | objects. 12 | 13 | Before calling any of the functions or macros, you must initialize 14 | the routines with: 15 | 16 | PycString_IMPORT 17 | 18 | This would typically be done in your init function. 19 | 20 | */ 21 | 22 | #define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI" 23 | 24 | #define PycString_IMPORT \ 25 | PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\ 26 | PycStringIO_CAPSULE_NAME, 0)) 27 | 28 | /* Basic functions to manipulate cStringIO objects from C */ 29 | 30 | static struct PycStringIO_CAPI { 31 | 32 | /* Read a string from an input object. If the last argument 33 | is -1, the remainder will be read. 34 | */ 35 | int(*cread)(PyObject *, char **, Py_ssize_t); 36 | 37 | /* Read a line from an input object. Returns the length of the read 38 | line as an int and a pointer inside the object buffer as char** (so 39 | the caller doesn't have to provide its own buffer as destination). 40 | */ 41 | int(*creadline)(PyObject *, char **); 42 | 43 | /* Write a string to an output object*/ 44 | int(*cwrite)(PyObject *, const char *, Py_ssize_t); 45 | 46 | /* Get the output object as a Python string (returns new reference). */ 47 | PyObject *(*cgetvalue)(PyObject *); 48 | 49 | /* Create a new output object */ 50 | PyObject *(*NewOutput)(int); 51 | 52 | /* Create an input object from a Python string 53 | (copies the Python string reference). 54 | */ 55 | PyObject *(*NewInput)(PyObject *); 56 | 57 | /* The Python types for cStringIO input and output objects. 58 | Note that you can do input on an output object. 59 | */ 60 | PyTypeObject *InputType, *OutputType; 61 | 62 | } *PycStringIO; 63 | 64 | /* These can be used to test if you have one */ 65 | #define PycStringIO_InputCheck(O) \ 66 | (Py_TYPE(O)==PycStringIO->InputType) 67 | #define PycStringIO_OutputCheck(O) \ 68 | (Py_TYPE(O)==PycStringIO->OutputType) 69 | 70 | #ifdef __cplusplus 71 | } 72 | #endif 73 | #endif /* !Py_CSTRINGIO_H */ 74 | -------------------------------------------------------------------------------- /inc/cellobject.h: -------------------------------------------------------------------------------- 1 | /* Cell object interface */ 2 | 3 | #ifndef Py_CELLOBJECT_H 4 | #define Py_CELLOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct { 10 | PyObject_HEAD 11 | PyObject *ob_ref; /* Content of the cell or NULL when empty */ 12 | } PyCellObject; 13 | 14 | PyAPI_DATA(PyTypeObject) PyCell_Type; 15 | 16 | #define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) 17 | 18 | PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); 19 | PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); 20 | PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); 21 | 22 | #define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) 23 | #define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /* !Py_TUPLEOBJECT_H */ 29 | -------------------------------------------------------------------------------- /inc/classobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Class object interface */ 3 | 4 | /* Revealing some structures (not for general use) */ 5 | 6 | #ifndef Py_CLASSOBJECT_H 7 | #define Py_CLASSOBJECT_H 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef struct { 13 | PyObject_HEAD 14 | PyObject *cl_bases; /* A tuple of class objects */ 15 | PyObject *cl_dict; /* A dictionary */ 16 | PyObject *cl_name; /* A string */ 17 | /* The following three are functions or NULL */ 18 | PyObject *cl_getattr; 19 | PyObject *cl_setattr; 20 | PyObject *cl_delattr; 21 | PyObject *cl_weakreflist; /* List of weak references */ 22 | } PyClassObject; 23 | 24 | typedef struct { 25 | PyObject_HEAD 26 | PyClassObject *in_class; /* The class object */ 27 | PyObject *in_dict; /* A dictionary */ 28 | PyObject *in_weakreflist; /* List of weak references */ 29 | } PyInstanceObject; 30 | 31 | typedef struct { 32 | PyObject_HEAD 33 | PyObject *im_func; /* The callable object implementing the method */ 34 | PyObject *im_self; /* The instance it is bound to, or NULL */ 35 | PyObject *im_class; /* The class that asked for the method */ 36 | PyObject *im_weakreflist; /* List of weak references */ 37 | } PyMethodObject; 38 | 39 | PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; 40 | 41 | #define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) 42 | #define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) 43 | #define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) 44 | 45 | PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); 46 | PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, 47 | PyObject *); 48 | PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); 49 | PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); 50 | 51 | PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); 52 | PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); 53 | PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); 54 | 55 | /* Look up attribute with name (a string) on instance object pinst, using 56 | * only the instance and base class dicts. If a descriptor is found in 57 | * a class dict, the descriptor is returned without calling it. 58 | * Returns NULL if nothing found, else a borrowed reference to the 59 | * value associated with name in the dict in which name was found. 60 | * The point of this routine is that it never calls arbitrary Python 61 | * code, so is always "safe": all it does is dict lookups. The function 62 | * can't fail, never sets an exception, and NULL is not an error (it just 63 | * means "not found"). 64 | */ 65 | PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); 66 | 67 | /* Macros for direct access to these values. Type checks are *not* 68 | done, so use with care. */ 69 | #define PyMethod_GET_FUNCTION(meth) \ 70 | (((PyMethodObject *)meth) -> im_func) 71 | #define PyMethod_GET_SELF(meth) \ 72 | (((PyMethodObject *)meth) -> im_self) 73 | #define PyMethod_GET_CLASS(meth) \ 74 | (((PyMethodObject *)meth) -> im_class) 75 | 76 | PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); 77 | 78 | PyAPI_FUNC(int) PyMethod_ClearFreeList(void); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | #endif /* !Py_CLASSOBJECT_H */ 84 | -------------------------------------------------------------------------------- /inc/cobject.h: -------------------------------------------------------------------------------- 1 | /* 2 | CObjects are marked Pending Deprecation as of Python 2.7. 3 | The full schedule for 2.x is as follows: 4 | - CObjects are marked Pending Deprecation in Python 2.7. 5 | - CObjects will be marked Deprecated in Python 2.8 6 | (if there is one). 7 | - CObjects will be removed in Python 2.9 (if there is one). 8 | 9 | Additionally, for the Python 3.x series: 10 | - CObjects were marked Deprecated in Python 3.1. 11 | - CObjects will be removed in Python 3.2. 12 | 13 | You should switch all use of CObjects to capsules. Capsules 14 | have a safer and more consistent API. For more information, 15 | see Include/pycapsule.h, or read the "Capsules" topic in 16 | the "Python/C API Reference Manual". 17 | 18 | Python 2.7 no longer uses CObjects itself; all objects which 19 | were formerly CObjects are now capsules. Note that this change 20 | does not by itself break binary compatibility with extensions 21 | built for previous versions of Python--PyCObject_AsVoidPtr() 22 | has been changed to also understand capsules. 23 | 24 | */ 25 | 26 | /* original file header comment follows: */ 27 | 28 | /* C objects to be exported from one extension module to another. 29 | 30 | C objects are used for communication between extension modules. 31 | They provide a way for an extension module to export a C interface 32 | to other extension modules, so that extension modules can use the 33 | Python import mechanism to link to one another. 34 | 35 | */ 36 | 37 | #ifndef Py_COBJECT_H 38 | #define Py_COBJECT_H 39 | #ifdef __cplusplus 40 | extern "C" { 41 | #endif 42 | 43 | PyAPI_DATA(PyTypeObject) PyCObject_Type; 44 | 45 | #define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type) 46 | 47 | /* Create a PyCObject from a pointer to a C object and an optional 48 | destructor function. If the second argument is non-null, then it 49 | will be called with the first argument if and when the PyCObject is 50 | destroyed. 51 | 52 | */ 53 | PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr( 54 | void *cobj, void (*destruct)(void*)); 55 | 56 | 57 | /* Create a PyCObject from a pointer to a C object, a description object, 58 | and an optional destructor function. If the third argument is non-null, 59 | then it will be called with the first and second arguments if and when 60 | the PyCObject is destroyed. 61 | */ 62 | PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc( 63 | void *cobj, void *desc, void (*destruct)(void*,void*)); 64 | 65 | /* Retrieve a pointer to a C object from a PyCObject. */ 66 | PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *); 67 | 68 | /* Retrieve a pointer to a description object from a PyCObject. */ 69 | PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *); 70 | 71 | /* Import a pointer to a C object from a module using a PyCObject. */ 72 | PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name); 73 | 74 | /* Modify a C object. Fails (==0) if object has a destructor. */ 75 | PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj); 76 | 77 | 78 | typedef struct { 79 | PyObject_HEAD 80 | void *cobject; 81 | void *desc; 82 | void (*destructor)(void *); 83 | } PyCObject; 84 | 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #endif /* !Py_COBJECT_H */ 90 | -------------------------------------------------------------------------------- /inc/compile.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_COMPILE_H 3 | #define Py_COMPILE_H 4 | 5 | #include "code.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | /* Public interface */ 12 | struct _node; /* Declare the existence of this type */ 13 | PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); 14 | 15 | /* Future feature support */ 16 | 17 | typedef struct { 18 | int ff_features; /* flags set by future statements */ 19 | int ff_lineno; /* line number of last future statement */ 20 | } PyFutureFeatures; 21 | 22 | #define FUTURE_NESTED_SCOPES "nested_scopes" 23 | #define FUTURE_GENERATORS "generators" 24 | #define FUTURE_DIVISION "division" 25 | #define FUTURE_ABSOLUTE_IMPORT "absolute_import" 26 | #define FUTURE_WITH_STATEMENT "with_statement" 27 | #define FUTURE_PRINT_FUNCTION "print_function" 28 | #define FUTURE_UNICODE_LITERALS "unicode_literals" 29 | 30 | 31 | struct _mod; /* Declare the existence of this type */ 32 | PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, 33 | PyCompilerFlags *, PyArena *); 34 | PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); 35 | 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* !Py_COMPILE_H */ 41 | -------------------------------------------------------------------------------- /inc/complexobject.h: -------------------------------------------------------------------------------- 1 | /* Complex number structure */ 2 | 3 | #ifndef Py_COMPLEXOBJECT_H 4 | #define Py_COMPLEXOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | typedef struct { 10 | double real; 11 | double imag; 12 | } Py_complex; 13 | 14 | /* Operations on complex numbers from complexmodule.c */ 15 | 16 | #define c_sum _Py_c_sum 17 | #define c_diff _Py_c_diff 18 | #define c_neg _Py_c_neg 19 | #define c_prod _Py_c_prod 20 | #define c_quot _Py_c_quot 21 | #define c_pow _Py_c_pow 22 | #define c_abs _Py_c_abs 23 | 24 | PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); 25 | PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); 26 | PyAPI_FUNC(Py_complex) c_neg(Py_complex); 27 | PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); 28 | PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); 29 | PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); 30 | PyAPI_FUNC(double) c_abs(Py_complex); 31 | 32 | 33 | /* Complex object interface */ 34 | 35 | /* 36 | PyComplexObject represents a complex number with double-precision 37 | real and imaginary parts. 38 | */ 39 | 40 | typedef struct { 41 | PyObject_HEAD 42 | Py_complex cval; 43 | } PyComplexObject; 44 | 45 | PyAPI_DATA(PyTypeObject) PyComplex_Type; 46 | 47 | #define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) 48 | #define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) 49 | 50 | PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); 51 | PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); 52 | 53 | PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); 54 | PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); 55 | PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); 56 | 57 | /* Format the object based on the format_spec, as defined in PEP 3101 58 | (Advanced String Formatting). */ 59 | PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj, 60 | char *format_spec, 61 | Py_ssize_t format_spec_len); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | #endif /* !Py_COMPLEXOBJECT_H */ 67 | -------------------------------------------------------------------------------- /inc/descrobject.h: -------------------------------------------------------------------------------- 1 | /* Descriptors */ 2 | #ifndef Py_DESCROBJECT_H 3 | #define Py_DESCROBJECT_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | typedef PyObject *(*getter)(PyObject *, void *); 9 | typedef int (*setter)(PyObject *, PyObject *, void *); 10 | 11 | typedef struct PyGetSetDef { 12 | char *name; 13 | getter get; 14 | setter set; 15 | char *doc; 16 | void *closure; 17 | } PyGetSetDef; 18 | 19 | typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, 20 | void *wrapped); 21 | 22 | typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, 23 | void *wrapped, PyObject *kwds); 24 | 25 | struct wrapperbase { 26 | char *name; 27 | int offset; 28 | void *function; 29 | wrapperfunc wrapper; 30 | char *doc; 31 | int flags; 32 | PyObject *name_strobj; 33 | }; 34 | 35 | /* Flags for above struct */ 36 | #define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ 37 | 38 | /* Various kinds of descriptor objects */ 39 | 40 | #define PyDescr_COMMON \ 41 | PyObject_HEAD \ 42 | PyTypeObject *d_type; \ 43 | PyObject *d_name 44 | 45 | typedef struct { 46 | PyDescr_COMMON; 47 | } PyDescrObject; 48 | 49 | typedef struct { 50 | PyDescr_COMMON; 51 | PyMethodDef *d_method; 52 | } PyMethodDescrObject; 53 | 54 | typedef struct { 55 | PyDescr_COMMON; 56 | struct PyMemberDef *d_member; 57 | } PyMemberDescrObject; 58 | 59 | typedef struct { 60 | PyDescr_COMMON; 61 | PyGetSetDef *d_getset; 62 | } PyGetSetDescrObject; 63 | 64 | typedef struct { 65 | PyDescr_COMMON; 66 | struct wrapperbase *d_base; 67 | void *d_wrapped; /* This can be any function pointer */ 68 | } PyWrapperDescrObject; 69 | 70 | PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; 71 | PyAPI_DATA(PyTypeObject) PyDictProxy_Type; 72 | PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; 73 | PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; 74 | 75 | PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); 76 | PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); 77 | PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, 78 | struct PyMemberDef *); 79 | PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, 80 | struct PyGetSetDef *); 81 | PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, 82 | struct wrapperbase *, void *); 83 | #define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) 84 | 85 | PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); 86 | PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); 87 | 88 | 89 | PyAPI_DATA(PyTypeObject) PyProperty_Type; 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #endif /* !Py_DESCROBJECT_H */ 94 | 95 | -------------------------------------------------------------------------------- /inc/dtoa.h: -------------------------------------------------------------------------------- 1 | #ifndef PY_NO_SHORT_FLOAT_REPR 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | 6 | PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); 7 | PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, 8 | int *decpt, int *sign, char **rve); 9 | PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); 10 | 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /inc/enumobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ENUMOBJECT_H 2 | #define Py_ENUMOBJECT_H 3 | 4 | /* Enumerate Object */ 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_DATA(PyTypeObject) PyEnum_Type; 11 | PyAPI_DATA(PyTypeObject) PyReversed_Type; 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif /* !Py_ENUMOBJECT_H */ 18 | -------------------------------------------------------------------------------- /inc/errcode.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ERRCODE_H 2 | #define Py_ERRCODE_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Error codes passed around between file input, tokenizer, parser and 9 | interpreter. This is necessary so we can turn them into Python 10 | exceptions at a higher level. Note that some errors have a 11 | slightly different meaning when passed from the tokenizer to the 12 | parser than when passed from the parser to the interpreter; e.g. 13 | the parser only returns E_EOF when it hits EOF immediately, and it 14 | never returns E_OK. */ 15 | 16 | #define E_OK 10 /* No error */ 17 | #define E_EOF 11 /* End Of File */ 18 | #define E_INTR 12 /* Interrupted */ 19 | #define E_TOKEN 13 /* Bad token */ 20 | #define E_SYNTAX 14 /* Syntax error */ 21 | #define E_NOMEM 15 /* Ran out of memory */ 22 | #define E_DONE 16 /* Parsing complete */ 23 | #define E_ERROR 17 /* Execution error */ 24 | #define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ 25 | #define E_OVERFLOW 19 /* Node had too many children */ 26 | #define E_TOODEEP 20 /* Too many indentation levels */ 27 | #define E_DEDENT 21 /* No matching outer block for dedent */ 28 | #define E_DECODE 22 /* Error in decoding into Unicode */ 29 | #define E_EOFS 23 /* EOF in triple-quoted string */ 30 | #define E_EOLS 24 /* EOL in single-quoted string */ 31 | #define E_LINECONT 25 /* Unexpected characters after a line continuation */ 32 | 33 | #ifdef __cplusplus 34 | } 35 | #endif 36 | #endif /* !Py_ERRCODE_H */ 37 | -------------------------------------------------------------------------------- /inc/eval.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interface to execute compiled code */ 3 | 4 | #ifndef Py_EVAL_H 5 | #define Py_EVAL_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); 11 | 12 | PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, 13 | PyObject *globals, 14 | PyObject *locals, 15 | PyObject **args, int argc, 16 | PyObject **kwds, int kwdc, 17 | PyObject **defs, int defc, 18 | PyObject *closure); 19 | 20 | PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | #endif /* !Py_EVAL_H */ 26 | -------------------------------------------------------------------------------- /inc/frameobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Frame object interface */ 3 | 4 | #ifndef Py_FRAMEOBJECT_H 5 | #define Py_FRAMEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct { 11 | int b_type; /* what kind of block this is */ 12 | int b_handler; /* where to jump to find handler */ 13 | int b_level; /* value stack level to pop to */ 14 | } PyTryBlock; 15 | 16 | typedef struct _frame { 17 | PyObject_VAR_HEAD 18 | struct _frame *f_back; /* previous frame, or NULL */ 19 | PyCodeObject *f_code; /* code segment */ 20 | PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ 21 | PyObject *f_globals; /* global symbol table (PyDictObject) */ 22 | PyObject *f_locals; /* local symbol table (any mapping) */ 23 | PyObject **f_valuestack; /* points after the last local */ 24 | /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. 25 | Frame evaluation usually NULLs it, but a frame that yields sets it 26 | to the current stack top. */ 27 | PyObject **f_stacktop; 28 | PyObject *f_trace; /* Trace function */ 29 | 30 | /* If an exception is raised in this frame, the next three are used to 31 | * record the exception info (if any) originally in the thread state. See 32 | * comments before set_exc_info() -- it's not obvious. 33 | * Invariant: if _type is NULL, then so are _value and _traceback. 34 | * Desired invariant: all three are NULL, or all three are non-NULL. That 35 | * one isn't currently true, but "should be". 36 | */ 37 | PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; 38 | 39 | PyThreadState *f_tstate; 40 | int f_lasti; /* Last instruction if called */ 41 | /* Call PyFrame_GetLineNumber() instead of reading this field 42 | directly. As of 2.3 f_lineno is only valid when tracing is 43 | active (i.e. when f_trace is set). At other times we use 44 | PyCode_Addr2Line to calculate the line from the current 45 | bytecode index. */ 46 | int f_lineno; /* Current line number */ 47 | int f_iblock; /* index in f_blockstack */ 48 | PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ 49 | PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ 50 | } PyFrameObject; 51 | 52 | 53 | /* Standard object interface */ 54 | 55 | PyAPI_DATA(PyTypeObject) PyFrame_Type; 56 | 57 | #define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) 58 | #define PyFrame_IsRestricted(f) \ 59 | ((f)->f_builtins != (f)->f_tstate->interp->builtins) 60 | 61 | PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, 62 | PyObject *, PyObject *); 63 | 64 | 65 | /* The rest of the interface is specific for frame objects */ 66 | 67 | /* Block management functions */ 68 | 69 | PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); 70 | PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); 71 | 72 | /* Extend the value stack */ 73 | 74 | PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); 75 | 76 | /* Conversions between "fast locals" and locals in dictionary */ 77 | 78 | PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); 79 | PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); 80 | 81 | PyAPI_FUNC(int) PyFrame_ClearFreeList(void); 82 | 83 | /* Return the line of code the frame is currently executing. */ 84 | PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | #endif /* !Py_FRAMEOBJECT_H */ 90 | -------------------------------------------------------------------------------- /inc/funcobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Function object interface */ 3 | 4 | #ifndef Py_FUNCOBJECT_H 5 | #define Py_FUNCOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* Function objects and code objects should not be confused with each other: 11 | * 12 | * Function objects are created by the execution of the 'def' statement. 13 | * They reference a code object in their func_code attribute, which is a 14 | * purely syntactic object, i.e. nothing more than a compiled version of some 15 | * source code lines. There is one code object per source code "fragment", 16 | * but each code object can be referenced by zero or many function objects 17 | * depending only on how many times the 'def' statement in the source was 18 | * executed so far. 19 | */ 20 | 21 | typedef struct { 22 | PyObject_HEAD 23 | PyObject *func_code; /* A code object */ 24 | PyObject *func_globals; /* A dictionary (other mappings won't do) */ 25 | PyObject *func_defaults; /* NULL or a tuple */ 26 | PyObject *func_closure; /* NULL or a tuple of cell objects */ 27 | PyObject *func_doc; /* The __doc__ attribute, can be anything */ 28 | PyObject *func_name; /* The __name__ attribute, a string object */ 29 | PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ 30 | PyObject *func_weakreflist; /* List of weak references */ 31 | PyObject *func_module; /* The __module__ attribute, can be anything */ 32 | 33 | /* Invariant: 34 | * func_closure contains the bindings for func_code->co_freevars, so 35 | * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) 36 | * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). 37 | */ 38 | } PyFunctionObject; 39 | 40 | PyAPI_DATA(PyTypeObject) PyFunction_Type; 41 | 42 | #define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) 43 | 44 | PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); 45 | PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); 46 | PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); 47 | PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); 48 | PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); 49 | PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); 50 | PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); 51 | PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); 52 | 53 | /* Macros for direct access to these values. Type checks are *not* 54 | done, so use with care. */ 55 | #define PyFunction_GET_CODE(func) \ 56 | (((PyFunctionObject *)func) -> func_code) 57 | #define PyFunction_GET_GLOBALS(func) \ 58 | (((PyFunctionObject *)func) -> func_globals) 59 | #define PyFunction_GET_MODULE(func) \ 60 | (((PyFunctionObject *)func) -> func_module) 61 | #define PyFunction_GET_DEFAULTS(func) \ 62 | (((PyFunctionObject *)func) -> func_defaults) 63 | #define PyFunction_GET_CLOSURE(func) \ 64 | (((PyFunctionObject *)func) -> func_closure) 65 | 66 | /* The classmethod and staticmethod types lives here, too */ 67 | PyAPI_DATA(PyTypeObject) PyClassMethod_Type; 68 | PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; 69 | 70 | PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); 71 | PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | #endif /* !Py_FUNCOBJECT_H */ 77 | -------------------------------------------------------------------------------- /inc/genobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Generator object interface */ 3 | 4 | #ifndef Py_GENOBJECT_H 5 | #define Py_GENOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | struct _frame; /* Avoid including frameobject.h */ 11 | 12 | typedef struct { 13 | PyObject_HEAD 14 | /* The gi_ prefix is intended to remind of generator-iterator. */ 15 | 16 | /* Note: gi_frame can be NULL if the generator is "finished" */ 17 | struct _frame *gi_frame; 18 | 19 | /* True if generator is being executed. */ 20 | int gi_running; 21 | 22 | /* The code object backing the generator */ 23 | PyObject *gi_code; 24 | 25 | /* List of weak reference. */ 26 | PyObject *gi_weakreflist; 27 | } PyGenObject; 28 | 29 | PyAPI_DATA(PyTypeObject) PyGen_Type; 30 | 31 | #define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) 32 | #define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) 33 | 34 | PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); 35 | PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* !Py_GENOBJECT_H */ 41 | -------------------------------------------------------------------------------- /inc/graminit.h: -------------------------------------------------------------------------------- 1 | /* Generated by Parser/pgen */ 2 | 3 | #define single_input 256 4 | #define file_input 257 5 | #define eval_input 258 6 | #define decorator 259 7 | #define decorators 260 8 | #define decorated 261 9 | #define funcdef 262 10 | #define parameters 263 11 | #define varargslist 264 12 | #define fpdef 265 13 | #define fplist 266 14 | #define stmt 267 15 | #define simple_stmt 268 16 | #define small_stmt 269 17 | #define expr_stmt 270 18 | #define augassign 271 19 | #define print_stmt 272 20 | #define del_stmt 273 21 | #define pass_stmt 274 22 | #define flow_stmt 275 23 | #define break_stmt 276 24 | #define continue_stmt 277 25 | #define return_stmt 278 26 | #define yield_stmt 279 27 | #define raise_stmt 280 28 | #define import_stmt 281 29 | #define import_name 282 30 | #define import_from 283 31 | #define import_as_name 284 32 | #define dotted_as_name 285 33 | #define import_as_names 286 34 | #define dotted_as_names 287 35 | #define dotted_name 288 36 | #define global_stmt 289 37 | #define exec_stmt 290 38 | #define assert_stmt 291 39 | #define compound_stmt 292 40 | #define if_stmt 293 41 | #define while_stmt 294 42 | #define for_stmt 295 43 | #define try_stmt 296 44 | #define with_stmt 297 45 | #define with_item 298 46 | #define except_clause 299 47 | #define suite 300 48 | #define testlist_safe 301 49 | #define old_test 302 50 | #define old_lambdef 303 51 | #define test 304 52 | #define or_test 305 53 | #define and_test 306 54 | #define not_test 307 55 | #define comparison 308 56 | #define comp_op 309 57 | #define expr 310 58 | #define xor_expr 311 59 | #define and_expr 312 60 | #define shift_expr 313 61 | #define arith_expr 314 62 | #define term 315 63 | #define factor 316 64 | #define power 317 65 | #define atom 318 66 | #define listmaker 319 67 | #define testlist_comp 320 68 | #define lambdef 321 69 | #define trailer 322 70 | #define subscriptlist 323 71 | #define subscript 324 72 | #define sliceop 325 73 | #define exprlist 326 74 | #define testlist 327 75 | #define dictorsetmaker 328 76 | #define classdef 329 77 | #define arglist 330 78 | #define argument 331 79 | #define list_iter 332 80 | #define list_for 333 81 | #define list_if 334 82 | #define comp_iter 335 83 | #define comp_for 336 84 | #define comp_if 337 85 | #define testlist1 338 86 | #define encoding_decl 339 87 | #define yield_expr 340 88 | -------------------------------------------------------------------------------- /inc/grammar.h: -------------------------------------------------------------------------------- 1 | 2 | /* Grammar interface */ 3 | 4 | #ifndef Py_GRAMMAR_H 5 | #define Py_GRAMMAR_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #include "bitset.h" /* Sigh... */ 11 | 12 | /* A label of an arc */ 13 | 14 | typedef struct { 15 | int lb_type; 16 | char *lb_str; 17 | } label; 18 | 19 | #define EMPTY 0 /* Label number 0 is by definition the empty label */ 20 | 21 | /* A list of labels */ 22 | 23 | typedef struct { 24 | int ll_nlabels; 25 | label *ll_label; 26 | } labellist; 27 | 28 | /* An arc from one state to another */ 29 | 30 | typedef struct { 31 | short a_lbl; /* Label of this arc */ 32 | short a_arrow; /* State where this arc goes to */ 33 | } arc; 34 | 35 | /* A state in a DFA */ 36 | 37 | typedef struct { 38 | int s_narcs; 39 | arc *s_arc; /* Array of arcs */ 40 | 41 | /* Optional accelerators */ 42 | int s_lower; /* Lowest label index */ 43 | int s_upper; /* Highest label index */ 44 | int *s_accel; /* Accelerator */ 45 | int s_accept; /* Nonzero for accepting state */ 46 | } state; 47 | 48 | /* A DFA */ 49 | 50 | typedef struct { 51 | int d_type; /* Non-terminal this represents */ 52 | char *d_name; /* For printing */ 53 | int d_initial; /* Initial state */ 54 | int d_nstates; 55 | state *d_state; /* Array of states */ 56 | bitset d_first; 57 | } dfa; 58 | 59 | /* A grammar */ 60 | 61 | typedef struct { 62 | int g_ndfas; 63 | dfa *g_dfa; /* Array of DFAs */ 64 | labellist g_ll; 65 | int g_start; /* Start symbol of the grammar */ 66 | int g_accel; /* Set if accelerators present */ 67 | } grammar; 68 | 69 | /* FUNCTIONS */ 70 | 71 | grammar *newgrammar(int start); 72 | dfa *adddfa(grammar *g, int type, char *name); 73 | int addstate(dfa *d); 74 | void addarc(dfa *d, int from, int to, int lbl); 75 | dfa *PyGrammar_FindDFA(grammar *g, int type); 76 | 77 | int addlabel(labellist *ll, int type, char *str); 78 | int findlabel(labellist *ll, int type, char *str); 79 | char *PyGrammar_LabelRepr(label *lb); 80 | void translatelabels(grammar *g); 81 | 82 | void addfirstsets(grammar *g); 83 | 84 | void PyGrammar_AddAccelerators(grammar *g); 85 | void PyGrammar_RemoveAccelerators(grammar *); 86 | 87 | void printgrammar(grammar *g, FILE *fp); 88 | void printnonterminals(grammar *g, FILE *fp); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #endif /* !Py_GRAMMAR_H */ 94 | -------------------------------------------------------------------------------- /inc/import.h: -------------------------------------------------------------------------------- 1 | 2 | /* Module definition and import interface */ 3 | 4 | #ifndef Py_IMPORT_H 5 | #define Py_IMPORT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(long) PyImport_GetMagicNumber(void); 11 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co); 12 | PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( 13 | char *name, PyObject *co, char *pathname); 14 | PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); 15 | PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name); 16 | PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name); 17 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *); 18 | PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name, 19 | PyObject *globals, PyObject *locals, PyObject *fromlist, int level); 20 | 21 | #define PyImport_ImportModuleEx(n, g, l, f) \ 22 | PyImport_ImportModuleLevel(n, g, l, f, -1) 23 | 24 | PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); 25 | PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); 26 | PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); 27 | PyAPI_FUNC(void) PyImport_Cleanup(void); 28 | PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); 29 | 30 | #ifdef WITH_THREAD 31 | PyAPI_FUNC(void) _PyImport_AcquireLock(void); 32 | PyAPI_FUNC(int) _PyImport_ReleaseLock(void); 33 | #else 34 | #define _PyImport_AcquireLock() 35 | #define _PyImport_ReleaseLock() 1 36 | #endif 37 | 38 | PyAPI_FUNC(struct filedescr *) _PyImport_FindModule( 39 | const char *, PyObject *, char *, size_t, FILE **, PyObject **); 40 | PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *); 41 | PyAPI_FUNC(void) _PyImport_ReInitLock(void); 42 | 43 | PyAPI_FUNC(PyObject *)_PyImport_FindExtension(char *, char *); 44 | PyAPI_FUNC(PyObject *)_PyImport_FixupExtension(char *, char *); 45 | 46 | struct _inittab { 47 | char *name; 48 | void (*initfunc)(void); 49 | }; 50 | 51 | PyAPI_DATA(PyTypeObject) PyNullImporter_Type; 52 | PyAPI_DATA(struct _inittab *) PyImport_Inittab; 53 | 54 | PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void)); 55 | PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); 56 | 57 | struct _frozen { 58 | char *name; 59 | unsigned char *code; 60 | int size; 61 | }; 62 | 63 | /* Embedding apps may change this pointer to point to their favorite 64 | collection of frozen modules: */ 65 | 66 | PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | #endif /* !Py_IMPORT_H */ 72 | -------------------------------------------------------------------------------- /inc/intobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Integer object interface */ 3 | 4 | /* 5 | PyIntObject represents a (long) integer. This is an immutable object; 6 | an integer cannot change its value after creation. 7 | 8 | There are functions to create new integer objects, to test an object 9 | for integer-ness, and to get the integer value. The latter functions 10 | returns -1 and sets errno to EBADF if the object is not an PyIntObject. 11 | None of the functions should be applied to nil objects. 12 | 13 | The type PyIntObject is (unfortunately) exposed here so we can declare 14 | _Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this. 15 | */ 16 | 17 | #ifndef Py_INTOBJECT_H 18 | #define Py_INTOBJECT_H 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | long ob_ival; 26 | } PyIntObject; 27 | 28 | PyAPI_DATA(PyTypeObject) PyInt_Type; 29 | 30 | #define PyInt_Check(op) \ 31 | PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS) 32 | #define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) 33 | 34 | PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); 35 | #ifdef Py_USING_UNICODE 36 | PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int); 37 | #endif 38 | PyAPI_FUNC(PyObject *) PyInt_FromLong(long); 39 | PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t); 40 | PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t); 41 | PyAPI_FUNC(long) PyInt_AsLong(PyObject *); 42 | PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *); 43 | PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); 44 | #ifdef HAVE_LONG_LONG 45 | PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); 46 | #endif 47 | 48 | PyAPI_FUNC(long) PyInt_GetMax(void); 49 | 50 | /* Macro, trading safety for speed */ 51 | #define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) 52 | 53 | /* These aren't really part of the Int object, but they're handy; the protos 54 | * are necessary for systems that need the magic of PyAPI_FUNC and that want 55 | * to have stropmodule as a dynamically loaded module instead of building it 56 | * into the main Python shared library/DLL. Guido thinks I'm weird for 57 | * building it this way. :-) [cjh] 58 | */ 59 | PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); 60 | PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); 61 | 62 | /* free list api */ 63 | PyAPI_FUNC(int) PyInt_ClearFreeList(void); 64 | 65 | /* Convert an integer to the given base. Returns a string. 66 | If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. 67 | If newstyle is zero, then use the pre-2.6 behavior of octal having 68 | a leading "0" */ 69 | PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle); 70 | 71 | /* Format the object based on the format_spec, as defined in PEP 3101 72 | (Advanced String Formatting). */ 73 | PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj, 74 | char *format_spec, 75 | Py_ssize_t format_spec_len); 76 | 77 | #ifdef __cplusplus 78 | } 79 | #endif 80 | #endif /* !Py_INTOBJECT_H */ 81 | -------------------------------------------------------------------------------- /inc/intrcheck.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_INTRCHECK_H 3 | #define Py_INTRCHECK_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(int) PyOS_InterruptOccurred(void); 9 | PyAPI_FUNC(void) PyOS_InitInterrupts(void); 10 | PyAPI_FUNC(void) PyOS_AfterFork(void); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif /* !Py_INTRCHECK_H */ 16 | -------------------------------------------------------------------------------- /inc/iterobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_ITEROBJECT_H 2 | #define Py_ITEROBJECT_H 3 | /* Iterators (the basic kind, over a sequence) */ 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_DATA(PyTypeObject) PySeqIter_Type; 9 | 10 | #define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) 11 | 12 | PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); 13 | 14 | PyAPI_DATA(PyTypeObject) PyCallIter_Type; 15 | 16 | #define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) 17 | 18 | PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif /* !Py_ITEROBJECT_H */ 23 | 24 | -------------------------------------------------------------------------------- /inc/listobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* List object interface */ 3 | 4 | /* 5 | Another generally useful object type is an list of object pointers. 6 | This is a mutable type: the list items can be changed, and items can be 7 | added or removed. Out-of-range indices or non-list objects are ignored. 8 | 9 | *** WARNING *** PyList_SetItem does not increment the new item's reference 10 | count, but does decrement the reference count of the item it replaces, 11 | if not nil. It does *decrement* the reference count if it is *not* 12 | inserted in the list. Similarly, PyList_GetItem does not increment the 13 | returned item's reference count. 14 | */ 15 | 16 | #ifndef Py_LISTOBJECT_H 17 | #define Py_LISTOBJECT_H 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | typedef struct { 23 | PyObject_VAR_HEAD 24 | /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ 25 | PyObject **ob_item; 26 | 27 | /* ob_item contains space for 'allocated' elements. The number 28 | * currently in use is ob_size. 29 | * Invariants: 30 | * 0 <= ob_size <= allocated 31 | * len(list) == ob_size 32 | * ob_item == NULL implies ob_size == allocated == 0 33 | * list.sort() temporarily sets allocated to -1 to detect mutations. 34 | * 35 | * Items must normally not be NULL, except during construction when 36 | * the list is not yet visible outside the function that builds it. 37 | */ 38 | Py_ssize_t allocated; 39 | } PyListObject; 40 | 41 | PyAPI_DATA(PyTypeObject) PyList_Type; 42 | 43 | #define PyList_Check(op) \ 44 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) 45 | #define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) 46 | 47 | PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); 48 | PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); 49 | PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); 50 | PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); 51 | PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); 52 | PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); 53 | PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 54 | PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); 55 | PyAPI_FUNC(int) PyList_Sort(PyObject *); 56 | PyAPI_FUNC(int) PyList_Reverse(PyObject *); 57 | PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); 58 | PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); 59 | 60 | /* Macro, trading safety for speed */ 61 | #define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) 62 | #define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) 63 | #define PyList_GET_SIZE(op) Py_SIZE(op) 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | #endif /* !Py_LISTOBJECT_H */ 69 | -------------------------------------------------------------------------------- /inc/marshal.h: -------------------------------------------------------------------------------- 1 | 2 | /* Interface for marshal.c */ 3 | 4 | #ifndef Py_MARSHAL_H 5 | #define Py_MARSHAL_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #define Py_MARSHAL_VERSION 2 11 | 12 | PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); 13 | PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); 14 | PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); 15 | 16 | PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); 17 | PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); 18 | PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); 19 | PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); 20 | PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | #endif /* !Py_MARSHAL_H */ 26 | -------------------------------------------------------------------------------- /inc/memoryobject.h: -------------------------------------------------------------------------------- 1 | /* Memory view object. In Python this is available as "memoryview". */ 2 | 3 | #ifndef Py_MEMORYOBJECT_H 4 | #define Py_MEMORYOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | PyAPI_DATA(PyTypeObject) PyMemoryView_Type; 10 | 11 | #define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) 12 | 13 | /* Get a pointer to the underlying Py_buffer of a memoryview object. */ 14 | #define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) 15 | /* Get a pointer to the PyObject from which originates a memoryview object. */ 16 | #define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) 17 | 18 | 19 | PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, 20 | int buffertype, 21 | char fort); 22 | 23 | /* Return a contiguous chunk of memory representing the buffer 24 | from an object in a memory view object. If a copy is made then the 25 | base object for the memory view will be a *new* bytes object. 26 | 27 | Otherwise, the base-object will be the object itself and no 28 | data-copying will be done. 29 | 30 | The buffertype argument can be PyBUF_READ, PyBUF_WRITE, 31 | PyBUF_SHADOW to determine whether the returned buffer 32 | should be READONLY, WRITABLE, or set to update the 33 | original buffer if a copy must be made. If buffertype is 34 | PyBUF_WRITE and the buffer is not contiguous an error will 35 | be raised. In this circumstance, the user can use 36 | PyBUF_SHADOW to ensure that a a writable temporary 37 | contiguous buffer is returned. The contents of this 38 | contiguous buffer will be copied back into the original 39 | object after the memoryview object is deleted as long as 40 | the original object is writable and allows setting an 41 | exclusive write lock. If this is not allowed by the 42 | original object, then a BufferError is raised. 43 | 44 | If the object is multi-dimensional and if fortran is 'F', 45 | the first dimension of the underlying array will vary the 46 | fastest in the buffer. If fortran is 'C', then the last 47 | dimension will vary the fastest (C-style contiguous). If 48 | fortran is 'A', then it does not matter and you will get 49 | whatever the object decides is more efficient. 50 | 51 | A new reference is returned that must be DECREF'd when finished. 52 | */ 53 | 54 | PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); 55 | 56 | PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); 57 | /* create new if bufptr is NULL 58 | will be a new bytesobject in base */ 59 | 60 | 61 | /* The struct is declared here so that macros can work, but it shouldn't 62 | be considered public. Don't access those fields directly, use the macros 63 | and functions instead! */ 64 | typedef struct { 65 | PyObject_HEAD 66 | PyObject *base; 67 | Py_buffer view; 68 | } PyMemoryViewObject; 69 | 70 | 71 | #ifdef __cplusplus 72 | } 73 | #endif 74 | #endif /* !Py_MEMORYOBJECT_H */ 75 | -------------------------------------------------------------------------------- /inc/metagrammar.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_METAGRAMMAR_H 2 | #define Py_METAGRAMMAR_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | #define MSTART 256 9 | #define RULE 257 10 | #define RHS 258 11 | #define ALT 259 12 | #define ITEM 260 13 | #define ATOM 261 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif /* !Py_METAGRAMMAR_H */ 19 | -------------------------------------------------------------------------------- /inc/methodobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Method object interface */ 3 | 4 | #ifndef Py_METHODOBJECT_H 5 | #define Py_METHODOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* This is about the type 'builtin_function_or_method', 11 | not Python methods in user-defined classes. See classobject.h 12 | for the latter. */ 13 | 14 | PyAPI_DATA(PyTypeObject) PyCFunction_Type; 15 | 16 | #define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) 17 | 18 | typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); 19 | typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, 20 | PyObject *); 21 | typedef PyObject *(*PyNoArgsFunction)(PyObject *); 22 | 23 | PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); 24 | PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); 25 | PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); 26 | 27 | /* Macros for direct access to these values. Type checks are *not* 28 | done, so use with care. */ 29 | #define PyCFunction_GET_FUNCTION(func) \ 30 | (((PyCFunctionObject *)func) -> m_ml -> ml_meth) 31 | #define PyCFunction_GET_SELF(func) \ 32 | (((PyCFunctionObject *)func) -> m_self) 33 | #define PyCFunction_GET_FLAGS(func) \ 34 | (((PyCFunctionObject *)func) -> m_ml -> ml_flags) 35 | PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); 36 | 37 | struct PyMethodDef { 38 | const char *ml_name; /* The name of the built-in function/method */ 39 | PyCFunction ml_meth; /* The C function that implements it */ 40 | int ml_flags; /* Combination of METH_xxx flags, which mostly 41 | describe the args expected by the C func */ 42 | const char *ml_doc; /* The __doc__ attribute, or NULL */ 43 | }; 44 | typedef struct PyMethodDef PyMethodDef; 45 | 46 | PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *); 47 | 48 | #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) 49 | PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, 50 | PyObject *); 51 | 52 | /* Flag passed to newmethodobject */ 53 | #define METH_OLDARGS 0x0000 54 | #define METH_VARARGS 0x0001 55 | #define METH_KEYWORDS 0x0002 56 | /* METH_NOARGS and METH_O must not be combined with the flags above. */ 57 | #define METH_NOARGS 0x0004 58 | #define METH_O 0x0008 59 | 60 | /* METH_CLASS and METH_STATIC are a little different; these control 61 | the construction of methods for a class. These cannot be used for 62 | functions in modules. */ 63 | #define METH_CLASS 0x0010 64 | #define METH_STATIC 0x0020 65 | 66 | /* METH_COEXIST allows a method to be entered eventhough a slot has 67 | already filled the entry. When defined, the flag allows a separate 68 | method, "__contains__" for example, to coexist with a defined 69 | slot like sq_contains. */ 70 | 71 | #define METH_COEXIST 0x0040 72 | 73 | typedef struct PyMethodChain { 74 | PyMethodDef *methods; /* Methods of this type */ 75 | struct PyMethodChain *link; /* NULL or base type */ 76 | } PyMethodChain; 77 | 78 | PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, 79 | const char *); 80 | 81 | typedef struct { 82 | PyObject_HEAD 83 | PyMethodDef *m_ml; /* Description of the C function to call */ 84 | PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ 85 | PyObject *m_module; /* The __module__ attribute, can be anything */ 86 | } PyCFunctionObject; 87 | 88 | PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | #endif /* !Py_METHODOBJECT_H */ 94 | -------------------------------------------------------------------------------- /inc/moduleobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Module object interface */ 3 | 4 | #ifndef Py_MODULEOBJECT_H 5 | #define Py_MODULEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_DATA(PyTypeObject) PyModule_Type; 11 | 12 | #define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) 13 | #define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) 14 | 15 | PyAPI_FUNC(PyObject *) PyModule_New(const char *); 16 | PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); 17 | PyAPI_FUNC(char *) PyModule_GetName(PyObject *); 18 | PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); 19 | PyAPI_FUNC(void) _PyModule_Clear(PyObject *); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif /* !Py_MODULEOBJECT_H */ 25 | -------------------------------------------------------------------------------- /inc/node.h: -------------------------------------------------------------------------------- 1 | 2 | /* Parse tree node interface */ 3 | 4 | #ifndef Py_NODE_H 5 | #define Py_NODE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct _node { 11 | short n_type; 12 | char *n_str; 13 | int n_lineno; 14 | int n_col_offset; 15 | int n_nchildren; 16 | struct _node *n_child; 17 | } node; 18 | 19 | PyAPI_FUNC(node *) PyNode_New(int type); 20 | PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, 21 | char *str, int lineno, int col_offset); 22 | PyAPI_FUNC(void) PyNode_Free(node *n); 23 | 24 | /* Node access functions */ 25 | #define NCH(n) ((n)->n_nchildren) 26 | 27 | #define CHILD(n, i) (&(n)->n_child[i]) 28 | #define RCHILD(n, i) (CHILD(n, NCH(n) + i)) 29 | #define TYPE(n) ((n)->n_type) 30 | #define STR(n) ((n)->n_str) 31 | 32 | /* Assert that the type of a node is what we expect */ 33 | #define REQ(n, type) assert(TYPE(n) == (type)) 34 | 35 | PyAPI_FUNC(void) PyNode_ListTree(node *); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | #endif /* !Py_NODE_H */ 41 | -------------------------------------------------------------------------------- /inc/osdefs.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_OSDEFS_H 2 | #define Py_OSDEFS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Operating system dependencies */ 9 | 10 | /* Mod by chrish: QNX has WATCOM, but isn't DOS */ 11 | #if !defined(__QNX__) 12 | #if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2) 13 | #if defined(PYOS_OS2) && defined(PYCC_GCC) 14 | #define MAXPATHLEN 260 15 | #define SEP '/' 16 | #define ALTSEP '\\' 17 | #else 18 | #define SEP '\\' 19 | #define ALTSEP '/' 20 | #define MAXPATHLEN 256 21 | #endif 22 | #define DELIM ';' 23 | #endif 24 | #endif 25 | 26 | #ifdef RISCOS 27 | #define SEP '.' 28 | #define MAXPATHLEN 256 29 | #define DELIM ',' 30 | #endif 31 | 32 | 33 | /* Filename separator */ 34 | #ifndef SEP 35 | #define SEP '/' 36 | #endif 37 | 38 | /* Max pathname length */ 39 | #ifndef MAXPATHLEN 40 | #if defined(PATH_MAX) && PATH_MAX > 1024 41 | #define MAXPATHLEN PATH_MAX 42 | #else 43 | #define MAXPATHLEN 1024 44 | #endif 45 | #endif 46 | 47 | /* Search path entry delimiter */ 48 | #ifndef DELIM 49 | #define DELIM ':' 50 | #endif 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | #endif /* !Py_OSDEFS_H */ 56 | -------------------------------------------------------------------------------- /inc/parsetok.h: -------------------------------------------------------------------------------- 1 | 2 | /* Parser-tokenizer link interface */ 3 | 4 | #ifndef Py_PARSETOK_H 5 | #define Py_PARSETOK_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct { 11 | int error; 12 | const char *filename; 13 | int lineno; 14 | int offset; 15 | char *text; 16 | int token; 17 | int expected; 18 | } perrdetail; 19 | 20 | #if 0 21 | #define PyPARSE_YIELD_IS_KEYWORD 0x0001 22 | #endif 23 | 24 | #define PyPARSE_DONT_IMPLY_DEDENT 0x0002 25 | 26 | #if 0 27 | #define PyPARSE_WITH_IS_KEYWORD 0x0003 28 | #endif 29 | 30 | #define PyPARSE_PRINT_IS_FUNCTION 0x0004 31 | #define PyPARSE_UNICODE_LITERALS 0x0008 32 | 33 | 34 | 35 | PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, 36 | perrdetail *); 37 | PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, 38 | char *, char *, perrdetail *); 39 | 40 | PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, 41 | perrdetail *, int); 42 | PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *, 43 | int, char *, char *, 44 | perrdetail *, int); 45 | PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *, 46 | int, char *, char *, 47 | perrdetail *, int *); 48 | 49 | PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *, 50 | const char *, 51 | grammar *, int, 52 | perrdetail *, int); 53 | PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *, 54 | const char *, 55 | grammar *, int, 56 | perrdetail *, int *); 57 | 58 | /* Note that he following function is defined in pythonrun.c not parsetok.c. */ 59 | PyAPI_FUNC(void) PyParser_SetError(perrdetail *); 60 | 61 | #ifdef __cplusplus 62 | } 63 | #endif 64 | #endif /* !Py_PARSETOK_H */ 65 | -------------------------------------------------------------------------------- /inc/patchlevel.h: -------------------------------------------------------------------------------- 1 | 2 | /* Newfangled version identification scheme. 3 | 4 | This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL 5 | was available. To test for presence of the scheme, test for 6 | defined(PY_MAJOR_VERSION). 7 | 8 | When the major or minor version changes, the VERSION variable in 9 | configure.in must also be changed. 10 | 11 | There is also (independent) API version information in modsupport.h. 12 | */ 13 | 14 | /* Values for PY_RELEASE_LEVEL */ 15 | #define PY_RELEASE_LEVEL_ALPHA 0xA 16 | #define PY_RELEASE_LEVEL_BETA 0xB 17 | #define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ 18 | #define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ 19 | /* Higher for patch releases */ 20 | 21 | /* Version parsed out into numeric values */ 22 | /*--start constants--*/ 23 | #define PY_MAJOR_VERSION 2 24 | #define PY_MINOR_VERSION 7 25 | #define PY_MICRO_VERSION 3 26 | #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL 27 | #define PY_RELEASE_SERIAL 0 28 | 29 | /* Version as a string */ 30 | #define PY_VERSION "2.7.3" 31 | /*--end constants--*/ 32 | 33 | /* Subversion Revision number of this file (not of the repository). Empty 34 | since Mercurial migration. */ 35 | #define PY_PATCHLEVEL_REVISION "" 36 | 37 | /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. 38 | Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ 39 | #define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ 40 | (PY_MINOR_VERSION << 16) | \ 41 | (PY_MICRO_VERSION << 8) | \ 42 | (PY_RELEASE_LEVEL << 4) | \ 43 | (PY_RELEASE_SERIAL << 0)) 44 | -------------------------------------------------------------------------------- /inc/pgen.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PGEN_H 2 | #define Py_PGEN_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Parser generator interface */ 9 | 10 | extern grammar *meta_grammar(void); 11 | 12 | struct _node; 13 | extern grammar *pgen(struct _node *); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif /* !Py_PGEN_H */ 19 | -------------------------------------------------------------------------------- /inc/pgenheaders.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_PGENHEADERS_H 2 | #define Py_PGENHEADERS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Include files and extern declarations used by most of the parser. */ 9 | 10 | #include "Python.h" 11 | 12 | PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) 13 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 14 | PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) 15 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 16 | 17 | #define addarc _Py_addarc 18 | #define addbit _Py_addbit 19 | #define adddfa _Py_adddfa 20 | #define addfirstsets _Py_addfirstsets 21 | #define addlabel _Py_addlabel 22 | #define addstate _Py_addstate 23 | #define delbitset _Py_delbitset 24 | #define dumptree _Py_dumptree 25 | #define findlabel _Py_findlabel 26 | #define mergebitset _Py_mergebitset 27 | #define meta_grammar _Py_meta_grammar 28 | #define newbitset _Py_newbitset 29 | #define newgrammar _Py_newgrammar 30 | #define pgen _Py_pgen 31 | #define printgrammar _Py_printgrammar 32 | #define printnonterminals _Py_printnonterminals 33 | #define printtree _Py_printtree 34 | #define samebitset _Py_samebitset 35 | #define showtree _Py_showtree 36 | #define tok_dump _Py_tok_dump 37 | #define translatelabels _Py_translatelabels 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | #endif /* !Py_PGENHEADERS_H */ 43 | -------------------------------------------------------------------------------- /inc/pyarena.h: -------------------------------------------------------------------------------- 1 | /* An arena-like memory interface for the compiler. 2 | */ 3 | 4 | #ifndef Py_PYARENA_H 5 | #define Py_PYARENA_H 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | typedef struct _arena PyArena; 12 | 13 | /* PyArena_New() and PyArena_Free() create a new arena and free it, 14 | respectively. Once an arena has been created, it can be used 15 | to allocate memory via PyArena_Malloc(). Pointers to PyObject can 16 | also be registered with the arena via PyArena_AddPyObject(), and the 17 | arena will ensure that the PyObjects stay alive at least until 18 | PyArena_Free() is called. When an arena is freed, all the memory it 19 | allocated is freed, the arena releases internal references to registered 20 | PyObject*, and none of its pointers are valid. 21 | XXX (tim) What does "none of its pointers are valid" mean? Does it 22 | XXX mean that pointers previously obtained via PyArena_Malloc() are 23 | XXX no longer valid? (That's clearly true, but not sure that's what 24 | XXX the text is trying to say.) 25 | 26 | PyArena_New() returns an arena pointer. On error, it 27 | returns a negative number and sets an exception. 28 | XXX (tim): Not true. On error, PyArena_New() actually returns NULL, 29 | XXX and looks like it may or may not set an exception (e.g., if the 30 | XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on 31 | XXX and an exception is set; OTOH, if the internal 32 | XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but 33 | XXX an exception is not set in that case). 34 | */ 35 | PyAPI_FUNC(PyArena *) PyArena_New(void); 36 | PyAPI_FUNC(void) PyArena_Free(PyArena *); 37 | 38 | /* Mostly like malloc(), return the address of a block of memory spanning 39 | * `size` bytes, or return NULL (without setting an exception) if enough 40 | * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with 41 | * size=0 does not guarantee to return a unique pointer (the pointer 42 | * returned may equal one or more other pointers obtained from 43 | * PyArena_Malloc()). 44 | * Note that pointers obtained via PyArena_Malloc() must never be passed to 45 | * the system free() or realloc(), or to any of Python's similar memory- 46 | * management functions. PyArena_Malloc()-obtained pointers remain valid 47 | * until PyArena_Free(ar) is called, at which point all pointers obtained 48 | * from the arena `ar` become invalid simultaneously. 49 | */ 50 | PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); 51 | 52 | /* This routine isn't a proper arena allocation routine. It takes 53 | * a PyObject* and records it so that it can be DECREFed when the 54 | * arena is freed. 55 | */ 56 | PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* !Py_PYARENA_H */ 63 | -------------------------------------------------------------------------------- /inc/pycapsule.h: -------------------------------------------------------------------------------- 1 | 2 | /* Capsule objects let you wrap a C "void *" pointer in a Python 3 | object. They're a way of passing data through the Python interpreter 4 | without creating your own custom type. 5 | 6 | Capsules are used for communication between extension modules. 7 | They provide a way for an extension module to export a C interface 8 | to other extension modules, so that extension modules can use the 9 | Python import mechanism to link to one another. 10 | 11 | For more information, please see "c-api/capsule.html" in the 12 | documentation. 13 | */ 14 | 15 | #ifndef Py_CAPSULE_H 16 | #define Py_CAPSULE_H 17 | #ifdef __cplusplus 18 | extern "C" { 19 | #endif 20 | 21 | PyAPI_DATA(PyTypeObject) PyCapsule_Type; 22 | 23 | typedef void (*PyCapsule_Destructor)(PyObject *); 24 | 25 | #define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) 26 | 27 | 28 | PyAPI_FUNC(PyObject *) PyCapsule_New( 29 | void *pointer, 30 | const char *name, 31 | PyCapsule_Destructor destructor); 32 | 33 | PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); 34 | 35 | PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); 36 | 37 | PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); 38 | 39 | PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); 40 | 41 | PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); 42 | 43 | PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); 44 | 45 | PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); 46 | 47 | PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); 48 | 49 | PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); 50 | 51 | PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block); 52 | 53 | #ifdef __cplusplus 54 | } 55 | #endif 56 | #endif /* !Py_CAPSULE_H */ 57 | -------------------------------------------------------------------------------- /inc/pyctype.h: -------------------------------------------------------------------------------- 1 | #ifndef PYCTYPE_H 2 | #define PYCTYPE_H 3 | 4 | #define PY_CTF_LOWER 0x01 5 | #define PY_CTF_UPPER 0x02 6 | #define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) 7 | #define PY_CTF_DIGIT 0x04 8 | #define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) 9 | #define PY_CTF_SPACE 0x08 10 | #define PY_CTF_XDIGIT 0x10 11 | 12 | PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; 13 | 14 | /* Unlike their C counterparts, the following macros are not meant to 15 | * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument 16 | * must be a signed/unsigned char. */ 17 | #define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) 18 | #define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) 19 | #define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) 20 | #define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) 21 | #define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) 22 | #define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) 23 | #define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) 24 | 25 | PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; 26 | PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; 27 | 28 | #define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) 29 | #define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) 30 | 31 | #endif /* !PYCTYPE_H */ 32 | -------------------------------------------------------------------------------- /inc/pydebug.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_PYDEBUG_H 3 | #define Py_PYDEBUG_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_DATA(int) Py_DebugFlag; 9 | PyAPI_DATA(int) Py_VerboseFlag; 10 | PyAPI_DATA(int) Py_InteractiveFlag; 11 | PyAPI_DATA(int) Py_InspectFlag; 12 | PyAPI_DATA(int) Py_OptimizeFlag; 13 | PyAPI_DATA(int) Py_NoSiteFlag; 14 | PyAPI_DATA(int) Py_BytesWarningFlag; 15 | PyAPI_DATA(int) Py_UseClassExceptionsFlag; 16 | PyAPI_DATA(int) Py_FrozenFlag; 17 | PyAPI_DATA(int) Py_TabcheckFlag; 18 | PyAPI_DATA(int) Py_UnicodeFlag; 19 | PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; 20 | PyAPI_DATA(int) Py_DivisionWarningFlag; 21 | PyAPI_DATA(int) Py_DontWriteBytecodeFlag; 22 | PyAPI_DATA(int) Py_NoUserSiteDirectory; 23 | /* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed, 24 | on the command line, and is used in 2.2 by ceval.c to make all "/" divisions 25 | true divisions (which they will be in 3.0). */ 26 | PyAPI_DATA(int) _Py_QnewFlag; 27 | /* Warn about 3.x issues */ 28 | PyAPI_DATA(int) Py_Py3kWarningFlag; 29 | PyAPI_DATA(int) Py_HashRandomizationFlag; 30 | 31 | /* this is a wrapper around getenv() that pays attention to 32 | Py_IgnoreEnvironmentFlag. It should be used for getting variables like 33 | PYTHONPATH and PYTHONHOME from the environment */ 34 | #define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) 35 | 36 | PyAPI_FUNC(void) Py_FatalError(const char *message); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif /* !Py_PYDEBUG_H */ 42 | -------------------------------------------------------------------------------- /inc/pyexpat.h: -------------------------------------------------------------------------------- 1 | /* Stuff to export relevant 'expat' entry points from pyexpat to other 2 | * parser modules, such as cElementTree. */ 3 | 4 | /* note: you must import expat.h before importing this module! */ 5 | 6 | #define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" 7 | #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" 8 | 9 | struct PyExpat_CAPI 10 | { 11 | char* magic; /* set to PyExpat_CAPI_MAGIC */ 12 | int size; /* set to sizeof(struct PyExpat_CAPI) */ 13 | int MAJOR_VERSION; 14 | int MINOR_VERSION; 15 | int MICRO_VERSION; 16 | /* pointers to selected expat functions. add new functions at 17 | the end, if needed */ 18 | const XML_LChar * (*ErrorString)(enum XML_Error code); 19 | enum XML_Error (*GetErrorCode)(XML_Parser parser); 20 | XML_Size (*GetErrorColumnNumber)(XML_Parser parser); 21 | XML_Size (*GetErrorLineNumber)(XML_Parser parser); 22 | enum XML_Status (*Parse)( 23 | XML_Parser parser, const char *s, int len, int isFinal); 24 | XML_Parser (*ParserCreate_MM)( 25 | const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, 26 | const XML_Char *namespaceSeparator); 27 | void (*ParserFree)(XML_Parser parser); 28 | void (*SetCharacterDataHandler)( 29 | XML_Parser parser, XML_CharacterDataHandler handler); 30 | void (*SetCommentHandler)( 31 | XML_Parser parser, XML_CommentHandler handler); 32 | void (*SetDefaultHandlerExpand)( 33 | XML_Parser parser, XML_DefaultHandler handler); 34 | void (*SetElementHandler)( 35 | XML_Parser parser, XML_StartElementHandler start, 36 | XML_EndElementHandler end); 37 | void (*SetNamespaceDeclHandler)( 38 | XML_Parser parser, XML_StartNamespaceDeclHandler start, 39 | XML_EndNamespaceDeclHandler end); 40 | void (*SetProcessingInstructionHandler)( 41 | XML_Parser parser, XML_ProcessingInstructionHandler handler); 42 | void (*SetUnknownEncodingHandler)( 43 | XML_Parser parser, XML_UnknownEncodingHandler handler, 44 | void *encodingHandlerData); 45 | void (*SetUserData)(XML_Parser parser, void *userData); 46 | /* always add new stuff to the end! */ 47 | }; 48 | 49 | -------------------------------------------------------------------------------- /inc/pygetopt.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_PYGETOPT_H 3 | #define Py_PYGETOPT_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_DATA(int) _PyOS_opterr; 9 | PyAPI_DATA(int) _PyOS_optind; 10 | PyAPI_DATA(char *) _PyOS_optarg; 11 | 12 | PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); 13 | PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); 14 | 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | #endif /* !Py_PYGETOPT_H */ 19 | -------------------------------------------------------------------------------- /inc/pymacconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef PYMACCONFIG_H 2 | #define PYMACCONFIG_H 3 | /* 4 | * This file moves some of the autoconf magic to compile-time 5 | * when building on MacOSX. This is needed for building 4-way 6 | * universal binaries and for 64-bit universal binaries because 7 | * the values redefined below aren't configure-time constant but 8 | * only compile-time constant in these scenarios. 9 | */ 10 | 11 | #if defined(__APPLE__) 12 | 13 | # undef SIZEOF_LONG 14 | # undef SIZEOF_PTHREAD_T 15 | # undef SIZEOF_SIZE_T 16 | # undef SIZEOF_TIME_T 17 | # undef SIZEOF_VOID_P 18 | # undef SIZEOF__BOOL 19 | # undef SIZEOF_UINTPTR_T 20 | # undef SIZEOF_PTHREAD_T 21 | # undef WORDS_BIGENDIAN 22 | # undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 23 | # undef DOUBLE_IS_BIG_ENDIAN_IEEE754 24 | # undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 25 | # undef HAVE_GCC_ASM_FOR_X87 26 | 27 | # undef VA_LIST_IS_ARRAY 28 | # if defined(__LP64__) && defined(__x86_64__) 29 | # define VA_LIST_IS_ARRAY 1 30 | # endif 31 | 32 | # undef HAVE_LARGEFILE_SUPPORT 33 | # ifndef __LP64__ 34 | # define HAVE_LARGEFILE_SUPPORT 1 35 | # endif 36 | 37 | # undef SIZEOF_LONG 38 | # ifdef __LP64__ 39 | # define SIZEOF__BOOL 1 40 | # define SIZEOF__BOOL 1 41 | # define SIZEOF_LONG 8 42 | # define SIZEOF_PTHREAD_T 8 43 | # define SIZEOF_SIZE_T 8 44 | # define SIZEOF_TIME_T 8 45 | # define SIZEOF_VOID_P 8 46 | # define SIZEOF_UINTPTR_T 8 47 | # define SIZEOF_PTHREAD_T 8 48 | # else 49 | # ifdef __ppc__ 50 | # define SIZEOF__BOOL 4 51 | # else 52 | # define SIZEOF__BOOL 1 53 | # endif 54 | # define SIZEOF_LONG 4 55 | # define SIZEOF_PTHREAD_T 4 56 | # define SIZEOF_SIZE_T 4 57 | # define SIZEOF_TIME_T 4 58 | # define SIZEOF_VOID_P 4 59 | # define SIZEOF_UINTPTR_T 4 60 | # define SIZEOF_PTHREAD_T 4 61 | # endif 62 | 63 | # if defined(__LP64__) 64 | /* MacOSX 10.4 (the first release to support 64-bit code 65 | * at all) only supports 64-bit in the UNIX layer. 66 | * Therefore surpress the toolbox-glue in 64-bit mode. 67 | */ 68 | 69 | /* In 64-bit mode setpgrp always has no argments, in 32-bit 70 | * mode that depends on the compilation environment 71 | */ 72 | # undef SETPGRP_HAVE_ARG 73 | 74 | # endif 75 | 76 | #ifdef __BIG_ENDIAN__ 77 | #define WORDS_BIGENDIAN 1 78 | #define DOUBLE_IS_BIG_ENDIAN_IEEE754 79 | #else 80 | #define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 81 | #endif /* __BIG_ENDIAN */ 82 | 83 | #ifdef __i386__ 84 | # define HAVE_GCC_ASM_FOR_X87 85 | #endif 86 | 87 | /* 88 | * The definition in pyconfig.h is only valid on the OS release 89 | * where configure ran on and not necessarily for all systems where 90 | * the executable can be used on. 91 | * 92 | * Specifically: OSX 10.4 has limited supported for '%zd', while 93 | * 10.5 has full support for '%zd'. A binary built on 10.5 won't 94 | * work properly on 10.4 unless we surpress the definition 95 | * of PY_FORMAT_SIZE_T 96 | */ 97 | #undef PY_FORMAT_SIZE_T 98 | 99 | 100 | #endif /* defined(_APPLE__) */ 101 | 102 | #endif /* PYMACCONFIG_H */ 103 | -------------------------------------------------------------------------------- /inc/pystrcmp.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRCMP_H 2 | #define Py_STRCMP_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); 9 | PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); 10 | 11 | #if defined(MS_WINDOWS) || defined(PYOS_OS2) 12 | #define PyOS_strnicmp strnicmp 13 | #define PyOS_stricmp stricmp 14 | #else 15 | #define PyOS_strnicmp PyOS_mystrnicmp 16 | #define PyOS_stricmp PyOS_mystricmp 17 | #endif 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif /* !Py_STRCMP_H */ 24 | -------------------------------------------------------------------------------- /inc/pystrtod.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRTOD_H 2 | #define Py_STRTOD_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | 9 | PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr); 10 | PyAPI_FUNC(double) PyOS_ascii_atof(const char *str); 11 | 12 | /* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */ 13 | PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, 14 | const char *format, double d); 15 | PyAPI_FUNC(double) PyOS_string_to_double(const char *str, 16 | char **endptr, 17 | PyObject *overflow_exception); 18 | 19 | /* The caller is responsible for calling PyMem_Free to free the buffer 20 | that's is returned. */ 21 | PyAPI_FUNC(char *) PyOS_double_to_string(double val, 22 | char format_code, 23 | int precision, 24 | int flags, 25 | int *type); 26 | 27 | PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); 28 | 29 | 30 | /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ 31 | #define Py_DTSF_SIGN 0x01 /* always add the sign */ 32 | #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ 33 | #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code 34 | specific */ 35 | 36 | /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ 37 | #define Py_DTST_FINITE 0 38 | #define Py_DTST_INFINITE 1 39 | #define Py_DTST_NAN 2 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* !Py_STRTOD_H */ 46 | -------------------------------------------------------------------------------- /inc/pythread.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_PYTHREAD_H 3 | #define Py_PYTHREAD_H 4 | 5 | typedef void *PyThread_type_lock; 6 | typedef void *PyThread_type_sema; 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | PyAPI_FUNC(void) PyThread_init_thread(void); 13 | PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); 14 | PyAPI_FUNC(void) PyThread_exit_thread(void); 15 | PyAPI_FUNC(long) PyThread_get_thread_ident(void); 16 | 17 | PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); 18 | PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); 19 | PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); 20 | #define WAIT_LOCK 1 21 | #define NOWAIT_LOCK 0 22 | PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); 23 | 24 | PyAPI_FUNC(size_t) PyThread_get_stacksize(void); 25 | PyAPI_FUNC(int) PyThread_set_stacksize(size_t); 26 | 27 | /* Thread Local Storage (TLS) API */ 28 | PyAPI_FUNC(int) PyThread_create_key(void); 29 | PyAPI_FUNC(void) PyThread_delete_key(int); 30 | PyAPI_FUNC(int) PyThread_set_key_value(int, void *); 31 | PyAPI_FUNC(void *) PyThread_get_key_value(int); 32 | PyAPI_FUNC(void) PyThread_delete_key_value(int key); 33 | 34 | /* Cleanup after a fork */ 35 | PyAPI_FUNC(void) PyThread_ReInitTLS(void); 36 | 37 | #ifdef __cplusplus 38 | } 39 | #endif 40 | 41 | #endif /* !Py_PYTHREAD_H */ 42 | -------------------------------------------------------------------------------- /inc/rangeobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Range object interface */ 3 | 4 | #ifndef Py_RANGEOBJECT_H 5 | #define Py_RANGEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* This is about the type 'xrange', not the built-in function range(), which 11 | returns regular lists. */ 12 | 13 | /* 14 | A range object represents an integer range. This is an immutable object; 15 | a range cannot change its value after creation. 16 | 17 | Range objects behave like the corresponding tuple objects except that 18 | they are represented by a start, stop, and step datamembers. 19 | */ 20 | 21 | PyAPI_DATA(PyTypeObject) PyRange_Type; 22 | 23 | #define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) 24 | 25 | #ifdef __cplusplus 26 | } 27 | #endif 28 | #endif /* !Py_RANGEOBJECT_H */ 29 | -------------------------------------------------------------------------------- /inc/setobject.h: -------------------------------------------------------------------------------- 1 | /* Set object interface */ 2 | 3 | #ifndef Py_SETOBJECT_H 4 | #define Py_SETOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | /* 11 | There are three kinds of slots in the table: 12 | 13 | 1. Unused: key == NULL 14 | 2. Active: key != NULL and key != dummy 15 | 3. Dummy: key == dummy 16 | 17 | Note: .pop() abuses the hash field of an Unused or Dummy slot to 18 | hold a search finger. The hash field of Unused or Dummy slots has 19 | no meaning otherwise. 20 | */ 21 | 22 | #define PySet_MINSIZE 8 23 | 24 | typedef struct { 25 | long hash; /* cached hash code for the entry key */ 26 | PyObject *key; 27 | } setentry; 28 | 29 | 30 | /* 31 | This data structure is shared by set and frozenset objects. 32 | */ 33 | 34 | typedef struct _setobject PySetObject; 35 | struct _setobject { 36 | PyObject_HEAD 37 | 38 | Py_ssize_t fill; /* # Active + # Dummy */ 39 | Py_ssize_t used; /* # Active */ 40 | 41 | /* The table contains mask + 1 slots, and that's a power of 2. 42 | * We store the mask instead of the size because the mask is more 43 | * frequently needed. 44 | */ 45 | Py_ssize_t mask; 46 | 47 | /* table points to smalltable for small tables, else to 48 | * additional malloc'ed memory. table is never NULL! This rule 49 | * saves repeated runtime null-tests. 50 | */ 51 | setentry *table; 52 | setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); 53 | setentry smalltable[PySet_MINSIZE]; 54 | 55 | long hash; /* only used by frozenset objects */ 56 | PyObject *weakreflist; /* List of weak references */ 57 | }; 58 | 59 | PyAPI_DATA(PyTypeObject) PySet_Type; 60 | PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; 61 | 62 | /* Invariants for frozensets: 63 | * data is immutable. 64 | * hash is the hash of the frozenset or -1 if not computed yet. 65 | * Invariants for sets: 66 | * hash is -1 67 | */ 68 | 69 | #define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) 70 | #define PyAnySet_CheckExact(ob) \ 71 | (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) 72 | #define PyAnySet_Check(ob) \ 73 | (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ 74 | PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ 75 | PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) 76 | #define PySet_Check(ob) \ 77 | (Py_TYPE(ob) == &PySet_Type || \ 78 | PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) 79 | #define PyFrozenSet_Check(ob) \ 80 | (Py_TYPE(ob) == &PyFrozenSet_Type || \ 81 | PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) 82 | 83 | PyAPI_FUNC(PyObject *) PySet_New(PyObject *); 84 | PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); 85 | PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); 86 | #define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) 87 | PyAPI_FUNC(int) PySet_Clear(PyObject *set); 88 | PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); 89 | PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); 90 | PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); 91 | PyAPI_FUNC(int) _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key); 92 | PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash); 93 | PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); 94 | PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #endif /* !Py_SETOBJECT_H */ 100 | -------------------------------------------------------------------------------- /inc/sliceobject.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_SLICEOBJECT_H 2 | #define Py_SLICEOBJECT_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | /* The unique ellipsis object "..." */ 8 | 9 | PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ 10 | 11 | #define Py_Ellipsis (&_Py_EllipsisObject) 12 | 13 | /* Slice object interface */ 14 | 15 | /* 16 | 17 | A slice object containing start, stop, and step data members (the 18 | names are from range). After much talk with Guido, it was decided to 19 | let these be any arbitrary python type. Py_None stands for omitted values. 20 | */ 21 | 22 | typedef struct { 23 | PyObject_HEAD 24 | PyObject *start, *stop, *step; /* not NULL */ 25 | } PySliceObject; 26 | 27 | PyAPI_DATA(PyTypeObject) PySlice_Type; 28 | PyAPI_DATA(PyTypeObject) PyEllipsis_Type; 29 | 30 | #define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) 31 | 32 | PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, 33 | PyObject* step); 34 | PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); 35 | PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, 36 | Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); 37 | PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, 38 | Py_ssize_t *start, Py_ssize_t *stop, 39 | Py_ssize_t *step, Py_ssize_t *slicelength); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | #endif /* !Py_SLICEOBJECT_H */ 45 | -------------------------------------------------------------------------------- /inc/structmember.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_STRUCTMEMBER_H 2 | #define Py_STRUCTMEMBER_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | 8 | /* Interface to map C struct members to Python object attributes */ 9 | 10 | #include /* For offsetof */ 11 | 12 | /* The offsetof() macro calculates the offset of a structure member 13 | in its structure. Unfortunately this cannot be written down 14 | portably, hence it is provided by a Standard C header file. 15 | For pre-Standard C compilers, here is a version that usually works 16 | (but watch out!): */ 17 | 18 | #ifndef offsetof 19 | #define offsetof(type, member) ( (int) & ((type*)0) -> member ) 20 | #endif 21 | 22 | /* An array of memberlist structures defines the name, type and offset 23 | of selected members of a C structure. These can be read by 24 | PyMember_Get() and set by PyMember_Set() (except if their READONLY flag 25 | is set). The array must be terminated with an entry whose name 26 | pointer is NULL. */ 27 | 28 | struct memberlist { 29 | /* Obsolete version, for binary backwards compatibility */ 30 | char *name; 31 | int type; 32 | int offset; 33 | int flags; 34 | }; 35 | 36 | typedef struct PyMemberDef { 37 | /* Current version, use this */ 38 | char *name; 39 | int type; 40 | Py_ssize_t offset; 41 | int flags; 42 | char *doc; 43 | } PyMemberDef; 44 | 45 | /* Types */ 46 | #define T_SHORT 0 47 | #define T_INT 1 48 | #define T_LONG 2 49 | #define T_FLOAT 3 50 | #define T_DOUBLE 4 51 | #define T_STRING 5 52 | #define T_OBJECT 6 53 | /* XXX the ordering here is weird for binary compatibility */ 54 | #define T_CHAR 7 /* 1-character string */ 55 | #define T_BYTE 8 /* 8-bit signed int */ 56 | /* unsigned variants: */ 57 | #define T_UBYTE 9 58 | #define T_USHORT 10 59 | #define T_UINT 11 60 | #define T_ULONG 12 61 | 62 | /* Added by Jack: strings contained in the structure */ 63 | #define T_STRING_INPLACE 13 64 | 65 | /* Added by Lillo: bools contained in the structure (assumed char) */ 66 | #define T_BOOL 14 67 | 68 | #define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError 69 | when the value is NULL, instead of 70 | converting to None. */ 71 | #ifdef HAVE_LONG_LONG 72 | #define T_LONGLONG 17 73 | #define T_ULONGLONG 18 74 | #endif /* HAVE_LONG_LONG */ 75 | 76 | #define T_PYSSIZET 19 /* Py_ssize_t */ 77 | 78 | 79 | /* Flags */ 80 | #define READONLY 1 81 | #define RO READONLY /* Shorthand */ 82 | #define READ_RESTRICTED 2 83 | #define PY_WRITE_RESTRICTED 4 84 | #define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) 85 | 86 | 87 | /* Obsolete API, for binary backwards compatibility */ 88 | PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *); 89 | PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *); 90 | 91 | /* Current API, use this */ 92 | PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); 93 | PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); 94 | 95 | 96 | #ifdef __cplusplus 97 | } 98 | #endif 99 | #endif /* !Py_STRUCTMEMBER_H */ 100 | -------------------------------------------------------------------------------- /inc/structseq.h: -------------------------------------------------------------------------------- 1 | 2 | /* Tuple object interface */ 3 | 4 | #ifndef Py_STRUCTSEQ_H 5 | #define Py_STRUCTSEQ_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct PyStructSequence_Field { 11 | char *name; 12 | char *doc; 13 | } PyStructSequence_Field; 14 | 15 | typedef struct PyStructSequence_Desc { 16 | char *name; 17 | char *doc; 18 | struct PyStructSequence_Field *fields; 19 | int n_in_sequence; 20 | } PyStructSequence_Desc; 21 | 22 | extern char* PyStructSequence_UnnamedField; 23 | 24 | PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, 25 | PyStructSequence_Desc *desc); 26 | 27 | PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); 28 | 29 | typedef struct { 30 | PyObject_VAR_HEAD 31 | PyObject *ob_item[1]; 32 | } PyStructSequence; 33 | 34 | /* Macro, *only* to be used to fill in brand new objects */ 35 | #define PyStructSequence_SET_ITEM(op, i, v) \ 36 | (((PyStructSequence *)(op))->ob_item[i] = v) 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | #endif /* !Py_STRUCTSEQ_H */ 42 | -------------------------------------------------------------------------------- /inc/sysmodule.h: -------------------------------------------------------------------------------- 1 | 2 | /* System module interface */ 3 | 4 | #ifndef Py_SYSMODULE_H 5 | #define Py_SYSMODULE_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | PyAPI_FUNC(PyObject *) PySys_GetObject(char *); 11 | PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *); 12 | PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); 13 | PyAPI_FUNC(void) PySys_SetArgv(int, char **); 14 | PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int); 15 | PyAPI_FUNC(void) PySys_SetPath(char *); 16 | 17 | PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) 18 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 19 | PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) 20 | Py_GCC_ATTRIBUTE((format(printf, 1, 2))); 21 | 22 | PyAPI_DATA(PyObject *) _PySys_TraceFunc, *_PySys_ProfileFunc; 23 | PyAPI_DATA(int) _PySys_CheckInterval; 24 | 25 | PyAPI_FUNC(void) PySys_ResetWarnOptions(void); 26 | PyAPI_FUNC(void) PySys_AddWarnOption(char *); 27 | PyAPI_FUNC(int) PySys_HasWarnOptions(void); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif 32 | #endif /* !Py_SYSMODULE_H */ 33 | -------------------------------------------------------------------------------- /inc/timefuncs.h: -------------------------------------------------------------------------------- 1 | /* timefuncs.h 2 | */ 3 | 4 | /* Utility function related to timemodule.c. */ 5 | 6 | #ifndef TIMEFUNCS_H 7 | #define TIMEFUNCS_H 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | 13 | /* Cast double x to time_t, but raise ValueError if x is too large 14 | * to fit in a time_t. ValueError is set on return iff the return 15 | * value is (time_t)-1 and PyErr_Occurred(). 16 | */ 17 | PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); 18 | 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | #endif /* TIMEFUNCS_H */ 24 | -------------------------------------------------------------------------------- /inc/token.h: -------------------------------------------------------------------------------- 1 | 2 | /* Token types */ 3 | 4 | #ifndef Py_TOKEN_H 5 | #define Py_TOKEN_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | #undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ 11 | 12 | #define ENDMARKER 0 13 | #define NAME 1 14 | #define NUMBER 2 15 | #define STRING 3 16 | #define NEWLINE 4 17 | #define INDENT 5 18 | #define DEDENT 6 19 | #define LPAR 7 20 | #define RPAR 8 21 | #define LSQB 9 22 | #define RSQB 10 23 | #define COLON 11 24 | #define COMMA 12 25 | #define SEMI 13 26 | #define PLUS 14 27 | #define MINUS 15 28 | #define STAR 16 29 | #define SLASH 17 30 | #define VBAR 18 31 | #define AMPER 19 32 | #define LESS 20 33 | #define GREATER 21 34 | #define EQUAL 22 35 | #define DOT 23 36 | #define PERCENT 24 37 | #define BACKQUOTE 25 38 | #define LBRACE 26 39 | #define RBRACE 27 40 | #define EQEQUAL 28 41 | #define NOTEQUAL 29 42 | #define LESSEQUAL 30 43 | #define GREATEREQUAL 31 44 | #define TILDE 32 45 | #define CIRCUMFLEX 33 46 | #define LEFTSHIFT 34 47 | #define RIGHTSHIFT 35 48 | #define DOUBLESTAR 36 49 | #define PLUSEQUAL 37 50 | #define MINEQUAL 38 51 | #define STAREQUAL 39 52 | #define SLASHEQUAL 40 53 | #define PERCENTEQUAL 41 54 | #define AMPEREQUAL 42 55 | #define VBAREQUAL 43 56 | #define CIRCUMFLEXEQUAL 44 57 | #define LEFTSHIFTEQUAL 45 58 | #define RIGHTSHIFTEQUAL 46 59 | #define DOUBLESTAREQUAL 47 60 | #define DOUBLESLASH 48 61 | #define DOUBLESLASHEQUAL 49 62 | #define AT 50 63 | /* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ 64 | #define OP 51 65 | #define ERRORTOKEN 52 66 | #define N_TOKENS 53 67 | 68 | /* Special definitions for cooperation with parser */ 69 | 70 | #define NT_OFFSET 256 71 | 72 | #define ISTERMINAL(x) ((x) < NT_OFFSET) 73 | #define ISNONTERMINAL(x) ((x) >= NT_OFFSET) 74 | #define ISEOF(x) ((x) == ENDMARKER) 75 | 76 | 77 | PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ 78 | PyAPI_FUNC(int) PyToken_OneChar(int); 79 | PyAPI_FUNC(int) PyToken_TwoChars(int, int); 80 | PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | #endif /* !Py_TOKEN_H */ 86 | -------------------------------------------------------------------------------- /inc/traceback.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef Py_TRACEBACK_H 3 | #define Py_TRACEBACK_H 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | struct _frame; 9 | 10 | /* Traceback interface */ 11 | 12 | typedef struct _traceback { 13 | PyObject_HEAD 14 | struct _traceback *tb_next; 15 | struct _frame *tb_frame; 16 | int tb_lasti; 17 | int tb_lineno; 18 | } PyTracebackObject; 19 | 20 | PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); 21 | PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); 22 | PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int); 23 | 24 | /* Reveal traceback type so we can typecheck traceback objects */ 25 | PyAPI_DATA(PyTypeObject) PyTraceBack_Type; 26 | #define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* !Py_TRACEBACK_H */ 32 | -------------------------------------------------------------------------------- /inc/tupleobject.h: -------------------------------------------------------------------------------- 1 | 2 | /* Tuple object interface */ 3 | 4 | #ifndef Py_TUPLEOBJECT_H 5 | #define Py_TUPLEOBJECT_H 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | /* 11 | Another generally useful object type is a tuple of object pointers. 12 | For Python, this is an immutable type. C code can change the tuple items 13 | (but not their number), and even use tuples are general-purpose arrays of 14 | object references, but in general only brand new tuples should be mutated, 15 | not ones that might already have been exposed to Python code. 16 | 17 | *** WARNING *** PyTuple_SetItem does not increment the new item's reference 18 | count, but does decrement the reference count of the item it replaces, 19 | if not nil. It does *decrement* the reference count if it is *not* 20 | inserted in the tuple. Similarly, PyTuple_GetItem does not increment the 21 | returned item's reference count. 22 | */ 23 | 24 | typedef struct { 25 | PyObject_VAR_HEAD 26 | PyObject *ob_item[1]; 27 | 28 | /* ob_item contains space for 'ob_size' elements. 29 | * Items must normally not be NULL, except during construction when 30 | * the tuple is not yet visible outside the function that builds it. 31 | */ 32 | } PyTupleObject; 33 | 34 | PyAPI_DATA(PyTypeObject) PyTuple_Type; 35 | 36 | #define PyTuple_Check(op) \ 37 | PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) 38 | #define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) 39 | 40 | PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); 41 | PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); 42 | PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); 43 | PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); 44 | PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); 45 | PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); 46 | PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); 47 | PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); 48 | 49 | /* Macro, trading safety for speed */ 50 | #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) 51 | #define PyTuple_GET_SIZE(op) Py_SIZE(op) 52 | 53 | /* Macro, *only* to be used to fill in brand new tuples */ 54 | #define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) 55 | 56 | PyAPI_FUNC(int) PyTuple_ClearFreeList(void); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | #endif /* !Py_TUPLEOBJECT_H */ 62 | -------------------------------------------------------------------------------- /inc/ucnhash.h: -------------------------------------------------------------------------------- 1 | /* Unicode name database interface */ 2 | 3 | #ifndef Py_UCNHASH_H 4 | #define Py_UCNHASH_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | /* revised ucnhash CAPI interface (exported through a "wrapper") */ 10 | 11 | #define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" 12 | 13 | typedef struct { 14 | 15 | /* Size of this struct */ 16 | int size; 17 | 18 | /* Get name for a given character code. Returns non-zero if 19 | success, zero if not. Does not set Python exceptions. 20 | If self is NULL, data come from the default version of the database. 21 | If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ 22 | int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen); 23 | 24 | /* Get character code for a given name. Same error handling 25 | as for getname. */ 26 | int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code); 27 | 28 | } _PyUnicode_Name_CAPI; 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | #endif /* !Py_UCNHASH_H */ 34 | -------------------------------------------------------------------------------- /inc/warnings.h: -------------------------------------------------------------------------------- 1 | #ifndef Py_WARNINGS_H 2 | #define Py_WARNINGS_H 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | PyAPI_FUNC(void) _PyWarnings_Init(void); 8 | 9 | PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t); 10 | PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int, 11 | const char *, PyObject *); 12 | 13 | #define PyErr_WarnPy3k(msg, stacklevel) \ 14 | (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0) 15 | 16 | /* DEPRECATED: Use PyErr_WarnEx() instead. */ 17 | #define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | #endif /* !Py_WARNINGS_H */ 23 | 24 | -------------------------------------------------------------------------------- /inc/weakrefobject.h: -------------------------------------------------------------------------------- 1 | /* Weak references objects for Python. */ 2 | 3 | #ifndef Py_WEAKREFOBJECT_H 4 | #define Py_WEAKREFOBJECT_H 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | 10 | typedef struct _PyWeakReference PyWeakReference; 11 | 12 | /* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, 13 | * and CallableProxyType. 14 | */ 15 | struct _PyWeakReference { 16 | PyObject_HEAD 17 | 18 | /* The object to which this is a weak reference, or Py_None if none. 19 | * Note that this is a stealth reference: wr_object's refcount is 20 | * not incremented to reflect this pointer. 21 | */ 22 | PyObject *wr_object; 23 | 24 | /* A callable to invoke when wr_object dies, or NULL if none. */ 25 | PyObject *wr_callback; 26 | 27 | /* A cache for wr_object's hash code. As usual for hashes, this is -1 28 | * if the hash code isn't known yet. 29 | */ 30 | long hash; 31 | 32 | /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- 33 | * terminated list of weak references to it. These are the list pointers. 34 | * If wr_object goes away, wr_object is set to Py_None, and these pointers 35 | * have no meaning then. 36 | */ 37 | PyWeakReference *wr_prev; 38 | PyWeakReference *wr_next; 39 | }; 40 | 41 | PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; 42 | PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; 43 | PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; 44 | 45 | #define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) 46 | #define PyWeakref_CheckRefExact(op) \ 47 | (Py_TYPE(op) == &_PyWeakref_RefType) 48 | #define PyWeakref_CheckProxy(op) \ 49 | ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ 50 | (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) 51 | 52 | /* This macro calls PyWeakref_CheckRef() last since that can involve a 53 | function call; this makes it more likely that the function call 54 | will be avoided. */ 55 | #define PyWeakref_Check(op) \ 56 | (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) 57 | 58 | 59 | PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, 60 | PyObject *callback); 61 | PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, 62 | PyObject *callback); 63 | PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); 64 | 65 | PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); 66 | 67 | PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); 68 | 69 | #define PyWeakref_GET_OBJECT(ref) (((PyWeakReference *)(ref))->wr_object) 70 | 71 | 72 | #ifdef __cplusplus 73 | } 74 | #endif 75 | #endif /* !Py_WEAKREFOBJECT_H */ 76 | -------------------------------------------------------------------------------- /lib/Linux/x64/libpython2.7.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Linux/x64/libpython2.7.a -------------------------------------------------------------------------------- /lib/Linux/x64/libpython2.7.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Linux/x64/libpython2.7.so -------------------------------------------------------------------------------- /lib/Windows/x64/python27.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x64/python27.exp -------------------------------------------------------------------------------- /lib/Windows/x64/python27.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x64/python27.lib -------------------------------------------------------------------------------- /lib/Windows/x64/python27_d.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x64/python27_d.exp -------------------------------------------------------------------------------- /lib/Windows/x64/python27_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x64/python27_d.lib -------------------------------------------------------------------------------- /lib/Windows/x86/python27.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x86/python27.exp -------------------------------------------------------------------------------- /lib/Windows/x86/python27.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x86/python27.lib -------------------------------------------------------------------------------- /lib/Windows/x86/python27_d.exp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x86/python27_d.exp -------------------------------------------------------------------------------- /lib/Windows/x86/python27_d.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/austinsc/python/3f8fa00528daa3e3849be251f05227842905c7a9/lib/Windows/x86/python27_d.lib --------------------------------------------------------------------------------