AppPkg/Applications/Hello/Hello.inf # No LibC includes or functions.\r
AppPkg/Applications/Main/Main.inf # Simple invocation. No other LibC functions.\r
AppPkg/Applications/Enquire/Enquire.inf\r
+ AppPkg/Applications/Python/PythonCore.inf\r
\r
################################################################\r
#\r
--- /dev/null
+/* Module configuration */\r
+\r
+/* This file contains the table of built-in modules.\r
+ See init_builtin() in import.c. */\r
+\r
+#include "Python.h"\r
+\r
+extern void initarray(void);\r
+//#ifndef MS_WINI64\r
+//extern void initaudioop(void);\r
+//#endif\r
+extern void initbinascii(void);\r
+extern void initcmath(void);\r
+extern void initerrno(void);\r
+extern void initfuture_builtins(void);\r
+extern void initgc(void);\r
+#ifndef MS_WINI64\r
+extern void initimageop(void);\r
+#endif\r
+extern void initmath(void);\r
+extern void init_md5(void);\r
+extern void initnt(void);\r
+extern void initoperator(void);\r
+extern void initsignal(void);\r
+extern void init_sha(void);\r
+extern void init_sha256(void);\r
+extern void init_sha512(void);\r
+extern void initstrop(void);\r
+extern void inittime(void);\r
+//extern void initthread(void);\r
+extern void initcStringIO(void);\r
+extern void initcPickle(void);\r
+#ifdef WIN32\r
+extern void initmsvcrt(void);\r
+extern void init_locale(void);\r
+#endif\r
+extern void init_codecs(void);\r
+extern void init_weakref(void);\r
+extern void init_hotshot(void);\r
+extern void initxxsubtype(void);\r
+//extern void initzipimport(void);\r
+extern void init_random(void);\r
+extern void inititertools(void);\r
+extern void init_collections(void);\r
+extern void init_heapq(void);\r
+extern void init_bisect(void);\r
+extern void init_symtable(void);\r
+//extern void initmmap(void);\r
+extern void init_csv(void);\r
+extern void init_sre(void);\r
+extern void initparser(void);\r
+//extern void init_winreg(void);\r
+extern void init_struct(void);\r
+extern void initdatetime(void);\r
+extern void init_functools(void);\r
+extern void init_json(void);\r
+//extern void initzlib(void);\r
+\r
+extern void init_multibytecodec(void);\r
+extern void init_codecs_cn(void);\r
+extern void init_codecs_hk(void);\r
+extern void init_codecs_iso2022(void);\r
+extern void init_codecs_jp(void);\r
+extern void init_codecs_kr(void);\r
+extern void init_codecs_tw(void);\r
+//extern void init_subprocess(void);\r
+//extern void init_lsprof(void);\r
+extern void init_ast(void);\r
+extern void init_io(void);\r
+extern void _PyWarnings_Init(void);\r
+\r
+/* tools/freeze/makeconfig.py marker for additional "extern" */\r
+/* -- ADDMODULE MARKER 1 -- */\r
+\r
+extern void PyMarshal_Init(void);\r
+extern void initimp(void);\r
+\r
+struct _inittab _PyImport_Inittab[] = {\r
+\r
+ {"array", initarray},\r
+ {"_ast", init_ast},\r
+//#ifdef MS_WINDOWS\r
+//#ifndef MS_WINI64\r
+// {"audioop", initaudioop},\r
+//#endif\r
+//#endif\r
+ {"binascii", initbinascii},\r
+ //{"cmath", initcmath},\r
+ {"errno", initerrno},\r
+ {"future_builtins", initfuture_builtins},\r
+ {"gc", initgc},\r
+#ifndef MS_WINI64\r
+ {"imageop", initimageop},\r
+#endif\r
+ {"math", initmath},\r
+ {"_md5", init_md5},\r
+ //{"nt", initnt}, /* Use the NT os functions, not posix */\r
+ {"operator", initoperator},\r
+ {"signal", initsignal},\r
+ {"_sha", init_sha},\r
+ {"_sha256", init_sha256},\r
+ {"_sha512", init_sha512},\r
+ {"strop", initstrop},\r
+ {"time", inittime},\r
+#ifdef WITH_THREAD\r
+ {"thread", initthread},\r
+#endif\r
+ {"cStringIO", initcStringIO},\r
+ {"cPickle", initcPickle},\r
+#ifdef WIN32\r
+ {"msvcrt", initmsvcrt},\r
+ {"_locale", init_locale},\r
+#endif\r
+ /* XXX Should _subprocess go in a WIN32 block? not WIN64? */\r
+ //{"_subprocess", init_subprocess},\r
+\r
+ {"_codecs", init_codecs},\r
+ //{"_weakref", init_weakref},\r
+ //{"_hotshot", init_hotshot},\r
+ {"_random", init_random},\r
+ {"_bisect", init_bisect},\r
+ {"_heapq", init_heapq},\r
+ //{"_lsprof", init_lsprof},\r
+ {"itertools", inititertools},\r
+ {"_collections", init_collections},\r
+ {"_symtable", init_symtable},\r
+ //{"mmap", initmmap},\r
+ {"_csv", init_csv},\r
+ {"_sre", init_sre},\r
+ {"parser", initparser},\r
+ //{"_winreg", init_winreg},\r
+ {"_struct", init_struct},\r
+ //{"datetime", initdatetime},\r
+ {"_functools", init_functools},\r
+ {"_json", init_json},\r
+\r
+ {"xxsubtype", initxxsubtype},\r
+ //{"zipimport", initzipimport},\r
+ //{"zlib", initzlib},\r
+\r
+ /* CJK codecs */\r
+ {"_multibytecodec", init_multibytecodec},\r
+ {"_codecs_cn", init_codecs_cn},\r
+ {"_codecs_hk", init_codecs_hk},\r
+ {"_codecs_iso2022", init_codecs_iso2022},\r
+ {"_codecs_jp", init_codecs_jp},\r
+ {"_codecs_kr", init_codecs_kr},\r
+ {"_codecs_tw", init_codecs_tw},\r
+\r
+/* tools/freeze/makeconfig.py marker for additional "_inittab" entries */\r
+/* -- ADDMODULE MARKER 2 -- */\r
+\r
+ /* This module "lives in" with marshal.c */\r
+ {"marshal", PyMarshal_Init},\r
+\r
+ /* This lives it with import.c */\r
+ {"imp", initimp},\r
+\r
+ /* These entries are here for sys.builtin_module_names */\r
+ {"__main__", NULL},\r
+ {"__builtin__", NULL},\r
+ {"sys", NULL},\r
+ {"exceptions", NULL},\r
+ {"_warnings", _PyWarnings_Init},\r
+\r
+ {"_io", init_io},\r
+\r
+ /* Sentinel */\r
+ {0, 0}\r
+};\r
--- /dev/null
+/* @file\r
+ Manually generated Python Configuration file for EDK II.\r
+*/\r
+\r
+\r
+#ifndef Py_PYCONFIG_H\r
+#define Py_PYCONFIG_H\r
+\r
+#ifndef PYTHONPATH\r
+# define PYTHONPATH "/Efi/Python;/Efi/Python/Lib"\r
+#endif\r
+\r
+/* Define if building universal (internal helper macro) */\r
+#undef AC_APPLE_UNIVERSAL_BUILD\r
+\r
+/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want\r
+ support for AIX C++ shared extension modules. */\r
+#undef AIX_GENUINE_CPLUSPLUS\r
+\r
+/* Define this if you have AtheOS threads. */\r
+#undef ATHEOS_THREADS\r
+\r
+/* Define this if you have BeOS threads. */\r
+#undef BEOS_THREADS\r
+\r
+/* Define if you have the Mach cthreads package */\r
+#undef C_THREADS\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM\r
+ mixed-endian order (byte order 45670123) */\r
+#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most\r
+ significant byte first */\r
+#undef DOUBLE_IS_BIG_ENDIAN_IEEE754\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the\r
+ least significant byte first */\r
+#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754\r
+\r
+/* Define if --enable-ipv6 is specified */\r
+#undef ENABLE_IPV6\r
+\r
+/* Define if flock needs to be linked with bsd library. */\r
+#undef FLOCK_NEEDS_LIBBSD\r
+\r
+/* Define if getpgrp() must be called as getpgrp(0). */\r
+#undef GETPGRP_HAVE_ARG\r
+\r
+/* Define if gettimeofday() does not have second (timezone) argument This is\r
+ the case on Motorola V4 (R40V4.2) */\r
+#undef GETTIMEOFDAY_NO_TZ\r
+\r
+/* Define to 1 if you have the `acosh' function. */\r
+#undef HAVE_ACOSH\r
+\r
+/* struct addrinfo (netdb.h) */\r
+#undef HAVE_ADDRINFO\r
+\r
+/* Define to 1 if you have the `alarm' function. */\r
+#undef HAVE_ALARM\r
+\r
+/* Define this if your time.h defines altzone. */\r
+#undef HAVE_ALTZONE\r
+\r
+/* Define to 1 if you have the `asinh' function. */\r
+#undef HAVE_ASINH\r
+\r
+/* Define to 1 if you have the <asm/types.h> header file. */\r
+#undef HAVE_ASM_TYPES_H\r
+\r
+/* Define to 1 if you have the `atanh' function. */\r
+#undef HAVE_ATANH\r
+\r
+/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */\r
+#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE\r
+\r
+/* Define to 1 if you have the `bind_textdomain_codeset' function. */\r
+#undef HAVE_BIND_TEXTDOMAIN_CODESET\r
+\r
+/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */\r
+#undef HAVE_BLUETOOTH_BLUETOOTH_H\r
+\r
+/* Define to 1 if you have the <bluetooth.h> header file. */\r
+#undef HAVE_BLUETOOTH_H\r
+\r
+/* Define if nice() returns success/failure instead of the new priority. */\r
+#undef HAVE_BROKEN_NICE\r
+\r
+/* Define if the system reports an invalid PIPE_BUF value. */\r
+#undef HAVE_BROKEN_PIPE_BUF\r
+\r
+/* Define if poll() sets errno on invalid file descriptors. */\r
+#undef HAVE_BROKEN_POLL\r
+\r
+/* Define if the Posix semaphores do not work on your system */\r
+#define HAVE_BROKEN_POSIX_SEMAPHORES 1\r
+\r
+/* Define if pthread_sigmask() does not work on your system. */\r
+#define HAVE_BROKEN_PTHREAD_SIGMASK 1\r
+\r
+/* define to 1 if your sem_getvalue is broken. */\r
+#define HAVE_BROKEN_SEM_GETVALUE 1\r
+\r
+/* Define this if you have the type _Bool. */\r
+#define HAVE_C99_BOOL 1\r
+\r
+/* Define to 1 if you have the `chflags' function. */\r
+#undef HAVE_CHFLAGS\r
+\r
+/* Define to 1 if you have the `chown' function. */\r
+#undef HAVE_CHOWN\r
+\r
+/* Define if you have the 'chroot' function. */\r
+#undef HAVE_CHROOT\r
+\r
+/* Define to 1 if you have the `clock' function. */\r
+#define HAVE_CLOCK 1\r
+\r
+/* Define to 1 if you have the `confstr' function. */\r
+#undef HAVE_CONFSTR\r
+\r
+/* Define to 1 if you have the <conio.h> header file. */\r
+#undef HAVE_CONIO_H\r
+\r
+/* Define to 1 if you have the `copysign' function. */\r
+#undef HAVE_COPYSIGN\r
+\r
+/* Define to 1 if you have the `ctermid' function. */\r
+#undef HAVE_CTERMID\r
+\r
+/* Define if you have the 'ctermid_r' function. */\r
+#undef HAVE_CTERMID_R\r
+\r
+/* Define to 1 if you have the <curses.h> header file. */\r
+#undef HAVE_CURSES_H\r
+\r
+/* Define if you have the 'is_term_resized' function. */\r
+#undef HAVE_CURSES_IS_TERM_RESIZED\r
+\r
+/* Define if you have the 'resizeterm' function. */\r
+#undef HAVE_CURSES_RESIZETERM\r
+\r
+/* Define if you have the 'resize_term' function. */\r
+#undef HAVE_CURSES_RESIZE_TERM\r
+\r
+/* Define to 1 if you have the declaration of `isfinite', and to 0 if you\r
+ don't. */\r
+#define HAVE_DECL_ISFINITE 0\r
+\r
+/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_ISINF 1\r
+\r
+/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_ISNAN 1\r
+\r
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_TZNAME 0\r
+\r
+/* Define to 1 if you have the device macros. */\r
+#undef HAVE_DEVICE_MACROS\r
+\r
+/* Define if we have /dev/ptc. */\r
+#undef HAVE_DEV_PTC\r
+\r
+/* Define if we have /dev/ptmx. */\r
+#undef HAVE_DEV_PTMX\r
+\r
+/* Define to 1 if you have the <direct.h> header file. */\r
+#undef HAVE_DIRECT_H\r
+\r
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_DIRENT_H\r
+\r
+/* Define to 1 if you have the <dlfcn.h> header file. */\r
+#undef HAVE_DLFCN_H\r
+\r
+/* Define to 1 if you have the `dlopen' function. */\r
+#undef HAVE_DLOPEN\r
+\r
+/* Define to 1 if you have the `dup2' function. */\r
+#define HAVE_DUP2 1\r
+\r
+/* Defined when any dynamic module loading is enabled. */\r
+#undef HAVE_DYNAMIC_LOADING\r
+\r
+/* Define if you have the 'epoll' functions. */\r
+#undef HAVE_EPOLL\r
+\r
+/* Define to 1 if you have the `erf' function. */\r
+#undef HAVE_ERF\r
+\r
+/* Define to 1 if you have the `erfc' function. */\r
+#undef HAVE_ERFC\r
+\r
+/* Define to 1 if you have the <errno.h> header file. */\r
+#define HAVE_ERRNO_H 1\r
+\r
+/* Define to 1 if you have the `execv' function. */\r
+#undef HAVE_EXECV\r
+\r
+/* Define to 1 if you have the `expm1' function. */\r
+#undef HAVE_EXPM1\r
+\r
+/* Define if you have the 'fchdir' function. */\r
+#undef HAVE_FCHDIR\r
+\r
+/* Define to 1 if you have the `fchmod' function. */\r
+#undef HAVE_FCHMOD\r
+\r
+/* Define to 1 if you have the `fchown' function. */\r
+#undef HAVE_FCHOWN\r
+\r
+/* Define to 1 if you have the <fcntl.h> header file. */\r
+#define HAVE_FCNTL_H 1\r
+\r
+/* Define if you have the 'fdatasync' function. */\r
+#undef HAVE_FDATASYNC\r
+\r
+/* Define to 1 if you have the `finite' function. */\r
+#define HAVE_FINITE 1\r
+\r
+/* Define to 1 if you have the `flock' function. */\r
+#undef HAVE_FLOCK\r
+\r
+/* Define to 1 if you have the `fork' function. */\r
+#undef HAVE_FORK\r
+\r
+/* Define to 1 if you have the `forkpty' function. */\r
+#undef HAVE_FORKPTY\r
+\r
+/* Define to 1 if you have the `fpathconf' function. */\r
+#undef HAVE_FPATHCONF\r
+\r
+/* Define to 1 if you have the `fseek64' function. */\r
+#undef HAVE_FSEEK64\r
+\r
+/* Define to 1 if you have the `fseeko' function. */\r
+#define HAVE_FSEEKO 1\r
+\r
+/* Define to 1 if you have the `fstatvfs' function. */\r
+#undef HAVE_FSTATVFS\r
+\r
+/* Define if you have the 'fsync' function. */\r
+#undef HAVE_FSYNC\r
+\r
+/* Define to 1 if you have the `ftell64' function. */\r
+#undef HAVE_FTELL64\r
+\r
+/* Define to 1 if you have the `ftello' function. */\r
+#define HAVE_FTELLO 1\r
+\r
+/* Define to 1 if you have the `ftime' function. */\r
+#undef HAVE_FTIME\r
+\r
+/* Define to 1 if you have the `ftruncate' function. */\r
+#undef HAVE_FTRUNCATE\r
+\r
+/* Define to 1 if you have the `gai_strerror' function. */\r
+#undef HAVE_GAI_STRERROR\r
+\r
+/* Define to 1 if you have the `gamma' function. */\r
+#undef HAVE_GAMMA\r
+\r
+/* Define if we can use gcc inline assembler to get and set x87 control word\r
+*/\r
+#if defined(__GNUC__)\r
+ #define HAVE_GCC_ASM_FOR_X87 1\r
+#else\r
+ #undef HAVE_GCC_ASM_FOR_X87\r
+#endif\r
+\r
+/* Define if you have the getaddrinfo function. */\r
+#undef HAVE_GETADDRINFO\r
+\r
+/* Define to 1 if you have the `getcwd' function. */\r
+#undef HAVE_GETCWD\r
+\r
+/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */\r
+#undef HAVE_GETC_UNLOCKED\r
+\r
+/* Define to 1 if you have the `getgroups' function. */\r
+#undef HAVE_GETGROUPS\r
+\r
+/* Define to 1 if you have the `gethostbyname' function. */\r
+#undef HAVE_GETHOSTBYNAME\r
+\r
+/* Define this if you have some version of gethostbyname_r() */\r
+#undef HAVE_GETHOSTBYNAME_R\r
+\r
+/* Define this if you have the 3-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_3_ARG\r
+\r
+/* Define this if you have the 5-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_5_ARG\r
+\r
+/* Define this if you have the 6-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_6_ARG\r
+\r
+/* Define to 1 if you have the `getitimer' function. */\r
+#undef HAVE_GETITIMER\r
+\r
+/* Define to 1 if you have the `getloadavg' function. */\r
+#undef HAVE_GETLOADAVG\r
+\r
+/* Define to 1 if you have the `getlogin' function. */\r
+#undef HAVE_GETLOGIN\r
+\r
+/* Define to 1 if you have the `getnameinfo' function. */\r
+#undef HAVE_GETNAMEINFO\r
+\r
+/* Define if you have the 'getpagesize' function. */\r
+#undef HAVE_GETPAGESIZE\r
+\r
+/* Define to 1 if you have the `getpeername' function. */\r
+#undef HAVE_GETPEERNAME\r
+\r
+/* Define to 1 if you have the `getpgid' function. */\r
+#undef HAVE_GETPGID\r
+\r
+/* Define to 1 if you have the `getpgrp' function. */\r
+#undef HAVE_GETPGRP\r
+\r
+/* Define to 1 if you have the `getpid' function. */\r
+#undef HAVE_GETPID\r
+\r
+/* Define to 1 if you have the `getpriority' function. */\r
+#undef HAVE_GETPRIORITY\r
+\r
+/* Define to 1 if you have the `getpwent' function. */\r
+#undef HAVE_GETPWENT\r
+\r
+/* Define to 1 if you have the `getresgid' function. */\r
+#undef HAVE_GETRESGID\r
+\r
+/* Define to 1 if you have the `getresuid' function. */\r
+#undef HAVE_GETRESUID\r
+\r
+/* Define to 1 if you have the `getsid' function. */\r
+#undef HAVE_GETSID\r
+\r
+/* Define to 1 if you have the `getspent' function. */\r
+#undef HAVE_GETSPENT\r
+\r
+/* Define to 1 if you have the `getspnam' function. */\r
+#undef HAVE_GETSPNAM\r
+\r
+/* Define to 1 if you have the `gettimeofday' function. */\r
+#undef HAVE_GETTIMEOFDAY\r
+\r
+/* Define to 1 if you have the `getwd' function. */\r
+#undef HAVE_GETWD\r
+\r
+/* Define to 1 if you have the <grp.h> header file. */\r
+#undef HAVE_GRP_H\r
+\r
+/* Define if you have the 'hstrerror' function. */\r
+#undef HAVE_HSTRERROR\r
+\r
+/* Define to 1 if you have the `hypot' function. */\r
+#undef HAVE_HYPOT\r
+\r
+/* Define to 1 if you have the <ieeefp.h> header file. */\r
+#undef HAVE_IEEEFP_H\r
+\r
+/* Define if you have the 'inet_aton' function. */\r
+#define HAVE_INET_ATON 1\r
+\r
+/* Define if you have the 'inet_pton' function. */\r
+#define HAVE_INET_PTON 1\r
+\r
+/* Define to 1 if you have the `initgroups' function. */\r
+#undef HAVE_INITGROUPS\r
+\r
+/* Define to 1 if you have the <inttypes.h> header file. */\r
+#define HAVE_INTTYPES_H 1\r
+\r
+/* Define to 1 if you have the <io.h> header file. */\r
+#undef HAVE_IO_H\r
+\r
+/* Define to 1 if you have the `kill' function. */\r
+#undef HAVE_KILL\r
+\r
+/* Define to 1 if you have the `killpg' function. */\r
+#undef HAVE_KILLPG\r
+\r
+/* Define if you have the 'kqueue' functions. */\r
+#undef HAVE_KQUEUE\r
+\r
+/* Define to 1 if you have the <langinfo.h> header file. */\r
+#define HAVE_LANGINFO_H 1\r
+\r
+/* Defined to enable large file support when an off_t is bigger than a long\r
+ and long long is available and at least as big as an off_t. You may need to\r
+ add some flags for configuration and compilation to enable this mode. (For\r
+ Solaris and Linux, the necessary defines are already defined.) */\r
+#undef HAVE_LARGEFILE_SUPPORT\r
+\r
+/* Define to 1 if you have the `lchflags' function. */\r
+#undef HAVE_LCHFLAGS\r
+\r
+/* Define to 1 if you have the `lchmod' function. */\r
+#undef HAVE_LCHMOD\r
+\r
+/* Define to 1 if you have the `lchown' function. */\r
+#undef HAVE_LCHOWN\r
+\r
+/* Define to 1 if you have the `lgamma' function. */\r
+#undef HAVE_LGAMMA\r
+\r
+/* Define to 1 if you have the `dl' library (-ldl). */\r
+#undef HAVE_LIBDL\r
+\r
+/* Define to 1 if you have the `dld' library (-ldld). */\r
+#undef HAVE_LIBDLD\r
+\r
+/* Define to 1 if you have the `ieee' library (-lieee). */\r
+#undef HAVE_LIBIEEE\r
+\r
+/* Define to 1 if you have the <libintl.h> header file. */\r
+#undef HAVE_LIBINTL_H\r
+\r
+/* Define if you have the readline library (-lreadline). */\r
+#undef HAVE_LIBREADLINE\r
+\r
+/* Define to 1 if you have the `resolv' library (-lresolv). */\r
+#undef HAVE_LIBRESOLV\r
+\r
+/* Define to 1 if you have the <libutil.h> header file. */\r
+#undef HAVE_LIBUTIL_H\r
+\r
+/* Define if you have the 'link' function. */\r
+#undef HAVE_LINK\r
+\r
+/* Define to 1 if you have the <linux/netlink.h> header file. */\r
+#undef HAVE_LINUX_NETLINK_H\r
+\r
+/* Define to 1 if you have the <linux/tipc.h> header file. */\r
+#undef HAVE_LINUX_TIPC_H\r
+\r
+/* Define to 1 if you have the `log1p' function. */\r
+#undef HAVE_LOG1P\r
+\r
+/* Define this if you have the type long double. */\r
+#undef HAVE_LONG_DOUBLE\r
+\r
+/* Define this if you have the type long long. */\r
+#define HAVE_LONG_LONG 1\r
+\r
+/* Define to 1 if you have the `lstat' function. */\r
+#define HAVE_LSTAT 1\r
+\r
+/* Define this if you have the makedev macro. */\r
+#undef HAVE_MAKEDEV\r
+\r
+/* Define to 1 if you have the `memmove' function. */\r
+#define HAVE_MEMMOVE 1\r
+\r
+/* Define to 1 if you have the <memory.h> header file. */\r
+#undef HAVE_MEMORY_H\r
+\r
+/* Define to 1 if you have the `mkfifo' function. */\r
+#undef HAVE_MKFIFO\r
+\r
+/* Define to 1 if you have the `mknod' function. */\r
+#undef HAVE_MKNOD\r
+\r
+/* Define to 1 if you have the `mktime' function. */\r
+#define HAVE_MKTIME 1\r
+\r
+/* Define to 1 if you have the `mremap' function. */\r
+#undef HAVE_MREMAP\r
+\r
+/* Define to 1 if you have the <ncurses.h> header file. */\r
+#undef HAVE_NCURSES_H\r
+\r
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */\r
+#undef HAVE_NDIR_H\r
+\r
+/* Define to 1 if you have the <netpacket/packet.h> header file. */\r
+#undef HAVE_NETPACKET_PACKET_H\r
+\r
+/* Define to 1 if you have the `nice' function. */\r
+#undef HAVE_NICE\r
+\r
+/* Define to 1 if you have the `openpty' function. */\r
+#undef HAVE_OPENPTY\r
+\r
+/* Define if compiling using MacOS X 10.5 SDK or later. */\r
+#undef HAVE_OSX105_SDK\r
+\r
+/* Define to 1 if you have the `pathconf' function. */\r
+#undef HAVE_PATHCONF\r
+\r
+/* Define to 1 if you have the `pause' function. */\r
+#undef HAVE_PAUSE\r
+\r
+/* Define to 1 if you have the `plock' function. */\r
+#undef HAVE_PLOCK\r
+\r
+/* Define to 1 if you have the `poll' function. */\r
+#undef HAVE_POLL\r
+\r
+/* Define to 1 if you have the <poll.h> header file. */\r
+#define HAVE_POLL_H 1\r
+\r
+/* Define to 1 if you have the <process.h> header file. */\r
+#undef HAVE_PROCESS_H\r
+\r
+/* Define if your compiler supports function prototype */\r
+#define HAVE_PROTOTYPES 1\r
+\r
+/* Define if you have GNU PTH threads. */\r
+#undef HAVE_PTH\r
+\r
+/* Defined for Solaris 2.6 bug in pthread header. */\r
+#undef HAVE_PTHREAD_DESTRUCTOR\r
+\r
+/* Define to 1 if you have the <pthread.h> header file. */\r
+#undef HAVE_PTHREAD_H\r
+\r
+/* Define to 1 if you have the `pthread_init' function. */\r
+#undef HAVE_PTHREAD_INIT\r
+\r
+/* Define to 1 if you have the `pthread_sigmask' function. */\r
+#undef HAVE_PTHREAD_SIGMASK\r
+\r
+/* Define to 1 if you have the <pty.h> header file. */\r
+#undef HAVE_PTY_H\r
+\r
+/* Define to 1 if you have the `putenv' function. */\r
+#undef HAVE_PUTENV\r
+\r
+/* Define to 1 if you have the `readlink' function. */\r
+#undef HAVE_READLINK\r
+\r
+/* Define to 1 if you have the `realpath' function. */\r
+#undef HAVE_REALPATH\r
+\r
+/* Define if you have readline 2.1 */\r
+#undef HAVE_RL_CALLBACK\r
+\r
+/* Define if you can turn off readline's signal handling. */\r
+#undef HAVE_RL_CATCH_SIGNAL\r
+\r
+/* Define if you have readline 2.2 */\r
+#undef HAVE_RL_COMPLETION_APPEND_CHARACTER\r
+\r
+/* Define if you have readline 4.0 */\r
+#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK\r
+\r
+/* Define if you have readline 4.2 */\r
+#undef HAVE_RL_COMPLETION_MATCHES\r
+\r
+/* Define if you have rl_completion_suppress_append */\r
+#undef HAVE_RL_COMPLETION_SUPPRESS_APPEND\r
+\r
+/* Define if you have readline 4.0 */\r
+#undef HAVE_RL_PRE_INPUT_HOOK\r
+\r
+/* Define to 1 if you have the `round' function. */\r
+#undef HAVE_ROUND\r
+\r
+/* Define to 1 if you have the `select' function. */\r
+#undef HAVE_SELECT\r
+\r
+/* Define to 1 if you have the `sem_getvalue' function. */\r
+#undef HAVE_SEM_GETVALUE\r
+\r
+/* Define to 1 if you have the `sem_open' function. */\r
+#undef HAVE_SEM_OPEN\r
+\r
+/* Define to 1 if you have the `sem_timedwait' function. */\r
+#undef HAVE_SEM_TIMEDWAIT\r
+\r
+/* Define to 1 if you have the `sem_unlink' function. */\r
+#undef HAVE_SEM_UNLINK\r
+\r
+/* Define to 1 if you have the `setegid' function. */\r
+#undef HAVE_SETEGID\r
+\r
+/* Define to 1 if you have the `seteuid' function. */\r
+#undef HAVE_SETEUID\r
+\r
+/* Define to 1 if you have the `setgid' function. */\r
+#undef HAVE_SETGID\r
+\r
+/* Define if you have the 'setgroups' function. */\r
+#undef HAVE_SETGROUPS\r
+\r
+/* Define to 1 if you have the `setitimer' function. */\r
+#undef HAVE_SETITIMER\r
+\r
+/* Define to 1 if you have the `setlocale' function. */\r
+#define HAVE_SETLOCALE 1\r
+\r
+/* Define to 1 if you have the `setpgid' function. */\r
+#undef HAVE_SETPGID\r
+\r
+/* Define to 1 if you have the `setpgrp' function. */\r
+#undef HAVE_SETPGRP\r
+\r
+/* Define to 1 if you have the `setregid' function. */\r
+#undef HAVE_SETREGID\r
+\r
+/* Define to 1 if you have the `setresgid' function. */\r
+#undef HAVE_SETRESGID\r
+\r
+/* Define to 1 if you have the `setresuid' function. */\r
+#undef HAVE_SETRESUID\r
+\r
+/* Define to 1 if you have the `setreuid' function. */\r
+#undef HAVE_SETREUID\r
+\r
+/* Define to 1 if you have the `setsid' function. */\r
+#undef HAVE_SETSID\r
+\r
+/* Define to 1 if you have the `setuid' function. */\r
+#undef HAVE_SETUID\r
+\r
+/* Define to 1 if you have the `setvbuf' function. */\r
+#undef HAVE_SETVBUF\r
+\r
+/* Define to 1 if you have the <shadow.h> header file. */\r
+#undef HAVE_SHADOW_H\r
+\r
+/* Define to 1 if you have the `sigaction' function. */\r
+#undef HAVE_SIGACTION\r
+\r
+/* Define to 1 if you have the `siginterrupt' function. */\r
+#undef HAVE_SIGINTERRUPT\r
+\r
+/* Define to 1 if you have the <signal.h> header file. */\r
+#define HAVE_SIGNAL_H 1\r
+\r
+/* Define to 1 if you have the `sigrelse' function. */\r
+#undef HAVE_SIGRELSE\r
+\r
+/* Define to 1 if you have the `snprintf' function. */\r
+#define HAVE_SNPRINTF 1\r
+\r
+/* Define if sockaddr has sa_len member */\r
+#undef HAVE_SOCKADDR_SA_LEN\r
+\r
+/* struct sockaddr_storage (sys/socket.h) */\r
+#undef HAVE_SOCKADDR_STORAGE\r
+\r
+/* Define if you have the 'socketpair' function. */\r
+#undef HAVE_SOCKETPAIR\r
+\r
+/* Define to 1 if you have the <spawn.h> header file. */\r
+#undef HAVE_SPAWN_H\r
+\r
+/* Define if your compiler provides ssize_t */\r
+#undef HAVE_SSIZE_T\r
+\r
+/* Define to 1 if you have the `statvfs' function. */\r
+#undef HAVE_STATVFS\r
+\r
+/* Define if you have struct stat.st_mtim.tv_nsec */\r
+#undef HAVE_STAT_TV_NSEC\r
+\r
+/* Define if you have struct stat.st_mtimensec */\r
+#undef HAVE_STAT_TV_NSEC2\r
+\r
+/* Define if your compiler supports variable length function prototypes (e.g.\r
+ void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */\r
+#define HAVE_STDARG_PROTOTYPES 1\r
+\r
+/* Define to 1 if you have the <stdint.h> header file. */\r
+#define HAVE_STDINT_H 1\r
+\r
+/* Define to 1 if you have the <stdlib.h> header file. */\r
+#define HAVE_STDLIB_H 1\r
+\r
+/* Define to 1 if you have the `strdup' function. */\r
+#define HAVE_STRDUP 1\r
+\r
+/* Define to 1 if you have the `strftime' function. */\r
+#define HAVE_STRFTIME 1\r
+\r
+/* Define to 1 if you have the <strings.h> header file. */\r
+#undef HAVE_STRINGS_H\r
+\r
+/* Define to 1 if you have the <string.h> header file. */\r
+#define HAVE_STRING_H 1\r
+\r
+/* Define to 1 if you have the <stropts.h> header file. */\r
+#undef HAVE_STROPTS_H\r
+\r
+/* Define to 1 if `st_birthtime' is a member of `struct stat'. */\r
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1\r
+\r
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */\r
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1\r
+\r
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_BLOCKS\r
+\r
+/* Define to 1 if `st_flags' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_FLAGS\r
+\r
+/* Define to 1 if `st_gen' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_GEN\r
+\r
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_RDEV\r
+\r
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */\r
+#undef HAVE_STRUCT_TM_TM_ZONE\r
+\r
+/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use\r
+ `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */\r
+#undef HAVE_ST_BLOCKS\r
+\r
+/* Define if you have the 'symlink' function. */\r
+#undef HAVE_SYMLINK\r
+\r
+/* Define to 1 if you have the `sysconf' function. */\r
+#undef HAVE_SYSCONF\r
+\r
+/* Define to 1 if you have the <sysexits.h> header file. */\r
+#undef HAVE_SYSEXITS_H\r
+\r
+/* Define to 1 if you have the <sys/audioio.h> header file. */\r
+#undef HAVE_SYS_AUDIOIO_H\r
+\r
+/* Define to 1 if you have the <sys/bsdtty.h> header file. */\r
+#undef HAVE_SYS_BSDTTY_H\r
+\r
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_SYS_DIR_H\r
+\r
+/* Define to 1 if you have the <sys/epoll.h> header file. */\r
+#undef HAVE_SYS_EPOLL_H\r
+\r
+/* Define to 1 if you have the <sys/event.h> header file. */\r
+#undef HAVE_SYS_EVENT_H\r
+\r
+/* Define to 1 if you have the <sys/file.h> header file. */\r
+#undef HAVE_SYS_FILE_H\r
+\r
+/* Define to 1 if you have the <sys/loadavg.h> header file. */\r
+#undef HAVE_SYS_LOADAVG_H\r
+\r
+/* Define to 1 if you have the <sys/lock.h> header file. */\r
+#undef HAVE_SYS_LOCK_H\r
+\r
+/* Define to 1 if you have the <sys/mkdev.h> header file. */\r
+#undef HAVE_SYS_MKDEV_H\r
+\r
+/* Define to 1 if you have the <sys/modem.h> header file. */\r
+#undef HAVE_SYS_MODEM_H\r
+\r
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_SYS_NDIR_H\r
+\r
+/* Define to 1 if you have the <sys/param.h> header file. */\r
+#define HAVE_SYS_PARAM_H 1\r
+\r
+/* Define to 1 if you have the <sys/poll.h> header file. */\r
+#define HAVE_SYS_POLL_H 1\r
+\r
+/* Define to 1 if you have the <sys/resource.h> header file. */\r
+#define HAVE_SYS_RESOURCE_H 1\r
+\r
+/* Define to 1 if you have the <sys/select.h> header file. */\r
+#define HAVE_SYS_SELECT_H 1\r
+\r
+/* Define to 1 if you have the <sys/socket.h> header file. */\r
+#define HAVE_SYS_SOCKET_H 1\r
+\r
+/* Define to 1 if you have the <sys/statvfs.h> header file. */\r
+#undef HAVE_SYS_STATVFS_H\r
+\r
+/* Define to 1 if you have the <sys/stat.h> header file. */\r
+#define HAVE_SYS_STAT_H 1\r
+\r
+/* Define to 1 if you have the <sys/termio.h> header file. */\r
+#undef HAVE_SYS_TERMIO_H\r
+\r
+/* Define to 1 if you have the <sys/times.h> header file. */\r
+#undef HAVE_SYS_TIMES_H\r
+\r
+/* Define to 1 if you have the <sys/time.h> header file. */\r
+#define HAVE_SYS_TIME_H 1\r
+\r
+/* Define to 1 if you have the <sys/types.h> header file. */\r
+#define HAVE_SYS_TYPES_H 1\r
+\r
+/* Define to 1 if you have the <sys/un.h> header file. */\r
+#undef HAVE_SYS_UN_H\r
+\r
+/* Define to 1 if you have the <sys/utsname.h> header file. */\r
+#undef HAVE_SYS_UTSNAME_H\r
+\r
+/* Define to 1 if you have the <sys/wait.h> header file. */\r
+#undef HAVE_SYS_WAIT_H\r
+\r
+/* Define to 1 if you have the `tcgetpgrp' function. */\r
+#undef HAVE_TCGETPGRP\r
+\r
+/* Define to 1 if you have the `tcsetpgrp' function. */\r
+#undef HAVE_TCSETPGRP\r
+\r
+/* Define to 1 if you have the `tempnam' function. */\r
+#define HAVE_TEMPNAM 1\r
+\r
+/* Define to 1 if you have the <termios.h> header file. */\r
+#define HAVE_TERMIOS_H 1\r
+\r
+/* Define to 1 if you have the <term.h> header file. */\r
+#undef HAVE_TERM_H\r
+\r
+/* Define to 1 if you have the `tgamma' function. */\r
+#undef HAVE_TGAMMA\r
+\r
+/* Define to 1 if you have the <thread.h> header file. */\r
+#undef HAVE_THREAD_H\r
+\r
+/* Define to 1 if you have the `timegm' function. */\r
+#undef HAVE_TIMEGM\r
+\r
+/* Define to 1 if you have the `times' function. */\r
+#undef HAVE_TIMES\r
+\r
+/* Define to 1 if you have the `tmpfile' function. */\r
+#define HAVE_TMPFILE 1\r
+\r
+/* Define to 1 if you have the `tmpnam' function. */\r
+#define HAVE_TMPNAM 1\r
+\r
+/* Define to 1 if you have the `tmpnam_r' function. */\r
+#undef HAVE_TMPNAM_R\r
+\r
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use\r
+ `HAVE_STRUCT_TM_TM_ZONE' instead. */\r
+#undef HAVE_TM_ZONE\r
+\r
+/* Define to 1 if you have the `truncate' function. */\r
+#undef HAVE_TRUNCATE\r
+\r
+/* Define to 1 if you don't have `tm_zone' but do have the external array\r
+ `tzname'. */\r
+#undef HAVE_TZNAME\r
+\r
+/* Define this if you have tcl and TCL_UTF_MAX==6 */\r
+#undef HAVE_UCS4_TCL\r
+\r
+/* Define to 1 if the system has the type `uintptr_t'. */\r
+#define HAVE_UINTPTR_T 1\r
+\r
+/* Define to 1 if you have the `uname' function. */\r
+#undef HAVE_UNAME\r
+\r
+/* Define to 1 if you have the <unistd.h> header file. */\r
+#define HAVE_UNISTD_H 1\r
+\r
+/* Define to 1 if you have the `unsetenv' function. */\r
+#undef HAVE_UNSETENV\r
+\r
+/* Define if you have a useable wchar_t type defined in wchar.h; useable means\r
+ wchar_t must be an unsigned type with at least 16 bits. (see\r
+ Include/unicodeobject.h). */\r
+#define HAVE_USABLE_WCHAR_T 1\r
+\r
+/* Define to 1 if you have the <util.h> header file. */\r
+#undef HAVE_UTIL_H\r
+\r
+/* Define to 1 if you have the `utimes' function. */\r
+#undef HAVE_UTIMES\r
+\r
+/* Define to 1 if you have the <utime.h> header file. */\r
+#undef HAVE_UTIME_H\r
+\r
+/* Define to 1 if you have the `wait3' function. */\r
+#undef HAVE_WAIT3\r
+\r
+/* Define to 1 if you have the `wait4' function. */\r
+#undef HAVE_WAIT4\r
+\r
+/* Define to 1 if you have the `waitpid' function. */\r
+#undef HAVE_WAITPID\r
+\r
+/* Define if the compiler provides a wchar.h header file. */\r
+#define HAVE_WCHAR_H 1\r
+\r
+/* Define to 1 if you have the `wcscoll' function. */\r
+#define HAVE_WCSCOLL 1\r
+\r
+/* Define if tzset() actually switches the local timezone in a meaningful way.\r
+ */\r
+#undef HAVE_WORKING_TZSET\r
+\r
+/* Define if the zlib library has inflateCopy */\r
+#undef HAVE_ZLIB_COPY\r
+\r
+/* Define to 1 if you have the `_getpty' function. */\r
+#undef HAVE__GETPTY\r
+\r
+/* Define if you are using Mach cthreads directly under /include */\r
+#undef HURD_C_THREADS\r
+\r
+/* Define if you are using Mach cthreads under mach / */\r
+#undef MACH_C_THREADS\r
+\r
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.\r
+ */\r
+#undef MAJOR_IN_MKDEV\r
+\r
+/* Define to 1 if `major', `minor', and `makedev' are declared in\r
+ <sysmacros.h>. */\r
+#undef MAJOR_IN_SYSMACROS\r
+\r
+/* Define if mvwdelch in curses.h is an expression. */\r
+#undef MVWDELCH_IS_EXPRESSION\r
+\r
+/* Define to the address where bug reports for this package should be sent. */\r
+#undef PACKAGE_BUGREPORT\r
+\r
+/* Define to the full name of this package. */\r
+#define PACKAGE_NAME EDK II Python Package\r
+\r
+/* Define to the full name and version of this package. */\r
+#define PACKAGE_STRING EDK II Python Package V0.1\r
+\r
+/* Define to the one symbol short name of this package. */\r
+#define PACKAGE_TARNAME UDK_Python\r
+\r
+/* Define to the home page for this package. */\r
+#define PACKAGE_URL http://edk2.tianocore.org/toolkit/python\r
+\r
+/* Define to the version of this package. */\r
+#define PACKAGE_VERSION V0.1\r
+\r
+/* Define if POSIX semaphores aren't enabled on your system */\r
+#define POSIX_SEMAPHORES_NOT_ENABLED 1\r
+\r
+/* Defined if PTHREAD_SCOPE_SYSTEM supported. */\r
+#undef PTHREAD_SYSTEM_SCHED_SUPPORTED\r
+\r
+/* Define as the preferred size in bits of long digits */\r
+#undef PYLONG_BITS_IN_DIGIT\r
+\r
+/* Define to printf format modifier for long long type */\r
+#define PY_FORMAT_LONG_LONG "ll"\r
+\r
+/* Define to printf format modifier for Py_ssize_t */\r
+#define PY_FORMAT_SIZE_T "z"\r
+\r
+/* Define as the integral type used for Unicode representation. */\r
+#define PY_UNICODE_TYPE wchar_t\r
+\r
+/* Define if you want to build an interpreter with many run-time checks. */\r
+#undef Py_DEBUG\r
+\r
+/* Defined if Python is built as a shared library. */\r
+#undef Py_ENABLE_SHARED\r
+\r
+/* Define as the size of the unicode type. */\r
+#define Py_UNICODE_SIZE 2\r
+\r
+/* Define if you want to have a Unicode type. */\r
+#define Py_USING_UNICODE\r
+\r
+/* assume C89 semantics that RETSIGTYPE is always void */\r
+#undef RETSIGTYPE\r
+\r
+/* Define if setpgrp() must be called as setpgrp(0, 0). */\r
+#undef SETPGRP_HAVE_ARG\r
+\r
+/* Define this to be extension of shared libraries (including the dot!). */\r
+#undef SHLIB_EXT\r
+\r
+/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */\r
+#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS\r
+\r
+/* The size of `double', as computed by sizeof. */\r
+#define SIZEOF_DOUBLE 8\r
+\r
+/* The size of `float', as computed by sizeof. */\r
+#define SIZEOF_FLOAT 4\r
+\r
+/* The size of `fpos_t', as computed by sizeof. */\r
+#undef SIZEOF_FPOS_T\r
+\r
+/* The size of `int', as computed by sizeof. */\r
+#define SIZEOF_INT 4\r
+\r
+/* The size of `long', as computed by sizeof. */\r
+#define SIZEOF_LONG 4\r
+\r
+/* The size of `long double', as computed by sizeof. */\r
+#undef SIZEOF_LONG_DOUBLE\r
+\r
+/* The size of `long long', as computed by sizeof. */\r
+#define SIZEOF_LONG_LONG 8\r
+\r
+/* The size of `off_t', as computed by sizeof. */\r
+#define SIZEOF_OFF_T 4\r
+\r
+/* The size of `pid_t', as computed by sizeof. */\r
+#undef SIZEOF_PID_T\r
+\r
+/* The size of `pthread_t', as computed by sizeof. */\r
+#undef SIZEOF_PTHREAD_T\r
+\r
+/* The size of `short', as computed by sizeof. */\r
+#define SIZEOF_SHORT 2\r
+\r
+/* The size of `size_t', as computed by sizeof. */\r
+#define SIZEOF_SIZE_T 4\r
+\r
+/* The size of `time_t', as computed by sizeof. */\r
+#define SIZEOF_TIME_T 4\r
+\r
+/* The size of `uintptr_t', as computed by sizeof. */\r
+#define SIZEOF_UINTPTR_T 4\r
+\r
+/* The size of `void *', as computed by sizeof. */\r
+#define SIZEOF_VOID_P 4\r
+\r
+/* The size of `wchar_t', as computed by sizeof. */\r
+#define SIZEOF_WCHAR_T 2\r
+\r
+/* The size of `_Bool', as computed by sizeof. */\r
+#define SIZEOF__BOOL 1\r
+\r
+/* Define to 1 if you have the ANSI C header files. */\r
+#define STDC_HEADERS 1\r
+\r
+/* Define if you can safely include both <sys/select.h> and <sys/time.h>\r
+ (which you can't on SCO ODT 3.0). */\r
+#undef SYS_SELECT_WITH_SYS_TIME\r
+\r
+/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */\r
+#undef TANH_PRESERVES_ZERO_SIGN\r
+\r
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r
+#undef TIME_WITH_SYS_TIME\r
+\r
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */\r
+#undef TM_IN_SYS_TIME\r
+\r
+/* Enable extensions on AIX 3, Interix. */\r
+#ifndef _ALL_SOURCE\r
+# undef _ALL_SOURCE\r
+#endif\r
+/* Enable GNU extensions on systems that have them. */\r
+#ifndef _GNU_SOURCE\r
+# undef _GNU_SOURCE\r
+#endif\r
+/* Enable threading extensions on Solaris. */\r
+#ifndef _POSIX_PTHREAD_SEMANTICS\r
+# undef _POSIX_PTHREAD_SEMANTICS\r
+#endif\r
+/* Enable extensions on HP NonStop. */\r
+#ifndef _TANDEM_SOURCE\r
+# undef _TANDEM_SOURCE\r
+#endif\r
+/* Enable general extensions on Solaris. */\r
+#ifndef __EXTENSIONS__\r
+# undef __EXTENSIONS__\r
+#endif\r
+\r
+\r
+/* Define if you want to use MacPython modules on MacOSX in unix-Python. */\r
+#undef USE_TOOLBOX_OBJECT_GLUE\r
+\r
+/* Define if a va_list is an array of some kind */\r
+#undef VA_LIST_IS_ARRAY\r
+\r
+/* Define if you want SIGFPE handled (see Include/pyfpe.h). */\r
+#undef WANT_SIGFPE_HANDLER\r
+\r
+/* Define if you want wctype.h functions to be used instead of the one\r
+ supplied by Python itself. (see Include/unicodectype.h). */\r
+#undef WANT_WCTYPE_FUNCTIONS\r
+\r
+/* Define if WINDOW in curses.h offers a field _flags. */\r
+#undef WINDOW_HAS_FLAGS\r
+\r
+/* Define if you want documentation strings in extension modules */\r
+#undef WITH_DOC_STRINGS\r
+\r
+/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic\r
+ linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).\r
+ Dyld is necessary to support frameworks. */\r
+#undef WITH_DYLD\r
+\r
+/* Define to 1 if libintl is needed for locale functions. */\r
+#undef WITH_LIBINTL\r
+\r
+/* Define if you want to produce an OpenStep/Rhapsody framework (shared\r
+ library plus accessory files). */\r
+#undef WITH_NEXT_FRAMEWORK\r
+\r
+/* Define if you want to compile in Python-specific mallocs */\r
+#undef WITH_PYMALLOC\r
+\r
+/* Define if you want to compile in rudimentary thread support */\r
+#undef WITH_THREAD\r
+\r
+/* Define to profile with the Pentium timestamp counter */\r
+#undef WITH_TSC\r
+\r
+/* Define if you want pymalloc to be disabled when running under valgrind */\r
+#undef WITH_VALGRIND\r
+\r
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\r
+ significant byte first (like Motorola and SPARC, unlike Intel). */\r
+#if defined AC_APPLE_UNIVERSAL_BUILD\r
+# if defined __BIG_ENDIAN__\r
+# define WORDS_BIGENDIAN 1\r
+# endif\r
+#else\r
+# ifndef WORDS_BIGENDIAN\r
+# undef WORDS_BIGENDIAN\r
+# endif\r
+#endif\r
+\r
+/* Define if arithmetic is subject to x87-style double rounding issue */\r
+#undef X87_DOUBLE_ROUNDING\r
+\r
+/* Define on OpenBSD to activate all library features */\r
+#undef _BSD_SOURCE\r
+\r
+/* Define on Irix to enable u_int */\r
+#undef _BSD_TYPES\r
+\r
+/* Define on Darwin to activate all library features */\r
+#undef _DARWIN_C_SOURCE\r
+\r
+/* This must be set to 64 on some systems to enable large file support. */\r
+#undef _FILE_OFFSET_BITS\r
+\r
+/* Define on Linux to activate all library features */\r
+#undef _GNU_SOURCE\r
+\r
+/* This must be defined on some systems to enable large file support. */\r
+#undef _LARGEFILE_SOURCE\r
+\r
+/* Define to 1 if on MINIX. */\r
+#undef _MINIX\r
+\r
+/* Define on NetBSD to activate all library features */\r
+#define _NETBSD_SOURCE\r
+\r
+/* Define _OSF_SOURCE to get the makedev macro. */\r
+#undef _OSF_SOURCE\r
+\r
+/* Define to 2 if the system does not provide POSIX.1 features except with\r
+ this defined. */\r
+#undef _POSIX_1_SOURCE\r
+\r
+/* Define to activate features from IEEE Stds 1003.1-2001 */\r
+#undef _POSIX_C_SOURCE\r
+\r
+/* Define to 1 if you need to in order for `stat' and other things to work. */\r
+#undef _POSIX_SOURCE\r
+\r
+/* Define if you have POSIX threads, and your system does not define that. */\r
+#undef _POSIX_THREADS\r
+\r
+/* Define to force use of thread-safe errno, h_errno, and other functions */\r
+#undef _REENTRANT\r
+\r
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,\r
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the\r
+ #define below would cause a syntax error. */\r
+#undef _UINT32_T\r
+\r
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,\r
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the\r
+ #define below would cause a syntax error. */\r
+#undef _UINT64_T\r
+\r
+/* Define to the level of X/Open that your system supports */\r
+#undef _XOPEN_SOURCE\r
+\r
+/* Define to activate Unix95-and-earlier features */\r
+#undef _XOPEN_SOURCE_EXTENDED\r
+\r
+/* Define on FreeBSD to activate all library features */\r
+#undef __BSD_VISIBLE\r
+\r
+/* Define to 1 if type `char' is unsigned and you are not using gcc. */\r
+#ifndef __CHAR_UNSIGNED__\r
+# undef __CHAR_UNSIGNED__\r
+#endif\r
+\r
+/* Defined on Solaris to see additional function prototypes. */\r
+#undef __EXTENSIONS__\r
+\r
+/* Define to 'long' if <time.h> doesn't define. */\r
+//#undef clock_t\r
+\r
+/* Define to empty if `const' does not conform to ANSI C. */\r
+//#undef const\r
+\r
+/* Define to `int' if <sys/types.h> doesn't define. */\r
+//#undef gid_t\r
+\r
+/* Define to the type of a signed integer type of width exactly 32 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+//#undef int32_t\r
+\r
+/* Define to the type of a signed integer type of width exactly 64 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+//#undef int64_t\r
+\r
+/* Define to `int' if <sys/types.h> does not define. */\r
+//#undef mode_t\r
+\r
+/* Define to `long int' if <sys/types.h> does not define. */\r
+//#undef off_t\r
+\r
+/* Define to `int' if <sys/types.h> does not define. */\r
+//#undef pid_t\r
+\r
+/* Define to empty if the keyword does not work. */\r
+//#undef signed\r
+\r
+/* Define to `unsigned int' if <sys/types.h> does not define. */\r
+//#undef size_t\r
+\r
+/* Define to `int' if <sys/socket.h> does not define. */\r
+//#undef socklen_t\r
+\r
+/* Define to `int' if <sys/types.h> doesn't define. */\r
+//#undef uid_t\r
+\r
+/* Define to the type of an unsigned integer type of width exactly 32 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+//#undef uint32_t\r
+\r
+/* Define to the type of an unsigned integer type of width exactly 64 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+//#undef uint64_t\r
+\r
+/* Define to empty if the keyword does not work. */\r
+//#undef volatile\r
+\r
+\r
+/* Define the macros needed if on a UnixWare 7.x system. */\r
+#if defined(__USLC__) && defined(__SCO_VERSION__)\r
+#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */\r
+#endif\r
+\r
+#endif /*Py_PYCONFIG_H*/\r
+\r
--- /dev/null
+/* pyconfig.h.in. Generated from configure.in by autoheader. */\r
+\r
+\r
+#ifndef Py_PYCONFIG_H\r
+#define Py_PYCONFIG_H\r
+\r
+\r
+/* Define if building universal (internal helper macro) */\r
+#undef AC_APPLE_UNIVERSAL_BUILD\r
+\r
+/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want\r
+ support for AIX C++ shared extension modules. */\r
+#undef AIX_GENUINE_CPLUSPLUS\r
+\r
+/* Define this if you have AtheOS threads. */\r
+#undef ATHEOS_THREADS\r
+\r
+/* Define this if you have BeOS threads. */\r
+#undef BEOS_THREADS\r
+\r
+/* Define if you have the Mach cthreads package */\r
+#undef C_THREADS\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM\r
+ mixed-endian order (byte order 45670123) */\r
+#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most\r
+ significant byte first */\r
+#undef DOUBLE_IS_BIG_ENDIAN_IEEE754\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the\r
+ least significant byte first */\r
+#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754\r
+\r
+/* Define if --enable-ipv6 is specified */\r
+#undef ENABLE_IPV6\r
+\r
+/* Define if flock needs to be linked with bsd library. */\r
+#undef FLOCK_NEEDS_LIBBSD\r
+\r
+/* Define if getpgrp() must be called as getpgrp(0). */\r
+#undef GETPGRP_HAVE_ARG\r
+\r
+/* Define if gettimeofday() does not have second (timezone) argument This is\r
+ the case on Motorola V4 (R40V4.2) */\r
+#undef GETTIMEOFDAY_NO_TZ\r
+\r
+/* Define to 1 if you have the `acosh' function. */\r
+#undef HAVE_ACOSH\r
+\r
+/* struct addrinfo (netdb.h) */\r
+#undef HAVE_ADDRINFO\r
+\r
+/* Define to 1 if you have the `alarm' function. */\r
+#undef HAVE_ALARM\r
+\r
+/* Define this if your time.h defines altzone. */\r
+#undef HAVE_ALTZONE\r
+\r
+/* Define to 1 if you have the `asinh' function. */\r
+#undef HAVE_ASINH\r
+\r
+/* Define to 1 if you have the <asm/types.h> header file. */\r
+#undef HAVE_ASM_TYPES_H\r
+\r
+/* Define to 1 if you have the `atanh' function. */\r
+#undef HAVE_ATANH\r
+\r
+/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */\r
+#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE\r
+\r
+/* Define to 1 if you have the `bind_textdomain_codeset' function. */\r
+#undef HAVE_BIND_TEXTDOMAIN_CODESET\r
+\r
+/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */\r
+#undef HAVE_BLUETOOTH_BLUETOOTH_H\r
+\r
+/* Define to 1 if you have the <bluetooth.h> header file. */\r
+#undef HAVE_BLUETOOTH_H\r
+\r
+/* Define if nice() returns success/failure instead of the new priority. */\r
+#undef HAVE_BROKEN_NICE\r
+\r
+/* Define if the system reports an invalid PIPE_BUF value. */\r
+#undef HAVE_BROKEN_PIPE_BUF\r
+\r
+/* Define if poll() sets errno on invalid file descriptors. */\r
+#undef HAVE_BROKEN_POLL\r
+\r
+/* Define if the Posix semaphores do not work on your system */\r
+#define HAVE_BROKEN_POSIX_SEMAPHORES\r
+\r
+/* Define if pthread_sigmask() does not work on your system. */\r
+#define HAVE_BROKEN_PTHREAD_SIGMASK\r
+\r
+/* define to 1 if your sem_getvalue is broken. */\r
+#undef HAVE_BROKEN_SEM_GETVALUE\r
+\r
+/* Define this if you have the type _Bool. */\r
+#define HAVE_C99_BOOL\r
+\r
+/* Define to 1 if you have the `chflags' function. */\r
+#undef HAVE_CHFLAGS\r
+\r
+/* Define to 1 if you have the `chown' function. */\r
+#undef HAVE_CHOWN\r
+\r
+/* Define if you have the 'chroot' function. */\r
+#undef HAVE_CHROOT\r
+\r
+/* Define to 1 if you have the `clock' function. */\r
+#define HAVE_CLOCK\r
+\r
+/* Define to 1 if you have the `confstr' function. */\r
+#undef HAVE_CONFSTR\r
+\r
+/* Define to 1 if you have the <conio.h> header file. */\r
+#undef HAVE_CONIO_H\r
+\r
+/* Define to 1 if you have the `copysign' function. */\r
+#define HAVE_COPYSIGN 1\r
+\r
+/* Define to 1 if you have the `ctermid' function. */\r
+#undef HAVE_CTERMID\r
+\r
+/* Define if you have the 'ctermid_r' function. */\r
+#undef HAVE_CTERMID_R\r
+\r
+/* Define to 1 if you have the <curses.h> header file. */\r
+#undef HAVE_CURSES_H\r
+\r
+/* Define if you have the 'is_term_resized' function. */\r
+#undef HAVE_CURSES_IS_TERM_RESIZED\r
+\r
+/* Define if you have the 'resizeterm' function. */\r
+#undef HAVE_CURSES_RESIZETERM\r
+\r
+/* Define if you have the 'resize_term' function. */\r
+#undef HAVE_CURSES_RESIZE_TERM\r
+\r
+/* Define to 1 if you have the declaration of `isfinite', and to 0 if you\r
+ don't. */\r
+#define HAVE_DECL_ISFINITE 0\r
+\r
+/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_ISINF 1\r
+\r
+/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_ISNAN 1\r
+\r
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_TZNAME 0\r
+\r
+/* Define to 1 if you have the device macros. */\r
+#undef HAVE_DEVICE_MACROS\r
+\r
+/* Define if we have /dev/ptc. */\r
+#undef HAVE_DEV_PTC\r
+\r
+/* Define if we have /dev/ptmx. */\r
+#undef HAVE_DEV_PTMX\r
+\r
+/* Define to 1 if you have the <direct.h> header file. */\r
+#undef HAVE_DIRECT_H\r
+\r
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_DIRENT_H\r
+\r
+/* Define to 1 if you have the <dlfcn.h> header file. */\r
+#undef HAVE_DLFCN_H\r
+\r
+/* Define to 1 if you have the `dlopen' function. */\r
+#undef HAVE_DLOPEN\r
+\r
+/* Define to 1 if you have the `dup2' function. */\r
+#define HAVE_DUP2 1\r
+\r
+/* Defined when any dynamic module loading is enabled. */\r
+#undef HAVE_DYNAMIC_LOADING\r
+\r
+/* Define if you have the 'epoll' functions. */\r
+#undef HAVE_EPOLL\r
+\r
+/* Define to 1 if you have the `erf' function. */\r
+#undef HAVE_ERF\r
+\r
+/* Define to 1 if you have the `erfc' function. */\r
+#undef HAVE_ERFC\r
+\r
+/* Define to 1 if you have the <errno.h> header file. */\r
+#define HAVE_ERRNO_H 1\r
+\r
+/* Define to 1 if you have the `execv' function. */\r
+#undef HAVE_EXECV\r
+\r
+/* Define to 1 if you have the `expm1' function. */\r
+#undef HAVE_EXPM1\r
+\r
+/* Define if you have the 'fchdir' function. */\r
+#undef HAVE_FCHDIR\r
+\r
+/* Define to 1 if you have the `fchmod' function. */\r
+#undef HAVE_FCHMOD\r
+\r
+/* Define to 1 if you have the `fchown' function. */\r
+#undef HAVE_FCHOWN\r
+\r
+/* Define to 1 if you have the <fcntl.h> header file. */\r
+#define HAVE_FCNTL_H 1\r
+\r
+/* Define if you have the 'fdatasync' function. */\r
+#undef HAVE_FDATASYNC\r
+\r
+/* Define to 1 if you have the `finite' function. */\r
+#define HAVE_FINITE 1\r
+\r
+/* Define to 1 if you have the `flock' function. */\r
+#undef HAVE_FLOCK\r
+\r
+/* Define to 1 if you have the `fork' function. */\r
+#undef HAVE_FORK\r
+\r
+/* Define to 1 if you have the `forkpty' function. */\r
+#undef HAVE_FORKPTY\r
+\r
+/* Define to 1 if you have the `fpathconf' function. */\r
+#undef HAVE_FPATHCONF\r
+\r
+/* Define to 1 if you have the `fseek64' function. */\r
+#undef HAVE_FSEEK64\r
+\r
+/* Define to 1 if you have the `fseeko' function. */\r
+#define HAVE_FSEEKO 1\r
+\r
+/* Define to 1 if you have the `fstatvfs' function. */\r
+#undef HAVE_FSTATVFS\r
+\r
+/* Define if you have the 'fsync' function. */\r
+#undef HAVE_FSYNC\r
+\r
+/* Define to 1 if you have the `ftell64' function. */\r
+#undef HAVE_FTELL64\r
+\r
+/* Define to 1 if you have the `ftello' function. */\r
+#define HAVE_FTELLO 1\r
+\r
+/* Define to 1 if you have the `ftime' function. */\r
+#undef HAVE_FTIME\r
+\r
+/* Define to 1 if you have the `ftruncate' function. */\r
+#undef HAVE_FTRUNCATE\r
+\r
+/* Define to 1 if you have the `gai_strerror' function. */\r
+#undef HAVE_GAI_STRERROR\r
+\r
+/* Define to 1 if you have the `gamma' function. */\r
+#undef HAVE_GAMMA\r
+\r
+/* Define if we can use gcc inline assembler to get and set x87 control word\r
+ */\r
+#undef HAVE_GCC_ASM_FOR_X87\r
+\r
+/* Define if you have the getaddrinfo function. */\r
+#undef HAVE_GETADDRINFO\r
+\r
+/* Define to 1 if you have the `getcwd' function. */\r
+#undef HAVE_GETCWD\r
+\r
+/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */\r
+#define HAVE_GETC_UNLOCKED\r
+\r
+/* Define to 1 if you have the `getgroups' function. */\r
+#undef HAVE_GETGROUPS\r
+\r
+/* Define to 1 if you have the `gethostbyname' function. */\r
+#undef HAVE_GETHOSTBYNAME\r
+\r
+/* Define this if you have some version of gethostbyname_r() */\r
+#undef HAVE_GETHOSTBYNAME_R\r
+\r
+/* Define this if you have the 3-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_3_ARG\r
+\r
+/* Define this if you have the 5-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_5_ARG\r
+\r
+/* Define this if you have the 6-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_6_ARG\r
+\r
+/* Define to 1 if you have the `getitimer' function. */\r
+#undef HAVE_GETITIMER\r
+\r
+/* Define to 1 if you have the `getloadavg' function. */\r
+#undef HAVE_GETLOADAVG\r
+\r
+/* Define to 1 if you have the `getlogin' function. */\r
+#undef HAVE_GETLOGIN\r
+\r
+/* Define to 1 if you have the `getnameinfo' function. */\r
+#undef HAVE_GETNAMEINFO\r
+\r
+/* Define if you have the 'getpagesize' function. */\r
+#undef HAVE_GETPAGESIZE\r
+\r
+/* Define to 1 if you have the `getpeername' function. */\r
+#undef HAVE_GETPEERNAME\r
+\r
+/* Define to 1 if you have the `getpgid' function. */\r
+#undef HAVE_GETPGID\r
+\r
+/* Define to 1 if you have the `getpgrp' function. */\r
+#undef HAVE_GETPGRP\r
+\r
+/* Define to 1 if you have the `getpid' function. */\r
+#undef HAVE_GETPID\r
+\r
+/* Define to 1 if you have the `getpriority' function. */\r
+#undef HAVE_GETPRIORITY\r
+\r
+/* Define to 1 if you have the `getpwent' function. */\r
+#undef HAVE_GETPWENT\r
+\r
+/* Define to 1 if you have the `getresgid' function. */\r
+#undef HAVE_GETRESGID\r
+\r
+/* Define to 1 if you have the `getresuid' function. */\r
+#undef HAVE_GETRESUID\r
+\r
+/* Define to 1 if you have the `getsid' function. */\r
+#undef HAVE_GETSID\r
+\r
+/* Define to 1 if you have the `getspent' function. */\r
+#undef HAVE_GETSPENT\r
+\r
+/* Define to 1 if you have the `getspnam' function. */\r
+#undef HAVE_GETSPNAM\r
+\r
+/* Define to 1 if you have the `gettimeofday' function. */\r
+#undef HAVE_GETTIMEOFDAY\r
+\r
+/* Define to 1 if you have the `getwd' function. */\r
+#undef HAVE_GETWD\r
+\r
+/* Define to 1 if you have the <grp.h> header file. */\r
+#undef HAVE_GRP_H\r
+\r
+/* Define if you have the 'hstrerror' function. */\r
+#undef HAVE_HSTRERROR\r
+\r
+/* Define to 1 if you have the `hypot' function. */\r
+#undef HAVE_HYPOT\r
+\r
+/* Define to 1 if you have the <ieeefp.h> header file. */\r
+#undef HAVE_IEEEFP_H\r
+\r
+/* Define if you have the 'inet_aton' function. */\r
+#undef HAVE_INET_ATON\r
+\r
+/* Define if you have the 'inet_pton' function. */\r
+#undef HAVE_INET_PTON\r
+\r
+/* Define to 1 if you have the `initgroups' function. */\r
+#undef HAVE_INITGROUPS\r
+\r
+/* Define to 1 if you have the <inttypes.h> header file. */\r
+#define HAVE_INTTYPES_H 1\r
+\r
+/* Define to 1 if you have the <io.h> header file. */\r
+#undef HAVE_IO_H\r
+\r
+/* Define to 1 if you have the `kill' function. */\r
+#undef HAVE_KILL\r
+\r
+/* Define to 1 if you have the `killpg' function. */\r
+#undef HAVE_KILLPG\r
+\r
+/* Define if you have the 'kqueue' functions. */\r
+#undef HAVE_KQUEUE\r
+\r
+/* Define to 1 if you have the <langinfo.h> header file. */\r
+#define HAVE_LANGINFO_H 1\r
+\r
+/* Defined to enable large file support when an off_t is bigger than a long\r
+ and long long is available and at least as big as an off_t. You may need to\r
+ add some flags for configuration and compilation to enable this mode. (For\r
+ Solaris and Linux, the necessary defines are already defined.) */\r
+#undef HAVE_LARGEFILE_SUPPORT\r
+\r
+/* Define to 1 if you have the `lchflags' function. */\r
+#undef HAVE_LCHFLAGS\r
+\r
+/* Define to 1 if you have the `lchmod' function. */\r
+#undef HAVE_LCHMOD\r
+\r
+/* Define to 1 if you have the `lchown' function. */\r
+#undef HAVE_LCHOWN\r
+\r
+/* Define to 1 if you have the `lgamma' function. */\r
+#undef HAVE_LGAMMA\r
+\r
+/* Define to 1 if you have the `dl' library (-ldl). */\r
+#undef HAVE_LIBDL\r
+\r
+/* Define to 1 if you have the `dld' library (-ldld). */\r
+#undef HAVE_LIBDLD\r
+\r
+/* Define to 1 if you have the `ieee' library (-lieee). */\r
+#undef HAVE_LIBIEEE\r
+\r
+/* Define to 1 if you have the <libintl.h> header file. */\r
+#undef HAVE_LIBINTL_H\r
+\r
+/* Define if you have the readline library (-lreadline). */\r
+#undef HAVE_LIBREADLINE\r
+\r
+/* Define to 1 if you have the `resolv' library (-lresolv). */\r
+#undef HAVE_LIBRESOLV\r
+\r
+/* Define to 1 if you have the <libutil.h> header file. */\r
+#undef HAVE_LIBUTIL_H\r
+\r
+/* Define if you have the 'link' function. */\r
+#undef HAVE_LINK\r
+\r
+/* Define to 1 if you have the <linux/netlink.h> header file. */\r
+#undef HAVE_LINUX_NETLINK_H\r
+\r
+/* Define to 1 if you have the <linux/tipc.h> header file. */\r
+#undef HAVE_LINUX_TIPC_H\r
+\r
+/* Define to 1 if you have the `log1p' function. */\r
+#undef HAVE_LOG1P\r
+\r
+/* Define this if you have the type long double. */\r
+#define HAVE_LONG_DOUBLE\r
+\r
+/* Define this if you have the type long long. */\r
+#define HAVE_LONG_LONG\r
+\r
+/* Define to 1 if you have the `lstat' function. */\r
+#define HAVE_LSTAT 1\r
+\r
+/* Define this if you have the makedev macro. */\r
+#undef HAVE_MAKEDEV\r
+\r
+/* Define to 1 if you have the `memmove' function. */\r
+#define HAVE_MEMMOVE 1\r
+\r
+/* Define to 1 if you have the <memory.h> header file. */\r
+#undef HAVE_MEMORY_H\r
+\r
+/* Define to 1 if you have the `mkfifo' function. */\r
+#undef HAVE_MKFIFO\r
+\r
+/* Define to 1 if you have the `mknod' function. */\r
+#undef HAVE_MKNOD\r
+\r
+/* Define to 1 if you have the `mktime' function. */\r
+#define HAVE_MKTIME 1\r
+\r
+/* Define to 1 if you have the `mremap' function. */\r
+#undef HAVE_MREMAP\r
+\r
+/* Define to 1 if you have the <ncurses.h> header file. */\r
+#undef HAVE_NCURSES_H\r
+\r
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */\r
+#undef HAVE_NDIR_H\r
+\r
+/* Define to 1 if you have the <netpacket/packet.h> header file. */\r
+#undef HAVE_NETPACKET_PACKET_H\r
+\r
+/* Define to 1 if you have the `nice' function. */\r
+#undef HAVE_NICE\r
+\r
+/* Define to 1 if you have the `openpty' function. */\r
+#undef HAVE_OPENPTY\r
+\r
+/* Define if compiling using MacOS X 10.5 SDK or later. */\r
+#undef HAVE_OSX105_SDK\r
+\r
+/* Define to 1 if you have the `pathconf' function. */\r
+#undef HAVE_PATHCONF\r
+\r
+/* Define to 1 if you have the `pause' function. */\r
+#undef HAVE_PAUSE\r
+\r
+/* Define to 1 if you have the `plock' function. */\r
+#undef HAVE_PLOCK\r
+\r
+/* Define to 1 if you have the `poll' function. */\r
+#undef HAVE_POLL\r
+\r
+/* Define to 1 if you have the <poll.h> header file. */\r
+#undef HAVE_POLL_H\r
+\r
+/* Define to 1 if you have the <process.h> header file. */\r
+#undef HAVE_PROCESS_H\r
+\r
+/* Define if your compiler supports function prototype */\r
+#define HAVE_PROTOTYPES\r
+\r
+/* Define if you have GNU PTH threads. */\r
+#undef HAVE_PTH\r
+\r
+/* Defined for Solaris 2.6 bug in pthread header. */\r
+#undef HAVE_PTHREAD_DESTRUCTOR\r
+\r
+/* Define to 1 if you have the <pthread.h> header file. */\r
+#undef HAVE_PTHREAD_H\r
+\r
+/* Define to 1 if you have the `pthread_init' function. */\r
+#undef HAVE_PTHREAD_INIT\r
+\r
+/* Define to 1 if you have the `pthread_sigmask' function. */\r
+#undef HAVE_PTHREAD_SIGMASK\r
+\r
+/* Define to 1 if you have the <pty.h> header file. */\r
+#undef HAVE_PTY_H\r
+\r
+/* Define to 1 if you have the `putenv' function. */\r
+#undef HAVE_PUTENV\r
+\r
+/* Define to 1 if you have the `readlink' function. */\r
+#undef HAVE_READLINK\r
+\r
+/* Define to 1 if you have the `realpath' function. */\r
+#undef HAVE_REALPATH\r
+\r
+/* Define if you have readline 2.1 */\r
+#undef HAVE_RL_CALLBACK\r
+\r
+/* Define if you can turn off readline's signal handling. */\r
+#undef HAVE_RL_CATCH_SIGNAL\r
+\r
+/* Define if you have readline 2.2 */\r
+#undef HAVE_RL_COMPLETION_APPEND_CHARACTER\r
+\r
+/* Define if you have readline 4.0 */\r
+#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK\r
+\r
+/* Define if you have readline 4.2 */\r
+#undef HAVE_RL_COMPLETION_MATCHES\r
+\r
+/* Define if you have rl_completion_suppress_append */\r
+#undef HAVE_RL_COMPLETION_SUPPRESS_APPEND\r
+\r
+/* Define if you have readline 4.0 */\r
+#undef HAVE_RL_PRE_INPUT_HOOK\r
+\r
+/* Define to 1 if you have the `round' function. */\r
+#undef HAVE_ROUND\r
+\r
+/* Define to 1 if you have the `select' function. */\r
+#undef HAVE_SELECT\r
+\r
+/* Define to 1 if you have the `sem_getvalue' function. */\r
+#undef HAVE_SEM_GETVALUE\r
+\r
+/* Define to 1 if you have the `sem_open' function. */\r
+#undef HAVE_SEM_OPEN\r
+\r
+/* Define to 1 if you have the `sem_timedwait' function. */\r
+#undef HAVE_SEM_TIMEDWAIT\r
+\r
+/* Define to 1 if you have the `sem_unlink' function. */\r
+#undef HAVE_SEM_UNLINK\r
+\r
+/* Define to 1 if you have the `setegid' function. */\r
+#undef HAVE_SETEGID\r
+\r
+/* Define to 1 if you have the `seteuid' function. */\r
+#undef HAVE_SETEUID\r
+\r
+/* Define to 1 if you have the `setgid' function. */\r
+#undef HAVE_SETGID\r
+\r
+/* Define if you have the 'setgroups' function. */\r
+#undef HAVE_SETGROUPS\r
+\r
+/* Define to 1 if you have the `setitimer' function. */\r
+#undef HAVE_SETITIMER\r
+\r
+/* Define to 1 if you have the `setlocale' function. */\r
+#define HAVE_SETLOCALE 1\r
+\r
+/* Define to 1 if you have the `setpgid' function. */\r
+#undef HAVE_SETPGID\r
+\r
+/* Define to 1 if you have the `setpgrp' function. */\r
+#undef HAVE_SETPGRP\r
+\r
+/* Define to 1 if you have the `setregid' function. */\r
+#undef HAVE_SETREGID\r
+\r
+/* Define to 1 if you have the `setresgid' function. */\r
+#undef HAVE_SETRESGID\r
+\r
+/* Define to 1 if you have the `setresuid' function. */\r
+#undef HAVE_SETRESUID\r
+\r
+/* Define to 1 if you have the `setreuid' function. */\r
+#undef HAVE_SETREUID\r
+\r
+/* Define to 1 if you have the `setsid' function. */\r
+#undef HAVE_SETSID\r
+\r
+/* Define to 1 if you have the `setuid' function. */\r
+#undef HAVE_SETUID\r
+\r
+/* Define to 1 if you have the `setvbuf' function. */\r
+#undef HAVE_SETVBUF\r
+\r
+/* Define to 1 if you have the <shadow.h> header file. */\r
+#undef HAVE_SHADOW_H\r
+\r
+/* Define to 1 if you have the `sigaction' function. */\r
+#undef HAVE_SIGACTION\r
+\r
+/* Define to 1 if you have the `siginterrupt' function. */\r
+#undef HAVE_SIGINTERRUPT\r
+\r
+/* Define to 1 if you have the <signal.h> header file. */\r
+#define HAVE_SIGNAL_H 1\r
+\r
+/* Define to 1 if you have the `sigrelse' function. */\r
+#undef HAVE_SIGRELSE\r
+\r
+/* Define to 1 if you have the `snprintf' function. */\r
+#define HAVE_SNPRINTF 1\r
+\r
+/* Define if sockaddr has sa_len member */\r
+#undef HAVE_SOCKADDR_SA_LEN\r
+\r
+/* struct sockaddr_storage (sys/socket.h) */\r
+#undef HAVE_SOCKADDR_STORAGE\r
+\r
+/* Define if you have the 'socketpair' function. */\r
+#undef HAVE_SOCKETPAIR\r
+\r
+/* Define to 1 if you have the <spawn.h> header file. */\r
+#undef HAVE_SPAWN_H\r
+\r
+/* Define if your compiler provides ssize_t */\r
+#undef HAVE_SSIZE_T\r
+\r
+/* Define to 1 if you have the `statvfs' function. */\r
+#undef HAVE_STATVFS\r
+\r
+/* Define if you have struct stat.st_mtim.tv_nsec */\r
+#undef HAVE_STAT_TV_NSEC\r
+\r
+/* Define if you have struct stat.st_mtimensec */\r
+#undef HAVE_STAT_TV_NSEC2\r
+\r
+/* Define if your compiler supports variable length function prototypes (e.g.\r
+ void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */\r
+#define HAVE_STDARG_PROTOTYPES\r
+\r
+/* Define to 1 if you have the <stdint.h> header file. */\r
+#define HAVE_STDINT_H 1\r
+\r
+/* Define to 1 if you have the <stdlib.h> header file. */\r
+#define HAVE_STDLIB_H 1\r
+\r
+/* Define to 1 if you have the `strdup' function. */\r
+#define HAVE_STRDUP 1\r
+\r
+/* Define to 1 if you have the `strftime' function. */\r
+#define HAVE_STRFTIME 1\r
+\r
+/* Define to 1 if you have the <strings.h> header file. */\r
+#undef HAVE_STRINGS_H\r
+\r
+/* Define to 1 if you have the <string.h> header file. */\r
+#define HAVE_STRING_H 1\r
+\r
+/* Define to 1 if you have the <stropts.h> header file. */\r
+#undef HAVE_STROPTS_H\r
+\r
+/* Define to 1 if `st_birthtime' is a member of `struct stat'. */\r
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1\r
+\r
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */\r
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1\r
+\r
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_BLOCKS\r
+\r
+/* Define to 1 if `st_flags' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_FLAGS\r
+\r
+/* Define to 1 if `st_gen' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_GEN\r
+\r
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_RDEV\r
+\r
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */\r
+#undef HAVE_STRUCT_TM_TM_ZONE\r
+\r
+/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use\r
+ `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */\r
+#undef HAVE_ST_BLOCKS\r
+\r
+/* Define if you have the 'symlink' function. */\r
+#undef HAVE_SYMLINK\r
+\r
+/* Define to 1 if you have the `sysconf' function. */\r
+#undef HAVE_SYSCONF\r
+\r
+/* Define to 1 if you have the <sysexits.h> header file. */\r
+#undef HAVE_SYSEXITS_H\r
+\r
+/* Define to 1 if you have the <sys/audioio.h> header file. */\r
+#undef HAVE_SYS_AUDIOIO_H\r
+\r
+/* Define to 1 if you have the <sys/bsdtty.h> header file. */\r
+#undef HAVE_SYS_BSDTTY_H\r
+\r
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_SYS_DIR_H\r
+\r
+/* Define to 1 if you have the <sys/epoll.h> header file. */\r
+#undef HAVE_SYS_EPOLL_H\r
+\r
+/* Define to 1 if you have the <sys/event.h> header file. */\r
+#undef HAVE_SYS_EVENT_H\r
+\r
+/* Define to 1 if you have the <sys/file.h> header file. */\r
+#undef HAVE_SYS_FILE_H\r
+\r
+/* Define to 1 if you have the <sys/loadavg.h> header file. */\r
+#undef HAVE_SYS_LOADAVG_H\r
+\r
+/* Define to 1 if you have the <sys/lock.h> header file. */\r
+#undef HAVE_SYS_LOCK_H\r
+\r
+/* Define to 1 if you have the <sys/mkdev.h> header file. */\r
+#undef HAVE_SYS_MKDEV_H\r
+\r
+/* Define to 1 if you have the <sys/modem.h> header file. */\r
+#undef HAVE_SYS_MODEM_H\r
+\r
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_SYS_NDIR_H\r
+\r
+/* Define to 1 if you have the <sys/param.h> header file. */\r
+#define HAVE_SYS_PARAM_H 1\r
+\r
+/* Define to 1 if you have the <sys/poll.h> header file. */\r
+#undef HAVE_SYS_POLL_H\r
+\r
+/* Define to 1 if you have the <sys/resource.h> header file. */\r
+#define HAVE_SYS_RESOURCE_H 1\r
+\r
+/* Define to 1 if you have the <sys/select.h> header file. */\r
+#undef HAVE_SYS_SELECT_H\r
+\r
+/* Define to 1 if you have the <sys/socket.h> header file. */\r
+#undef HAVE_SYS_SOCKET_H\r
+\r
+/* Define to 1 if you have the <sys/statvfs.h> header file. */\r
+#undef HAVE_SYS_STATVFS_H\r
+\r
+/* Define to 1 if you have the <sys/stat.h> header file. */\r
+#define HAVE_SYS_STAT_H 1\r
+\r
+/* Define to 1 if you have the <sys/termio.h> header file. */\r
+#undef HAVE_SYS_TERMIO_H\r
+\r
+/* Define to 1 if you have the <sys/times.h> header file. */\r
+#undef HAVE_SYS_TIMES_H\r
+\r
+/* Define to 1 if you have the <sys/time.h> header file. */\r
+#define HAVE_SYS_TIME_H 1\r
+\r
+/* Define to 1 if you have the <sys/types.h> header file. */\r
+#define HAVE_SYS_TYPES_H 1\r
+\r
+/* Define to 1 if you have the <sys/un.h> header file. */\r
+#undef HAVE_SYS_UN_H\r
+\r
+/* Define to 1 if you have the <sys/utsname.h> header file. */\r
+#undef HAVE_SYS_UTSNAME_H\r
+\r
+/* Define to 1 if you have the <sys/wait.h> header file. */\r
+#undef HAVE_SYS_WAIT_H\r
+\r
+/* Define to 1 if you have the `tcgetpgrp' function. */\r
+#undef HAVE_TCGETPGRP\r
+\r
+/* Define to 1 if you have the `tcsetpgrp' function. */\r
+#undef HAVE_TCSETPGRP\r
+\r
+/* Define to 1 if you have the `tempnam' function. */\r
+#define HAVE_TEMPNAM 1\r
+\r
+/* Define to 1 if you have the <termios.h> header file. */\r
+#define HAVE_TERMIOS_H 1\r
+\r
+/* Define to 1 if you have the <term.h> header file. */\r
+#undef HAVE_TERM_H\r
+\r
+/* Define to 1 if you have the `tgamma' function. */\r
+#undef HAVE_TGAMMA\r
+\r
+/* Define to 1 if you have the <thread.h> header file. */\r
+#undef HAVE_THREAD_H\r
+\r
+/* Define to 1 if you have the `timegm' function. */\r
+#undef HAVE_TIMEGM\r
+\r
+/* Define to 1 if you have the `times' function. */\r
+#undef HAVE_TIMES\r
+\r
+/* Define to 1 if you have the `tmpfile' function. */\r
+#define HAVE_TMPFILE 1\r
+\r
+/* Define to 1 if you have the `tmpnam' function. */\r
+#define HAVE_TMPNAM 1\r
+\r
+/* Define to 1 if you have the `tmpnam_r' function. */\r
+#undef HAVE_TMPNAM_R\r
+\r
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use\r
+ `HAVE_STRUCT_TM_TM_ZONE' instead. */\r
+#undef HAVE_TM_ZONE\r
+\r
+/* Define to 1 if you have the `truncate' function. */\r
+#undef HAVE_TRUNCATE\r
+\r
+/* Define to 1 if you don't have `tm_zone' but do have the external array\r
+ `tzname'. */\r
+#undef HAVE_TZNAME\r
+\r
+/* Define this if you have tcl and TCL_UTF_MAX==6 */\r
+#undef HAVE_UCS4_TCL\r
+\r
+/* Define to 1 if the system has the type `uintptr_t'. */\r
+#define HAVE_UINTPTR_T 1\r
+\r
+/* Define to 1 if you have the `uname' function. */\r
+#undef HAVE_UNAME\r
+\r
+/* Define to 1 if you have the <unistd.h> header file. */\r
+#undef HAVE_UNISTD_H\r
+\r
+/* Define to 1 if you have the `unsetenv' function. */\r
+#undef HAVE_UNSETENV\r
+\r
+/* Define if you have a useable wchar_t type defined in wchar.h; useable means\r
+ wchar_t must be an unsigned type with at least 16 bits. (see\r
+ Include/unicodeobject.h). */\r
+#define HAVE_USABLE_WCHAR_T\r
+\r
+/* Define to 1 if you have the <util.h> header file. */\r
+#undef HAVE_UTIL_H\r
+\r
+/* Define to 1 if you have the `utimes' function. */\r
+#undef HAVE_UTIMES\r
+\r
+/* Define to 1 if you have the <utime.h> header file. */\r
+#undef HAVE_UTIME_H\r
+\r
+/* Define to 1 if you have the `wait3' function. */\r
+#undef HAVE_WAIT3\r
+\r
+/* Define to 1 if you have the `wait4' function. */\r
+#undef HAVE_WAIT4\r
+\r
+/* Define to 1 if you have the `waitpid' function. */\r
+#undef HAVE_WAITPID\r
+\r
+/* Define if the compiler provides a wchar.h header file. */\r
+#define HAVE_WCHAR_H\r
+\r
+/* Define to 1 if you have the `wcscoll' function. */\r
+#undef HAVE_WCSCOLL\r
+\r
+/* Define if tzset() actually switches the local timezone in a meaningful way.\r
+ */\r
+#define HAVE_WORKING_TZSET\r
+\r
+/* Define if the zlib library has inflateCopy */\r
+#undef HAVE_ZLIB_COPY\r
+\r
+/* Define to 1 if you have the `_getpty' function. */\r
+#undef HAVE__GETPTY\r
+\r
+/* Define if you are using Mach cthreads directly under /include */\r
+#undef HURD_C_THREADS\r
+\r
+/* Define if you are using Mach cthreads under mach / */\r
+#undef MACH_C_THREADS\r
+\r
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.\r
+ */\r
+#undef MAJOR_IN_MKDEV\r
+\r
+/* Define to 1 if `major', `minor', and `makedev' are declared in\r
+ <sysmacros.h>. */\r
+#undef MAJOR_IN_SYSMACROS\r
+\r
+/* Define if mvwdelch in curses.h is an expression. */\r
+#undef MVWDELCH_IS_EXPRESSION\r
+\r
+/* Define to the address where bug reports for this package should be sent. */\r
+#undef PACKAGE_BUGREPORT\r
+\r
+/* Define to the full name of this package. */\r
+#define PACKAGE_NAME EDK II Python Package\r
+\r
+/* Define to the full name and version of this package. */\r
+#define PACKAGE_STRING EDK II Python Package V0.1\r
+\r
+/* Define to the one symbol short name of this package. */\r
+#define PACKAGE_TARNAME UDK_Python\r
+\r
+/* Define to the home page for this package. */\r
+#define PACKAGE_URL http://edk2.tianocore.org/toolkit/python\r
+\r
+/* Define to the version of this package. */\r
+#undef PACKAGE_VERSION V0.1\r
+\r
+/* Define if POSIX semaphores aren't enabled on your system */\r
+#define POSIX_SEMAPHORES_NOT_ENABLED\r
+\r
+/* Defined if PTHREAD_SCOPE_SYSTEM supported. */\r
+#undef PTHREAD_SYSTEM_SCHED_SUPPORTED\r
+\r
+/* Define as the preferred size in bits of long digits */\r
+#undef PYLONG_BITS_IN_DIGIT\r
+\r
+/* Define to printf format modifier for long long type */\r
+#undef PY_FORMAT_LONG_LONG\r
+\r
+/* Define to printf format modifier for Py_ssize_t */\r
+#undef PY_FORMAT_SIZE_T\r
+\r
+/* Define as the integral type used for Unicode representation. */\r
+#undef PY_UNICODE_TYPE\r
+\r
+/* Define if you want to build an interpreter with many run-time checks. */\r
+#undef Py_DEBUG\r
+\r
+/* Defined if Python is built as a shared library. */\r
+#undef Py_ENABLE_SHARED\r
+\r
+/* Define as the size of the unicode type. */\r
+#define Py_UNICODE_SIZE 2\r
+\r
+/* Define if you want to have a Unicode type. */\r
+#define Py_USING_UNICODE\r
+\r
+/* assume C89 semantics that RETSIGTYPE is always void */\r
+#undef RETSIGTYPE\r
+\r
+/* Define if setpgrp() must be called as setpgrp(0, 0). */\r
+#undef SETPGRP_HAVE_ARG\r
+\r
+/* Define this to be extension of shared libraries (including the dot!). */\r
+#undef SHLIB_EXT\r
+\r
+/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */\r
+#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS\r
+\r
+/* The size of `double', as computed by sizeof. */\r
+#undef SIZEOF_DOUBLE\r
+\r
+/* The size of `float', as computed by sizeof. */\r
+#undef SIZEOF_FLOAT\r
+\r
+/* The size of `fpos_t', as computed by sizeof. */\r
+#undef SIZEOF_FPOS_T\r
+\r
+/* The size of `int', as computed by sizeof. */\r
+#undef SIZEOF_INT\r
+\r
+/* The size of `long', as computed by sizeof. */\r
+#undef SIZEOF_LONG\r
+\r
+/* The size of `long double', as computed by sizeof. */\r
+#undef SIZEOF_LONG_DOUBLE\r
+\r
+/* The size of `long long', as computed by sizeof. */\r
+#undef SIZEOF_LONG_LONG\r
+\r
+/* The size of `off_t', as computed by sizeof. */\r
+#undef SIZEOF_OFF_T\r
+\r
+/* The size of `pid_t', as computed by sizeof. */\r
+#undef SIZEOF_PID_T\r
+\r
+/* The size of `pthread_t', as computed by sizeof. */\r
+#undef SIZEOF_PTHREAD_T\r
+\r
+/* The size of `short', as computed by sizeof. */\r
+#undef SIZEOF_SHORT\r
+\r
+/* The size of `size_t', as computed by sizeof. */\r
+#undef SIZEOF_SIZE_T\r
+\r
+/* The size of `time_t', as computed by sizeof. */\r
+#undef SIZEOF_TIME_T\r
+\r
+/* The size of `uintptr_t', as computed by sizeof. */\r
+#undef SIZEOF_UINTPTR_T\r
+\r
+/* The size of `void *', as computed by sizeof. */\r
+#undef SIZEOF_VOID_P\r
+\r
+/* The size of `wchar_t', as computed by sizeof. */\r
+#undef SIZEOF_WCHAR_T\r
+\r
+/* The size of `_Bool', as computed by sizeof. */\r
+#undef SIZEOF__BOOL\r
+\r
+/* Define to 1 if you have the ANSI C header files. */\r
+#define STDC_HEADERS 1\r
+\r
+/* Define if you can safely include both <sys/select.h> and <sys/time.h>\r
+ (which you can't on SCO ODT 3.0). */\r
+#undef SYS_SELECT_WITH_SYS_TIME\r
+\r
+/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */\r
+#undef TANH_PRESERVES_ZERO_SIGN\r
+\r
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r
+#undef TIME_WITH_SYS_TIME\r
+\r
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */\r
+#undef TM_IN_SYS_TIME\r
+\r
+/* Enable extensions on AIX 3, Interix. */\r
+#ifndef _ALL_SOURCE\r
+# undef _ALL_SOURCE\r
+#endif\r
+/* Enable GNU extensions on systems that have them. */\r
+#ifndef _GNU_SOURCE\r
+# undef _GNU_SOURCE\r
+#endif\r
+/* Enable threading extensions on Solaris. */\r
+#ifndef _POSIX_PTHREAD_SEMANTICS\r
+# undef _POSIX_PTHREAD_SEMANTICS\r
+#endif\r
+/* Enable extensions on HP NonStop. */\r
+#ifndef _TANDEM_SOURCE\r
+# undef _TANDEM_SOURCE\r
+#endif\r
+/* Enable general extensions on Solaris. */\r
+#ifndef __EXTENSIONS__\r
+# undef __EXTENSIONS__\r
+#endif\r
+\r
+\r
+/* Define if you want to use MacPython modules on MacOSX in unix-Python. */\r
+#undef USE_TOOLBOX_OBJECT_GLUE\r
+\r
+/* Define if a va_list is an array of some kind */\r
+#undef VA_LIST_IS_ARRAY\r
+\r
+/* Define if you want SIGFPE handled (see Include/pyfpe.h). */\r
+#undef WANT_SIGFPE_HANDLER\r
+\r
+/* Define if you want wctype.h functions to be used instead of the one\r
+ supplied by Python itself. (see Include/unicodectype.h). */\r
+#undef WANT_WCTYPE_FUNCTIONS\r
+\r
+/* Define if WINDOW in curses.h offers a field _flags. */\r
+#undef WINDOW_HAS_FLAGS\r
+\r
+/* Define if you want documentation strings in extension modules */\r
+#undef WITH_DOC_STRINGS\r
+\r
+/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic\r
+ linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).\r
+ Dyld is necessary to support frameworks. */\r
+#undef WITH_DYLD\r
+\r
+/* Define to 1 if libintl is needed for locale functions. */\r
+#undef WITH_LIBINTL\r
+\r
+/* Define if you want to produce an OpenStep/Rhapsody framework (shared\r
+ library plus accessory files). */\r
+#undef WITH_NEXT_FRAMEWORK\r
+\r
+/* Define if you want to compile in Python-specific mallocs */\r
+#undef WITH_PYMALLOC\r
+\r
+/* Define if you want to compile in rudimentary thread support */\r
+#undef WITH_THREAD\r
+\r
+/* Define to profile with the Pentium timestamp counter */\r
+#undef WITH_TSC\r
+\r
+/* Define if you want pymalloc to be disabled when running under valgrind */\r
+#undef WITH_VALGRIND\r
+\r
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\r
+ significant byte first (like Motorola and SPARC, unlike Intel). */\r
+#if defined AC_APPLE_UNIVERSAL_BUILD\r
+# if defined __BIG_ENDIAN__\r
+# define WORDS_BIGENDIAN 1\r
+# endif\r
+#else\r
+# ifndef WORDS_BIGENDIAN\r
+# undef WORDS_BIGENDIAN\r
+# endif\r
+#endif\r
+\r
+/* Define if arithmetic is subject to x87-style double rounding issue */\r
+#undef X87_DOUBLE_ROUNDING\r
+\r
+/* Define on OpenBSD to activate all library features */\r
+#undef _BSD_SOURCE\r
+\r
+/* Define on Irix to enable u_int */\r
+#undef _BSD_TYPES\r
+\r
+/* Define on Darwin to activate all library features */\r
+#undef _DARWIN_C_SOURCE\r
+\r
+/* This must be set to 64 on some systems to enable large file support. */\r
+#undef _FILE_OFFSET_BITS\r
+\r
+/* Define on Linux to activate all library features */\r
+#undef _GNU_SOURCE\r
+\r
+/* This must be defined on some systems to enable large file support. */\r
+#undef _LARGEFILE_SOURCE\r
+\r
+/* Define to 1 if on MINIX. */\r
+#undef _MINIX\r
+\r
+/* Define on NetBSD to activate all library features */\r
+#define _NETBSD_SOURCE\r
+\r
+/* Define _OSF_SOURCE to get the makedev macro. */\r
+#undef _OSF_SOURCE\r
+\r
+/* Define to 2 if the system does not provide POSIX.1 features except with\r
+ this defined. */\r
+#undef _POSIX_1_SOURCE\r
+\r
+/* Define to activate features from IEEE Stds 1003.1-2001 */\r
+#undef _POSIX_C_SOURCE\r
+\r
+/* Define to 1 if you need to in order for `stat' and other things to work. */\r
+#undef _POSIX_SOURCE\r
+\r
+/* Define if you have POSIX threads, and your system does not define that. */\r
+#undef _POSIX_THREADS\r
+\r
+/* Define to force use of thread-safe errno, h_errno, and other functions */\r
+#undef _REENTRANT\r
+\r
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,\r
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the\r
+ #define below would cause a syntax error. */\r
+#undef _UINT32_T\r
+\r
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,\r
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the\r
+ #define below would cause a syntax error. */\r
+#undef _UINT64_T\r
+\r
+/* Define to the level of X/Open that your system supports */\r
+#undef _XOPEN_SOURCE\r
+\r
+/* Define to activate Unix95-and-earlier features */\r
+#undef _XOPEN_SOURCE_EXTENDED\r
+\r
+/* Define on FreeBSD to activate all library features */\r
+#undef __BSD_VISIBLE\r
+\r
+/* Define to 1 if type `char' is unsigned and you are not using gcc. */\r
+#ifndef __CHAR_UNSIGNED__\r
+# undef __CHAR_UNSIGNED__\r
+#endif\r
+\r
+/* Defined on Solaris to see additional function prototypes. */\r
+#undef __EXTENSIONS__\r
+\r
+/* Define to 'long' if <time.h> doesn't define. */\r
+#undef clock_t\r
+\r
+/* Define to empty if `const' does not conform to ANSI C. */\r
+#undef const\r
+\r
+/* Define to `int' if <sys/types.h> doesn't define. */\r
+#undef gid_t\r
+\r
+/* Define to the type of a signed integer type of width exactly 32 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef int32_t\r
+\r
+/* Define to the type of a signed integer type of width exactly 64 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef int64_t\r
+\r
+/* Define to `int' if <sys/types.h> does not define. */\r
+#undef mode_t\r
+\r
+/* Define to `long int' if <sys/types.h> does not define. */\r
+#undef off_t\r
+\r
+/* Define to `int' if <sys/types.h> does not define. */\r
+#undef pid_t\r
+\r
+/* Define to empty if the keyword does not work. */\r
+#undef signed\r
+\r
+/* Define to `unsigned int' if <sys/types.h> does not define. */\r
+#undef size_t\r
+\r
+/* Define to `int' if <sys/socket.h> does not define. */\r
+#undef socklen_t\r
+\r
+/* Define to `int' if <sys/types.h> doesn't define. */\r
+#undef uid_t\r
+\r
+/* Define to the type of an unsigned integer type of width exactly 32 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef uint32_t\r
+\r
+/* Define to the type of an unsigned integer type of width exactly 64 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef uint64_t\r
+\r
+/* Define to empty if the keyword does not work. */\r
+#undef volatile\r
+\r
+\r
+/* Define the macros needed if on a UnixWare 7.x system. */\r
+#if defined(__USLC__) && defined(__SCO_VERSION__)\r
+#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */\r
+#endif\r
+\r
+#endif /*Py_PYCONFIG_H*/\r
+\r
--- /dev/null
+\r
+/* File object interface */\r
+\r
+#ifndef Py_FILEOBJECT_H\r
+#define Py_FILEOBJECT_H\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+typedef struct {\r
+ PyObject_HEAD\r
+ FILE *f_fp;\r
+ PyObject *f_name;\r
+ PyObject *f_mode;\r
+ int (*f_close)(FILE *);\r
+ int f_softspace; /* Flag used by 'print' command */\r
+ int f_binary; /* Flag which indicates whether the file is\r
+ open in binary (1) or text (0) mode */\r
+ char* f_buf; /* Allocated readahead buffer */\r
+ char* f_bufend; /* Points after last occupied position */\r
+ char* f_bufptr; /* Current buffer position */\r
+ char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */\r
+ int f_univ_newline; /* Handle any newline convention */\r
+ int f_newlinetypes; /* Types of newlines seen */\r
+ int f_skipnextlf; /* Skip next \n */\r
+ PyObject *f_encoding;\r
+ PyObject *f_errors;\r
+ PyObject *weakreflist; /* List of weak references */\r
+ int unlocked_count; /* Num. currently running sections of code\r
+ using f_fp with the GIL released. */\r
+ int readable;\r
+ int writable;\r
+} PyFileObject;\r
+\r
+PyAPI_DATA(PyTypeObject) PyFile_Type;\r
+\r
+#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type)\r
+#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type)\r
+\r
+PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *);\r
+PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int);\r
+PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *);\r
+PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors);\r
+PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *,\r
+ int (*)(FILE *));\r
+PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *);\r
+PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *);\r
+PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *);\r
+PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *);\r
+PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int);\r
+PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int);\r
+PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int);\r
+PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *);\r
+PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *);\r
+\r
+/* The default encoding used by the platform file system APIs\r
+ If non-NULL, this is different than the default encoding for strings\r
+*/\r
+PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;\r
+\r
+/* Routines to replace fread() and fgets() which accept any of \r, \n\r
+ or \r\n as line terminators.\r
+*/\r
+#define PY_STDIOTEXTMODE "b"\r
+char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);\r
+size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);\r
+\r
+/* A routine to do sanity checking on the file mode string. returns\r
+ non-zero on if an exception occurred\r
+*/\r
+int _PyFile_SanitizeMode(char *mode);\r
+\r
+//#if defined _MSC_VER && _MSC_VER >= 1400\r
+/* A routine to check if a file descriptor is valid on Windows. Returns 0\r
+ * and sets errno to EBADF if it isn't. This is to avoid Assertions\r
+ * from various functions in the Windows CRT beginning with\r
+ * Visual Studio 2005\r
+ */\r
+//int _PyVerify_fd(int fd);\r
+//#elif defined _MSC_VER && _MSC_VER >= 1200\r
+/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */\r
+//#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0)\r
+//#else\r
+#define _PyVerify_fd(A) (1) /* dummy */\r
+//#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif /* !Py_FILEOBJECT_H */\r
--- /dev/null
+#ifndef Py_PYPORT_H\r
+#define Py_PYPORT_H\r
+\r
+#include "pyconfig.h" /* include for defines */\r
+\r
+/* Some versions of HP-UX & Solaris need inttypes.h for int32_t,\r
+ INT32_MAX, etc. */\r
+#ifdef HAVE_INTTYPES_H\r
+#include <inttypes.h>\r
+#endif\r
+\r
+#ifdef HAVE_STDINT_H\r
+#include <stdint.h>\r
+#endif\r
+\r
+/**************************************************************************\r
+Symbols and macros to supply platform-independent interfaces to basic\r
+C language & library operations whose spellings vary across platforms.\r
+\r
+Please try to make documentation here as clear as possible: by definition,\r
+the stuff here is trying to illuminate C's darkest corners.\r
+\r
+Config #defines referenced here:\r
+\r
+SIGNED_RIGHT_SHIFT_ZERO_FILLS\r
+Meaning: To be defined iff i>>j does not extend the sign bit when i is a\r
+ signed integral type and i < 0.\r
+Used in: Py_ARITHMETIC_RIGHT_SHIFT\r
+\r
+Py_DEBUG\r
+Meaning: Extra checks compiled in for debug mode.\r
+Used in: Py_SAFE_DOWNCAST\r
+\r
+HAVE_UINTPTR_T\r
+Meaning: The C9X type uintptr_t is supported by the compiler\r
+Used in: Py_uintptr_t\r
+\r
+HAVE_LONG_LONG\r
+Meaning: The compiler supports the C type "long long"\r
+Used in: PY_LONG_LONG\r
+\r
+**************************************************************************/\r
+\r
+\r
+/* For backward compatibility only. Obsolete, do not use. */\r
+#ifdef HAVE_PROTOTYPES\r
+#define Py_PROTO(x) x\r
+#else\r
+#define Py_PROTO(x) ()\r
+#endif\r
+#ifndef Py_FPROTO\r
+#define Py_FPROTO(x) Py_PROTO(x)\r
+#endif\r
+\r
+/* typedefs for some C9X-defined synonyms for integral types.\r
+ *\r
+ * The names in Python are exactly the same as the C9X names, except with a\r
+ * Py_ prefix. Until C9X is universally implemented, this is the only way\r
+ * to ensure that Python gets reliable names that don't conflict with names\r
+ * in non-Python code that are playing their own tricks to define the C9X\r
+ * names.\r
+ *\r
+ * NOTE: don't go nuts here! Python has no use for *most* of the C9X\r
+ * integral synonyms. Only define the ones we actually need.\r
+ */\r
+\r
+#ifdef HAVE_LONG_LONG\r
+#ifndef PY_LONG_LONG\r
+#define PY_LONG_LONG long long\r
+#if defined(LLONG_MAX)\r
+/* If LLONG_MAX is defined in limits.h, use that. */\r
+#define PY_LLONG_MIN LLONG_MIN\r
+#define PY_LLONG_MAX LLONG_MAX\r
+#define PY_ULLONG_MAX ULLONG_MAX\r
+#elif defined(__LONG_LONG_MAX__)\r
+/* Otherwise, if GCC has a builtin define, use that. */\r
+#define PY_LLONG_MAX __LONG_LONG_MAX__\r
+#define PY_LLONG_MIN (-PY_LLONG_MAX-1)\r
+#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL)\r
+#else\r
+/* Otherwise, rely on two's complement. */\r
+#define PY_ULLONG_MAX (~0ULL)\r
+#define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1))\r
+#define PY_LLONG_MIN (-PY_LLONG_MAX-1)\r
+#endif /* LLONG_MAX */\r
+#endif\r
+#endif /* HAVE_LONG_LONG */\r
+\r
+/* a build with 30-bit digits for Python long integers needs an exact-width\r
+ * 32-bit unsigned integer type to store those digits. (We could just use\r
+ * type 'unsigned long', but that would be wasteful on a system where longs\r
+ * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines\r
+ * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.\r
+ * However, it doesn't set HAVE_UINT32_T, so we do that here.\r
+ */\r
+#if (defined UINT32_MAX || defined uint32_t)\r
+#ifndef PY_UINT32_T\r
+#define HAVE_UINT32_T 1\r
+#define PY_UINT32_T uint32_t\r
+#endif\r
+#endif\r
+\r
+/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the\r
+ * long integer implementation, when 30-bit digits are enabled.\r
+ */\r
+#if (defined UINT64_MAX || defined uint64_t)\r
+#ifndef PY_UINT64_T\r
+#define HAVE_UINT64_T 1\r
+#define PY_UINT64_T uint64_t\r
+#endif\r
+#endif\r
+\r
+/* Signed variants of the above */\r
+#if (defined INT32_MAX || defined int32_t)\r
+#ifndef PY_INT32_T\r
+#define HAVE_INT32_T 1\r
+#define PY_INT32_T int32_t\r
+#endif\r
+#endif\r
+#if (defined INT64_MAX || defined int64_t)\r
+#ifndef PY_INT64_T\r
+#define HAVE_INT64_T 1\r
+#define PY_INT64_T int64_t\r
+#endif\r
+#endif\r
+\r
+/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all\r
+ the necessary integer types are available, and we're on a 64-bit platform\r
+ (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */\r
+\r
+#ifndef PYLONG_BITS_IN_DIGIT\r
+#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \\r
+ defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8)\r
+#define PYLONG_BITS_IN_DIGIT 30\r
+#else\r
+#define PYLONG_BITS_IN_DIGIT 15\r
+#endif\r
+#endif\r
+\r
+/* uintptr_t is the C9X name for an unsigned integral type such that a\r
+ * legitimate void* can be cast to uintptr_t and then back to void* again\r
+ * without loss of information. Similarly for intptr_t, wrt a signed\r
+ * integral type.\r
+ */\r
+#ifdef HAVE_UINTPTR_T\r
+typedef uintptr_t Py_uintptr_t;\r
+typedef intptr_t Py_intptr_t;\r
+\r
+#elif SIZEOF_VOID_P <= SIZEOF_INT\r
+typedef unsigned int Py_uintptr_t;\r
+typedef int Py_intptr_t;\r
+\r
+#elif SIZEOF_VOID_P <= SIZEOF_LONG\r
+typedef unsigned long Py_uintptr_t;\r
+typedef long Py_intptr_t;\r
+\r
+#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG)\r
+typedef unsigned PY_LONG_LONG Py_uintptr_t;\r
+typedef PY_LONG_LONG Py_intptr_t;\r
+\r
+#else\r
+# error "Python needs a typedef for Py_uintptr_t in pyport.h."\r
+#endif /* HAVE_UINTPTR_T */\r
+\r
+/* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) ==\r
+ * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an\r
+ * unsigned integral type). See PEP 353 for details.\r
+ */\r
+#ifdef HAVE_SSIZE_T\r
+typedef ssize_t Py_ssize_t;\r
+#elif SIZEOF_VOID_P == SIZEOF_SIZE_T\r
+typedef Py_intptr_t Py_ssize_t;\r
+#else\r
+# error "Python needs a typedef for Py_ssize_t in pyport.h."\r
+#endif\r
+\r
+/* Largest possible value of size_t.\r
+ SIZE_MAX is part of C99, so it might be defined on some\r
+ platforms. If it is not defined, (size_t)-1 is a portable\r
+ definition for C89, due to the way signed->unsigned\r
+ conversion is defined. */\r
+#ifdef SIZE_MAX\r
+#define PY_SIZE_MAX SIZE_MAX\r
+#else\r
+#define PY_SIZE_MAX ((size_t)-1)\r
+#endif\r
+\r
+/* Largest positive value of type Py_ssize_t. */\r
+#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1))\r
+/* Smallest negative value of type Py_ssize_t. */\r
+#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)\r
+\r
+#if SIZEOF_PID_T > SIZEOF_LONG\r
+# error "Python doesn't support sizeof(pid_t) > sizeof(long)"\r
+#endif\r
+\r
+/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf\r
+ * format to convert an argument with the width of a size_t or Py_ssize_t.\r
+ * C99 introduced "z" for this purpose, but not all platforms support that;\r
+ * e.g., MS compilers use "I" instead.\r
+ *\r
+ * These "high level" Python format functions interpret "z" correctly on\r
+ * all platforms (Python interprets the format string itself, and does whatever\r
+ * the platform C requires to convert a size_t/Py_ssize_t argument):\r
+ *\r
+ * PyString_FromFormat\r
+ * PyErr_Format\r
+ * PyString_FromFormatV\r
+ *\r
+ * Lower-level uses require that you interpolate the correct format modifier\r
+ * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for\r
+ * example,\r
+ *\r
+ * Py_ssize_t index;\r
+ * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index);\r
+ *\r
+ * That will expand to %ld, or %Id, or to something else correct for a\r
+ * Py_ssize_t on the platform.\r
+ */\r
+#ifndef PY_FORMAT_SIZE_T\r
+# if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__)\r
+# define PY_FORMAT_SIZE_T ""\r
+# elif SIZEOF_SIZE_T == SIZEOF_LONG\r
+# define PY_FORMAT_SIZE_T "l"\r
+# elif defined(MS_WINDOWS)\r
+# define PY_FORMAT_SIZE_T "I"\r
+# else\r
+# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T"\r
+# endif\r
+#endif\r
+\r
+/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for\r
+ * the long long type instead of the size_t type. It's only available\r
+ * when HAVE_LONG_LONG is defined. The "high level" Python format\r
+ * functions listed above will interpret "lld" or "llu" correctly on\r
+ * all platforms.\r
+ */\r
+#ifdef HAVE_LONG_LONG\r
+# ifndef PY_FORMAT_LONG_LONG\r
+# if defined(MS_WIN64) || defined(MS_WINDOWS)\r
+# define PY_FORMAT_LONG_LONG "I64"\r
+# else\r
+# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"\r
+# endif\r
+# endif\r
+#endif\r
+\r
+/* Py_LOCAL can be used instead of static to get the fastest possible calling\r
+ * convention for functions that are local to a given module.\r
+ *\r
+ * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining,\r
+ * for platforms that support that.\r
+ *\r
+ * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more\r
+ * "aggressive" inlining/optimizaion is enabled for the entire module. This\r
+ * may lead to code bloat, and may slow things down for those reasons. It may\r
+ * also lead to errors, if the code relies on pointer aliasing. Use with\r
+ * care.\r
+ *\r
+ * NOTE: You can only use this for functions that are entirely local to a\r
+ * module; functions that are exported via method tables, callbacks, etc,\r
+ * should keep using static.\r
+ */\r
+\r
+#undef USE_INLINE /* XXX - set via configure? */\r
+\r
+#if defined(_MSC_VER)\r
+#if defined(PY_LOCAL_AGGRESSIVE)\r
+/* enable more aggressive optimization for visual studio */\r
+//#pragma optimize("agtw", on)\r
+#pragma optimize("gt", on) // a and w are not legal for VS2005\r
+#endif\r
+/* ignore warnings if the compiler decides not to inline a function */\r
+#pragma warning(disable: 4710)\r
+/* fastest possible local call under MSVC */\r
+#define Py_LOCAL(type) static type __fastcall\r
+#define Py_LOCAL_INLINE(type) static __inline type __fastcall\r
+#elif defined(USE_INLINE)\r
+#define Py_LOCAL(type) static type\r
+#define Py_LOCAL_INLINE(type) static inline type\r
+#else\r
+#define Py_LOCAL(type) static type\r
+#define Py_LOCAL_INLINE(type) static type\r
+#endif\r
+\r
+/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks\r
+ * are often very short. While most platforms have highly optimized code for\r
+ * large transfers, the setup costs for memcpy are often quite high. MEMCPY\r
+ * solves this by doing short copies "in line".\r
+ */\r
+\r
+#if defined(_MSC_VER)\r
+#define Py_MEMCPY(target, source, length) do { \\r
+ size_t i_, n_ = (length); \\r
+ char *t_ = (void*) (target); \\r
+ const char *s_ = (void*) (source); \\r
+ if (n_ >= 16) \\r
+ memcpy(t_, s_, n_); \\r
+ else \\r
+ for (i_ = 0; i_ < n_; i_++) \\r
+ t_[i_] = s_[i_]; \\r
+ } while (0)\r
+#else\r
+#define Py_MEMCPY memcpy\r
+#endif\r
+\r
+#include <stdlib.h>\r
+\r
+#ifdef HAVE_IEEEFP_H\r
+#include <ieeefp.h> /* needed for 'finite' declaration on some platforms */\r
+#endif\r
+\r
+#include <math.h> /* Moved here from the math section, before extern "C" */\r
+\r
+/********************************************\r
+ * WRAPPER FOR <time.h> and/or <sys/time.h> *\r
+ ********************************************/\r
+\r
+#ifdef TIME_WITH_SYS_TIME\r
+#include <sys/time.h>\r
+#include <time.h>\r
+#else /* !TIME_WITH_SYS_TIME */\r
+#ifdef HAVE_SYS_TIME_H\r
+#include <sys/time.h>\r
+#else /* !HAVE_SYS_TIME_H */\r
+#include <time.h>\r
+#endif /* !HAVE_SYS_TIME_H */\r
+#endif /* !TIME_WITH_SYS_TIME */\r
+\r
+\r
+/******************************\r
+ * WRAPPER FOR <sys/select.h> *\r
+ ******************************/\r
+\r
+/* NB caller must include <sys/types.h> */\r
+\r
+#ifdef HAVE_SYS_SELECT_H\r
+\r
+#include <sys/select.h>\r
+\r
+#endif /* !HAVE_SYS_SELECT_H */\r
+\r
+/*******************************\r
+ * stat() and fstat() fiddling *\r
+ *******************************/\r
+\r
+/* We expect that stat and fstat exist on most systems.\r
+ * It's confirmed on Unix, Mac and Windows.\r
+ * If you don't have them, add\r
+ * #define DONT_HAVE_STAT\r
+ * and/or\r
+ * #define DONT_HAVE_FSTAT\r
+ * to your pyconfig.h. Python code beyond this should check HAVE_STAT and\r
+ * HAVE_FSTAT instead.\r
+ * Also\r
+ * #define HAVE_SYS_STAT_H\r
+ * if <sys/stat.h> exists on your platform, and\r
+ * #define HAVE_STAT_H\r
+ * if <stat.h> does.\r
+ */\r
+#ifndef DONT_HAVE_STAT\r
+#define HAVE_STAT\r
+#endif\r
+\r
+#ifndef DONT_HAVE_FSTAT\r
+#define HAVE_FSTAT\r
+#endif\r
+\r
+#ifdef RISCOS\r
+#include <sys/types.h>\r
+#include "unixstuff.h"\r
+#endif\r
+\r
+#ifdef HAVE_SYS_STAT_H\r
+#if defined(PYOS_OS2) && defined(PYCC_GCC)\r
+#include <sys/types.h>\r
+#endif\r
+#include <sys/stat.h>\r
+#elif defined(HAVE_STAT_H)\r
+#include <stat.h>\r
+#endif\r
+\r
+#if defined(PYCC_VACPP)\r
+/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */\r
+#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG)\r
+#endif\r
+\r
+#ifndef S_ISREG\r
+#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG)\r
+#endif\r
+\r
+#ifndef S_ISDIR\r
+#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR)\r
+#endif\r
+\r
+\r
+#ifdef __cplusplus\r
+/* Move this down here since some C++ #include's don't like to be included\r
+ inside an extern "C" */\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/* Py_ARITHMETIC_RIGHT_SHIFT\r
+ * C doesn't define whether a right-shift of a signed integer sign-extends\r
+ * or zero-fills. Here a macro to force sign extension:\r
+ * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J)\r
+ * Return I >> J, forcing sign extension. Arithmetically, return the\r
+ * floor of I/2**J.\r
+ * Requirements:\r
+ * I should have signed integer type. In the terminology of C99, this can\r
+ * be either one of the five standard signed integer types (signed char,\r
+ * short, int, long, long long) or an extended signed integer type.\r
+ * J is an integer >= 0 and strictly less than the number of bits in the\r
+ * type of I (because C doesn't define what happens for J outside that\r
+ * range either).\r
+ * TYPE used to specify the type of I, but is now ignored. It's been left\r
+ * in for backwards compatibility with versions <= 2.6 or 3.0.\r
+ * Caution:\r
+ * I may be evaluated more than once.\r
+ */\r
+#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS\r
+#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \\r
+ ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J))\r
+#else\r
+#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J))\r
+#endif\r
+\r
+/* Py_FORCE_EXPANSION(X)\r
+ * "Simply" returns its argument. However, macro expansions within the\r
+ * argument are evaluated. This unfortunate trickery is needed to get\r
+ * token-pasting to work as desired in some cases.\r
+ */\r
+#define Py_FORCE_EXPANSION(X) X\r
+\r
+/* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW)\r
+ * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this\r
+ * assert-fails if any information is lost.\r
+ * Caution:\r
+ * VALUE may be evaluated more than once.\r
+ */\r
+#ifdef Py_DEBUG\r
+#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \\r
+ (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE))\r
+#else\r
+#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE)\r
+#endif\r
+\r
+/* Py_SET_ERRNO_ON_MATH_ERROR(x)\r
+ * If a libm function did not set errno, but it looks like the result\r
+ * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno\r
+ * to 0 before calling a libm function, and invoke this macro after,\r
+ * passing the function result.\r
+ * Caution:\r
+ * This isn't reliable. See Py_OVERFLOWED comments.\r
+ * X is evaluated more than once.\r
+ */\r
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64))\r
+#define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM;\r
+#else\r
+#define _Py_SET_EDOM_FOR_NAN(X) ;\r
+#endif\r
+#define Py_SET_ERRNO_ON_MATH_ERROR(X) \\r
+ do { \\r
+ if (errno == 0) { \\r
+ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \\r
+ errno = ERANGE; \\r
+ else _Py_SET_EDOM_FOR_NAN(X) \\r
+ } \\r
+ } while(0)\r
+\r
+/* Py_SET_ERANGE_ON_OVERFLOW(x)\r
+ * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility.\r
+ */\r
+#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X)\r
+\r
+/* Py_ADJUST_ERANGE1(x)\r
+ * Py_ADJUST_ERANGE2(x, y)\r
+ * Set errno to 0 before calling a libm function, and invoke one of these\r
+ * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful\r
+ * for functions returning complex results). This makes two kinds of\r
+ * adjustments to errno: (A) If it looks like the platform libm set\r
+ * errno=ERANGE due to underflow, clear errno. (B) If it looks like the\r
+ * platform libm overflowed but didn't set errno, force errno to ERANGE. In\r
+ * effect, we're trying to force a useful implementation of C89 errno\r
+ * behavior.\r
+ * Caution:\r
+ * This isn't reliable. See Py_OVERFLOWED comments.\r
+ * X and Y may be evaluated more than once.\r
+ */\r
+#define Py_ADJUST_ERANGE1(X) \\r
+ do { \\r
+ if (errno == 0) { \\r
+ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \\r
+ errno = ERANGE; \\r
+ } \\r
+ else if (errno == ERANGE && (X) == 0.0) \\r
+ errno = 0; \\r
+ } while(0)\r
+\r
+#define Py_ADJUST_ERANGE2(X, Y) \\r
+ do { \\r
+ if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \\r
+ (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \\r
+ if (errno == 0) \\r
+ errno = ERANGE; \\r
+ } \\r
+ else if (errno == ERANGE) \\r
+ errno = 0; \\r
+ } while(0)\r
+\r
+/* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are\r
+ * required to support the short float repr introduced in Python 3.1) require\r
+ * that the floating-point unit that's being used for arithmetic operations\r
+ * on C doubles is set to use 53-bit precision. It also requires that the\r
+ * FPU rounding mode is round-half-to-even, but that's less often an issue.\r
+ *\r
+ * If your FPU isn't already set to 53-bit precision/round-half-to-even, and\r
+ * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should\r
+ *\r
+ * #define HAVE_PY_SET_53BIT_PRECISION 1\r
+ *\r
+ * and also give appropriate definitions for the following three macros:\r
+ *\r
+ * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and\r
+ * set FPU to 53-bit precision/round-half-to-even\r
+ * _PY_SET_53BIT_PRECISION_END : restore original FPU settings\r
+ * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to\r
+ * use the two macros above.\r
+ *\r
+ * The macros are designed to be used within a single C function: see\r
+ * Python/pystrtod.c for an example of their use.\r
+ */\r
+\r
+/* get and set x87 control word for gcc/x86 */\r
+#ifdef HAVE_GCC_ASM_FOR_X87\r
+#define HAVE_PY_SET_53BIT_PRECISION 1\r
+/* _Py_get/set_387controlword functions are defined in Python/pymath.c */\r
+#define _Py_SET_53BIT_PRECISION_HEADER \\r
+ unsigned short old_387controlword, new_387controlword\r
+#define _Py_SET_53BIT_PRECISION_START \\r
+ do { \\r
+ old_387controlword = _Py_get_387controlword(); \\r
+ new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \\r
+ if (new_387controlword != old_387controlword) \\r
+ _Py_set_387controlword(new_387controlword); \\r
+ } while (0)\r
+#define _Py_SET_53BIT_PRECISION_END \\r
+ if (new_387controlword != old_387controlword) \\r
+ _Py_set_387controlword(old_387controlword)\r
+#endif\r
+\r
+/* default definitions are empty */\r
+#ifndef HAVE_PY_SET_53BIT_PRECISION\r
+#define _Py_SET_53BIT_PRECISION_HEADER\r
+#define _Py_SET_53BIT_PRECISION_START\r
+#define _Py_SET_53BIT_PRECISION_END\r
+#endif\r
+\r
+/* If we can't guarantee 53-bit precision, don't use the code\r
+ in Python/dtoa.c, but fall back to standard code. This\r
+ means that repr of a float will be long (17 sig digits).\r
+\r
+ Realistically, there are two things that could go wrong:\r
+\r
+ (1) doubles aren't IEEE 754 doubles, or\r
+ (2) we're on x86 with the rounding precision set to 64-bits\r
+ (extended precision), and we don't know how to change\r
+ the rounding precision.\r
+ */\r
+\r
+#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \\r
+ !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \\r
+ !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)\r
+#define PY_NO_SHORT_FLOAT_REPR\r
+#endif\r
+\r
+/* double rounding is symptomatic of use of extended precision on x86. If\r
+ we're seeing double rounding, and we don't have any mechanism available for\r
+ changing the FPU rounding precision, then don't use Python/dtoa.c. */\r
+#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION)\r
+#define PY_NO_SHORT_FLOAT_REPR\r
+#endif\r
+\r
+/* Py_DEPRECATED(version)\r
+ * Declare a variable, type, or function deprecated.\r
+ * Usage:\r
+ * extern int old_var Py_DEPRECATED(2.3);\r
+ * typedef int T1 Py_DEPRECATED(2.4);\r
+ * extern int x() Py_DEPRECATED(2.5);\r
+ */\r
+#if defined(__GNUC__) && ((__GNUC__ >= 4) || \\r
+ (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1))\r
+#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))\r
+#else\r
+#define Py_DEPRECATED(VERSION_UNUSED)\r
+#endif\r
+\r
+/**************************************************************************\r
+Prototypes that are missing from the standard include files on some systems\r
+(and possibly only some versions of such systems.)\r
+\r
+Please be conservative with adding new ones, document them and enclose them\r
+in platform-specific #ifdefs.\r
+**************************************************************************/\r
+\r
+#ifdef SOLARIS\r
+/* Unchecked */\r
+extern int gethostname(char *, int);\r
+#endif\r
+\r
+#ifdef __BEOS__\r
+/* Unchecked */\r
+/* It's in the libs, but not the headers... - [cjh] */\r
+int shutdown( int, int );\r
+#endif\r
+\r
+#ifdef HAVE__GETPTY\r
+#include <sys/types.h> /* we need to import mode_t */\r
+extern char * _getpty(int *, int, mode_t, int);\r
+#endif\r
+\r
+/* On QNX 6, struct termio must be declared by including sys/termio.h\r
+ if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must\r
+ be included before termios.h or it will generate an error. */\r
+#ifdef HAVE_SYS_TERMIO_H\r
+#include <sys/termio.h>\r
+#endif\r
+\r
+#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY)\r
+#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H)\r
+/* BSDI does not supply a prototype for the 'openpty' and 'forkpty'\r
+ functions, even though they are included in libutil. */\r
+#include <termios.h>\r
+extern int openpty(int *, int *, char *, struct termios *, struct winsize *);\r
+extern pid_t forkpty(int *, char *, struct termios *, struct winsize *);\r
+#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */\r
+#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */\r
+\r
+\r
+/* These are pulled from various places. It isn't obvious on what platforms\r
+ they are necessary, nor what the exact prototype should look like (which\r
+ is likely to vary between platforms!) If you find you need one of these\r
+ declarations, please move them to a platform-specific block and include\r
+ proper prototypes. */\r
+#if 0\r
+\r
+/* From Modules/resource.c */\r
+extern int getrusage();\r
+extern int getpagesize();\r
+\r
+/* From Python/sysmodule.c and Modules/posixmodule.c */\r
+extern int fclose(FILE *);\r
+\r
+/* From Modules/posixmodule.c */\r
+extern int fdatasync(int);\r
+#endif /* 0 */\r
+\r
+\r
+/* On 4.4BSD-descendants, ctype functions serves the whole range of\r
+ * wchar_t character set rather than single byte code points only.\r
+ * This characteristic can break some operations of string object\r
+ * including str.upper() and str.split() on UTF-8 locales. This\r
+ * workaround was provided by Tim Robbins of FreeBSD project.\r
+ */\r
+\r
+#ifdef __FreeBSD__\r
+#include <osreldate.h>\r
+#if __FreeBSD_version > 500039\r
+# define _PY_PORT_CTYPE_UTF8_ISSUE\r
+#endif\r
+#endif\r
+\r
+\r
+#if defined(__APPLE__)\r
+# define _PY_PORT_CTYPE_UTF8_ISSUE\r
+#endif\r
+\r
+#ifdef _PY_PORT_CTYPE_UTF8_ISSUE\r
+#include <ctype.h>\r
+#include <wctype.h>\r
+#undef isalnum\r
+#define isalnum(c) iswalnum(btowc(c))\r
+#undef isalpha\r
+#define isalpha(c) iswalpha(btowc(c))\r
+#undef islower\r
+#define islower(c) iswlower(btowc(c))\r
+#undef isspace\r
+#define isspace(c) iswspace(btowc(c))\r
+#undef isupper\r
+#define isupper(c) iswupper(btowc(c))\r
+#undef tolower\r
+#define tolower(c) towlower(btowc(c))\r
+#undef toupper\r
+#define toupper(c) towupper(btowc(c))\r
+#endif\r
+\r
+\r
+/* Declarations for symbol visibility.\r
+\r
+ PyAPI_FUNC(type): Declares a public Python API function and return type\r
+ PyAPI_DATA(type): Declares public Python data and its type\r
+ PyMODINIT_FUNC: A Python module init function. If these functions are\r
+ inside the Python core, they are private to the core.\r
+ If in an extension module, it may be declared with\r
+ external linkage depending on the platform.\r
+\r
+ As a number of platforms support/require "__declspec(dllimport/dllexport)",\r
+ we support a HAVE_DECLSPEC_DLL macro to save duplication.\r
+*/\r
+\r
+/*\r
+ All windows ports, except cygwin, are handled in PC/pyconfig.h.\r
+\r
+ BeOS and cygwin are the only other autoconf platform requiring special\r
+ linkage handling and both of these use __declspec().\r
+*/\r
+#if defined(__CYGWIN__) || defined(__BEOS__)\r
+# define HAVE_DECLSPEC_DLL\r
+#endif\r
+\r
+/* only get special linkage if built as shared or platform is Cygwin */\r
+#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__)\r
+# if defined(HAVE_DECLSPEC_DLL)\r
+# ifdef Py_BUILD_CORE\r
+# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE\r
+# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE\r
+ /* module init functions inside the core need no external linkage */\r
+ /* except for Cygwin to handle embedding (FIXME: BeOS too?) */\r
+# if defined(__CYGWIN__)\r
+# define PyMODINIT_FUNC __declspec(dllexport) void\r
+# else /* __CYGWIN__ */\r
+# define PyMODINIT_FUNC void\r
+# endif /* __CYGWIN__ */\r
+# else /* Py_BUILD_CORE */\r
+ /* Building an extension module, or an embedded situation */\r
+ /* public Python functions and data are imported */\r
+ /* Under Cygwin, auto-import functions to prevent compilation */\r
+ /* failures similar to those described at the bottom of 4.1: */\r
+ /* http://docs.python.org/extending/windows.html#a-cookbook-approach */\r
+# if !defined(__CYGWIN__)\r
+# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE\r
+# endif /* !__CYGWIN__ */\r
+# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE\r
+ /* module init functions outside the core must be exported */\r
+# if defined(__cplusplus)\r
+# define PyMODINIT_FUNC extern "C" __declspec(dllexport) void\r
+# else /* __cplusplus */\r
+# define PyMODINIT_FUNC __declspec(dllexport) void\r
+# endif /* __cplusplus */\r
+# endif /* Py_BUILD_CORE */\r
+# endif /* HAVE_DECLSPEC */\r
+#endif /* Py_ENABLE_SHARED */\r
+\r
+/* If no external linkage macros defined by now, create defaults */\r
+#ifndef PyAPI_FUNC\r
+# define PyAPI_FUNC(RTYPE) RTYPE\r
+#endif\r
+#ifndef PyAPI_DATA\r
+# define PyAPI_DATA(RTYPE) extern RTYPE\r
+#endif\r
+#ifndef PyMODINIT_FUNC\r
+# if defined(__cplusplus)\r
+# define PyMODINIT_FUNC extern "C" void\r
+# else /* __cplusplus */\r
+# define PyMODINIT_FUNC void\r
+# endif /* __cplusplus */\r
+#endif\r
+\r
+/* Deprecated DL_IMPORT and DL_EXPORT macros */\r
+#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL)\r
+# if defined(Py_BUILD_CORE)\r
+# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE\r
+# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE\r
+# else\r
+# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE\r
+# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE\r
+# endif\r
+#endif\r
+#ifndef DL_EXPORT\r
+# define DL_EXPORT(RTYPE) RTYPE\r
+#endif\r
+#ifndef DL_IMPORT\r
+# define DL_IMPORT(RTYPE) RTYPE\r
+#endif\r
+/* End of deprecated DL_* macros */\r
+\r
+/* If the fd manipulation macros aren't defined,\r
+ here is a set that should do the job */\r
+\r
+#if 0 /* disabled and probably obsolete */\r
+\r
+#ifndef FD_SETSIZE\r
+#define FD_SETSIZE 256\r
+#endif\r
+\r
+#ifndef FD_SET\r
+\r
+typedef long fd_mask;\r
+\r
+#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */\r
+#ifndef howmany\r
+#define howmany(x, y) (((x)+((y)-1))/(y))\r
+#endif /* howmany */\r
+\r
+typedef struct fd_set {\r
+ fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];\r
+} fd_set;\r
+\r
+#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))\r
+#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))\r
+#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))\r
+#define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p)))\r
+\r
+#endif /* FD_SET */\r
+\r
+#endif /* fd manipulation macros */\r
+\r
+\r
+/* limits.h constants that may be missing */\r
+\r
+#ifndef INT_MAX\r
+#define INT_MAX 2147483647\r
+#endif\r
+\r
+#ifndef LONG_MAX\r
+#if SIZEOF_LONG == 4\r
+#define LONG_MAX 0X7FFFFFFFL\r
+#elif SIZEOF_LONG == 8\r
+#define LONG_MAX 0X7FFFFFFFFFFFFFFFL\r
+#else\r
+#error "could not set LONG_MAX in pyport.h"\r
+#endif\r
+#endif\r
+\r
+#ifndef LONG_MIN\r
+#define LONG_MIN (-LONG_MAX-1)\r
+#endif\r
+\r
+#ifndef LONG_BIT\r
+#define LONG_BIT (8 * SIZEOF_LONG)\r
+#endif\r
+\r
+#if LONG_BIT != 8 * SIZEOF_LONG\r
+/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent\r
+ * 32-bit platforms using gcc. We try to catch that here at compile-time\r
+ * rather than waiting for integer multiplication to trigger bogus\r
+ * overflows.\r
+ */\r
+#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+/*\r
+ * Hide GCC attributes from compilers that don't support them.\r
+ */\r
+#if (!defined(__GNUC__) || __GNUC__ < 2 || \\r
+ (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \\r
+ !defined(RISCOS)\r
+#define Py_GCC_ATTRIBUTE(x)\r
+#else\r
+#define Py_GCC_ATTRIBUTE(x) __attribute__(x)\r
+#endif\r
+\r
+/*\r
+ * Add PyArg_ParseTuple format where available.\r
+ */\r
+#ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE\r
+#define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2)))\r
+#else\r
+#define Py_FORMAT_PARSETUPLE(func,p1,p2)\r
+#endif\r
+\r
+/*\r
+ * Specify alignment on compilers that support it.\r
+ */\r
+#if defined(__GNUC__) && __GNUC__ >= 3\r
+#define Py_ALIGNED(x) __attribute__((aligned(x)))\r
+#else\r
+#define Py_ALIGNED(x)\r
+#endif\r
+\r
+/* Eliminate end-of-loop code not reached warnings from SunPro C\r
+ * when using do{...}while(0) macros\r
+ */\r
+#ifdef __SUNPRO_C\r
+#pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED)\r
+#endif\r
+\r
+/*\r
+ * Older Microsoft compilers don't support the C99 long long literal suffixes,\r
+ * so these will be defined in PC/pyconfig.h for those compilers.\r
+ */\r
+#ifndef Py_LL\r
+#define Py_LL(x) x##LL\r
+#endif\r
+\r
+#ifndef Py_ULL\r
+#define Py_ULL(x) Py_LL(x##U)\r
+#endif\r
+\r
+#endif /* Py_PYPORT_H */\r
--- /dev/null
+/*\r
+ * Secret Labs' Regular Expression Engine\r
+ *\r
+ * regular expression matching engine\r
+ *\r
+ * partial history:\r
+ * 1999-10-24 fl created (based on existing template matcher code)\r
+ * 2000-03-06 fl first alpha, sort of\r
+ * 2000-08-01 fl fixes for 1.6b1\r
+ * 2000-08-07 fl use PyOS_CheckStack() if available\r
+ * 2000-09-20 fl added expand method\r
+ * 2001-03-20 fl lots of fixes for 2.1b2\r
+ * 2001-04-15 fl export copyright as Python attribute, not global\r
+ * 2001-04-28 fl added __copy__ methods (work in progress)\r
+ * 2001-05-14 fl fixes for 1.5.2 compatibility\r
+ * 2001-07-01 fl added BIGCHARSET support (from Martin von Loewis)\r
+ * 2001-10-18 fl fixed group reset issue (from Matthew Mueller)\r
+ * 2001-10-20 fl added split primitive; reenable unicode for 1.6/2.0/2.1\r
+ * 2001-10-21 fl added sub/subn primitive\r
+ * 2001-10-24 fl added finditer primitive (for 2.2 only)\r
+ * 2001-12-07 fl fixed memory leak in sub/subn (Guido van Rossum)\r
+ * 2002-11-09 fl fixed empty sub/subn return type\r
+ * 2003-04-18 mvl fully support 4-byte codes\r
+ * 2003-10-17 gn implemented non recursive scheme\r
+ *\r
+ * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved.\r
+ *\r
+ * This version of the SRE library can be redistributed under CNRI's\r
+ * Python 1.6 license. For any other use, please contact Secret Labs\r
+ * AB (info@pythonware.com).\r
+ *\r
+ * Portions of this engine have been developed in cooperation with\r
+ * CNRI. Hewlett-Packard provided funding for 1.6 integration and\r
+ * other compatibility work.\r
+ */\r
+\r
+/* Get rid of these macros to prevent collisions between EFI and Python in this file. */\r
+#undef RETURN_ERROR\r
+#undef RETURN_SUCCESS\r
+\r
+#ifndef SRE_RECURSIVE\r
+\r
+static char copyright[] =\r
+ " SRE 2.2.2 Copyright (c) 1997-2002 by Secret Labs AB ";\r
+\r
+#define PY_SSIZE_T_CLEAN\r
+\r
+#include "Python.h"\r
+#include "structmember.h" /* offsetof */\r
+\r
+#include "sre.h"\r
+\r
+#include <ctype.h>\r
+\r
+/* name of this module, minus the leading underscore */\r
+#if !defined(SRE_MODULE)\r
+#define SRE_MODULE "sre"\r
+#endif\r
+\r
+#define SRE_PY_MODULE "re"\r
+\r
+/* defining this one enables tracing */\r
+#undef VERBOSE\r
+\r
+#if PY_VERSION_HEX >= 0x01060000\r
+#if PY_VERSION_HEX < 0x02020000 || defined(Py_USING_UNICODE)\r
+/* defining this enables unicode support (default under 1.6a1 and later) */\r
+#define HAVE_UNICODE\r
+#endif\r
+#endif\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* optional features */\r
+\r
+/* enables fast searching */\r
+#define USE_FAST_SEARCH\r
+\r
+/* enables aggressive inlining (always on for Visual C) */\r
+#undef USE_INLINE\r
+\r
+/* enables copy/deepcopy handling (work in progress) */\r
+#undef USE_BUILTIN_COPY\r
+\r
+#if PY_VERSION_HEX < 0x01060000\r
+#define PyObject_DEL(op) PyMem_DEL((op))\r
+#endif\r
+\r
+/* -------------------------------------------------------------------- */\r
+\r
+#if defined(_MSC_VER)\r
+#pragma optimize("gt", on) /* doesn't seem to make much difference... */\r
+#pragma warning(disable: 4710) /* who cares if functions are not inlined ;-) */\r
+/* fastest possible local call under MSVC */\r
+#define LOCAL(type) static __inline type __fastcall\r
+#elif defined(USE_INLINE)\r
+#define LOCAL(type) static inline type\r
+#else\r
+#define LOCAL(type) static type\r
+#endif\r
+\r
+/* error codes */\r
+#define SRE_ERROR_ILLEGAL -1 /* illegal opcode */\r
+#define SRE_ERROR_STATE -2 /* illegal state */\r
+#define SRE_ERROR_RECURSION_LIMIT -3 /* runaway recursion */\r
+#define SRE_ERROR_MEMORY -9 /* out of memory */\r
+#define SRE_ERROR_INTERRUPTED -10 /* signal handler raised exception */\r
+\r
+#if defined(VERBOSE)\r
+#define TRACE(v) printf v\r
+#else\r
+#define TRACE(v)\r
+#endif\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* search engine state */\r
+\r
+/* default character predicates (run sre_chars.py to regenerate tables) */\r
+\r
+#define SRE_DIGIT_MASK 1\r
+#define SRE_SPACE_MASK 2\r
+#define SRE_LINEBREAK_MASK 4\r
+#define SRE_ALNUM_MASK 8\r
+#define SRE_WORD_MASK 16\r
+\r
+/* FIXME: this assumes ASCII. create tables in init_sre() instead */\r
+\r
+static char sre_char_info[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 2,\r
+2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,\r
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25,\r
+25, 25, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\r
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0,\r
+0, 0, 16, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,\r
+24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0 };\r
+\r
+static char sre_char_lower[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,\r
+10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\r
+27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,\r
+44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,\r
+61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,\r
+108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,\r
+122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,\r
+106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,\r
+120, 121, 122, 123, 124, 125, 126, 127 };\r
+\r
+#define SRE_IS_DIGIT(ch)\\r
+ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_DIGIT_MASK) : 0)\r
+#define SRE_IS_SPACE(ch)\\r
+ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_SPACE_MASK) : 0)\r
+#define SRE_IS_LINEBREAK(ch)\\r
+ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_LINEBREAK_MASK) : 0)\r
+#define SRE_IS_ALNUM(ch)\\r
+ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_ALNUM_MASK) : 0)\r
+#define SRE_IS_WORD(ch)\\r
+ ((ch) < 128 ? (sre_char_info[(ch)] & SRE_WORD_MASK) : 0)\r
+\r
+static unsigned int sre_lower(unsigned int ch)\r
+{\r
+ return ((ch) < 128 ? (unsigned int)sre_char_lower[ch] : ch);\r
+}\r
+\r
+/* locale-specific character predicates */\r
+/* !(c & ~N) == (c < N+1) for any unsigned c, this avoids\r
+ * warnings when c's type supports only numbers < N+1 */\r
+#define SRE_LOC_IS_DIGIT(ch) (!((ch) & ~255) ? isdigit((ch)) : 0)\r
+#define SRE_LOC_IS_SPACE(ch) (!((ch) & ~255) ? isspace((ch)) : 0)\r
+#define SRE_LOC_IS_LINEBREAK(ch) ((ch) == '\n')\r
+#define SRE_LOC_IS_ALNUM(ch) (!((ch) & ~255) ? isalnum((ch)) : 0)\r
+#define SRE_LOC_IS_WORD(ch) (SRE_LOC_IS_ALNUM((ch)) || (ch) == '_')\r
+\r
+static unsigned int sre_lower_locale(unsigned int ch)\r
+{\r
+ return ((ch) < 256 ? (unsigned int)tolower((ch)) : ch);\r
+}\r
+\r
+/* unicode-specific character predicates */\r
+\r
+#if defined(HAVE_UNICODE)\r
+\r
+#define SRE_UNI_IS_DIGIT(ch) Py_UNICODE_ISDECIMAL((Py_UNICODE)(ch))\r
+#define SRE_UNI_IS_SPACE(ch) Py_UNICODE_ISSPACE((Py_UNICODE)(ch))\r
+#define SRE_UNI_IS_LINEBREAK(ch) Py_UNICODE_ISLINEBREAK((Py_UNICODE)(ch))\r
+#define SRE_UNI_IS_ALNUM(ch) Py_UNICODE_ISALNUM((Py_UNICODE)(ch))\r
+#define SRE_UNI_IS_WORD(ch) (SRE_UNI_IS_ALNUM((ch)) || (ch) == '_')\r
+\r
+static unsigned int sre_lower_unicode(unsigned int ch)\r
+{\r
+ return (unsigned int) Py_UNICODE_TOLOWER((Py_UNICODE)(ch));\r
+}\r
+\r
+#endif\r
+\r
+LOCAL(int)\r
+sre_category(SRE_CODE category, unsigned int ch)\r
+{\r
+ switch (category) {\r
+\r
+ case SRE_CATEGORY_DIGIT:\r
+ return SRE_IS_DIGIT(ch);\r
+ case SRE_CATEGORY_NOT_DIGIT:\r
+ return !SRE_IS_DIGIT(ch);\r
+ case SRE_CATEGORY_SPACE:\r
+ return SRE_IS_SPACE(ch);\r
+ case SRE_CATEGORY_NOT_SPACE:\r
+ return !SRE_IS_SPACE(ch);\r
+ case SRE_CATEGORY_WORD:\r
+ return SRE_IS_WORD(ch);\r
+ case SRE_CATEGORY_NOT_WORD:\r
+ return !SRE_IS_WORD(ch);\r
+ case SRE_CATEGORY_LINEBREAK:\r
+ return SRE_IS_LINEBREAK(ch);\r
+ case SRE_CATEGORY_NOT_LINEBREAK:\r
+ return !SRE_IS_LINEBREAK(ch);\r
+\r
+ case SRE_CATEGORY_LOC_WORD:\r
+ return SRE_LOC_IS_WORD(ch);\r
+ case SRE_CATEGORY_LOC_NOT_WORD:\r
+ return !SRE_LOC_IS_WORD(ch);\r
+\r
+#if defined(HAVE_UNICODE)\r
+ case SRE_CATEGORY_UNI_DIGIT:\r
+ return SRE_UNI_IS_DIGIT(ch);\r
+ case SRE_CATEGORY_UNI_NOT_DIGIT:\r
+ return !SRE_UNI_IS_DIGIT(ch);\r
+ case SRE_CATEGORY_UNI_SPACE:\r
+ return SRE_UNI_IS_SPACE(ch);\r
+ case SRE_CATEGORY_UNI_NOT_SPACE:\r
+ return !SRE_UNI_IS_SPACE(ch);\r
+ case SRE_CATEGORY_UNI_WORD:\r
+ return SRE_UNI_IS_WORD(ch);\r
+ case SRE_CATEGORY_UNI_NOT_WORD:\r
+ return !SRE_UNI_IS_WORD(ch);\r
+ case SRE_CATEGORY_UNI_LINEBREAK:\r
+ return SRE_UNI_IS_LINEBREAK(ch);\r
+ case SRE_CATEGORY_UNI_NOT_LINEBREAK:\r
+ return !SRE_UNI_IS_LINEBREAK(ch);\r
+#else\r
+ case SRE_CATEGORY_UNI_DIGIT:\r
+ return SRE_IS_DIGIT(ch);\r
+ case SRE_CATEGORY_UNI_NOT_DIGIT:\r
+ return !SRE_IS_DIGIT(ch);\r
+ case SRE_CATEGORY_UNI_SPACE:\r
+ return SRE_IS_SPACE(ch);\r
+ case SRE_CATEGORY_UNI_NOT_SPACE:\r
+ return !SRE_IS_SPACE(ch);\r
+ case SRE_CATEGORY_UNI_WORD:\r
+ return SRE_LOC_IS_WORD(ch);\r
+ case SRE_CATEGORY_UNI_NOT_WORD:\r
+ return !SRE_LOC_IS_WORD(ch);\r
+ case SRE_CATEGORY_UNI_LINEBREAK:\r
+ return SRE_IS_LINEBREAK(ch);\r
+ case SRE_CATEGORY_UNI_NOT_LINEBREAK:\r
+ return !SRE_IS_LINEBREAK(ch);\r
+#endif\r
+ }\r
+ return 0;\r
+}\r
+\r
+/* helpers */\r
+\r
+static void\r
+data_stack_dealloc(SRE_STATE* state)\r
+{\r
+ if (state->data_stack) {\r
+ PyMem_FREE(state->data_stack);\r
+ state->data_stack = NULL;\r
+ }\r
+ state->data_stack_size = state->data_stack_base = 0;\r
+}\r
+\r
+static int\r
+data_stack_grow(SRE_STATE* state, Py_ssize_t size)\r
+{\r
+ Py_ssize_t minsize, cursize;\r
+ minsize = state->data_stack_base+size;\r
+ cursize = state->data_stack_size;\r
+ if (cursize < minsize) {\r
+ void* stack;\r
+ cursize = minsize+minsize/4+1024;\r
+ TRACE(("allocate/grow stack %d\n", cursize));\r
+ stack = PyMem_REALLOC(state->data_stack, cursize);\r
+ if (!stack) {\r
+ data_stack_dealloc(state);\r
+ return SRE_ERROR_MEMORY;\r
+ }\r
+ state->data_stack = (char *)stack;\r
+ state->data_stack_size = cursize;\r
+ }\r
+ return 0;\r
+}\r
+\r
+/* generate 8-bit version */\r
+\r
+#define SRE_CHAR unsigned char\r
+#define SRE_AT sre_at\r
+#define SRE_COUNT sre_count\r
+#define SRE_CHARSET sre_charset\r
+#define SRE_INFO sre_info\r
+#define SRE_MATCH sre_match\r
+#define SRE_MATCH_CONTEXT sre_match_context\r
+#define SRE_SEARCH sre_search\r
+#define SRE_LITERAL_TEMPLATE sre_literal_template\r
+\r
+#if defined(HAVE_UNICODE)\r
+\r
+#define SRE_RECURSIVE\r
+#include "_sre.c"\r
+#undef SRE_RECURSIVE\r
+\r
+#undef SRE_LITERAL_TEMPLATE\r
+#undef SRE_SEARCH\r
+#undef SRE_MATCH\r
+#undef SRE_MATCH_CONTEXT\r
+#undef SRE_INFO\r
+#undef SRE_CHARSET\r
+#undef SRE_COUNT\r
+#undef SRE_AT\r
+#undef SRE_CHAR\r
+\r
+/* generate 16-bit unicode version */\r
+\r
+#define SRE_CHAR Py_UNICODE\r
+#define SRE_AT sre_uat\r
+#define SRE_COUNT sre_ucount\r
+#define SRE_CHARSET sre_ucharset\r
+#define SRE_INFO sre_uinfo\r
+#define SRE_MATCH sre_umatch\r
+#define SRE_MATCH_CONTEXT sre_umatch_context\r
+#define SRE_SEARCH sre_usearch\r
+#define SRE_LITERAL_TEMPLATE sre_uliteral_template\r
+#endif\r
+\r
+#endif /* SRE_RECURSIVE */\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* String matching engine */\r
+\r
+/* the following section is compiled twice, with different character\r
+ settings */\r
+\r
+LOCAL(int)\r
+SRE_AT(SRE_STATE* state, SRE_CHAR* ptr, SRE_CODE at)\r
+{\r
+ /* check if pointer is at given position */\r
+\r
+ Py_ssize_t thisp, thatp;\r
+\r
+ switch (at) {\r
+\r
+ case SRE_AT_BEGINNING:\r
+ case SRE_AT_BEGINNING_STRING:\r
+ return ((void*) ptr == state->beginning);\r
+\r
+ case SRE_AT_BEGINNING_LINE:\r
+ return ((void*) ptr == state->beginning ||\r
+ SRE_IS_LINEBREAK((int) ptr[-1]));\r
+\r
+ case SRE_AT_END:\r
+ return (((void*) (ptr+1) == state->end &&\r
+ SRE_IS_LINEBREAK((int) ptr[0])) ||\r
+ ((void*) ptr == state->end));\r
+\r
+ case SRE_AT_END_LINE:\r
+ return ((void*) ptr == state->end ||\r
+ SRE_IS_LINEBREAK((int) ptr[0]));\r
+\r
+ case SRE_AT_END_STRING:\r
+ return ((void*) ptr == state->end);\r
+\r
+ case SRE_AT_BOUNDARY:\r
+ if (state->beginning == state->end)\r
+ return 0;\r
+ thatp = ((void*) ptr > state->beginning) ?\r
+ SRE_IS_WORD((int) ptr[-1]) : 0;\r
+ thisp = ((void*) ptr < state->end) ?\r
+ SRE_IS_WORD((int) ptr[0]) : 0;\r
+ return thisp != thatp;\r
+\r
+ case SRE_AT_NON_BOUNDARY:\r
+ if (state->beginning == state->end)\r
+ return 0;\r
+ thatp = ((void*) ptr > state->beginning) ?\r
+ SRE_IS_WORD((int) ptr[-1]) : 0;\r
+ thisp = ((void*) ptr < state->end) ?\r
+ SRE_IS_WORD((int) ptr[0]) : 0;\r
+ return thisp == thatp;\r
+\r
+ case SRE_AT_LOC_BOUNDARY:\r
+ if (state->beginning == state->end)\r
+ return 0;\r
+ thatp = ((void*) ptr > state->beginning) ?\r
+ SRE_LOC_IS_WORD((int) ptr[-1]) : 0;\r
+ thisp = ((void*) ptr < state->end) ?\r
+ SRE_LOC_IS_WORD((int) ptr[0]) : 0;\r
+ return thisp != thatp;\r
+\r
+ case SRE_AT_LOC_NON_BOUNDARY:\r
+ if (state->beginning == state->end)\r
+ return 0;\r
+ thatp = ((void*) ptr > state->beginning) ?\r
+ SRE_LOC_IS_WORD((int) ptr[-1]) : 0;\r
+ thisp = ((void*) ptr < state->end) ?\r
+ SRE_LOC_IS_WORD((int) ptr[0]) : 0;\r
+ return thisp == thatp;\r
+\r
+#if defined(HAVE_UNICODE)\r
+ case SRE_AT_UNI_BOUNDARY:\r
+ if (state->beginning == state->end)\r
+ return 0;\r
+ thatp = ((void*) ptr > state->beginning) ?\r
+ SRE_UNI_IS_WORD((int) ptr[-1]) : 0;\r
+ thisp = ((void*) ptr < state->end) ?\r
+ SRE_UNI_IS_WORD((int) ptr[0]) : 0;\r
+ return thisp != thatp;\r
+\r
+ case SRE_AT_UNI_NON_BOUNDARY:\r
+ if (state->beginning == state->end)\r
+ return 0;\r
+ thatp = ((void*) ptr > state->beginning) ?\r
+ SRE_UNI_IS_WORD((int) ptr[-1]) : 0;\r
+ thisp = ((void*) ptr < state->end) ?\r
+ SRE_UNI_IS_WORD((int) ptr[0]) : 0;\r
+ return thisp == thatp;\r
+#endif\r
+\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+LOCAL(int)\r
+SRE_CHARSET(SRE_CODE* set, SRE_CODE ch)\r
+{\r
+ /* check if character is a member of the given set */\r
+\r
+ int ok = 1;\r
+\r
+ for (;;) {\r
+ switch (*set++) {\r
+\r
+ case SRE_OP_FAILURE:\r
+ return !ok;\r
+\r
+ case SRE_OP_LITERAL:\r
+ /* <LITERAL> <code> */\r
+ if (ch == set[0])\r
+ return ok;\r
+ set++;\r
+ break;\r
+\r
+ case SRE_OP_CATEGORY:\r
+ /* <CATEGORY> <code> */\r
+ if (sre_category(set[0], (int) ch))\r
+ return ok;\r
+ set += 1;\r
+ break;\r
+\r
+ case SRE_OP_CHARSET:\r
+ if (sizeof(SRE_CODE) == 2) {\r
+ /* <CHARSET> <bitmap> (16 bits per code word) */\r
+ if (ch < 256 && (set[ch >> 4] & (1 << (ch & 15))))\r
+ return ok;\r
+ set += 16;\r
+ }\r
+ else {\r
+ /* <CHARSET> <bitmap> (32 bits per code word) */\r
+ if (ch < 256 && (set[ch >> 5] & (1 << (ch & 31))))\r
+ return ok;\r
+ set += 8;\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_RANGE:\r
+ /* <RANGE> <lower> <upper> */\r
+ if (set[0] <= ch && ch <= set[1])\r
+ return ok;\r
+ set += 2;\r
+ break;\r
+\r
+ case SRE_OP_NEGATE:\r
+ ok = !ok;\r
+ break;\r
+\r
+ case SRE_OP_BIGCHARSET:\r
+ /* <BIGCHARSET> <blockcount> <256 blockindices> <blocks> */\r
+ {\r
+ Py_ssize_t count, block;\r
+ count = *(set++);\r
+\r
+ if (sizeof(SRE_CODE) == 2) {\r
+ block = ((unsigned char*)set)[ch >> 8];\r
+ set += 128;\r
+ if (set[block*16 + ((ch & 255)>>4)] & (1 << (ch & 15)))\r
+ return ok;\r
+ set += count*16;\r
+ }\r
+ else {\r
+ /* !(c & ~N) == (c < N+1) for any unsigned c, this avoids\r
+ * warnings when c's type supports only numbers < N+1 */\r
+ if (!(ch & ~65535))\r
+ block = ((unsigned char*)set)[ch >> 8];\r
+ else\r
+ block = -1;\r
+ set += 64;\r
+ if (block >=0 &&\r
+ (set[block*8 + ((ch & 255)>>5)] & (1 << (ch & 31))))\r
+ return ok;\r
+ set += count*8;\r
+ }\r
+ break;\r
+ }\r
+\r
+ default:\r
+ /* internal error -- there's not much we can do about it\r
+ here, so let's just pretend it didn't match... */\r
+ return 0;\r
+ }\r
+ }\r
+}\r
+\r
+LOCAL(Py_ssize_t) SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern);\r
+\r
+LOCAL(Py_ssize_t)\r
+SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, Py_ssize_t maxcount)\r
+{\r
+ SRE_CODE chr;\r
+ SRE_CHAR* ptr = (SRE_CHAR *)state->ptr;\r
+ SRE_CHAR* end = (SRE_CHAR *)state->end;\r
+ Py_ssize_t i;\r
+\r
+ /* adjust end */\r
+ if (maxcount < end - ptr && maxcount != 65535)\r
+ end = ptr + maxcount;\r
+\r
+ switch (pattern[0]) {\r
+\r
+ case SRE_OP_IN:\r
+ /* repeated set */\r
+ TRACE(("|%p|%p|COUNT IN\n", pattern, ptr));\r
+ while (ptr < end && SRE_CHARSET(pattern + 2, *ptr))\r
+ ptr++;\r
+ break;\r
+\r
+ case SRE_OP_ANY:\r
+ /* repeated dot wildcard. */\r
+ TRACE(("|%p|%p|COUNT ANY\n", pattern, ptr));\r
+ while (ptr < end && !SRE_IS_LINEBREAK(*ptr))\r
+ ptr++;\r
+ break;\r
+\r
+ case SRE_OP_ANY_ALL:\r
+ /* repeated dot wildcard. skip to the end of the target\r
+ string, and backtrack from there */\r
+ TRACE(("|%p|%p|COUNT ANY_ALL\n", pattern, ptr));\r
+ ptr = end;\r
+ break;\r
+\r
+ case SRE_OP_LITERAL:\r
+ /* repeated literal */\r
+ chr = pattern[1];\r
+ TRACE(("|%p|%p|COUNT LITERAL %d\n", pattern, ptr, chr));\r
+ while (ptr < end && (SRE_CODE) *ptr == chr)\r
+ ptr++;\r
+ break;\r
+\r
+ case SRE_OP_LITERAL_IGNORE:\r
+ /* repeated literal */\r
+ chr = pattern[1];\r
+ TRACE(("|%p|%p|COUNT LITERAL_IGNORE %d\n", pattern, ptr, chr));\r
+ while (ptr < end && (SRE_CODE) state->lower(*ptr) == chr)\r
+ ptr++;\r
+ break;\r
+\r
+ case SRE_OP_NOT_LITERAL:\r
+ /* repeated non-literal */\r
+ chr = pattern[1];\r
+ TRACE(("|%p|%p|COUNT NOT_LITERAL %d\n", pattern, ptr, chr));\r
+ while (ptr < end && (SRE_CODE) *ptr != chr)\r
+ ptr++;\r
+ break;\r
+\r
+ case SRE_OP_NOT_LITERAL_IGNORE:\r
+ /* repeated non-literal */\r
+ chr = pattern[1];\r
+ TRACE(("|%p|%p|COUNT NOT_LITERAL_IGNORE %d\n", pattern, ptr, chr));\r
+ while (ptr < end && (SRE_CODE) state->lower(*ptr) != chr)\r
+ ptr++;\r
+ break;\r
+\r
+ default:\r
+ /* repeated single character pattern */\r
+ TRACE(("|%p|%p|COUNT SUBPATTERN\n", pattern, ptr));\r
+ while ((SRE_CHAR*) state->ptr < end) {\r
+ i = SRE_MATCH(state, pattern);\r
+ if (i < 0)\r
+ return i;\r
+ if (!i)\r
+ break;\r
+ }\r
+ TRACE(("|%p|%p|COUNT %d\n", pattern, ptr,\r
+ (SRE_CHAR*) state->ptr - ptr));\r
+ return (SRE_CHAR*) state->ptr - ptr;\r
+ }\r
+\r
+ TRACE(("|%p|%p|COUNT %d\n", pattern, ptr, ptr - (SRE_CHAR*) state->ptr));\r
+ return ptr - (SRE_CHAR*) state->ptr;\r
+}\r
+\r
+#if 0 /* not used in this release */\r
+LOCAL(int)\r
+SRE_INFO(SRE_STATE* state, SRE_CODE* pattern)\r
+{\r
+ /* check if an SRE_OP_INFO block matches at the current position.\r
+ returns the number of SRE_CODE objects to skip if successful, 0\r
+ if no match */\r
+\r
+ SRE_CHAR* end = state->end;\r
+ SRE_CHAR* ptr = state->ptr;\r
+ Py_ssize_t i;\r
+\r
+ /* check minimal length */\r
+ if (pattern[3] && (end - ptr) < pattern[3])\r
+ return 0;\r
+\r
+ /* check known prefix */\r
+ if (pattern[2] & SRE_INFO_PREFIX && pattern[5] > 1) {\r
+ /* <length> <skip> <prefix data> <overlap data> */\r
+ for (i = 0; i < pattern[5]; i++)\r
+ if ((SRE_CODE) ptr[i] != pattern[7 + i])\r
+ return 0;\r
+ return pattern[0] + 2 * pattern[6];\r
+ }\r
+ return pattern[0];\r
+}\r
+#endif\r
+\r
+/* The macros below should be used to protect recursive SRE_MATCH()\r
+ * calls that *failed* and do *not* return immediately (IOW, those\r
+ * that will backtrack). Explaining:\r
+ *\r
+ * - Recursive SRE_MATCH() returned true: that's usually a success\r
+ * (besides atypical cases like ASSERT_NOT), therefore there's no\r
+ * reason to restore lastmark;\r
+ *\r
+ * - Recursive SRE_MATCH() returned false but the current SRE_MATCH()\r
+ * is returning to the caller: If the current SRE_MATCH() is the\r
+ * top function of the recursion, returning false will be a matching\r
+ * failure, and it doesn't matter where lastmark is pointing to.\r
+ * If it's *not* the top function, it will be a recursive SRE_MATCH()\r
+ * failure by itself, and the calling SRE_MATCH() will have to deal\r
+ * with the failure by the same rules explained here (it will restore\r
+ * lastmark by itself if necessary);\r
+ *\r
+ * - Recursive SRE_MATCH() returned false, and will continue the\r
+ * outside 'for' loop: must be protected when breaking, since the next\r
+ * OP could potentially depend on lastmark;\r
+ *\r
+ * - Recursive SRE_MATCH() returned false, and will be called again\r
+ * inside a local for/while loop: must be protected between each\r
+ * loop iteration, since the recursive SRE_MATCH() could do anything,\r
+ * and could potentially depend on lastmark.\r
+ *\r
+ * For more information, check the discussion at SF patch #712900.\r
+ */\r
+#define LASTMARK_SAVE() \\r
+ do { \\r
+ ctx->lastmark = state->lastmark; \\r
+ ctx->lastindex = state->lastindex; \\r
+ } while (0)\r
+#define LASTMARK_RESTORE() \\r
+ do { \\r
+ state->lastmark = ctx->lastmark; \\r
+ state->lastindex = ctx->lastindex; \\r
+ } while (0)\r
+\r
+#define RETURN_ERROR(i) do { return i; } while(0)\r
+#define RETURN_FAILURE do { ret = 0; goto exit; } while(0)\r
+#define RETURN_SUCCESS do { ret = 1; goto exit; } while(0)\r
+\r
+#define RETURN_ON_ERROR(i) \\r
+ do { if (i < 0) RETURN_ERROR(i); } while (0)\r
+#define RETURN_ON_SUCCESS(i) \\r
+ do { RETURN_ON_ERROR(i); if (i > 0) RETURN_SUCCESS; } while (0)\r
+#define RETURN_ON_FAILURE(i) \\r
+ do { RETURN_ON_ERROR(i); if (i == 0) RETURN_FAILURE; } while (0)\r
+\r
+#define SFY(x) #x\r
+\r
+#define DATA_STACK_ALLOC(state, type, ptr) \\r
+do { \\r
+ alloc_pos = state->data_stack_base; \\r
+ TRACE(("allocating %s in %d (%d)\n", \\r
+ SFY(type), alloc_pos, sizeof(type))); \\r
+ if (state->data_stack_size < alloc_pos+sizeof(type)) { \\r
+ int j = data_stack_grow(state, sizeof(type)); \\r
+ if (j < 0) return j; \\r
+ if (ctx_pos != -1) \\r
+ DATA_STACK_LOOKUP_AT(state, SRE_MATCH_CONTEXT, ctx, ctx_pos); \\r
+ } \\r
+ ptr = (type*)(state->data_stack+alloc_pos); \\r
+ state->data_stack_base += sizeof(type); \\r
+} while (0)\r
+\r
+#define DATA_STACK_LOOKUP_AT(state, type, ptr, pos) \\r
+do { \\r
+ TRACE(("looking up %s at %d\n", SFY(type), pos)); \\r
+ ptr = (type*)(state->data_stack+pos); \\r
+} while (0)\r
+\r
+#define DATA_STACK_PUSH(state, data, size) \\r
+do { \\r
+ TRACE(("copy data in %p to %d (%d)\n", \\r
+ data, state->data_stack_base, size)); \\r
+ if (state->data_stack_size < state->data_stack_base+size) { \\r
+ int j = data_stack_grow(state, size); \\r
+ if (j < 0) return j; \\r
+ if (ctx_pos != -1) \\r
+ DATA_STACK_LOOKUP_AT(state, SRE_MATCH_CONTEXT, ctx, ctx_pos); \\r
+ } \\r
+ memcpy(state->data_stack+state->data_stack_base, data, size); \\r
+ state->data_stack_base += size; \\r
+} while (0)\r
+\r
+#define DATA_STACK_POP(state, data, size, discard) \\r
+do { \\r
+ TRACE(("copy data to %p from %d (%d)\n", \\r
+ data, state->data_stack_base-size, size)); \\r
+ memcpy(data, state->data_stack+state->data_stack_base-size, size); \\r
+ if (discard) \\r
+ state->data_stack_base -= size; \\r
+} while (0)\r
+\r
+#define DATA_STACK_POP_DISCARD(state, size) \\r
+do { \\r
+ TRACE(("discard data from %d (%d)\n", \\r
+ state->data_stack_base-size, size)); \\r
+ state->data_stack_base -= size; \\r
+} while(0)\r
+\r
+#define DATA_PUSH(x) \\r
+ DATA_STACK_PUSH(state, (x), sizeof(*(x)))\r
+#define DATA_POP(x) \\r
+ DATA_STACK_POP(state, (x), sizeof(*(x)), 1)\r
+#define DATA_POP_DISCARD(x) \\r
+ DATA_STACK_POP_DISCARD(state, sizeof(*(x)))\r
+#define DATA_ALLOC(t,p) \\r
+ DATA_STACK_ALLOC(state, t, p)\r
+#define DATA_LOOKUP_AT(t,p,pos) \\r
+ DATA_STACK_LOOKUP_AT(state,t,p,pos)\r
+\r
+#define MARK_PUSH(lastmark) \\r
+ do if (lastmark > 0) { \\r
+ i = lastmark; /* ctx->lastmark may change if reallocated */ \\r
+ DATA_STACK_PUSH(state, state->mark, (i+1)*sizeof(void*)); \\r
+ } while (0)\r
+#define MARK_POP(lastmark) \\r
+ do if (lastmark > 0) { \\r
+ DATA_STACK_POP(state, state->mark, (lastmark+1)*sizeof(void*), 1); \\r
+ } while (0)\r
+#define MARK_POP_KEEP(lastmark) \\r
+ do if (lastmark > 0) { \\r
+ DATA_STACK_POP(state, state->mark, (lastmark+1)*sizeof(void*), 0); \\r
+ } while (0)\r
+#define MARK_POP_DISCARD(lastmark) \\r
+ do if (lastmark > 0) { \\r
+ DATA_STACK_POP_DISCARD(state, (lastmark+1)*sizeof(void*)); \\r
+ } while (0)\r
+\r
+#define JUMP_NONE 0\r
+#define JUMP_MAX_UNTIL_1 1\r
+#define JUMP_MAX_UNTIL_2 2\r
+#define JUMP_MAX_UNTIL_3 3\r
+#define JUMP_MIN_UNTIL_1 4\r
+#define JUMP_MIN_UNTIL_2 5\r
+#define JUMP_MIN_UNTIL_3 6\r
+#define JUMP_REPEAT 7\r
+#define JUMP_REPEAT_ONE_1 8\r
+#define JUMP_REPEAT_ONE_2 9\r
+#define JUMP_MIN_REPEAT_ONE 10\r
+#define JUMP_BRANCH 11\r
+#define JUMP_ASSERT 12\r
+#define JUMP_ASSERT_NOT 13\r
+\r
+#define DO_JUMP(jumpvalue, jumplabel, nextpattern) \\r
+ DATA_ALLOC(SRE_MATCH_CONTEXT, nextctx); \\r
+ nextctx->last_ctx_pos = ctx_pos; \\r
+ nextctx->jump = jumpvalue; \\r
+ nextctx->pattern = nextpattern; \\r
+ ctx_pos = alloc_pos; \\r
+ ctx = nextctx; \\r
+ goto entrance; \\r
+ jumplabel: \\r
+ while (0) /* gcc doesn't like labels at end of scopes */ \\r
+\r
+typedef struct {\r
+ Py_ssize_t last_ctx_pos;\r
+ Py_ssize_t jump;\r
+ SRE_CHAR* ptr;\r
+ SRE_CODE* pattern;\r
+ Py_ssize_t count;\r
+ Py_ssize_t lastmark;\r
+ Py_ssize_t lastindex;\r
+ union {\r
+ SRE_CODE chr;\r
+ SRE_REPEAT* rep;\r
+ } u;\r
+} SRE_MATCH_CONTEXT;\r
+\r
+/* check if string matches the given pattern. returns <0 for\r
+ error, 0 for failure, and 1 for success */\r
+LOCAL(Py_ssize_t)\r
+SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern)\r
+{\r
+ SRE_CHAR* end = (SRE_CHAR *)state->end;\r
+ Py_ssize_t alloc_pos, ctx_pos = -1;\r
+ Py_ssize_t i, ret = 0;\r
+ Py_ssize_t jump;\r
+ unsigned int sigcount=0;\r
+\r
+ SRE_MATCH_CONTEXT* ctx;\r
+ SRE_MATCH_CONTEXT* nextctx;\r
+\r
+ TRACE(("|%p|%p|ENTER\n", pattern, state->ptr));\r
+\r
+ DATA_ALLOC(SRE_MATCH_CONTEXT, ctx);\r
+ ctx->last_ctx_pos = -1;\r
+ ctx->jump = JUMP_NONE;\r
+ ctx->pattern = pattern;\r
+ ctx_pos = alloc_pos;\r
+\r
+entrance:\r
+\r
+ ctx->ptr = (SRE_CHAR *)state->ptr;\r
+\r
+ if (ctx->pattern[0] == SRE_OP_INFO) {\r
+ /* optimization info block */\r
+ /* <INFO> <1=skip> <2=flags> <3=min> ... */\r
+ if (ctx->pattern[3] && (end - ctx->ptr) < ctx->pattern[3]) {\r
+ TRACE(("reject (got %d chars, need %d)\n",\r
+ (end - ctx->ptr), ctx->pattern[3]));\r
+ RETURN_FAILURE;\r
+ }\r
+ ctx->pattern += ctx->pattern[1] + 1;\r
+ }\r
+\r
+ for (;;) {\r
+ ++sigcount;\r
+ if ((0 == (sigcount & 0xfff)) && PyErr_CheckSignals())\r
+ RETURN_ERROR(SRE_ERROR_INTERRUPTED);\r
+\r
+ switch (*ctx->pattern++) {\r
+\r
+ case SRE_OP_MARK:\r
+ /* set mark */\r
+ /* <MARK> <gid> */\r
+ TRACE(("|%p|%p|MARK %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[0]));\r
+ i = ctx->pattern[0];\r
+ if (i & 1)\r
+ state->lastindex = i/2 + 1;\r
+ if (i > state->lastmark) {\r
+ /* state->lastmark is the highest valid index in the\r
+ state->mark array. If it is increased by more than 1,\r
+ the intervening marks must be set to NULL to signal\r
+ that these marks have not been encountered. */\r
+ Py_ssize_t j = state->lastmark + 1;\r
+ while (j < i)\r
+ state->mark[j++] = NULL;\r
+ state->lastmark = i;\r
+ }\r
+ state->mark[i] = ctx->ptr;\r
+ ctx->pattern++;\r
+ break;\r
+\r
+ case SRE_OP_LITERAL:\r
+ /* match literal string */\r
+ /* <LITERAL> <code> */\r
+ TRACE(("|%p|%p|LITERAL %d\n", ctx->pattern,\r
+ ctx->ptr, *ctx->pattern));\r
+ if (ctx->ptr >= end || (SRE_CODE) ctx->ptr[0] != ctx->pattern[0])\r
+ RETURN_FAILURE;\r
+ ctx->pattern++;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_NOT_LITERAL:\r
+ /* match anything that is not literal character */\r
+ /* <NOT_LITERAL> <code> */\r
+ TRACE(("|%p|%p|NOT_LITERAL %d\n", ctx->pattern,\r
+ ctx->ptr, *ctx->pattern));\r
+ if (ctx->ptr >= end || (SRE_CODE) ctx->ptr[0] == ctx->pattern[0])\r
+ RETURN_FAILURE;\r
+ ctx->pattern++;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_SUCCESS:\r
+ /* end of pattern */\r
+ TRACE(("|%p|%p|SUCCESS\n", ctx->pattern, ctx->ptr));\r
+ state->ptr = ctx->ptr;\r
+ RETURN_SUCCESS;\r
+\r
+ case SRE_OP_AT:\r
+ /* match at given position */\r
+ /* <AT> <code> */\r
+ TRACE(("|%p|%p|AT %d\n", ctx->pattern, ctx->ptr, *ctx->pattern));\r
+ if (!SRE_AT(state, ctx->ptr, *ctx->pattern))\r
+ RETURN_FAILURE;\r
+ ctx->pattern++;\r
+ break;\r
+\r
+ case SRE_OP_CATEGORY:\r
+ /* match at given category */\r
+ /* <CATEGORY> <code> */\r
+ TRACE(("|%p|%p|CATEGORY %d\n", ctx->pattern,\r
+ ctx->ptr, *ctx->pattern));\r
+ if (ctx->ptr >= end || !sre_category(ctx->pattern[0], ctx->ptr[0]))\r
+ RETURN_FAILURE;\r
+ ctx->pattern++;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_ANY:\r
+ /* match anything (except a newline) */\r
+ /* <ANY> */\r
+ TRACE(("|%p|%p|ANY\n", ctx->pattern, ctx->ptr));\r
+ if (ctx->ptr >= end || SRE_IS_LINEBREAK(ctx->ptr[0]))\r
+ RETURN_FAILURE;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_ANY_ALL:\r
+ /* match anything */\r
+ /* <ANY_ALL> */\r
+ TRACE(("|%p|%p|ANY_ALL\n", ctx->pattern, ctx->ptr));\r
+ if (ctx->ptr >= end)\r
+ RETURN_FAILURE;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_IN:\r
+ /* match set member (or non_member) */\r
+ /* <IN> <skip> <set> */\r
+ TRACE(("|%p|%p|IN\n", ctx->pattern, ctx->ptr));\r
+ if (ctx->ptr >= end || !SRE_CHARSET(ctx->pattern + 1, *ctx->ptr))\r
+ RETURN_FAILURE;\r
+ ctx->pattern += ctx->pattern[0];\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_LITERAL_IGNORE:\r
+ TRACE(("|%p|%p|LITERAL_IGNORE %d\n",\r
+ ctx->pattern, ctx->ptr, ctx->pattern[0]));\r
+ if (ctx->ptr >= end ||\r
+ state->lower(*ctx->ptr) != state->lower(*ctx->pattern))\r
+ RETURN_FAILURE;\r
+ ctx->pattern++;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_NOT_LITERAL_IGNORE:\r
+ TRACE(("|%p|%p|NOT_LITERAL_IGNORE %d\n",\r
+ ctx->pattern, ctx->ptr, *ctx->pattern));\r
+ if (ctx->ptr >= end ||\r
+ state->lower(*ctx->ptr) == state->lower(*ctx->pattern))\r
+ RETURN_FAILURE;\r
+ ctx->pattern++;\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_IN_IGNORE:\r
+ TRACE(("|%p|%p|IN_IGNORE\n", ctx->pattern, ctx->ptr));\r
+ if (ctx->ptr >= end\r
+ || !SRE_CHARSET(ctx->pattern+1,\r
+ (SRE_CODE)state->lower(*ctx->ptr)))\r
+ RETURN_FAILURE;\r
+ ctx->pattern += ctx->pattern[0];\r
+ ctx->ptr++;\r
+ break;\r
+\r
+ case SRE_OP_JUMP:\r
+ case SRE_OP_INFO:\r
+ /* jump forward */\r
+ /* <JUMP> <offset> */\r
+ TRACE(("|%p|%p|JUMP %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[0]));\r
+ ctx->pattern += ctx->pattern[0];\r
+ break;\r
+\r
+ case SRE_OP_BRANCH:\r
+ /* alternation */\r
+ /* <BRANCH> <0=skip> code <JUMP> ... <NULL> */\r
+ TRACE(("|%p|%p|BRANCH\n", ctx->pattern, ctx->ptr));\r
+ LASTMARK_SAVE();\r
+ ctx->u.rep = state->repeat;\r
+ if (ctx->u.rep)\r
+ MARK_PUSH(ctx->lastmark);\r
+ for (; ctx->pattern[0]; ctx->pattern += ctx->pattern[0]) {\r
+ if (ctx->pattern[1] == SRE_OP_LITERAL &&\r
+ (ctx->ptr >= end ||\r
+ (SRE_CODE) *ctx->ptr != ctx->pattern[2]))\r
+ continue;\r
+ if (ctx->pattern[1] == SRE_OP_IN &&\r
+ (ctx->ptr >= end ||\r
+ !SRE_CHARSET(ctx->pattern + 3, (SRE_CODE) *ctx->ptr)))\r
+ continue;\r
+ state->ptr = ctx->ptr;\r
+ DO_JUMP(JUMP_BRANCH, jump_branch, ctx->pattern+1);\r
+ if (ret) {\r
+ if (ctx->u.rep)\r
+ MARK_POP_DISCARD(ctx->lastmark);\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ if (ctx->u.rep)\r
+ MARK_POP_KEEP(ctx->lastmark);\r
+ LASTMARK_RESTORE();\r
+ }\r
+ if (ctx->u.rep)\r
+ MARK_POP_DISCARD(ctx->lastmark);\r
+ RETURN_FAILURE;\r
+\r
+ case SRE_OP_REPEAT_ONE:\r
+ /* match repeated sequence (maximizing regexp) */\r
+\r
+ /* this operator only works if the repeated item is\r
+ exactly one character wide, and we're not already\r
+ collecting backtracking points. for other cases,\r
+ use the MAX_REPEAT operator */\r
+\r
+ /* <REPEAT_ONE> <skip> <1=min> <2=max> item <SUCCESS> tail */\r
+\r
+ TRACE(("|%p|%p|REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,\r
+ ctx->pattern[1], ctx->pattern[2]));\r
+\r
+ if (ctx->ptr + ctx->pattern[1] > end)\r
+ RETURN_FAILURE; /* cannot match */\r
+\r
+ state->ptr = ctx->ptr;\r
+\r
+ ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]);\r
+ RETURN_ON_ERROR(ret);\r
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);\r
+ ctx->count = ret;\r
+ ctx->ptr += ctx->count;\r
+\r
+ /* when we arrive here, count contains the number of\r
+ matches, and ctx->ptr points to the tail of the target\r
+ string. check if the rest of the pattern matches,\r
+ and backtrack if not. */\r
+\r
+ if (ctx->count < (Py_ssize_t) ctx->pattern[1])\r
+ RETURN_FAILURE;\r
+\r
+ if (ctx->pattern[ctx->pattern[0]] == SRE_OP_SUCCESS) {\r
+ /* tail is empty. we're finished */\r
+ state->ptr = ctx->ptr;\r
+ RETURN_SUCCESS;\r
+ }\r
+\r
+ LASTMARK_SAVE();\r
+\r
+ if (ctx->pattern[ctx->pattern[0]] == SRE_OP_LITERAL) {\r
+ /* tail starts with a literal. skip positions where\r
+ the rest of the pattern cannot possibly match */\r
+ ctx->u.chr = ctx->pattern[ctx->pattern[0]+1];\r
+ for (;;) {\r
+ while (ctx->count >= (Py_ssize_t) ctx->pattern[1] &&\r
+ (ctx->ptr >= end || *ctx->ptr != ctx->u.chr)) {\r
+ ctx->ptr--;\r
+ ctx->count--;\r
+ }\r
+ if (ctx->count < (Py_ssize_t) ctx->pattern[1])\r
+ break;\r
+ state->ptr = ctx->ptr;\r
+ DO_JUMP(JUMP_REPEAT_ONE_1, jump_repeat_one_1,\r
+ ctx->pattern+ctx->pattern[0]);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+\r
+ LASTMARK_RESTORE();\r
+\r
+ ctx->ptr--;\r
+ ctx->count--;\r
+ }\r
+\r
+ } else {\r
+ /* general case */\r
+ while (ctx->count >= (Py_ssize_t) ctx->pattern[1]) {\r
+ state->ptr = ctx->ptr;\r
+ DO_JUMP(JUMP_REPEAT_ONE_2, jump_repeat_one_2,\r
+ ctx->pattern+ctx->pattern[0]);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ ctx->ptr--;\r
+ ctx->count--;\r
+ LASTMARK_RESTORE();\r
+ }\r
+ }\r
+ RETURN_FAILURE;\r
+\r
+ case SRE_OP_MIN_REPEAT_ONE:\r
+ /* match repeated sequence (minimizing regexp) */\r
+\r
+ /* this operator only works if the repeated item is\r
+ exactly one character wide, and we're not already\r
+ collecting backtracking points. for other cases,\r
+ use the MIN_REPEAT operator */\r
+\r
+ /* <MIN_REPEAT_ONE> <skip> <1=min> <2=max> item <SUCCESS> tail */\r
+\r
+ TRACE(("|%p|%p|MIN_REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr,\r
+ ctx->pattern[1], ctx->pattern[2]));\r
+\r
+ if (ctx->ptr + ctx->pattern[1] > end)\r
+ RETURN_FAILURE; /* cannot match */\r
+\r
+ state->ptr = ctx->ptr;\r
+\r
+ if (ctx->pattern[1] == 0)\r
+ ctx->count = 0;\r
+ else {\r
+ /* count using pattern min as the maximum */\r
+ ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[1]);\r
+ RETURN_ON_ERROR(ret);\r
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);\r
+ if (ret < (Py_ssize_t) ctx->pattern[1])\r
+ /* didn't match minimum number of times */\r
+ RETURN_FAILURE;\r
+ /* advance past minimum matches of repeat */\r
+ ctx->count = ret;\r
+ ctx->ptr += ctx->count;\r
+ }\r
+\r
+ if (ctx->pattern[ctx->pattern[0]] == SRE_OP_SUCCESS) {\r
+ /* tail is empty. we're finished */\r
+ state->ptr = ctx->ptr;\r
+ RETURN_SUCCESS;\r
+\r
+ } else {\r
+ /* general case */\r
+ LASTMARK_SAVE();\r
+ while ((Py_ssize_t)ctx->pattern[2] == 65535\r
+ || ctx->count <= (Py_ssize_t)ctx->pattern[2]) {\r
+ state->ptr = ctx->ptr;\r
+ DO_JUMP(JUMP_MIN_REPEAT_ONE,jump_min_repeat_one,\r
+ ctx->pattern+ctx->pattern[0]);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ state->ptr = ctx->ptr;\r
+ ret = SRE_COUNT(state, ctx->pattern+3, 1);\r
+ RETURN_ON_ERROR(ret);\r
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);\r
+ if (ret == 0)\r
+ break;\r
+ assert(ret == 1);\r
+ ctx->ptr++;\r
+ ctx->count++;\r
+ LASTMARK_RESTORE();\r
+ }\r
+ }\r
+ RETURN_FAILURE;\r
+\r
+ case SRE_OP_REPEAT:\r
+ /* create repeat context. all the hard work is done\r
+ by the UNTIL operator (MAX_UNTIL, MIN_UNTIL) */\r
+ /* <REPEAT> <skip> <1=min> <2=max> item <UNTIL> tail */\r
+ TRACE(("|%p|%p|REPEAT %d %d\n", ctx->pattern, ctx->ptr,\r
+ ctx->pattern[1], ctx->pattern[2]));\r
+\r
+ /* install new repeat context */\r
+ ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep));\r
+ if (!ctx->u.rep) {\r
+ PyErr_NoMemory();\r
+ RETURN_FAILURE;\r
+ }\r
+ ctx->u.rep->count = -1;\r
+ ctx->u.rep->pattern = ctx->pattern;\r
+ ctx->u.rep->prev = state->repeat;\r
+ ctx->u.rep->last_ptr = NULL;\r
+ state->repeat = ctx->u.rep;\r
+\r
+ state->ptr = ctx->ptr;\r
+ DO_JUMP(JUMP_REPEAT, jump_repeat, ctx->pattern+ctx->pattern[0]);\r
+ state->repeat = ctx->u.rep->prev;\r
+ PyObject_FREE(ctx->u.rep);\r
+\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ RETURN_FAILURE;\r
+\r
+ case SRE_OP_MAX_UNTIL:\r
+ /* maximizing repeat */\r
+ /* <REPEAT> <skip> <1=min> <2=max> item <MAX_UNTIL> tail */\r
+\r
+ /* FIXME: we probably need to deal with zero-width\r
+ matches in here... */\r
+\r
+ ctx->u.rep = state->repeat;\r
+ if (!ctx->u.rep)\r
+ RETURN_ERROR(SRE_ERROR_STATE);\r
+\r
+ state->ptr = ctx->ptr;\r
+\r
+ ctx->count = ctx->u.rep->count+1;\r
+\r
+ TRACE(("|%p|%p|MAX_UNTIL %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->count));\r
+\r
+ if (ctx->count < ctx->u.rep->pattern[1]) {\r
+ /* not enough matches */\r
+ ctx->u.rep->count = ctx->count;\r
+ DO_JUMP(JUMP_MAX_UNTIL_1, jump_max_until_1,\r
+ ctx->u.rep->pattern+3);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ ctx->u.rep->count = ctx->count-1;\r
+ state->ptr = ctx->ptr;\r
+ RETURN_FAILURE;\r
+ }\r
+\r
+ if ((ctx->count < ctx->u.rep->pattern[2] ||\r
+ ctx->u.rep->pattern[2] == 65535) &&\r
+ state->ptr != ctx->u.rep->last_ptr) {\r
+ /* we may have enough matches, but if we can\r
+ match another item, do so */\r
+ ctx->u.rep->count = ctx->count;\r
+ LASTMARK_SAVE();\r
+ MARK_PUSH(ctx->lastmark);\r
+ /* zero-width match protection */\r
+ DATA_PUSH(&ctx->u.rep->last_ptr);\r
+ ctx->u.rep->last_ptr = state->ptr;\r
+ DO_JUMP(JUMP_MAX_UNTIL_2, jump_max_until_2,\r
+ ctx->u.rep->pattern+3);\r
+ DATA_POP(&ctx->u.rep->last_ptr);\r
+ if (ret) {\r
+ MARK_POP_DISCARD(ctx->lastmark);\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ MARK_POP(ctx->lastmark);\r
+ LASTMARK_RESTORE();\r
+ ctx->u.rep->count = ctx->count-1;\r
+ state->ptr = ctx->ptr;\r
+ }\r
+\r
+ /* cannot match more repeated items here. make sure the\r
+ tail matches */\r
+ state->repeat = ctx->u.rep->prev;\r
+ DO_JUMP(JUMP_MAX_UNTIL_3, jump_max_until_3, ctx->pattern);\r
+ RETURN_ON_SUCCESS(ret);\r
+ state->repeat = ctx->u.rep;\r
+ state->ptr = ctx->ptr;\r
+ RETURN_FAILURE;\r
+\r
+ case SRE_OP_MIN_UNTIL:\r
+ /* minimizing repeat */\r
+ /* <REPEAT> <skip> <1=min> <2=max> item <MIN_UNTIL> tail */\r
+\r
+ ctx->u.rep = state->repeat;\r
+ if (!ctx->u.rep)\r
+ RETURN_ERROR(SRE_ERROR_STATE);\r
+\r
+ state->ptr = ctx->ptr;\r
+\r
+ ctx->count = ctx->u.rep->count+1;\r
+\r
+ TRACE(("|%p|%p|MIN_UNTIL %d %p\n", ctx->pattern,\r
+ ctx->ptr, ctx->count, ctx->u.rep->pattern));\r
+\r
+ if (ctx->count < ctx->u.rep->pattern[1]) {\r
+ /* not enough matches */\r
+ ctx->u.rep->count = ctx->count;\r
+ DO_JUMP(JUMP_MIN_UNTIL_1, jump_min_until_1,\r
+ ctx->u.rep->pattern+3);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ ctx->u.rep->count = ctx->count-1;\r
+ state->ptr = ctx->ptr;\r
+ RETURN_FAILURE;\r
+ }\r
+\r
+ LASTMARK_SAVE();\r
+\r
+ /* see if the tail matches */\r
+ state->repeat = ctx->u.rep->prev;\r
+ DO_JUMP(JUMP_MIN_UNTIL_2, jump_min_until_2, ctx->pattern);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+\r
+ state->repeat = ctx->u.rep;\r
+ state->ptr = ctx->ptr;\r
+\r
+ LASTMARK_RESTORE();\r
+\r
+ if (ctx->count >= ctx->u.rep->pattern[2]\r
+ && ctx->u.rep->pattern[2] != 65535)\r
+ RETURN_FAILURE;\r
+\r
+ ctx->u.rep->count = ctx->count;\r
+ DO_JUMP(JUMP_MIN_UNTIL_3,jump_min_until_3,\r
+ ctx->u.rep->pattern+3);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_SUCCESS;\r
+ }\r
+ ctx->u.rep->count = ctx->count-1;\r
+ state->ptr = ctx->ptr;\r
+ RETURN_FAILURE;\r
+\r
+ case SRE_OP_GROUPREF:\r
+ /* match backreference */\r
+ TRACE(("|%p|%p|GROUPREF %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[0]));\r
+ i = ctx->pattern[0];\r
+ {\r
+ Py_ssize_t groupref = i+i;\r
+ if (groupref >= state->lastmark) {\r
+ RETURN_FAILURE;\r
+ } else {\r
+ SRE_CHAR* p = (SRE_CHAR*) state->mark[groupref];\r
+ SRE_CHAR* e = (SRE_CHAR*) state->mark[groupref+1];\r
+ if (!p || !e || e < p)\r
+ RETURN_FAILURE;\r
+ while (p < e) {\r
+ if (ctx->ptr >= end || *ctx->ptr != *p)\r
+ RETURN_FAILURE;\r
+ p++; ctx->ptr++;\r
+ }\r
+ }\r
+ }\r
+ ctx->pattern++;\r
+ break;\r
+\r
+ case SRE_OP_GROUPREF_IGNORE:\r
+ /* match backreference */\r
+ TRACE(("|%p|%p|GROUPREF_IGNORE %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[0]));\r
+ i = ctx->pattern[0];\r
+ {\r
+ Py_ssize_t groupref = i+i;\r
+ if (groupref >= state->lastmark) {\r
+ RETURN_FAILURE;\r
+ } else {\r
+ SRE_CHAR* p = (SRE_CHAR*) state->mark[groupref];\r
+ SRE_CHAR* e = (SRE_CHAR*) state->mark[groupref+1];\r
+ if (!p || !e || e < p)\r
+ RETURN_FAILURE;\r
+ while (p < e) {\r
+ if (ctx->ptr >= end ||\r
+ state->lower(*ctx->ptr) != state->lower(*p))\r
+ RETURN_FAILURE;\r
+ p++; ctx->ptr++;\r
+ }\r
+ }\r
+ }\r
+ ctx->pattern++;\r
+ break;\r
+\r
+ case SRE_OP_GROUPREF_EXISTS:\r
+ TRACE(("|%p|%p|GROUPREF_EXISTS %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[0]));\r
+ /* <GROUPREF_EXISTS> <group> <skip> codeyes <JUMP> codeno ... */\r
+ i = ctx->pattern[0];\r
+ {\r
+ Py_ssize_t groupref = i+i;\r
+ if (groupref >= state->lastmark) {\r
+ ctx->pattern += ctx->pattern[1];\r
+ break;\r
+ } else {\r
+ SRE_CHAR* p = (SRE_CHAR*) state->mark[groupref];\r
+ SRE_CHAR* e = (SRE_CHAR*) state->mark[groupref+1];\r
+ if (!p || !e || e < p) {\r
+ ctx->pattern += ctx->pattern[1];\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ ctx->pattern += 2;\r
+ break;\r
+\r
+ case SRE_OP_ASSERT:\r
+ /* assert subpattern */\r
+ /* <ASSERT> <skip> <back> <pattern> */\r
+ TRACE(("|%p|%p|ASSERT %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[1]));\r
+ state->ptr = ctx->ptr - ctx->pattern[1];\r
+ if (state->ptr < state->beginning)\r
+ RETURN_FAILURE;\r
+ DO_JUMP(JUMP_ASSERT, jump_assert, ctx->pattern+2);\r
+ RETURN_ON_FAILURE(ret);\r
+ ctx->pattern += ctx->pattern[0];\r
+ break;\r
+\r
+ case SRE_OP_ASSERT_NOT:\r
+ /* assert not subpattern */\r
+ /* <ASSERT_NOT> <skip> <back> <pattern> */\r
+ TRACE(("|%p|%p|ASSERT_NOT %d\n", ctx->pattern,\r
+ ctx->ptr, ctx->pattern[1]));\r
+ state->ptr = ctx->ptr - ctx->pattern[1];\r
+ if (state->ptr >= state->beginning) {\r
+ DO_JUMP(JUMP_ASSERT_NOT, jump_assert_not, ctx->pattern+2);\r
+ if (ret) {\r
+ RETURN_ON_ERROR(ret);\r
+ RETURN_FAILURE;\r
+ }\r
+ }\r
+ ctx->pattern += ctx->pattern[0];\r
+ break;\r
+\r
+ case SRE_OP_FAILURE:\r
+ /* immediate failure */\r
+ TRACE(("|%p|%p|FAILURE\n", ctx->pattern, ctx->ptr));\r
+ RETURN_FAILURE;\r
+\r
+ default:\r
+ TRACE(("|%p|%p|UNKNOWN %d\n", ctx->pattern, ctx->ptr,\r
+ ctx->pattern[-1]));\r
+ RETURN_ERROR(SRE_ERROR_ILLEGAL);\r
+ }\r
+ }\r
+\r
+exit:\r
+ ctx_pos = ctx->last_ctx_pos;\r
+ jump = ctx->jump;\r
+ DATA_POP_DISCARD(ctx);\r
+ if (ctx_pos == -1)\r
+ return ret;\r
+ DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos);\r
+\r
+ switch (jump) {\r
+ case JUMP_MAX_UNTIL_2:\r
+ TRACE(("|%p|%p|JUMP_MAX_UNTIL_2\n", ctx->pattern, ctx->ptr));\r
+ goto jump_max_until_2;\r
+ case JUMP_MAX_UNTIL_3:\r
+ TRACE(("|%p|%p|JUMP_MAX_UNTIL_3\n", ctx->pattern, ctx->ptr));\r
+ goto jump_max_until_3;\r
+ case JUMP_MIN_UNTIL_2:\r
+ TRACE(("|%p|%p|JUMP_MIN_UNTIL_2\n", ctx->pattern, ctx->ptr));\r
+ goto jump_min_until_2;\r
+ case JUMP_MIN_UNTIL_3:\r
+ TRACE(("|%p|%p|JUMP_MIN_UNTIL_3\n", ctx->pattern, ctx->ptr));\r
+ goto jump_min_until_3;\r
+ case JUMP_BRANCH:\r
+ TRACE(("|%p|%p|JUMP_BRANCH\n", ctx->pattern, ctx->ptr));\r
+ goto jump_branch;\r
+ case JUMP_MAX_UNTIL_1:\r
+ TRACE(("|%p|%p|JUMP_MAX_UNTIL_1\n", ctx->pattern, ctx->ptr));\r
+ goto jump_max_until_1;\r
+ case JUMP_MIN_UNTIL_1:\r
+ TRACE(("|%p|%p|JUMP_MIN_UNTIL_1\n", ctx->pattern, ctx->ptr));\r
+ goto jump_min_until_1;\r
+ case JUMP_REPEAT:\r
+ TRACE(("|%p|%p|JUMP_REPEAT\n", ctx->pattern, ctx->ptr));\r
+ goto jump_repeat;\r
+ case JUMP_REPEAT_ONE_1:\r
+ TRACE(("|%p|%p|JUMP_REPEAT_ONE_1\n", ctx->pattern, ctx->ptr));\r
+ goto jump_repeat_one_1;\r
+ case JUMP_REPEAT_ONE_2:\r
+ TRACE(("|%p|%p|JUMP_REPEAT_ONE_2\n", ctx->pattern, ctx->ptr));\r
+ goto jump_repeat_one_2;\r
+ case JUMP_MIN_REPEAT_ONE:\r
+ TRACE(("|%p|%p|JUMP_MIN_REPEAT_ONE\n", ctx->pattern, ctx->ptr));\r
+ goto jump_min_repeat_one;\r
+ case JUMP_ASSERT:\r
+ TRACE(("|%p|%p|JUMP_ASSERT\n", ctx->pattern, ctx->ptr));\r
+ goto jump_assert;\r
+ case JUMP_ASSERT_NOT:\r
+ TRACE(("|%p|%p|JUMP_ASSERT_NOT\n", ctx->pattern, ctx->ptr));\r
+ goto jump_assert_not;\r
+ case JUMP_NONE:\r
+ TRACE(("|%p|%p|RETURN %d\n", ctx->pattern, ctx->ptr, ret));\r
+ break;\r
+ }\r
+\r
+ return ret; /* should never get here */\r
+}\r
+\r
+LOCAL(Py_ssize_t)\r
+SRE_SEARCH(SRE_STATE* state, SRE_CODE* pattern)\r
+{\r
+ SRE_CHAR* ptr = (SRE_CHAR *)state->start;\r
+ SRE_CHAR* end = (SRE_CHAR *)state->end;\r
+ Py_ssize_t status = 0;\r
+ Py_ssize_t prefix_len = 0;\r
+ Py_ssize_t prefix_skip = 0;\r
+ SRE_CODE* prefix = NULL;\r
+ SRE_CODE* charset = NULL;\r
+ SRE_CODE* overlap = NULL;\r
+ int flags = 0;\r
+\r
+ if (pattern[0] == SRE_OP_INFO) {\r
+ /* optimization info block */\r
+ /* <INFO> <1=skip> <2=flags> <3=min> <4=max> <5=prefix info> */\r
+\r
+ flags = pattern[2];\r
+\r
+ if (pattern[3] > 1) {\r
+ /* adjust end point (but make sure we leave at least one\r
+ character in there, so literal search will work) */\r
+ end -= pattern[3]-1;\r
+ if (end <= ptr)\r
+ end = ptr+1;\r
+ }\r
+\r
+ if (flags & SRE_INFO_PREFIX) {\r
+ /* pattern starts with a known prefix */\r
+ /* <length> <skip> <prefix data> <overlap data> */\r
+ prefix_len = pattern[5];\r
+ prefix_skip = pattern[6];\r
+ prefix = pattern + 7;\r
+ overlap = prefix + prefix_len - 1;\r
+ } else if (flags & SRE_INFO_CHARSET)\r
+ /* pattern starts with a character from a known set */\r
+ /* <charset> */\r
+ charset = pattern + 5;\r
+\r
+ pattern += 1 + pattern[1];\r
+ }\r
+\r
+ TRACE(("prefix = %p %d %d\n", prefix, prefix_len, prefix_skip));\r
+ TRACE(("charset = %p\n", charset));\r
+\r
+#if defined(USE_FAST_SEARCH)\r
+ if (prefix_len > 1) {\r
+ /* pattern starts with a known prefix. use the overlap\r
+ table to skip forward as fast as we possibly can */\r
+ Py_ssize_t i = 0;\r
+ end = (SRE_CHAR *)state->end;\r
+ while (ptr < end) {\r
+ for (;;) {\r
+ if ((SRE_CODE) ptr[0] != prefix[i]) {\r
+ if (!i)\r
+ break;\r
+ else\r
+ i = overlap[i];\r
+ } else {\r
+ if (++i == prefix_len) {\r
+ /* found a potential match */\r
+ TRACE(("|%p|%p|SEARCH SCAN\n", pattern, ptr));\r
+ state->start = ptr + 1 - prefix_len;\r
+ state->ptr = ptr + 1 - prefix_len + prefix_skip;\r
+ if (flags & SRE_INFO_LITERAL)\r
+ return 1; /* we got all of it */\r
+ status = SRE_MATCH(state, pattern + 2*prefix_skip);\r
+ if (status != 0)\r
+ return status;\r
+ /* close but no cigar -- try again */\r
+ i = overlap[i];\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ ptr++;\r
+ }\r
+ return 0;\r
+ }\r
+#endif\r
+\r
+ if (pattern[0] == SRE_OP_LITERAL) {\r
+ /* pattern starts with a literal character. this is used\r
+ for short prefixes, and if fast search is disabled */\r
+ SRE_CODE chr = pattern[1];\r
+ end = (SRE_CHAR *)state->end;\r
+ for (;;) {\r
+ while (ptr < end && (SRE_CODE) ptr[0] != chr)\r
+ ptr++;\r
+ if (ptr >= end)\r
+ return 0;\r
+ TRACE(("|%p|%p|SEARCH LITERAL\n", pattern, ptr));\r
+ state->start = ptr;\r
+ state->ptr = ++ptr;\r
+ if (flags & SRE_INFO_LITERAL)\r
+ return 1; /* we got all of it */\r
+ status = SRE_MATCH(state, pattern + 2);\r
+ if (status != 0)\r
+ break;\r
+ }\r
+ } else if (charset) {\r
+ /* pattern starts with a character from a known set */\r
+ end = (SRE_CHAR *)state->end;\r
+ for (;;) {\r
+ while (ptr < end && !SRE_CHARSET(charset, ptr[0]))\r
+ ptr++;\r
+ if (ptr >= end)\r
+ return 0;\r
+ TRACE(("|%p|%p|SEARCH CHARSET\n", pattern, ptr));\r
+ state->start = ptr;\r
+ state->ptr = ptr;\r
+ status = SRE_MATCH(state, pattern);\r
+ if (status != 0)\r
+ break;\r
+ ptr++;\r
+ }\r
+ } else\r
+ /* general case */\r
+ while (ptr <= end) {\r
+ TRACE(("|%p|%p|SEARCH\n", pattern, ptr));\r
+ state->start = state->ptr = ptr++;\r
+ status = SRE_MATCH(state, pattern);\r
+ if (status != 0)\r
+ break;\r
+ }\r
+\r
+ return status;\r
+}\r
+\r
+LOCAL(int)\r
+SRE_LITERAL_TEMPLATE(SRE_CHAR* ptr, Py_ssize_t len)\r
+{\r
+ /* check if given string is a literal template (i.e. no escapes) */\r
+ while (len-- > 0)\r
+ if (*ptr++ == '\\')\r
+ return 0;\r
+ return 1;\r
+}\r
+\r
+#if !defined(SRE_RECURSIVE)\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* factories and destructors */\r
+\r
+/* see sre.h for object declarations */\r
+static PyObject*pattern_new_match(PatternObject*, SRE_STATE*, int);\r
+static PyObject*pattern_scanner(PatternObject*, PyObject*);\r
+\r
+static PyObject *\r
+sre_codesize(PyObject* self, PyObject *unused)\r
+{\r
+ return Py_BuildValue("l", sizeof(SRE_CODE));\r
+}\r
+\r
+static PyObject *\r
+sre_getlower(PyObject* self, PyObject* args)\r
+{\r
+ int character, flags;\r
+ if (!PyArg_ParseTuple(args, "ii", &character, &flags))\r
+ return NULL;\r
+ if (flags & SRE_FLAG_LOCALE)\r
+ return Py_BuildValue("i", sre_lower_locale(character));\r
+ if (flags & SRE_FLAG_UNICODE)\r
+#if defined(HAVE_UNICODE)\r
+ return Py_BuildValue("i", sre_lower_unicode(character));\r
+#else\r
+ return Py_BuildValue("i", sre_lower_locale(character));\r
+#endif\r
+ return Py_BuildValue("i", sre_lower(character));\r
+}\r
+\r
+LOCAL(void)\r
+state_reset(SRE_STATE* state)\r
+{\r
+ /* FIXME: dynamic! */\r
+ /*memset(state->mark, 0, sizeof(*state->mark) * SRE_MARK_SIZE);*/\r
+\r
+ state->lastmark = -1;\r
+ state->lastindex = -1;\r
+\r
+ state->repeat = NULL;\r
+\r
+ data_stack_dealloc(state);\r
+}\r
+\r
+static void*\r
+getstring(PyObject* string, Py_ssize_t* p_length, int* p_charsize)\r
+{\r
+ /* given a python object, return a data pointer, a length (in\r
+ characters), and a character size. return NULL if the object\r
+ is not a string (or not compatible) */\r
+\r
+ PyBufferProcs *buffer;\r
+ Py_ssize_t size, bytes;\r
+ int charsize;\r
+ void* ptr;\r
+\r
+#if defined(HAVE_UNICODE)\r
+ if (PyUnicode_Check(string)) {\r
+ /* unicode strings doesn't always support the buffer interface */\r
+ ptr = (void*) PyUnicode_AS_DATA(string);\r
+ /* bytes = PyUnicode_GET_DATA_SIZE(string); */\r
+ size = PyUnicode_GET_SIZE(string);\r
+ charsize = sizeof(Py_UNICODE);\r
+\r
+ } else {\r
+#endif\r
+\r
+ /* get pointer to string buffer */\r
+ buffer = Py_TYPE(string)->tp_as_buffer;\r
+ if (!buffer || !buffer->bf_getreadbuffer || !buffer->bf_getsegcount ||\r
+ buffer->bf_getsegcount(string, NULL) != 1) {\r
+ PyErr_SetString(PyExc_TypeError, "expected string or buffer");\r
+ return NULL;\r
+ }\r
+\r
+ /* determine buffer size */\r
+ bytes = buffer->bf_getreadbuffer(string, 0, &ptr);\r
+ if (bytes < 0) {\r
+ PyErr_SetString(PyExc_TypeError, "buffer has negative size");\r
+ return NULL;\r
+ }\r
+\r
+ /* determine character size */\r
+#if PY_VERSION_HEX >= 0x01060000\r
+ size = PyObject_Size(string);\r
+#else\r
+ size = PyObject_Length(string);\r
+#endif\r
+\r
+ if (PyString_Check(string) || bytes == size)\r
+ charsize = 1;\r
+#if defined(HAVE_UNICODE)\r
+ else if (bytes == (Py_ssize_t) (size * sizeof(Py_UNICODE)))\r
+ charsize = sizeof(Py_UNICODE);\r
+#endif\r
+ else {\r
+ PyErr_SetString(PyExc_TypeError, "buffer size mismatch");\r
+ return NULL;\r
+ }\r
+\r
+#if defined(HAVE_UNICODE)\r
+ }\r
+#endif\r
+\r
+ *p_length = size;\r
+ *p_charsize = charsize;\r
+\r
+ return ptr;\r
+}\r
+\r
+LOCAL(PyObject*)\r
+state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string,\r
+ Py_ssize_t start, Py_ssize_t end)\r
+{\r
+ /* prepare state object */\r
+\r
+ Py_ssize_t length;\r
+ int charsize;\r
+ void* ptr;\r
+\r
+ memset(state, 0, sizeof(SRE_STATE));\r
+\r
+ state->lastmark = -1;\r
+ state->lastindex = -1;\r
+\r
+ ptr = getstring(string, &length, &charsize);\r
+ if (!ptr)\r
+ return NULL;\r
+\r
+ /* adjust boundaries */\r
+ if (start < 0)\r
+ start = 0;\r
+ else if (start > length)\r
+ start = length;\r
+\r
+ if (end < 0)\r
+ end = 0;\r
+ else if (end > length)\r
+ end = length;\r
+\r
+ state->charsize = charsize;\r
+\r
+ state->beginning = ptr;\r
+\r
+ state->start = (void*) ((char*) ptr + start * state->charsize);\r
+ state->end = (void*) ((char*) ptr + end * state->charsize);\r
+\r
+ Py_INCREF(string);\r
+ state->string = string;\r
+ state->pos = start;\r
+ state->endpos = end;\r
+\r
+ if (pattern->flags & SRE_FLAG_LOCALE)\r
+ state->lower = sre_lower_locale;\r
+ else if (pattern->flags & SRE_FLAG_UNICODE)\r
+#if defined(HAVE_UNICODE)\r
+ state->lower = sre_lower_unicode;\r
+#else\r
+ state->lower = sre_lower_locale;\r
+#endif\r
+ else\r
+ state->lower = sre_lower;\r
+\r
+ return string;\r
+}\r
+\r
+LOCAL(void)\r
+state_fini(SRE_STATE* state)\r
+{\r
+ Py_XDECREF(state->string);\r
+ data_stack_dealloc(state);\r
+}\r
+\r
+/* calculate offset from start of string */\r
+#define STATE_OFFSET(state, member)\\r
+ (((char*)(member) - (char*)(state)->beginning) / (state)->charsize)\r
+\r
+LOCAL(PyObject*)\r
+state_getslice(SRE_STATE* state, Py_ssize_t index, PyObject* string, int empty)\r
+{\r
+ Py_ssize_t i, j;\r
+\r
+ index = (index - 1) * 2;\r
+\r
+ if (string == Py_None || index >= state->lastmark || !state->mark[index] || !state->mark[index+1]) {\r
+ if (empty)\r
+ /* want empty string */\r
+ i = j = 0;\r
+ else {\r
+ Py_INCREF(Py_None);\r
+ return Py_None;\r
+ }\r
+ } else {\r
+ i = STATE_OFFSET(state, state->mark[index]);\r
+ j = STATE_OFFSET(state, state->mark[index+1]);\r
+ }\r
+\r
+ return PySequence_GetSlice(string, i, j);\r
+}\r
+\r
+static void\r
+pattern_error(int status)\r
+{\r
+ switch (status) {\r
+ case SRE_ERROR_RECURSION_LIMIT:\r
+ PyErr_SetString(\r
+ PyExc_RuntimeError,\r
+ "maximum recursion limit exceeded"\r
+ );\r
+ break;\r
+ case SRE_ERROR_MEMORY:\r
+ PyErr_NoMemory();\r
+ break;\r
+ case SRE_ERROR_INTERRUPTED:\r
+ /* An exception has already been raised, so let it fly */\r
+ break;\r
+ default:\r
+ /* other error codes indicate compiler/engine bugs */\r
+ PyErr_SetString(\r
+ PyExc_RuntimeError,\r
+ "internal error in regular expression engine"\r
+ );\r
+ }\r
+}\r
+\r
+static void\r
+pattern_dealloc(PatternObject* self)\r
+{\r
+ if (self->weakreflist != NULL)\r
+ PyObject_ClearWeakRefs((PyObject *) self);\r
+ Py_XDECREF(self->pattern);\r
+ Py_XDECREF(self->groupindex);\r
+ Py_XDECREF(self->indexgroup);\r
+ PyObject_DEL(self);\r
+}\r
+\r
+static PyObject*\r
+pattern_match(PatternObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ SRE_STATE state;\r
+ int status;\r
+\r
+ PyObject* string;\r
+ Py_ssize_t start = 0;\r
+ Py_ssize_t end = PY_SSIZE_T_MAX;\r
+ static char* kwlist[] = { "pattern", "pos", "endpos", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O|nn:match", kwlist,\r
+ &string, &start, &end))\r
+ return NULL;\r
+\r
+ string = state_init(&state, self, string, start, end);\r
+ if (!string)\r
+ return NULL;\r
+\r
+ state.ptr = state.start;\r
+\r
+ TRACE(("|%p|%p|MATCH\n", PatternObject_GetCode(self), state.ptr));\r
+\r
+ if (state.charsize == 1) {\r
+ status = sre_match(&state, PatternObject_GetCode(self));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_umatch(&state, PatternObject_GetCode(self));\r
+#endif\r
+ }\r
+\r
+ TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr));\r
+ if (PyErr_Occurred())\r
+ return NULL;\r
+\r
+ state_fini(&state);\r
+\r
+ return pattern_new_match(self, &state, status);\r
+}\r
+\r
+static PyObject*\r
+pattern_search(PatternObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ SRE_STATE state;\r
+ int status;\r
+\r
+ PyObject* string;\r
+ Py_ssize_t start = 0;\r
+ Py_ssize_t end = PY_SSIZE_T_MAX;\r
+ static char* kwlist[] = { "pattern", "pos", "endpos", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O|nn:search", kwlist,\r
+ &string, &start, &end))\r
+ return NULL;\r
+\r
+ string = state_init(&state, self, string, start, end);\r
+ if (!string)\r
+ return NULL;\r
+\r
+ TRACE(("|%p|%p|SEARCH\n", PatternObject_GetCode(self), state.ptr));\r
+\r
+ if (state.charsize == 1) {\r
+ status = sre_search(&state, PatternObject_GetCode(self));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_usearch(&state, PatternObject_GetCode(self));\r
+#endif\r
+ }\r
+\r
+ TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr));\r
+\r
+ state_fini(&state);\r
+\r
+ if (PyErr_Occurred())\r
+ return NULL;\r
+\r
+ return pattern_new_match(self, &state, status);\r
+}\r
+\r
+static PyObject*\r
+call(char* module, char* function, PyObject* args)\r
+{\r
+ PyObject* name;\r
+ PyObject* mod;\r
+ PyObject* func;\r
+ PyObject* result;\r
+\r
+ if (!args)\r
+ return NULL;\r
+ name = PyString_FromString(module);\r
+ if (!name)\r
+ return NULL;\r
+ mod = PyImport_Import(name);\r
+ Py_DECREF(name);\r
+ if (!mod)\r
+ return NULL;\r
+ func = PyObject_GetAttrString(mod, function);\r
+ Py_DECREF(mod);\r
+ if (!func)\r
+ return NULL;\r
+ result = PyObject_CallObject(func, args);\r
+ Py_DECREF(func);\r
+ Py_DECREF(args);\r
+ return result;\r
+}\r
+\r
+#ifdef USE_BUILTIN_COPY\r
+static int\r
+deepcopy(PyObject** object, PyObject* memo)\r
+{\r
+ PyObject* copy;\r
+\r
+ copy = call(\r
+ "copy", "deepcopy",\r
+ PyTuple_Pack(2, *object, memo)\r
+ );\r
+ if (!copy)\r
+ return 0;\r
+\r
+ Py_DECREF(*object);\r
+ *object = copy;\r
+\r
+ return 1; /* success */\r
+}\r
+#endif\r
+\r
+static PyObject*\r
+join_list(PyObject* list, PyObject* string)\r
+{\r
+ /* join list elements */\r
+\r
+ PyObject* joiner;\r
+#if PY_VERSION_HEX >= 0x01060000\r
+ PyObject* function;\r
+ PyObject* args;\r
+#endif\r
+ PyObject* result;\r
+\r
+ joiner = PySequence_GetSlice(string, 0, 0);\r
+ if (!joiner)\r
+ return NULL;\r
+\r
+ if (PyList_GET_SIZE(list) == 0) {\r
+ Py_DECREF(list);\r
+ return joiner;\r
+ }\r
+\r
+#if PY_VERSION_HEX >= 0x01060000\r
+ function = PyObject_GetAttrString(joiner, "join");\r
+ if (!function) {\r
+ Py_DECREF(joiner);\r
+ return NULL;\r
+ }\r
+ args = PyTuple_New(1);\r
+ if (!args) {\r
+ Py_DECREF(function);\r
+ Py_DECREF(joiner);\r
+ return NULL;\r
+ }\r
+ PyTuple_SET_ITEM(args, 0, list);\r
+ result = PyObject_CallObject(function, args);\r
+ Py_DECREF(args); /* also removes list */\r
+ Py_DECREF(function);\r
+#else\r
+ result = call(\r
+ "string", "join",\r
+ PyTuple_Pack(2, list, joiner)\r
+ );\r
+#endif\r
+ Py_DECREF(joiner);\r
+\r
+ return result;\r
+}\r
+\r
+static PyObject*\r
+pattern_findall(PatternObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ SRE_STATE state;\r
+ PyObject* list;\r
+ int status;\r
+ Py_ssize_t i, b, e;\r
+\r
+ PyObject* string;\r
+ Py_ssize_t start = 0;\r
+ Py_ssize_t end = PY_SSIZE_T_MAX;\r
+ static char* kwlist[] = { "source", "pos", "endpos", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O|nn:findall", kwlist,\r
+ &string, &start, &end))\r
+ return NULL;\r
+\r
+ string = state_init(&state, self, string, start, end);\r
+ if (!string)\r
+ return NULL;\r
+\r
+ list = PyList_New(0);\r
+ if (!list) {\r
+ state_fini(&state);\r
+ return NULL;\r
+ }\r
+\r
+ while (state.start <= state.end) {\r
+\r
+ PyObject* item;\r
+\r
+ state_reset(&state);\r
+\r
+ state.ptr = state.start;\r
+\r
+ if (state.charsize == 1) {\r
+ status = sre_search(&state, PatternObject_GetCode(self));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_usearch(&state, PatternObject_GetCode(self));\r
+#endif\r
+ }\r
+\r
+ if (PyErr_Occurred())\r
+ goto error;\r
+\r
+ if (status <= 0) {\r
+ if (status == 0)\r
+ break;\r
+ pattern_error(status);\r
+ goto error;\r
+ }\r
+\r
+ /* don't bother to build a match object */\r
+ switch (self->groups) {\r
+ case 0:\r
+ b = STATE_OFFSET(&state, state.start);\r
+ e = STATE_OFFSET(&state, state.ptr);\r
+ item = PySequence_GetSlice(string, b, e);\r
+ if (!item)\r
+ goto error;\r
+ break;\r
+ case 1:\r
+ item = state_getslice(&state, 1, string, 1);\r
+ if (!item)\r
+ goto error;\r
+ break;\r
+ default:\r
+ item = PyTuple_New(self->groups);\r
+ if (!item)\r
+ goto error;\r
+ for (i = 0; i < self->groups; i++) {\r
+ PyObject* o = state_getslice(&state, i+1, string, 1);\r
+ if (!o) {\r
+ Py_DECREF(item);\r
+ goto error;\r
+ }\r
+ PyTuple_SET_ITEM(item, i, o);\r
+ }\r
+ break;\r
+ }\r
+\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+\r
+ if (state.ptr == state.start)\r
+ state.start = (void*) ((char*) state.ptr + state.charsize);\r
+ else\r
+ state.start = state.ptr;\r
+\r
+ }\r
+\r
+ state_fini(&state);\r
+ return list;\r
+\r
+error:\r
+ Py_DECREF(list);\r
+ state_fini(&state);\r
+ return NULL;\r
+\r
+}\r
+\r
+#if PY_VERSION_HEX >= 0x02020000\r
+static PyObject*\r
+pattern_finditer(PatternObject* pattern, PyObject* args)\r
+{\r
+ PyObject* scanner;\r
+ PyObject* search;\r
+ PyObject* iterator;\r
+\r
+ scanner = pattern_scanner(pattern, args);\r
+ if (!scanner)\r
+ return NULL;\r
+\r
+ search = PyObject_GetAttrString(scanner, "search");\r
+ Py_DECREF(scanner);\r
+ if (!search)\r
+ return NULL;\r
+\r
+ iterator = PyCallIter_New(search, Py_None);\r
+ Py_DECREF(search);\r
+\r
+ return iterator;\r
+}\r
+#endif\r
+\r
+static PyObject*\r
+pattern_split(PatternObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ SRE_STATE state;\r
+ PyObject* list;\r
+ PyObject* item;\r
+ int status;\r
+ Py_ssize_t n;\r
+ Py_ssize_t i;\r
+ void* last;\r
+\r
+ PyObject* string;\r
+ Py_ssize_t maxsplit = 0;\r
+ static char* kwlist[] = { "source", "maxsplit", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "O|n:split", kwlist,\r
+ &string, &maxsplit))\r
+ return NULL;\r
+\r
+ string = state_init(&state, self, string, 0, PY_SSIZE_T_MAX);\r
+ if (!string)\r
+ return NULL;\r
+\r
+ list = PyList_New(0);\r
+ if (!list) {\r
+ state_fini(&state);\r
+ return NULL;\r
+ }\r
+\r
+ n = 0;\r
+ last = state.start;\r
+\r
+ while (!maxsplit || n < maxsplit) {\r
+\r
+ state_reset(&state);\r
+\r
+ state.ptr = state.start;\r
+\r
+ if (state.charsize == 1) {\r
+ status = sre_search(&state, PatternObject_GetCode(self));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_usearch(&state, PatternObject_GetCode(self));\r
+#endif\r
+ }\r
+\r
+ if (PyErr_Occurred())\r
+ goto error;\r
+\r
+ if (status <= 0) {\r
+ if (status == 0)\r
+ break;\r
+ pattern_error(status);\r
+ goto error;\r
+ }\r
+\r
+ if (state.start == state.ptr) {\r
+ if (last == state.end)\r
+ break;\r
+ /* skip one character */\r
+ state.start = (void*) ((char*) state.ptr + state.charsize);\r
+ continue;\r
+ }\r
+\r
+ /* get segment before this match */\r
+ item = PySequence_GetSlice(\r
+ string, STATE_OFFSET(&state, last),\r
+ STATE_OFFSET(&state, state.start)\r
+ );\r
+ if (!item)\r
+ goto error;\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+\r
+ /* add groups (if any) */\r
+ for (i = 0; i < self->groups; i++) {\r
+ item = state_getslice(&state, i+1, string, 0);\r
+ if (!item)\r
+ goto error;\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+ }\r
+\r
+ n = n + 1;\r
+\r
+ last = state.start = state.ptr;\r
+\r
+ }\r
+\r
+ /* get segment following last match (even if empty) */\r
+ item = PySequence_GetSlice(\r
+ string, STATE_OFFSET(&state, last), state.endpos\r
+ );\r
+ if (!item)\r
+ goto error;\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+\r
+ state_fini(&state);\r
+ return list;\r
+\r
+error:\r
+ Py_DECREF(list);\r
+ state_fini(&state);\r
+ return NULL;\r
+\r
+}\r
+\r
+static PyObject*\r
+pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,\r
+ Py_ssize_t count, Py_ssize_t subn)\r
+{\r
+ SRE_STATE state;\r
+ PyObject* list;\r
+ PyObject* item;\r
+ PyObject* filter;\r
+ PyObject* args;\r
+ PyObject* match;\r
+ void* ptr;\r
+ int status;\r
+ Py_ssize_t n;\r
+ Py_ssize_t i, b, e;\r
+ int bint;\r
+ int filter_is_callable;\r
+\r
+ if (PyCallable_Check(ptemplate)) {\r
+ /* sub/subn takes either a function or a template */\r
+ filter = ptemplate;\r
+ Py_INCREF(filter);\r
+ filter_is_callable = 1;\r
+ } else {\r
+ /* if not callable, check if it's a literal string */\r
+ int literal;\r
+ ptr = getstring(ptemplate, &n, &bint);\r
+ b = bint;\r
+ if (ptr) {\r
+ if (b == 1) {\r
+ literal = sre_literal_template((unsigned char *)ptr, n);\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ literal = sre_uliteral_template((Py_UNICODE *)ptr, n);\r
+#endif\r
+ }\r
+ } else {\r
+ PyErr_Clear();\r
+ literal = 0;\r
+ }\r
+ if (literal) {\r
+ filter = ptemplate;\r
+ Py_INCREF(filter);\r
+ filter_is_callable = 0;\r
+ } else {\r
+ /* not a literal; hand it over to the template compiler */\r
+ filter = call(\r
+ SRE_PY_MODULE, "_subx",\r
+ PyTuple_Pack(2, self, ptemplate)\r
+ );\r
+ if (!filter)\r
+ return NULL;\r
+ filter_is_callable = PyCallable_Check(filter);\r
+ }\r
+ }\r
+\r
+ string = state_init(&state, self, string, 0, PY_SSIZE_T_MAX);\r
+ if (!string) {\r
+ Py_DECREF(filter);\r
+ return NULL;\r
+ }\r
+\r
+ list = PyList_New(0);\r
+ if (!list) {\r
+ Py_DECREF(filter);\r
+ state_fini(&state);\r
+ return NULL;\r
+ }\r
+\r
+ n = i = 0;\r
+\r
+ while (!count || n < count) {\r
+\r
+ state_reset(&state);\r
+\r
+ state.ptr = state.start;\r
+\r
+ if (state.charsize == 1) {\r
+ status = sre_search(&state, PatternObject_GetCode(self));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_usearch(&state, PatternObject_GetCode(self));\r
+#endif\r
+ }\r
+\r
+ if (PyErr_Occurred())\r
+ goto error;\r
+\r
+ if (status <= 0) {\r
+ if (status == 0)\r
+ break;\r
+ pattern_error(status);\r
+ goto error;\r
+ }\r
+\r
+ b = STATE_OFFSET(&state, state.start);\r
+ e = STATE_OFFSET(&state, state.ptr);\r
+\r
+ if (i < b) {\r
+ /* get segment before this match */\r
+ item = PySequence_GetSlice(string, i, b);\r
+ if (!item)\r
+ goto error;\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+\r
+ } else if (i == b && i == e && n > 0)\r
+ /* ignore empty match on latest position */\r
+ goto next;\r
+\r
+ if (filter_is_callable) {\r
+ /* pass match object through filter */\r
+ match = pattern_new_match(self, &state, 1);\r
+ if (!match)\r
+ goto error;\r
+ args = PyTuple_Pack(1, match);\r
+ if (!args) {\r
+ Py_DECREF(match);\r
+ goto error;\r
+ }\r
+ item = PyObject_CallObject(filter, args);\r
+ Py_DECREF(args);\r
+ Py_DECREF(match);\r
+ if (!item)\r
+ goto error;\r
+ } else {\r
+ /* filter is literal string */\r
+ item = filter;\r
+ Py_INCREF(item);\r
+ }\r
+\r
+ /* add to list */\r
+ if (item != Py_None) {\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+ }\r
+\r
+ i = e;\r
+ n = n + 1;\r
+\r
+next:\r
+ /* move on */\r
+ if (state.ptr == state.start)\r
+ state.start = (void*) ((char*) state.ptr + state.charsize);\r
+ else\r
+ state.start = state.ptr;\r
+\r
+ }\r
+\r
+ /* get segment following last match */\r
+ if (i < state.endpos) {\r
+ item = PySequence_GetSlice(string, i, state.endpos);\r
+ if (!item)\r
+ goto error;\r
+ status = PyList_Append(list, item);\r
+ Py_DECREF(item);\r
+ if (status < 0)\r
+ goto error;\r
+ }\r
+\r
+ state_fini(&state);\r
+\r
+ Py_DECREF(filter);\r
+\r
+ /* convert list to single string (also removes list) */\r
+ item = join_list(list, string);\r
+\r
+ if (!item)\r
+ return NULL;\r
+\r
+ if (subn)\r
+ return Py_BuildValue("Ni", item, n);\r
+\r
+ return item;\r
+\r
+error:\r
+ Py_DECREF(list);\r
+ state_fini(&state);\r
+ Py_DECREF(filter);\r
+ return NULL;\r
+\r
+}\r
+\r
+static PyObject*\r
+pattern_sub(PatternObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ PyObject* ptemplate;\r
+ PyObject* string;\r
+ Py_ssize_t count = 0;\r
+ static char* kwlist[] = { "repl", "string", "count", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|n:sub", kwlist,\r
+ &ptemplate, &string, &count))\r
+ return NULL;\r
+\r
+ return pattern_subx(self, ptemplate, string, count, 0);\r
+}\r
+\r
+static PyObject*\r
+pattern_subn(PatternObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ PyObject* ptemplate;\r
+ PyObject* string;\r
+ Py_ssize_t count = 0;\r
+ static char* kwlist[] = { "repl", "string", "count", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|n:subn", kwlist,\r
+ &ptemplate, &string, &count))\r
+ return NULL;\r
+\r
+ return pattern_subx(self, ptemplate, string, count, 1);\r
+}\r
+\r
+static PyObject*\r
+pattern_copy(PatternObject* self, PyObject *unused)\r
+{\r
+#ifdef USE_BUILTIN_COPY\r
+ PatternObject* copy;\r
+ int offset;\r
+\r
+ copy = PyObject_NEW_VAR(PatternObject, &Pattern_Type, self->codesize);\r
+ if (!copy)\r
+ return NULL;\r
+\r
+ offset = offsetof(PatternObject, groups);\r
+\r
+ Py_XINCREF(self->groupindex);\r
+ Py_XINCREF(self->indexgroup);\r
+ Py_XINCREF(self->pattern);\r
+\r
+ memcpy((char*) copy + offset, (char*) self + offset,\r
+ sizeof(PatternObject) + self->codesize * sizeof(SRE_CODE) - offset);\r
+ copy->weakreflist = NULL;\r
+\r
+ return (PyObject*) copy;\r
+#else\r
+ PyErr_SetString(PyExc_TypeError, "cannot copy this pattern object");\r
+ return NULL;\r
+#endif\r
+}\r
+\r
+static PyObject*\r
+pattern_deepcopy(PatternObject* self, PyObject* memo)\r
+{\r
+#ifdef USE_BUILTIN_COPY\r
+ PatternObject* copy;\r
+\r
+ copy = (PatternObject*) pattern_copy(self);\r
+ if (!copy)\r
+ return NULL;\r
+\r
+ if (!deepcopy(©->groupindex, memo) ||\r
+ !deepcopy(©->indexgroup, memo) ||\r
+ !deepcopy(©->pattern, memo)) {\r
+ Py_DECREF(copy);\r
+ return NULL;\r
+ }\r
+\r
+#else\r
+ PyErr_SetString(PyExc_TypeError, "cannot deepcopy this pattern object");\r
+ return NULL;\r
+#endif\r
+}\r
+\r
+PyDoc_STRVAR(pattern_match_doc,\r
+"match(string[, pos[, endpos]]) --> match object or None.\n\\r
+ Matches zero or more characters at the beginning of the string");\r
+\r
+PyDoc_STRVAR(pattern_search_doc,\r
+"search(string[, pos[, endpos]]) --> match object or None.\n\\r
+ Scan through string looking for a match, and return a corresponding\n\\r
+ MatchObject instance. Return None if no position in the string matches.");\r
+\r
+PyDoc_STRVAR(pattern_split_doc,\r
+"split(string[, maxsplit = 0]) --> list.\n\\r
+ Split string by the occurrences of pattern.");\r
+\r
+PyDoc_STRVAR(pattern_findall_doc,\r
+"findall(string[, pos[, endpos]]) --> list.\n\\r
+ Return a list of all non-overlapping matches of pattern in string.");\r
+\r
+PyDoc_STRVAR(pattern_finditer_doc,\r
+"finditer(string[, pos[, endpos]]) --> iterator.\n\\r
+ Return an iterator over all non-overlapping matches for the \n\\r
+ RE pattern in string. For each match, the iterator returns a\n\\r
+ match object.");\r
+\r
+PyDoc_STRVAR(pattern_sub_doc,\r
+"sub(repl, string[, count = 0]) --> newstring\n\\r
+ Return the string obtained by replacing the leftmost non-overlapping\n\\r
+ occurrences of pattern in string by the replacement repl.");\r
+\r
+PyDoc_STRVAR(pattern_subn_doc,\r
+"subn(repl, string[, count = 0]) --> (newstring, number of subs)\n\\r
+ Return the tuple (new_string, number_of_subs_made) found by replacing\n\\r
+ the leftmost non-overlapping occurrences of pattern with the\n\\r
+ replacement repl.");\r
+\r
+PyDoc_STRVAR(pattern_doc, "Compiled regular expression objects");\r
+\r
+static PyMethodDef pattern_methods[] = {\r
+ {"match", (PyCFunction) pattern_match, METH_VARARGS|METH_KEYWORDS,\r
+ pattern_match_doc},\r
+ {"search", (PyCFunction) pattern_search, METH_VARARGS|METH_KEYWORDS,\r
+ pattern_search_doc},\r
+ {"sub", (PyCFunction) pattern_sub, METH_VARARGS|METH_KEYWORDS,\r
+ pattern_sub_doc},\r
+ {"subn", (PyCFunction) pattern_subn, METH_VARARGS|METH_KEYWORDS,\r
+ pattern_subn_doc},\r
+ {"split", (PyCFunction) pattern_split, METH_VARARGS|METH_KEYWORDS,\r
+ pattern_split_doc},\r
+ {"findall", (PyCFunction) pattern_findall, METH_VARARGS|METH_KEYWORDS,\r
+ pattern_findall_doc},\r
+#if PY_VERSION_HEX >= 0x02020000\r
+ {"finditer", (PyCFunction) pattern_finditer, METH_VARARGS,\r
+ pattern_finditer_doc},\r
+#endif\r
+ {"scanner", (PyCFunction) pattern_scanner, METH_VARARGS},\r
+ {"__copy__", (PyCFunction) pattern_copy, METH_NOARGS},\r
+ {"__deepcopy__", (PyCFunction) pattern_deepcopy, METH_O},\r
+ {NULL, NULL}\r
+};\r
+\r
+static PyObject*\r
+pattern_getattr(PatternObject* self, char* name)\r
+{\r
+ PyObject* res;\r
+\r
+ res = Py_FindMethod(pattern_methods, (PyObject*) self, name);\r
+\r
+ if (res)\r
+ return res;\r
+\r
+ PyErr_Clear();\r
+\r
+ /* attributes */\r
+ if (!strcmp(name, "pattern")) {\r
+ Py_INCREF(self->pattern);\r
+ return self->pattern;\r
+ }\r
+\r
+ if (!strcmp(name, "flags"))\r
+ return Py_BuildValue("i", self->flags);\r
+\r
+ if (!strcmp(name, "groups"))\r
+ return Py_BuildValue("i", self->groups);\r
+\r
+ if (!strcmp(name, "groupindex") && self->groupindex) {\r
+ Py_INCREF(self->groupindex);\r
+ return self->groupindex;\r
+ }\r
+\r
+ PyErr_SetString(PyExc_AttributeError, name);\r
+ return NULL;\r
+}\r
+\r
+statichere PyTypeObject Pattern_Type = {\r
+ PyObject_HEAD_INIT(NULL)\r
+ 0, "_" SRE_MODULE ".SRE_Pattern",\r
+ sizeof(PatternObject), sizeof(SRE_CODE),\r
+ (destructor)pattern_dealloc, /*tp_dealloc*/\r
+ 0, /*tp_print*/\r
+ (getattrfunc)pattern_getattr, /*tp_getattr*/\r
+ 0, /* tp_setattr */\r
+ 0, /* tp_compare */\r
+ 0, /* tp_repr */\r
+ 0, /* tp_as_number */\r
+ 0, /* tp_as_sequence */\r
+ 0, /* tp_as_mapping */\r
+ 0, /* tp_hash */\r
+ 0, /* tp_call */\r
+ 0, /* tp_str */\r
+ 0, /* tp_getattro */\r
+ 0, /* tp_setattro */\r
+ 0, /* tp_as_buffer */\r
+ Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */\r
+ pattern_doc, /* tp_doc */\r
+ 0, /* tp_traverse */\r
+ 0, /* tp_clear */\r
+ 0, /* tp_richcompare */\r
+ offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */\r
+};\r
+\r
+static int _validate(PatternObject *self); /* Forward */\r
+\r
+static PyObject *\r
+_compile(PyObject* self_, PyObject* args)\r
+{\r
+ /* "compile" pattern descriptor to pattern object */\r
+\r
+ PatternObject* self;\r
+ Py_ssize_t i, n;\r
+\r
+ PyObject* pattern;\r
+ int flags = 0;\r
+ PyObject* code;\r
+ Py_ssize_t groups = 0;\r
+ PyObject* groupindex = NULL;\r
+ PyObject* indexgroup = NULL;\r
+ if (!PyArg_ParseTuple(args, "OiO!|nOO", &pattern, &flags,\r
+ &PyList_Type, &code, &groups,\r
+ &groupindex, &indexgroup))\r
+ return NULL;\r
+\r
+ n = PyList_GET_SIZE(code);\r
+ /* coverity[ampersand_in_size] */\r
+ self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, n);\r
+ if (!self)\r
+ return NULL;\r
+ self->weakreflist = NULL;\r
+ self->pattern = NULL;\r
+ self->groupindex = NULL;\r
+ self->indexgroup = NULL;\r
+\r
+ self->codesize = n;\r
+\r
+ for (i = 0; i < n; i++) {\r
+ PyObject *o = PyList_GET_ITEM(code, i);\r
+ unsigned long value = PyInt_Check(o) ? (unsigned long)PyInt_AsLong(o)\r
+ : PyLong_AsUnsignedLong(o);\r
+ self->code[i] = (SRE_CODE) value;\r
+ if ((unsigned long) self->code[i] != value) {\r
+ PyErr_SetString(PyExc_OverflowError,\r
+ "regular expression code size limit exceeded");\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (PyErr_Occurred()) {\r
+ Py_DECREF(self);\r
+ return NULL;\r
+ }\r
+\r
+ Py_INCREF(pattern);\r
+ self->pattern = pattern;\r
+\r
+ self->flags = flags;\r
+\r
+ self->groups = groups;\r
+\r
+ Py_XINCREF(groupindex);\r
+ self->groupindex = groupindex;\r
+\r
+ Py_XINCREF(indexgroup);\r
+ self->indexgroup = indexgroup;\r
+\r
+ self->weakreflist = NULL;\r
+\r
+ if (!_validate(self)) {\r
+ Py_DECREF(self);\r
+ return NULL;\r
+ }\r
+\r
+ return (PyObject*) self;\r
+}\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* Code validation */\r
+\r
+/* To learn more about this code, have a look at the _compile() function in\r
+ Lib/sre_compile.py. The validation functions below checks the code array\r
+ for conformance with the code patterns generated there.\r
+\r
+ The nice thing about the generated code is that it is position-independent:\r
+ all jumps are relative jumps forward. Also, jumps don't cross each other:\r
+ the target of a later jump is always earlier than the target of an earlier\r
+ jump. IOW, this is okay:\r
+\r
+ J---------J-------T--------T\r
+ \ \_____/ /\r
+ \______________________/\r
+\r
+ but this is not:\r
+\r
+ J---------J-------T--------T\r
+ \_________\_____/ /\r
+ \____________/\r
+\r
+ It also helps that SRE_CODE is always an unsigned type, either 2 bytes or 4\r
+ bytes wide (the latter if Python is compiled for "wide" unicode support).\r
+*/\r
+\r
+/* Defining this one enables tracing of the validator */\r
+#undef VVERBOSE\r
+\r
+/* Trace macro for the validator */\r
+#if defined(VVERBOSE)\r
+#define VTRACE(v) printf v\r
+#else\r
+#define VTRACE(v)\r
+#endif\r
+\r
+/* Report failure */\r
+#define FAIL do { VTRACE(("FAIL: %d\n", __LINE__)); return 0; } while (0)\r
+\r
+/* Extract opcode, argument, or skip count from code array */\r
+#define GET_OP \\r
+ do { \\r
+ VTRACE(("%p: ", code)); \\r
+ if (code >= end) FAIL; \\r
+ op = *code++; \\r
+ VTRACE(("%lu (op)\n", (unsigned long)op)); \\r
+ } while (0)\r
+#define GET_ARG \\r
+ do { \\r
+ VTRACE(("%p= ", code)); \\r
+ if (code >= end) FAIL; \\r
+ arg = *code++; \\r
+ VTRACE(("%lu (arg)\n", (unsigned long)arg)); \\r
+ } while (0)\r
+#define GET_SKIP_ADJ(adj) \\r
+ do { \\r
+ VTRACE(("%p= ", code)); \\r
+ if (code >= end) FAIL; \\r
+ skip = *code; \\r
+ VTRACE(("%lu (skip to %p)\n", \\r
+ (unsigned long)skip, code+skip)); \\r
+ if (code+skip-adj < code || code+skip-adj > end)\\r
+ FAIL; \\r
+ code++; \\r
+ } while (0)\r
+#define GET_SKIP GET_SKIP_ADJ(0)\r
+\r
+static int\r
+_validate_charset(SRE_CODE *code, SRE_CODE *end)\r
+{\r
+ /* Some variables are manipulated by the macros above */\r
+ SRE_CODE op;\r
+ SRE_CODE arg;\r
+ SRE_CODE offset;\r
+ int i;\r
+\r
+ while (code < end) {\r
+ GET_OP;\r
+ switch (op) {\r
+\r
+ case SRE_OP_NEGATE:\r
+ break;\r
+\r
+ case SRE_OP_LITERAL:\r
+ GET_ARG;\r
+ break;\r
+\r
+ case SRE_OP_RANGE:\r
+ GET_ARG;\r
+ GET_ARG;\r
+ break;\r
+\r
+ case SRE_OP_CHARSET:\r
+ offset = 32/sizeof(SRE_CODE); /* 32-byte bitmap */\r
+ if (code+offset < code || code+offset > end)\r
+ FAIL;\r
+ code += offset;\r
+ break;\r
+\r
+ case SRE_OP_BIGCHARSET:\r
+ GET_ARG; /* Number of blocks */\r
+ offset = 256/sizeof(SRE_CODE); /* 256-byte table */\r
+ if (code+offset < code || code+offset > end)\r
+ FAIL;\r
+ /* Make sure that each byte points to a valid block */\r
+ for (i = 0; i < 256; i++) {\r
+ if (((unsigned char *)code)[i] >= arg)\r
+ FAIL;\r
+ }\r
+ code += offset;\r
+ offset = arg * 32/sizeof(SRE_CODE); /* 32-byte bitmap times arg */\r
+ if (code+offset < code || code+offset > end)\r
+ FAIL;\r
+ code += offset;\r
+ break;\r
+\r
+ case SRE_OP_CATEGORY:\r
+ GET_ARG;\r
+ switch (arg) {\r
+ case SRE_CATEGORY_DIGIT:\r
+ case SRE_CATEGORY_NOT_DIGIT:\r
+ case SRE_CATEGORY_SPACE:\r
+ case SRE_CATEGORY_NOT_SPACE:\r
+ case SRE_CATEGORY_WORD:\r
+ case SRE_CATEGORY_NOT_WORD:\r
+ case SRE_CATEGORY_LINEBREAK:\r
+ case SRE_CATEGORY_NOT_LINEBREAK:\r
+ case SRE_CATEGORY_LOC_WORD:\r
+ case SRE_CATEGORY_LOC_NOT_WORD:\r
+ case SRE_CATEGORY_UNI_DIGIT:\r
+ case SRE_CATEGORY_UNI_NOT_DIGIT:\r
+ case SRE_CATEGORY_UNI_SPACE:\r
+ case SRE_CATEGORY_UNI_NOT_SPACE:\r
+ case SRE_CATEGORY_UNI_WORD:\r
+ case SRE_CATEGORY_UNI_NOT_WORD:\r
+ case SRE_CATEGORY_UNI_LINEBREAK:\r
+ case SRE_CATEGORY_UNI_NOT_LINEBREAK:\r
+ break;\r
+ default:\r
+ FAIL;\r
+ }\r
+ break;\r
+\r
+ default:\r
+ FAIL;\r
+\r
+ }\r
+ }\r
+\r
+ return 1;\r
+}\r
+\r
+static int\r
+_validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)\r
+{\r
+ /* Some variables are manipulated by the macros above */\r
+ SRE_CODE op;\r
+ SRE_CODE arg;\r
+ SRE_CODE skip;\r
+\r
+ VTRACE(("code=%p, end=%p\n", code, end));\r
+\r
+ if (code > end)\r
+ FAIL;\r
+\r
+ while (code < end) {\r
+ GET_OP;\r
+ switch (op) {\r
+\r
+ case SRE_OP_MARK:\r
+ /* We don't check whether marks are properly nested; the\r
+ sre_match() code is robust even if they don't, and the worst\r
+ you can get is nonsensical match results. */\r
+ GET_ARG;\r
+ if (arg > 2*groups+1) {\r
+ VTRACE(("arg=%d, groups=%d\n", (int)arg, (int)groups));\r
+ FAIL;\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_LITERAL:\r
+ case SRE_OP_NOT_LITERAL:\r
+ case SRE_OP_LITERAL_IGNORE:\r
+ case SRE_OP_NOT_LITERAL_IGNORE:\r
+ GET_ARG;\r
+ /* The arg is just a character, nothing to check */\r
+ break;\r
+\r
+ case SRE_OP_SUCCESS:\r
+ case SRE_OP_FAILURE:\r
+ /* Nothing to check; these normally end the matching process */\r
+ break;\r
+\r
+ case SRE_OP_AT:\r
+ GET_ARG;\r
+ switch (arg) {\r
+ case SRE_AT_BEGINNING:\r
+ case SRE_AT_BEGINNING_STRING:\r
+ case SRE_AT_BEGINNING_LINE:\r
+ case SRE_AT_END:\r
+ case SRE_AT_END_LINE:\r
+ case SRE_AT_END_STRING:\r
+ case SRE_AT_BOUNDARY:\r
+ case SRE_AT_NON_BOUNDARY:\r
+ case SRE_AT_LOC_BOUNDARY:\r
+ case SRE_AT_LOC_NON_BOUNDARY:\r
+ case SRE_AT_UNI_BOUNDARY:\r
+ case SRE_AT_UNI_NON_BOUNDARY:\r
+ break;\r
+ default:\r
+ FAIL;\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_ANY:\r
+ case SRE_OP_ANY_ALL:\r
+ /* These have no operands */\r
+ break;\r
+\r
+ case SRE_OP_IN:\r
+ case SRE_OP_IN_IGNORE:\r
+ GET_SKIP;\r
+ /* Stop 1 before the end; we check the FAILURE below */\r
+ if (!_validate_charset(code, code+skip-2))\r
+ FAIL;\r
+ if (code[skip-2] != SRE_OP_FAILURE)\r
+ FAIL;\r
+ code += skip-1;\r
+ break;\r
+\r
+ case SRE_OP_INFO:\r
+ {\r
+ /* A minimal info field is\r
+ <INFO> <1=skip> <2=flags> <3=min> <4=max>;\r
+ If SRE_INFO_PREFIX or SRE_INFO_CHARSET is in the flags,\r
+ more follows. */\r
+ SRE_CODE flags, i;\r
+ SRE_CODE *newcode;\r
+ GET_SKIP;\r
+ newcode = code+skip-1;\r
+ GET_ARG; flags = arg;\r
+ GET_ARG; /* min */\r
+ GET_ARG; /* max */\r
+ /* Check that only valid flags are present */\r
+ if ((flags & ~(SRE_INFO_PREFIX |\r
+ SRE_INFO_LITERAL |\r
+ SRE_INFO_CHARSET)) != 0)\r
+ FAIL;\r
+ /* PREFIX and CHARSET are mutually exclusive */\r
+ if ((flags & SRE_INFO_PREFIX) &&\r
+ (flags & SRE_INFO_CHARSET))\r
+ FAIL;\r
+ /* LITERAL implies PREFIX */\r
+ if ((flags & SRE_INFO_LITERAL) &&\r
+ !(flags & SRE_INFO_PREFIX))\r
+ FAIL;\r
+ /* Validate the prefix */\r
+ if (flags & SRE_INFO_PREFIX) {\r
+ SRE_CODE prefix_len;\r
+ GET_ARG; prefix_len = arg;\r
+ GET_ARG; /* prefix skip */\r
+ /* Here comes the prefix string */\r
+ if (code+prefix_len < code || code+prefix_len > newcode)\r
+ FAIL;\r
+ code += prefix_len;\r
+ /* And here comes the overlap table */\r
+ if (code+prefix_len < code || code+prefix_len > newcode)\r
+ FAIL;\r
+ /* Each overlap value should be < prefix_len */\r
+ for (i = 0; i < prefix_len; i++) {\r
+ if (code[i] >= prefix_len)\r
+ FAIL;\r
+ }\r
+ code += prefix_len;\r
+ }\r
+ /* Validate the charset */\r
+ if (flags & SRE_INFO_CHARSET) {\r
+ if (!_validate_charset(code, newcode-1))\r
+ FAIL;\r
+ if (newcode[-1] != SRE_OP_FAILURE)\r
+ FAIL;\r
+ code = newcode;\r
+ }\r
+ else if (code != newcode) {\r
+ VTRACE(("code=%p, newcode=%p\n", code, newcode));\r
+ FAIL;\r
+ }\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_BRANCH:\r
+ {\r
+ SRE_CODE *target = NULL;\r
+ for (;;) {\r
+ GET_SKIP;\r
+ if (skip == 0)\r
+ break;\r
+ /* Stop 2 before the end; we check the JUMP below */\r
+ if (!_validate_inner(code, code+skip-3, groups))\r
+ FAIL;\r
+ code += skip-3;\r
+ /* Check that it ends with a JUMP, and that each JUMP\r
+ has the same target */\r
+ GET_OP;\r
+ if (op != SRE_OP_JUMP)\r
+ FAIL;\r
+ GET_SKIP;\r
+ if (target == NULL)\r
+ target = code+skip-1;\r
+ else if (code+skip-1 != target)\r
+ FAIL;\r
+ }\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_REPEAT_ONE:\r
+ case SRE_OP_MIN_REPEAT_ONE:\r
+ {\r
+ SRE_CODE min, max;\r
+ GET_SKIP;\r
+ GET_ARG; min = arg;\r
+ GET_ARG; max = arg;\r
+ if (min > max)\r
+ FAIL;\r
+#ifdef Py_UNICODE_WIDE\r
+ if (max > 65535)\r
+ FAIL;\r
+#endif\r
+ if (!_validate_inner(code, code+skip-4, groups))\r
+ FAIL;\r
+ code += skip-4;\r
+ GET_OP;\r
+ if (op != SRE_OP_SUCCESS)\r
+ FAIL;\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_REPEAT:\r
+ {\r
+ SRE_CODE min, max;\r
+ GET_SKIP;\r
+ GET_ARG; min = arg;\r
+ GET_ARG; max = arg;\r
+ if (min > max)\r
+ FAIL;\r
+#ifdef Py_UNICODE_WIDE\r
+ if (max > 65535)\r
+ FAIL;\r
+#endif\r
+ if (!_validate_inner(code, code+skip-3, groups))\r
+ FAIL;\r
+ code += skip-3;\r
+ GET_OP;\r
+ if (op != SRE_OP_MAX_UNTIL && op != SRE_OP_MIN_UNTIL)\r
+ FAIL;\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_GROUPREF:\r
+ case SRE_OP_GROUPREF_IGNORE:\r
+ GET_ARG;\r
+ if (arg >= groups)\r
+ FAIL;\r
+ break;\r
+\r
+ case SRE_OP_GROUPREF_EXISTS:\r
+ /* The regex syntax for this is: '(?(group)then|else)', where\r
+ 'group' is either an integer group number or a group name,\r
+ 'then' and 'else' are sub-regexes, and 'else' is optional. */\r
+ GET_ARG;\r
+ if (arg >= groups)\r
+ FAIL;\r
+ GET_SKIP_ADJ(1);\r
+ code--; /* The skip is relative to the first arg! */\r
+ /* There are two possibilities here: if there is both a 'then'\r
+ part and an 'else' part, the generated code looks like:\r
+\r
+ GROUPREF_EXISTS\r
+ <group>\r
+ <skipyes>\r
+ ...then part...\r
+ JUMP\r
+ <skipno>\r
+ (<skipyes> jumps here)\r
+ ...else part...\r
+ (<skipno> jumps here)\r
+\r
+ If there is only a 'then' part, it looks like:\r
+\r
+ GROUPREF_EXISTS\r
+ <group>\r
+ <skip>\r
+ ...then part...\r
+ (<skip> jumps here)\r
+\r
+ There is no direct way to decide which it is, and we don't want\r
+ to allow arbitrary jumps anywhere in the code; so we just look\r
+ for a JUMP opcode preceding our skip target.\r
+ */\r
+ if (skip >= 3 && code+skip-3 >= code &&\r
+ code[skip-3] == SRE_OP_JUMP)\r
+ {\r
+ VTRACE(("both then and else parts present\n"));\r
+ if (!_validate_inner(code+1, code+skip-3, groups))\r
+ FAIL;\r
+ code += skip-2; /* Position after JUMP, at <skipno> */\r
+ GET_SKIP;\r
+ if (!_validate_inner(code, code+skip-1, groups))\r
+ FAIL;\r
+ code += skip-1;\r
+ }\r
+ else {\r
+ VTRACE(("only a then part present\n"));\r
+ if (!_validate_inner(code+1, code+skip-1, groups))\r
+ FAIL;\r
+ code += skip-1;\r
+ }\r
+ break;\r
+\r
+ case SRE_OP_ASSERT:\r
+ case SRE_OP_ASSERT_NOT:\r
+ GET_SKIP;\r
+ GET_ARG; /* 0 for lookahead, width for lookbehind */\r
+ code--; /* Back up over arg to simplify math below */\r
+ if (arg & 0x80000000)\r
+ FAIL; /* Width too large */\r
+ /* Stop 1 before the end; we check the SUCCESS below */\r
+ if (!_validate_inner(code+1, code+skip-2, groups))\r
+ FAIL;\r
+ code += skip-2;\r
+ GET_OP;\r
+ if (op != SRE_OP_SUCCESS)\r
+ FAIL;\r
+ break;\r
+\r
+ default:\r
+ FAIL;\r
+\r
+ }\r
+ }\r
+\r
+ VTRACE(("okay\n"));\r
+ return 1;\r
+}\r
+\r
+static int\r
+_validate_outer(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups)\r
+{\r
+ if (groups < 0 || groups > 100 || code >= end || end[-1] != SRE_OP_SUCCESS)\r
+ FAIL;\r
+ if (groups == 0) /* fix for simplejson */\r
+ groups = 100; /* 100 groups should always be safe */\r
+ return _validate_inner(code, end-1, groups);\r
+}\r
+\r
+static int\r
+_validate(PatternObject *self)\r
+{\r
+ if (!_validate_outer(self->code, self->code+self->codesize, self->groups))\r
+ {\r
+ PyErr_SetString(PyExc_RuntimeError, "invalid SRE code");\r
+ return 0;\r
+ }\r
+ else\r
+ VTRACE(("Success!\n"));\r
+ return 1;\r
+}\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* match methods */\r
+\r
+static void\r
+match_dealloc(MatchObject* self)\r
+{\r
+ Py_XDECREF(self->regs);\r
+ Py_XDECREF(self->string);\r
+ Py_DECREF(self->pattern);\r
+ PyObject_DEL(self);\r
+}\r
+\r
+static PyObject*\r
+match_getslice_by_index(MatchObject* self, Py_ssize_t index, PyObject* def)\r
+{\r
+ if (index < 0 || index >= self->groups) {\r
+ /* raise IndexError if we were given a bad group number */\r
+ PyErr_SetString(\r
+ PyExc_IndexError,\r
+ "no such group"\r
+ );\r
+ return NULL;\r
+ }\r
+\r
+ index *= 2;\r
+\r
+ if (self->string == Py_None || self->mark[index] < 0) {\r
+ /* return default value if the string or group is undefined */\r
+ Py_INCREF(def);\r
+ return def;\r
+ }\r
+\r
+ return PySequence_GetSlice(\r
+ self->string, self->mark[index], self->mark[index+1]\r
+ );\r
+}\r
+\r
+static Py_ssize_t\r
+match_getindex(MatchObject* self, PyObject* index)\r
+{\r
+ Py_ssize_t i;\r
+\r
+ if (PyInt_Check(index))\r
+ return PyInt_AsSsize_t(index);\r
+\r
+ i = -1;\r
+\r
+ if (self->pattern->groupindex) {\r
+ index = PyObject_GetItem(self->pattern->groupindex, index);\r
+ if (index) {\r
+ if (PyInt_Check(index) || PyLong_Check(index))\r
+ i = PyInt_AsSsize_t(index);\r
+ Py_DECREF(index);\r
+ } else\r
+ PyErr_Clear();\r
+ }\r
+\r
+ return i;\r
+}\r
+\r
+static PyObject*\r
+match_getslice(MatchObject* self, PyObject* index, PyObject* def)\r
+{\r
+ return match_getslice_by_index(self, match_getindex(self, index), def);\r
+}\r
+\r
+static PyObject*\r
+match_expand(MatchObject* self, PyObject* ptemplate)\r
+{\r
+ /* delegate to Python code */\r
+ return call(\r
+ SRE_PY_MODULE, "_expand",\r
+ PyTuple_Pack(3, self->pattern, self, ptemplate)\r
+ );\r
+}\r
+\r
+static PyObject*\r
+match_group(MatchObject* self, PyObject* args)\r
+{\r
+ PyObject* result;\r
+ Py_ssize_t i, size;\r
+\r
+ size = PyTuple_GET_SIZE(args);\r
+\r
+ switch (size) {\r
+ case 0:\r
+ result = match_getslice(self, Py_False, Py_None);\r
+ break;\r
+ case 1:\r
+ result = match_getslice(self, PyTuple_GET_ITEM(args, 0), Py_None);\r
+ break;\r
+ default:\r
+ /* fetch multiple items */\r
+ result = PyTuple_New(size);\r
+ if (!result)\r
+ return NULL;\r
+ for (i = 0; i < size; i++) {\r
+ PyObject* item = match_getslice(\r
+ self, PyTuple_GET_ITEM(args, i), Py_None\r
+ );\r
+ if (!item) {\r
+ Py_DECREF(result);\r
+ return NULL;\r
+ }\r
+ PyTuple_SET_ITEM(result, i, item);\r
+ }\r
+ break;\r
+ }\r
+ return result;\r
+}\r
+\r
+static PyObject*\r
+match_groups(MatchObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ PyObject* result;\r
+ Py_ssize_t index;\r
+\r
+ PyObject* def = Py_None;\r
+ static char* kwlist[] = { "default", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groups", kwlist, &def))\r
+ return NULL;\r
+\r
+ result = PyTuple_New(self->groups-1);\r
+ if (!result)\r
+ return NULL;\r
+\r
+ for (index = 1; index < self->groups; index++) {\r
+ PyObject* item;\r
+ item = match_getslice_by_index(self, index, def);\r
+ if (!item) {\r
+ Py_DECREF(result);\r
+ return NULL;\r
+ }\r
+ PyTuple_SET_ITEM(result, index-1, item);\r
+ }\r
+\r
+ return result;\r
+}\r
+\r
+static PyObject*\r
+match_groupdict(MatchObject* self, PyObject* args, PyObject* kw)\r
+{\r
+ PyObject* result;\r
+ PyObject* keys;\r
+ Py_ssize_t index;\r
+\r
+ PyObject* def = Py_None;\r
+ static char* kwlist[] = { "default", NULL };\r
+ if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groupdict", kwlist, &def))\r
+ return NULL;\r
+\r
+ result = PyDict_New();\r
+ if (!result || !self->pattern->groupindex)\r
+ return result;\r
+\r
+ keys = PyMapping_Keys(self->pattern->groupindex);\r
+ if (!keys)\r
+ goto failed;\r
+\r
+ for (index = 0; index < PyList_GET_SIZE(keys); index++) {\r
+ int status;\r
+ PyObject* key;\r
+ PyObject* value;\r
+ key = PyList_GET_ITEM(keys, index);\r
+ if (!key)\r
+ goto failed;\r
+ value = match_getslice(self, key, def);\r
+ if (!value) {\r
+ Py_DECREF(key);\r
+ goto failed;\r
+ }\r
+ status = PyDict_SetItem(result, key, value);\r
+ Py_DECREF(value);\r
+ if (status < 0)\r
+ goto failed;\r
+ }\r
+\r
+ Py_DECREF(keys);\r
+\r
+ return result;\r
+\r
+failed:\r
+ Py_XDECREF(keys);\r
+ Py_DECREF(result);\r
+ return NULL;\r
+}\r
+\r
+static PyObject*\r
+match_start(MatchObject* self, PyObject* args)\r
+{\r
+ Py_ssize_t index;\r
+\r
+ PyObject* index_ = Py_False; /* zero */\r
+ if (!PyArg_UnpackTuple(args, "start", 0, 1, &index_))\r
+ return NULL;\r
+\r
+ index = match_getindex(self, index_);\r
+\r
+ if (index < 0 || index >= self->groups) {\r
+ PyErr_SetString(\r
+ PyExc_IndexError,\r
+ "no such group"\r
+ );\r
+ return NULL;\r
+ }\r
+\r
+ /* mark is -1 if group is undefined */\r
+ return Py_BuildValue("i", self->mark[index*2]);\r
+}\r
+\r
+static PyObject*\r
+match_end(MatchObject* self, PyObject* args)\r
+{\r
+ Py_ssize_t index;\r
+\r
+ PyObject* index_ = Py_False; /* zero */\r
+ if (!PyArg_UnpackTuple(args, "end", 0, 1, &index_))\r
+ return NULL;\r
+\r
+ index = match_getindex(self, index_);\r
+\r
+ if (index < 0 || index >= self->groups) {\r
+ PyErr_SetString(\r
+ PyExc_IndexError,\r
+ "no such group"\r
+ );\r
+ return NULL;\r
+ }\r
+\r
+ /* mark is -1 if group is undefined */\r
+ return Py_BuildValue("i", self->mark[index*2+1]);\r
+}\r
+\r
+LOCAL(PyObject*)\r
+_pair(Py_ssize_t i1, Py_ssize_t i2)\r
+{\r
+ PyObject* pair;\r
+ PyObject* item;\r
+\r
+ pair = PyTuple_New(2);\r
+ if (!pair)\r
+ return NULL;\r
+\r
+ item = PyInt_FromSsize_t(i1);\r
+ if (!item)\r
+ goto error;\r
+ PyTuple_SET_ITEM(pair, 0, item);\r
+\r
+ item = PyInt_FromSsize_t(i2);\r
+ if (!item)\r
+ goto error;\r
+ PyTuple_SET_ITEM(pair, 1, item);\r
+\r
+ return pair;\r
+\r
+ error:\r
+ Py_DECREF(pair);\r
+ return NULL;\r
+}\r
+\r
+static PyObject*\r
+match_span(MatchObject* self, PyObject* args)\r
+{\r
+ Py_ssize_t index;\r
+\r
+ PyObject* index_ = Py_False; /* zero */\r
+ if (!PyArg_UnpackTuple(args, "span", 0, 1, &index_))\r
+ return NULL;\r
+\r
+ index = match_getindex(self, index_);\r
+\r
+ if (index < 0 || index >= self->groups) {\r
+ PyErr_SetString(\r
+ PyExc_IndexError,\r
+ "no such group"\r
+ );\r
+ return NULL;\r
+ }\r
+\r
+ /* marks are -1 if group is undefined */\r
+ return _pair(self->mark[index*2], self->mark[index*2+1]);\r
+}\r
+\r
+static PyObject*\r
+match_regs(MatchObject* self)\r
+{\r
+ PyObject* regs;\r
+ PyObject* item;\r
+ Py_ssize_t index;\r
+\r
+ regs = PyTuple_New(self->groups);\r
+ if (!regs)\r
+ return NULL;\r
+\r
+ for (index = 0; index < self->groups; index++) {\r
+ item = _pair(self->mark[index*2], self->mark[index*2+1]);\r
+ if (!item) {\r
+ Py_DECREF(regs);\r
+ return NULL;\r
+ }\r
+ PyTuple_SET_ITEM(regs, index, item);\r
+ }\r
+\r
+ Py_INCREF(regs);\r
+ self->regs = regs;\r
+\r
+ return regs;\r
+}\r
+\r
+static PyObject*\r
+match_copy(MatchObject* self, PyObject *unused)\r
+{\r
+#ifdef USE_BUILTIN_COPY\r
+ MatchObject* copy;\r
+ Py_ssize_t slots, offset;\r
+\r
+ slots = 2 * (self->pattern->groups+1);\r
+\r
+ copy = PyObject_NEW_VAR(MatchObject, &Match_Type, slots);\r
+ if (!copy)\r
+ return NULL;\r
+\r
+ /* this value a constant, but any compiler should be able to\r
+ figure that out all by itself */\r
+ offset = offsetof(MatchObject, string);\r
+\r
+ Py_XINCREF(self->pattern);\r
+ Py_XINCREF(self->string);\r
+ Py_XINCREF(self->regs);\r
+\r
+ memcpy((char*) copy + offset, (char*) self + offset,\r
+ sizeof(MatchObject) + slots * sizeof(Py_ssize_t) - offset);\r
+\r
+ return (PyObject*) copy;\r
+#else\r
+ PyErr_SetString(PyExc_TypeError, "cannot copy this match object");\r
+ return NULL;\r
+#endif\r
+}\r
+\r
+static PyObject*\r
+match_deepcopy(MatchObject* self, PyObject* memo)\r
+{\r
+#ifdef USE_BUILTIN_COPY\r
+ MatchObject* copy;\r
+\r
+ copy = (MatchObject*) match_copy(self);\r
+ if (!copy)\r
+ return NULL;\r
+\r
+ if (!deepcopy((PyObject**) ©->pattern, memo) ||\r
+ !deepcopy(©->string, memo) ||\r
+ !deepcopy(©->regs, memo)) {\r
+ Py_DECREF(copy);\r
+ return NULL;\r
+ }\r
+\r
+#else\r
+ PyErr_SetString(PyExc_TypeError, "cannot deepcopy this match object");\r
+ return NULL;\r
+#endif\r
+}\r
+\r
+static PyMethodDef match_methods[] = {\r
+ {"group", (PyCFunction) match_group, METH_VARARGS},\r
+ {"start", (PyCFunction) match_start, METH_VARARGS},\r
+ {"end", (PyCFunction) match_end, METH_VARARGS},\r
+ {"span", (PyCFunction) match_span, METH_VARARGS},\r
+ {"groups", (PyCFunction) match_groups, METH_VARARGS|METH_KEYWORDS},\r
+ {"groupdict", (PyCFunction) match_groupdict, METH_VARARGS|METH_KEYWORDS},\r
+ {"expand", (PyCFunction) match_expand, METH_O},\r
+ {"__copy__", (PyCFunction) match_copy, METH_NOARGS},\r
+ {"__deepcopy__", (PyCFunction) match_deepcopy, METH_O},\r
+ {NULL, NULL}\r
+};\r
+\r
+static PyObject*\r
+match_getattr(MatchObject* self, char* name)\r
+{\r
+ PyObject* res;\r
+\r
+ res = Py_FindMethod(match_methods, (PyObject*) self, name);\r
+ if (res)\r
+ return res;\r
+\r
+ PyErr_Clear();\r
+\r
+ if (!strcmp(name, "lastindex")) {\r
+ if (self->lastindex >= 0)\r
+ return Py_BuildValue("i", self->lastindex);\r
+ Py_INCREF(Py_None);\r
+ return Py_None;\r
+ }\r
+\r
+ if (!strcmp(name, "lastgroup")) {\r
+ if (self->pattern->indexgroup && self->lastindex >= 0) {\r
+ PyObject* result = PySequence_GetItem(\r
+ self->pattern->indexgroup, self->lastindex\r
+ );\r
+ if (result)\r
+ return result;\r
+ PyErr_Clear();\r
+ }\r
+ Py_INCREF(Py_None);\r
+ return Py_None;\r
+ }\r
+\r
+ if (!strcmp(name, "string")) {\r
+ if (self->string) {\r
+ Py_INCREF(self->string);\r
+ return self->string;\r
+ } else {\r
+ Py_INCREF(Py_None);\r
+ return Py_None;\r
+ }\r
+ }\r
+\r
+ if (!strcmp(name, "regs")) {\r
+ if (self->regs) {\r
+ Py_INCREF(self->regs);\r
+ return self->regs;\r
+ } else\r
+ return match_regs(self);\r
+ }\r
+\r
+ if (!strcmp(name, "re")) {\r
+ Py_INCREF(self->pattern);\r
+ return (PyObject*) self->pattern;\r
+ }\r
+\r
+ if (!strcmp(name, "pos"))\r
+ return Py_BuildValue("i", self->pos);\r
+\r
+ if (!strcmp(name, "endpos"))\r
+ return Py_BuildValue("i", self->endpos);\r
+\r
+ PyErr_SetString(PyExc_AttributeError, name);\r
+ return NULL;\r
+}\r
+\r
+/* FIXME: implement setattr("string", None) as a special case (to\r
+ detach the associated string, if any */\r
+\r
+statichere PyTypeObject Match_Type = {\r
+ PyObject_HEAD_INIT(NULL)\r
+ 0, "_" SRE_MODULE ".SRE_Match",\r
+ sizeof(MatchObject), sizeof(Py_ssize_t),\r
+ (destructor)match_dealloc, /*tp_dealloc*/\r
+ 0, /*tp_print*/\r
+ (getattrfunc)match_getattr /*tp_getattr*/\r
+};\r
+\r
+static PyObject*\r
+pattern_new_match(PatternObject* pattern, SRE_STATE* state, int status)\r
+{\r
+ /* create match object (from state object) */\r
+\r
+ MatchObject* match;\r
+ Py_ssize_t i, j;\r
+ char* base;\r
+ int n;\r
+\r
+ if (status > 0) {\r
+\r
+ /* create match object (with room for extra group marks) */\r
+ /* coverity[ampersand_in_size] */\r
+ match = PyObject_NEW_VAR(MatchObject, &Match_Type,\r
+ 2*(pattern->groups+1));\r
+ if (!match)\r
+ return NULL;\r
+\r
+ Py_INCREF(pattern);\r
+ match->pattern = pattern;\r
+\r
+ Py_INCREF(state->string);\r
+ match->string = state->string;\r
+\r
+ match->regs = NULL;\r
+ match->groups = pattern->groups+1;\r
+\r
+ /* fill in group slices */\r
+\r
+ base = (char*) state->beginning;\r
+ n = state->charsize;\r
+\r
+ match->mark[0] = ((char*) state->start - base) / n;\r
+ match->mark[1] = ((char*) state->ptr - base) / n;\r
+\r
+ for (i = j = 0; i < pattern->groups; i++, j+=2)\r
+ if (j+1 <= state->lastmark && state->mark[j] && state->mark[j+1]) {\r
+ match->mark[j+2] = ((char*) state->mark[j] - base) / n;\r
+ match->mark[j+3] = ((char*) state->mark[j+1] - base) / n;\r
+ } else\r
+ match->mark[j+2] = match->mark[j+3] = -1; /* undefined */\r
+\r
+ match->pos = state->pos;\r
+ match->endpos = state->endpos;\r
+\r
+ match->lastindex = state->lastindex;\r
+\r
+ return (PyObject*) match;\r
+\r
+ } else if (status == 0) {\r
+\r
+ /* no match */\r
+ Py_INCREF(Py_None);\r
+ return Py_None;\r
+\r
+ }\r
+\r
+ /* internal error */\r
+ pattern_error(status);\r
+ return NULL;\r
+}\r
+\r
+\r
+/* -------------------------------------------------------------------- */\r
+/* scanner methods (experimental) */\r
+\r
+static void\r
+scanner_dealloc(ScannerObject* self)\r
+{\r
+ state_fini(&self->state);\r
+ Py_XDECREF(self->pattern);\r
+ PyObject_DEL(self);\r
+}\r
+\r
+static PyObject*\r
+scanner_match(ScannerObject* self, PyObject *unused)\r
+{\r
+ SRE_STATE* state = &self->state;\r
+ PyObject* match;\r
+ int status;\r
+\r
+ state_reset(state);\r
+\r
+ state->ptr = state->start;\r
+\r
+ if (state->charsize == 1) {\r
+ status = sre_match(state, PatternObject_GetCode(self->pattern));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_umatch(state, PatternObject_GetCode(self->pattern));\r
+#endif\r
+ }\r
+ if (PyErr_Occurred())\r
+ return NULL;\r
+\r
+ match = pattern_new_match((PatternObject*) self->pattern,\r
+ state, status);\r
+\r
+ if (status == 0 || state->ptr == state->start)\r
+ state->start = (void*) ((char*) state->ptr + state->charsize);\r
+ else\r
+ state->start = state->ptr;\r
+\r
+ return match;\r
+}\r
+\r
+\r
+static PyObject*\r
+scanner_search(ScannerObject* self, PyObject *unused)\r
+{\r
+ SRE_STATE* state = &self->state;\r
+ PyObject* match;\r
+ int status;\r
+\r
+ state_reset(state);\r
+\r
+ state->ptr = state->start;\r
+\r
+ if (state->charsize == 1) {\r
+ status = sre_search(state, PatternObject_GetCode(self->pattern));\r
+ } else {\r
+#if defined(HAVE_UNICODE)\r
+ status = sre_usearch(state, PatternObject_GetCode(self->pattern));\r
+#endif\r
+ }\r
+ if (PyErr_Occurred())\r
+ return NULL;\r
+\r
+ match = pattern_new_match((PatternObject*) self->pattern,\r
+ state, status);\r
+\r
+ if (status == 0 || state->ptr == state->start)\r
+ state->start = (void*) ((char*) state->ptr + state->charsize);\r
+ else\r
+ state->start = state->ptr;\r
+\r
+ return match;\r
+}\r
+\r
+static PyMethodDef scanner_methods[] = {\r
+ {"match", (PyCFunction) scanner_match, METH_NOARGS},\r
+ {"search", (PyCFunction) scanner_search, METH_NOARGS},\r
+ {NULL, NULL}\r
+};\r
+\r
+static PyObject*\r
+scanner_getattr(ScannerObject* self, char* name)\r
+{\r
+ PyObject* res;\r
+\r
+ res = Py_FindMethod(scanner_methods, (PyObject*) self, name);\r
+ if (res)\r
+ return res;\r
+\r
+ PyErr_Clear();\r
+\r
+ /* attributes */\r
+ if (!strcmp(name, "pattern")) {\r
+ Py_INCREF(self->pattern);\r
+ return self->pattern;\r
+ }\r
+\r
+ PyErr_SetString(PyExc_AttributeError, name);\r
+ return NULL;\r
+}\r
+\r
+statichere PyTypeObject Scanner_Type = {\r
+ PyObject_HEAD_INIT(NULL)\r
+ 0, "_" SRE_MODULE ".SRE_Scanner",\r
+ sizeof(ScannerObject), 0,\r
+ (destructor)scanner_dealloc, /*tp_dealloc*/\r
+ 0, /*tp_print*/\r
+ (getattrfunc)scanner_getattr, /*tp_getattr*/\r
+};\r
+\r
+static PyObject*\r
+pattern_scanner(PatternObject* pattern, PyObject* args)\r
+{\r
+ /* create search state object */\r
+\r
+ ScannerObject* self;\r
+\r
+ PyObject* string;\r
+ Py_ssize_t start = 0;\r
+ Py_ssize_t end = PY_SSIZE_T_MAX;\r
+ if (!PyArg_ParseTuple(args, "O|nn:scanner", &string, &start, &end))\r
+ return NULL;\r
+\r
+ /* create scanner object */\r
+ self = PyObject_NEW(ScannerObject, &Scanner_Type);\r
+ if (!self)\r
+ return NULL;\r
+ self->pattern = NULL;\r
+\r
+ string = state_init(&self->state, pattern, string, start, end);\r
+ if (!string) {\r
+ Py_DECREF(self);\r
+ return NULL;\r
+ }\r
+\r
+ Py_INCREF(pattern);\r
+ self->pattern = (PyObject*) pattern;\r
+\r
+ return (PyObject*) self;\r
+}\r
+\r
+static PyMethodDef _functions[] = {\r
+ {"compile", _compile, METH_VARARGS},\r
+ {"getcodesize", sre_codesize, METH_NOARGS},\r
+ {"getlower", sre_getlower, METH_VARARGS},\r
+ {NULL, NULL}\r
+};\r
+\r
+#if PY_VERSION_HEX < 0x02030000\r
+DL_EXPORT(void) init_sre(void)\r
+#else\r
+PyMODINIT_FUNC init_sre(void)\r
+#endif\r
+{\r
+ PyObject* m;\r
+ PyObject* d;\r
+ PyObject* x;\r
+\r
+ /* Patch object types */\r
+ if (PyType_Ready(&Pattern_Type) || PyType_Ready(&Match_Type) ||\r
+ PyType_Ready(&Scanner_Type))\r
+ return;\r
+\r
+ m = Py_InitModule("_" SRE_MODULE, _functions);\r
+ if (m == NULL)\r
+ return;\r
+ d = PyModule_GetDict(m);\r
+\r
+ x = PyInt_FromLong(SRE_MAGIC);\r
+ if (x) {\r
+ PyDict_SetItemString(d, "MAGIC", x);\r
+ Py_DECREF(x);\r
+ }\r
+\r
+ x = PyInt_FromLong(sizeof(SRE_CODE));\r
+ if (x) {\r
+ PyDict_SetItemString(d, "CODESIZE", x);\r
+ Py_DECREF(x);\r
+ }\r
+\r
+ x = PyString_FromString(copyright);\r
+ if (x) {\r
+ PyDict_SetItemString(d, "copyright", x);\r
+ Py_DECREF(x);\r
+ }\r
+}\r
+\r
+#endif /* !defined(SRE_RECURSIVE) */\r
+\r
+/* vim:ts=4:sw=4:et\r
+*/\r
--- /dev/null
+/* zutil.h -- internal interface and configuration of the compression library\r
+ * Copyright (C) 1995-2005 Jean-loup Gailly.\r
+ * For conditions of distribution and use, see copyright notice in zlib.h\r
+ */\r
+\r
+/* WARNING: this file should *not* be used by applications. It is\r
+ part of the implementation of the compression library and is\r
+ subject to change. Applications should only use zlib.h.\r
+ */\r
+\r
+/* @(#) $Id$ */\r
+\r
+#ifndef ZUTIL_H\r
+#define ZUTIL_H\r
+\r
+#define ZLIB_INTERNAL\r
+#include "zlib.h"\r
+\r
+#ifdef STDC\r
+# ifndef _WIN32_WCE\r
+# include <stddef.h>\r
+# endif\r
+# include <string.h>\r
+# include <stdlib.h>\r
+#endif\r
+#ifdef NO_ERRNO_H\r
+# ifdef _WIN32_WCE\r
+ /* The Microsoft C Run-Time Library for Windows CE doesn't have\r
+ * errno. We define it as a global variable to simplify porting.\r
+ * Its value is always 0 and should not be used. We rename it to\r
+ * avoid conflict with other libraries that use the same workaround.\r
+ */\r
+# define errno z_errno\r
+# endif\r
+ extern int errno;\r
+#else\r
+# ifndef _WIN32_WCE\r
+# include <errno.h>\r
+# endif\r
+#endif\r
+\r
+#ifndef local\r
+# define local static\r
+#endif\r
+/* compile with -Dlocal if your debugger can't find static symbols */\r
+\r
+typedef unsigned char uch;\r
+typedef uch FAR uchf;\r
+typedef unsigned short ush;\r
+typedef ush FAR ushf;\r
+typedef unsigned long ulg;\r
+\r
+extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */\r
+/* (size given to avoid silly warnings with Visual C++) */\r
+\r
+#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]\r
+\r
+#define ERR_RETURN(strm,err) \\r
+ return (strm->msg = (char*)ERR_MSG(err), (err))\r
+/* To be used only when the state is known to be valid */\r
+\r
+ /* common constants */\r
+\r
+#ifndef DEF_WBITS\r
+# define DEF_WBITS MAX_WBITS\r
+#endif\r
+/* default windowBits for decompression. MAX_WBITS is for compression only */\r
+\r
+#if MAX_MEM_LEVEL >= 8\r
+# define DEF_MEM_LEVEL 8\r
+#else\r
+# define DEF_MEM_LEVEL MAX_MEM_LEVEL\r
+#endif\r
+/* default memLevel */\r
+\r
+#define STORED_BLOCK 0\r
+#define STATIC_TREES 1\r
+#define DYN_TREES 2\r
+/* The three kinds of block type */\r
+\r
+#define MIN_MATCH 3\r
+#define MAX_MATCH 258\r
+/* The minimum and maximum match lengths */\r
+\r
+#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */\r
+\r
+ /* target dependencies */\r
+\r
+#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))\r
+# define OS_CODE 0x00\r
+# if defined(__TURBOC__) || defined(__BORLANDC__)\r
+# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))\r
+ /* Allow compilation with ANSI keywords only enabled */\r
+ void _Cdecl farfree( void *block );\r
+ void *_Cdecl farmalloc( unsigned long nbytes );\r
+# else\r
+# include <alloc.h>\r
+# endif\r
+# else /* MSC or DJGPP */\r
+# include <malloc.h>\r
+# endif\r
+#endif\r
+\r
+#ifdef AMIGA\r
+# define OS_CODE 0x01\r
+#endif\r
+\r
+#if defined(VAXC) || defined(VMS)\r
+# define OS_CODE 0x02\r
+# define F_OPEN(name, mode) \\r
+ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")\r
+#endif\r
+\r
+#if defined(ATARI) || defined(atarist)\r
+# define OS_CODE 0x05\r
+#endif\r
+\r
+#ifdef OS2\r
+# define OS_CODE 0x06\r
+# ifdef M_I86\r
+ #include <malloc.h>\r
+# endif\r
+#endif\r
+\r
+#if defined(MACOS) || defined(TARGET_OS_MAC)\r
+# define OS_CODE 0x07\r
+# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os\r
+# include <unix.h> /* for fdopen */\r
+# else\r
+# ifndef fdopen\r
+# define fdopen(fd,mode) NULL /* No fdopen() */\r
+# endif\r
+# endif\r
+#endif\r
+\r
+#ifdef TOPS20\r
+# define OS_CODE 0x0a\r
+#endif\r
+\r
+#ifdef WIN32\r
+# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */\r
+# define OS_CODE 0x0b\r
+# endif\r
+#endif\r
+\r
+#ifdef __50SERIES /* Prime/PRIMOS */\r
+# define OS_CODE 0x0f\r
+#endif\r
+\r
+#if defined(_BEOS_) || defined(RISCOS)\r
+# define fdopen(fd,mode) NULL /* No fdopen() */\r
+#endif\r
+\r
+#if (defined(_MSC_VER) && (_MSC_VER > 600))\r
+# if defined(_WIN32_WCE) || defined(_EFI_STDLIB)\r
+# define fdopen(fd,mode) NULL /* No fdopen() */\r
+# ifndef _PTRDIFF_T_DEFINED\r
+ typedef int ptrdiff_t;\r
+# define _PTRDIFF_T_DEFINED\r
+# endif\r
+# else\r
+# define fdopen(fd,type) _fdopen(fd,type)\r
+# endif\r
+#endif\r
+\r
+ /* common defaults */\r
+\r
+#ifndef OS_CODE\r
+# define OS_CODE 0x03 /* assume Unix */\r
+#endif\r
+\r
+#ifndef F_OPEN\r
+# define F_OPEN(name, mode) fopen((name), (mode))\r
+#endif\r
+\r
+ /* functions */\r
+\r
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)\r
+# ifndef HAVE_VSNPRINTF\r
+# define HAVE_VSNPRINTF\r
+# endif\r
+#endif\r
+#if defined(__CYGWIN__)\r
+# ifndef HAVE_VSNPRINTF\r
+# define HAVE_VSNPRINTF\r
+# endif\r
+#endif\r
+#ifndef HAVE_VSNPRINTF\r
+# ifdef MSDOS\r
+ /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),\r
+ but for now we just assume it doesn't. */\r
+# define NO_vsnprintf\r
+# endif\r
+# ifdef __TURBOC__\r
+# define NO_vsnprintf\r
+# endif\r
+# ifdef WIN32\r
+ /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */\r
+# if !defined(vsnprintf) && !defined(NO_vsnprintf)\r
+# define vsnprintf _vsnprintf\r
+# endif\r
+# endif\r
+# ifdef __SASC\r
+# define NO_vsnprintf\r
+# endif\r
+#endif\r
+#ifdef VMS\r
+# define NO_vsnprintf\r
+#endif\r
+\r
+#if defined(pyr)\r
+# define NO_MEMCPY\r
+#endif\r
+#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)\r
+ /* Use our own functions for small and medium model with MSC <= 5.0.\r
+ * You may have to use the same strategy for Borland C (untested).\r
+ * The __SC__ check is for Symantec.\r
+ */\r
+# define NO_MEMCPY\r
+#endif\r
+#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)\r
+# define HAVE_MEMCPY\r
+#endif\r
+#ifdef HAVE_MEMCPY\r
+# ifdef SMALL_MEDIUM /* MSDOS small or medium model */\r
+# define zmemcpy _fmemcpy\r
+# define zmemcmp _fmemcmp\r
+# define zmemzero(dest, len) _fmemset(dest, 0, len)\r
+# else\r
+# define zmemcpy memcpy\r
+# define zmemcmp memcmp\r
+# define zmemzero(dest, len) memset(dest, 0, len)\r
+# endif\r
+#else\r
+ extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));\r
+ extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));\r
+ extern void zmemzero OF((Bytef* dest, uInt len));\r
+#endif\r
+\r
+/* Diagnostic functions */\r
+#ifdef DEBUG\r
+# include <stdio.h>\r
+ extern int z_verbose;\r
+ extern void z_error OF((char *m));\r
+# define Assert(cond,msg) {if(!(cond)) z_error(msg);}\r
+# define Trace(x) {if (z_verbose>=0) fprintf x ;}\r
+# define Tracev(x) {if (z_verbose>0) fprintf x ;}\r
+# define Tracevv(x) {if (z_verbose>1) fprintf x ;}\r
+# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}\r
+# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}\r
+#else\r
+# define Assert(cond,msg)\r
+# define Trace(x)\r
+# define Tracev(x)\r
+# define Tracevv(x)\r
+# define Tracec(c,x)\r
+# define Tracecv(c,x)\r
+#endif\r
+\r
+\r
+voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));\r
+void zcfree OF((voidpf opaque, voidpf ptr));\r
+\r
+#define ZALLOC(strm, items, size) \\r
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))\r
+#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))\r
+#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}\r
+\r
+#endif /* ZUTIL_H */\r
--- /dev/null
+/* stringlib: locale related helpers implementation */\r
+\r
+#ifndef STRINGLIB_LOCALEUTIL_H\r
+#define STRINGLIB_LOCALEUTIL_H\r
+\r
+#include <locale.h>\r
+\r
+// Prevent conflicts with EFI\r
+#undef MAX\r
+#undef MIN\r
+\r
+#define MAX(x, y) ((x) < (y) ? (y) : (x))\r
+#define MIN(x, y) ((x) < (y) ? (x) : (y))\r
+\r
+typedef struct {\r
+ const char *grouping;\r
+ char previous;\r
+ Py_ssize_t i; /* Where we're currently pointing in grouping. */\r
+} GroupGenerator;\r
+\r
+static void\r
+_GroupGenerator_init(GroupGenerator *self, const char *grouping)\r
+{\r
+ self->grouping = grouping;\r
+ self->i = 0;\r
+ self->previous = 0;\r
+}\r
+\r
+/* Returns the next grouping, or 0 to signify end. */\r
+static Py_ssize_t\r
+_GroupGenerator_next(GroupGenerator *self)\r
+{\r
+ /* Note that we don't really do much error checking here. If a\r
+ grouping string contains just CHAR_MAX, for example, then just\r
+ terminate the generator. That shouldn't happen, but at least we\r
+ fail gracefully. */\r
+ switch (self->grouping[self->i]) {\r
+ case 0:\r
+ return self->previous;\r
+ case CHAR_MAX:\r
+ /* Stop the generator. */\r
+ return 0;\r
+ default: {\r
+ char ch = self->grouping[self->i];\r
+ self->previous = ch;\r
+ self->i++;\r
+ return (Py_ssize_t)ch;\r
+ }\r
+ }\r
+}\r
+\r
+/* Fill in some digits, leading zeros, and thousands separator. All\r
+ are optional, depending on when we're called. */\r
+static void\r
+fill(STRINGLIB_CHAR **digits_end, STRINGLIB_CHAR **buffer_end,\r
+ Py_ssize_t n_chars, Py_ssize_t n_zeros, const char* thousands_sep,\r
+ Py_ssize_t thousands_sep_len)\r
+{\r
+#if STRINGLIB_IS_UNICODE\r
+ Py_ssize_t i;\r
+#endif\r
+\r
+ if (thousands_sep) {\r
+ *buffer_end -= thousands_sep_len;\r
+\r
+ /* Copy the thousands_sep chars into the buffer. */\r
+#if STRINGLIB_IS_UNICODE\r
+ /* Convert from the char's of the thousands_sep from\r
+ the locale into unicode. */\r
+ for (i = 0; i < thousands_sep_len; ++i)\r
+ (*buffer_end)[i] = thousands_sep[i];\r
+#else\r
+ /* No conversion, just memcpy the thousands_sep. */\r
+ memcpy(*buffer_end, thousands_sep, thousands_sep_len);\r
+#endif\r
+ }\r
+\r
+ *buffer_end -= n_chars;\r
+ *digits_end -= n_chars;\r
+ memcpy(*buffer_end, *digits_end, n_chars * sizeof(STRINGLIB_CHAR));\r
+\r
+ *buffer_end -= n_zeros;\r
+ STRINGLIB_FILL(*buffer_end, '0', n_zeros);\r
+}\r
+\r
+/**\r
+ * _Py_InsertThousandsGrouping:\r
+ * @buffer: A pointer to the start of a string.\r
+ * @n_buffer: Number of characters in @buffer.\r
+ * @digits: A pointer to the digits we're reading from. If count\r
+ * is non-NULL, this is unused.\r
+ * @n_digits: The number of digits in the string, in which we want\r
+ * to put the grouping chars.\r
+ * @min_width: The minimum width of the digits in the output string.\r
+ * Output will be zero-padded on the left to fill.\r
+ * @grouping: see definition in localeconv().\r
+ * @thousands_sep: see definition in localeconv().\r
+ *\r
+ * There are 2 modes: counting and filling. If @buffer is NULL,\r
+ * we are in counting mode, else filling mode.\r
+ * If counting, the required buffer size is returned.\r
+ * If filling, we know the buffer will be large enough, so we don't\r
+ * need to pass in the buffer size.\r
+ * Inserts thousand grouping characters (as defined by grouping and\r
+ * thousands_sep) into the string between buffer and buffer+n_digits.\r
+ *\r
+ * Return value: 0 on error, else 1. Note that no error can occur if\r
+ * count is non-NULL.\r
+ *\r
+ * This name won't be used, the includer of this file should define\r
+ * it to be the actual function name, based on unicode or string.\r
+ *\r
+ * As closely as possible, this code mimics the logic in decimal.py's\r
+ _insert_thousands_sep().\r
+ **/\r
+Py_ssize_t\r
+_Py_InsertThousandsGrouping(STRINGLIB_CHAR *buffer,\r
+ Py_ssize_t n_buffer,\r
+ STRINGLIB_CHAR *digits,\r
+ Py_ssize_t n_digits,\r
+ Py_ssize_t min_width,\r
+ const char *grouping,\r
+ const char *thousands_sep)\r
+{\r
+ Py_ssize_t count = 0;\r
+ Py_ssize_t n_zeros;\r
+ int loop_broken = 0;\r
+ int use_separator = 0; /* First time through, don't append the\r
+ separator. They only go between\r
+ groups. */\r
+ STRINGLIB_CHAR *buffer_end = NULL;\r
+ STRINGLIB_CHAR *digits_end = NULL;\r
+ Py_ssize_t l;\r
+ Py_ssize_t n_chars;\r
+ Py_ssize_t thousands_sep_len = strlen(thousands_sep);\r
+ Py_ssize_t remaining = n_digits; /* Number of chars remaining to\r
+ be looked at */\r
+ /* A generator that returns all of the grouping widths, until it\r
+ returns 0. */\r
+ GroupGenerator groupgen;\r
+ _GroupGenerator_init(&groupgen, grouping);\r
+\r
+ if (buffer) {\r
+ buffer_end = buffer + n_buffer;\r
+ digits_end = digits + n_digits;\r
+ }\r
+\r
+ while ((l = _GroupGenerator_next(&groupgen)) > 0) {\r
+ l = MIN(l, MAX(MAX(remaining, min_width), 1));\r
+ n_zeros = MAX(0, l - remaining);\r
+ n_chars = MAX(0, MIN(remaining, l));\r
+\r
+ /* Use n_zero zero's and n_chars chars */\r
+\r
+ /* Count only, don't do anything. */\r
+ count += (use_separator ? thousands_sep_len : 0) + n_zeros + n_chars;\r
+\r
+ if (buffer) {\r
+ /* Copy into the output buffer. */\r
+ fill(&digits_end, &buffer_end, n_chars, n_zeros,\r
+ use_separator ? thousands_sep : NULL, thousands_sep_len);\r
+ }\r
+\r
+ /* Use a separator next time. */\r
+ use_separator = 1;\r
+\r
+ remaining -= n_chars;\r
+ min_width -= l;\r
+\r
+ if (remaining <= 0 && min_width <= 0) {\r
+ loop_broken = 1;\r
+ break;\r
+ }\r
+ min_width -= thousands_sep_len;\r
+ }\r
+ if (!loop_broken) {\r
+ /* We left the loop without using a break statement. */\r
+\r
+ l = MAX(MAX(remaining, min_width), 1);\r
+ n_zeros = MAX(0, l - remaining);\r
+ n_chars = MAX(0, MIN(remaining, l));\r
+\r
+ /* Use n_zero zero's and n_chars chars */\r
+ count += (use_separator ? thousands_sep_len : 0) + n_zeros + n_chars;\r
+ if (buffer) {\r
+ /* Copy into the output buffer. */\r
+ fill(&digits_end, &buffer_end, n_chars, n_zeros,\r
+ use_separator ? thousands_sep : NULL, thousands_sep_len);\r
+ }\r
+ }\r
+ return count;\r
+}\r
+\r
+/**\r
+ * _Py_InsertThousandsGroupingLocale:\r
+ * @buffer: A pointer to the start of a string.\r
+ * @n_digits: The number of digits in the string, in which we want\r
+ * to put the grouping chars.\r
+ *\r
+ * Reads thee current locale and calls _Py_InsertThousandsGrouping().\r
+ **/\r
+Py_ssize_t\r
+_Py_InsertThousandsGroupingLocale(STRINGLIB_CHAR *buffer,\r
+ Py_ssize_t n_buffer,\r
+ STRINGLIB_CHAR *digits,\r
+ Py_ssize_t n_digits,\r
+ Py_ssize_t min_width)\r
+{\r
+ struct lconv *locale_data = localeconv();\r
+ const char *grouping = locale_data->grouping;\r
+ const char *thousands_sep = locale_data->thousands_sep;\r
+\r
+ return _Py_InsertThousandsGrouping(buffer, n_buffer, digits, n_digits,\r
+ min_width, grouping, thousands_sep);\r
+}\r
+#endif /* STRINGLIB_LOCALEUTIL_H */\r
--- /dev/null
+## @file\r
+# PythonCore.inf\r
+#\r
+# Uses include files from Python-2.7.1/Include\r
+#\r
+# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010006\r
+ BASE_NAME = Python\r
+ FILE_GUID = 42f58b27-5dc3-4fa7-844d-5a7dbff06432\r
+ MODULE_TYPE = UEFI_APPLICATION\r
+ VERSION_STRING = 0.1\r
+ ENTRY_POINT = ShellCEntryLib\r
+\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF\r
+#\r
+\r
+[Packages]\r
+ StdLib/StdLib.dec\r
+ MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+ UefiLib\r
+ LibC\r
+ LibString\r
+ LibStdio\r
+ LibGdtoa\r
+ LibWchar\r
+ LibMath\r
+ DevShell\r
+\r
+[Sources]\r
+ Python-2.7.1/Modules/python.c\r
+ Python-2.7.1/Modules/getbuildinfo.c\r
+\r
+#Parser\r
+ Python-2.7.1/Parser/acceler.c\r
+ Python-2.7.1/Parser/bitset.c\r
+ Python-2.7.1/Parser/firstsets.c\r
+ Python-2.7.1/Parser/grammar.c\r
+ Python-2.7.1/Parser/grammar1.c\r
+ Python-2.7.1/Parser/listnode.c\r
+ Python-2.7.1/Parser/metagrammar.c\r
+ Python-2.7.1/Parser/myreadline.c\r
+ Python-2.7.1/Parser/node.c\r
+ Python-2.7.1/Parser/parser.c\r
+ Python-2.7.1/Parser/parsetok.c\r
+ Python-2.7.1/Parser/tokenizer.c\r
+\r
+#Python\r
+ Python-2.7.1/Python/_warnings.c\r
+ Python-2.7.1/Python/asdl.c\r
+ Python-2.7.1/Python/ast.c\r
+ Python-2.7.1/Python/bltinmodule.c\r
+ Python-2.7.1/Python/ceval.c\r
+ Python-2.7.1/Python/codecs.c\r
+ Python-2.7.1/Python/compile.c\r
+ Python-2.7.1/Python/dtoa.c\r
+ Python-2.7.1/Python/dynload_stub.c # Change from dynload_win.c\r
+ Python-2.7.1/Python/errors.c\r
+ Python-2.7.1/Python/formatter_string.c\r
+ Python-2.7.1/Python/formatter_unicode.c\r
+ Python-2.7.1/Python/frozen.c\r
+ Python-2.7.1/Python/future.c\r
+ Python-2.7.1/Python/getargs.c\r
+ Python-2.7.1/Python/getcompiler.c\r
+ Python-2.7.1/Python/getcopyright.c\r
+ Python-2.7.1/Python/getopt.c\r
+ Python-2.7.1/Python/getplatform.c\r
+ Python-2.7.1/Python/getversion.c\r
+ Python-2.7.1/Python/graminit.c\r
+ Python-2.7.1/Python/import.c\r
+ Python-2.7.1/Python/importdl.c\r
+ Python-2.7.1/Python/marshal.c\r
+ Python-2.7.1/Python/modsupport.c\r
+ Python-2.7.1/Python/mysnprintf.c\r
+ Python-2.7.1/Python/mystrtoul.c\r
+ Python-2.7.1/Python/peephole.c\r
+ Python-2.7.1/Python/pyarena.c\r
+ Python-2.7.1/Python/pyctype.c\r
+ Python-2.7.1/Python/pyfpe.c\r
+ Python-2.7.1/Python/pymath.c\r
+ Python-2.7.1/Python/pystate.c\r
+ Python-2.7.1/Python/pystrcmp.c\r
+ Python-2.7.1/Python/pystrtod.c\r
+ Python-2.7.1/Python/Python-ast.c\r
+ Python-2.7.1/Python/pythonrun.c\r
+ Python-2.7.1/Python/structmember.c\r
+ Python-2.7.1/Python/symtable.c\r
+ Python-2.7.1/Python/sysmodule.c\r
+ Python-2.7.1/Python/traceback.c\r
+# Python-2.7.1/Python/thread.c\r
+\r
+#Modules -- See Efi/config.c\r
+ Python-2.7.1/Modules/_bisectmodule.c\r
+ Python-2.7.1/Modules/_codecsmodule.c\r
+ Python-2.7.1/Modules/_collectionsmodule.c\r
+ Python-2.7.1/Modules/_csv.c\r
+ Python-2.7.1/Modules/_functoolsmodule.c\r
+ Python-2.7.1/Modules/_heapqmodule.c\r
+# Python-2.7.1/Modules/_hotshot.c\r
+ Python-2.7.1/Modules/_json.c\r
+# Python-2.7.1/Modules/_localemodule.c\r
+# Python-2.7.1/Modules/_lsprof.c\r
+ Python-2.7.1/Modules/_math.c\r
+ Python-2.7.1/Modules/_randommodule.c\r
+ Python-2.7.1/Modules/_sre.c\r
+ Python-2.7.1/Modules/_struct.c\r
+# Python-2.7.1/Modules/_weakref.c\r
+ Python-2.7.1/Modules/arraymodule.c\r
+# Python-2.7.1/Modules/audioop.c\r
+ Python-2.7.1/Modules/binascii.c\r
+ Python-2.7.1/Modules/cPickle.c\r
+ Python-2.7.1/Modules/cStringIO.c\r
+# Python-2.7.1/Modules/cmathmodule.c\r
+# Python-2.7.1/Modules/datetimemodule.c\r
+ Python-2.7.1/Modules/errnomodule.c\r
+ Python-2.7.1/Modules/future_builtins.c\r
+ Python-2.7.1/Modules/gcmodule.c\r
+ Python-2.7.1/Modules/imageop.c\r
+ Python-2.7.1/Modules/itertoolsmodule.c\r
+ Python-2.7.1/Modules/mathmodule.c\r
+ Python-2.7.1/Modules/md5.c\r
+ Python-2.7.1/Modules/md5module.c\r
+# Python-2.7.1/Modules/mmapmodule.c\r
+ Python-2.7.1/Modules/operator.c\r
+ Python-2.7.1/Modules/parsermodule.c\r
+# Python-2.7.1/Modules/posixmodule.c\r
+ Python-2.7.1/Modules/signalmodule.c\r
+ Python-2.7.1/Modules/shamodule.c\r
+ Python-2.7.1/Modules/sha256module.c\r
+ Python-2.7.1/Modules/sha512module.c\r
+ Python-2.7.1/Modules/stropmodule.c\r
+ Python-2.7.1/Modules/symtablemodule.c\r
+# Python-2.7.1/Modules/threadmodule.c\r
+ Python-2.7.1/Modules/timemodule.c\r
+ Python-2.7.1/Modules/xxsubtype.c\r
+# Python-2.7.1/Modules/zipimport.c\r
+# Python-2.7.1/Modules/zlibmodule.c\r
+\r
+#Modules/cjkcodecs\r
+ Python-2.7.1/Modules/cjkcodecs/multibytecodec.c\r
+ Python-2.7.1/Modules/cjkcodecs/_codecs_cn.c\r
+ Python-2.7.1/Modules/cjkcodecs/_codecs_hk.c\r
+ Python-2.7.1/Modules/cjkcodecs/_codecs_iso2022.c\r
+ Python-2.7.1/Modules/cjkcodecs/_codecs_jp.c\r
+ Python-2.7.1/Modules/cjkcodecs/_codecs_kr.c\r
+ Python-2.7.1/Modules/cjkcodecs/_codecs_tw.c\r
+\r
+ Python-2.7.1/Modules/main.c\r
+# Python-2.7.1/Modules/rotatingtree.c\r
+\r
+#Modules/_io\r
+ Python-2.7.1/Modules/_io/_iomodule.c\r
+ Python-2.7.1/Modules/_io/bufferedio.c\r
+ Python-2.7.1/Modules/_io/bytesio.c\r
+ Python-2.7.1/Modules/_io/fileio.c\r
+ Python-2.7.1/Modules/_io/iobase.c\r
+ Python-2.7.1/Modules/_io/stringio.c\r
+ Python-2.7.1/Modules/_io/textio.c\r
+\r
+#Modules/zlib\r
+# Python-2.7.1/Modules/zlib/adler32.c\r
+# Python-2.7.1/Modules/zlib/compress.c\r
+# Python-2.7.1/Modules/zlib/crc32.c\r
+# Python-2.7.1/Modules/zlib/deflate.c\r
+# Python-2.7.1/Modules/zlib/gzio.c\r
+# Python-2.7.1/Modules/zlib/infback.c\r
+# Python-2.7.1/Modules/zlib/inffast.c\r
+# Python-2.7.1/Modules/zlib/inflate.c\r
+# Python-2.7.1/Modules/zlib/inftrees.c\r
+# Python-2.7.1/Modules/zlib/trees.c\r
+# Python-2.7.1/Modules/zlib/uncompr.c\r
+# Python-2.7.1/Modules/zlib/zutil.c\r
+\r
+#Objects\r
+ Python-2.7.1/Objects/abstract.c\r
+ Python-2.7.1/Objects/boolobject.c\r
+ Python-2.7.1/Objects/bufferobject.c\r
+ Python-2.7.1/Objects/bytearrayobject.c\r
+ Python-2.7.1/Objects/bytes_methods.c\r
+ Python-2.7.1/Objects/capsule.c\r
+ Python-2.7.1/Objects/cellobject.c\r
+ Python-2.7.1/Objects/classobject.c\r
+ Python-2.7.1/Objects/cobject.c\r
+ Python-2.7.1/Objects/codeobject.c\r
+ Python-2.7.1/Objects/complexobject.c\r
+ Python-2.7.1/Objects/descrobject.c\r
+ Python-2.7.1/Objects/dictobject.c\r
+ Python-2.7.1/Objects/enumobject.c\r
+ Python-2.7.1/Objects/exceptions.c\r
+ Python-2.7.1/Objects/fileobject.c\r
+ Python-2.7.1/Objects/floatobject.c\r
+ Python-2.7.1/Objects/frameobject.c\r
+ Python-2.7.1/Objects/funcobject.c\r
+ Python-2.7.1/Objects/genobject.c\r
+ Python-2.7.1/Objects/intobject.c\r
+ Python-2.7.1/Objects/iterobject.c\r
+ Python-2.7.1/Objects/listobject.c\r
+ Python-2.7.1/Objects/longobject.c\r
+ Python-2.7.1/Objects/memoryobject.c\r
+ Python-2.7.1/Objects/methodobject.c\r
+ Python-2.7.1/Objects/moduleobject.c\r
+ Python-2.7.1/Objects/object.c\r
+ Python-2.7.1/Objects/obmalloc.c\r
+ Python-2.7.1/Objects/rangeobject.c\r
+ Python-2.7.1/Objects/setobject.c\r
+ Python-2.7.1/Objects/sliceobject.c\r
+ Python-2.7.1/Objects/stringobject.c\r
+ Python-2.7.1/Objects/structseq.c\r
+ Python-2.7.1/Objects/tupleobject.c\r
+ Python-2.7.1/Objects/typeobject.c\r
+ Python-2.7.1/Objects/unicodectype.c\r
+ Python-2.7.1/Objects/unicodeobject.c\r
+ Python-2.7.1/Objects/weakrefobject.c\r
+\r
+#EFI -- EFI specific code\r
+ Efi/config.c\r
+ Efi/getpathp.c\r
+# Efi/_subprocess.c\r
+# Efi/_winreg.c\r
+# Efi/dl_nt.c\r
+# Efi/import_nt.c\r
+# Efi/msvcrtmodule.c\r
+\r
+[BuildOptions]\r
+ MSFT:*_*_*_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I%WORKSPACE%\AppPkg\Applications\Python\Ia32 /I%WORKSPACE%\AppPkg\Applications\Python\Python-2.7.1\Include\r
+ GCC:*_*_IPF_SYMRENAME_FLAGS = --redefine-syms=$WORKSPACE/StdLib/GccSymRename.txt\r
--- /dev/null
+/* pyconfig.h.in. Generated from configure.in by autoheader. */\r
+\r
+\r
+#ifndef Py_PYCONFIG_H\r
+#define Py_PYCONFIG_H\r
+\r
+\r
+/* Define if building universal (internal helper macro) */\r
+#undef AC_APPLE_UNIVERSAL_BUILD\r
+\r
+/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want\r
+ support for AIX C++ shared extension modules. */\r
+#undef AIX_GENUINE_CPLUSPLUS\r
+\r
+/* Define this if you have AtheOS threads. */\r
+#undef ATHEOS_THREADS\r
+\r
+/* Define this if you have BeOS threads. */\r
+#undef BEOS_THREADS\r
+\r
+/* Define if you have the Mach cthreads package */\r
+#undef C_THREADS\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM\r
+ mixed-endian order (byte order 45670123) */\r
+#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most\r
+ significant byte first */\r
+#undef DOUBLE_IS_BIG_ENDIAN_IEEE754\r
+\r
+/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the\r
+ least significant byte first */\r
+#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754\r
+\r
+/* Define if --enable-ipv6 is specified */\r
+#undef ENABLE_IPV6\r
+\r
+/* Define if flock needs to be linked with bsd library. */\r
+#undef FLOCK_NEEDS_LIBBSD\r
+\r
+/* Define if getpgrp() must be called as getpgrp(0). */\r
+#undef GETPGRP_HAVE_ARG\r
+\r
+/* Define if gettimeofday() does not have second (timezone) argument This is\r
+ the case on Motorola V4 (R40V4.2) */\r
+#undef GETTIMEOFDAY_NO_TZ\r
+\r
+/* Define to 1 if you have the `acosh' function. */\r
+#undef HAVE_ACOSH\r
+\r
+/* struct addrinfo (netdb.h) */\r
+#undef HAVE_ADDRINFO\r
+\r
+/* Define to 1 if you have the `alarm' function. */\r
+#undef HAVE_ALARM\r
+\r
+/* Define this if your time.h defines altzone. */\r
+#undef HAVE_ALTZONE\r
+\r
+/* Define to 1 if you have the `asinh' function. */\r
+#undef HAVE_ASINH\r
+\r
+/* Define to 1 if you have the <asm/types.h> header file. */\r
+#undef HAVE_ASM_TYPES_H\r
+\r
+/* Define to 1 if you have the `atanh' function. */\r
+#undef HAVE_ATANH\r
+\r
+/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */\r
+#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE\r
+\r
+/* Define to 1 if you have the `bind_textdomain_codeset' function. */\r
+#undef HAVE_BIND_TEXTDOMAIN_CODESET\r
+\r
+/* Define to 1 if you have the <bluetooth/bluetooth.h> header file. */\r
+#undef HAVE_BLUETOOTH_BLUETOOTH_H\r
+\r
+/* Define to 1 if you have the <bluetooth.h> header file. */\r
+#undef HAVE_BLUETOOTH_H\r
+\r
+/* Define if nice() returns success/failure instead of the new priority. */\r
+#undef HAVE_BROKEN_NICE\r
+\r
+/* Define if the system reports an invalid PIPE_BUF value. */\r
+#undef HAVE_BROKEN_PIPE_BUF\r
+\r
+/* Define if poll() sets errno on invalid file descriptors. */\r
+#undef HAVE_BROKEN_POLL\r
+\r
+/* Define if the Posix semaphores do not work on your system */\r
+#define HAVE_BROKEN_POSIX_SEMAPHORES\r
+\r
+/* Define if pthread_sigmask() does not work on your system. */\r
+#define HAVE_BROKEN_PTHREAD_SIGMASK\r
+\r
+/* define to 1 if your sem_getvalue is broken. */\r
+#undef HAVE_BROKEN_SEM_GETVALUE\r
+\r
+/* Define this if you have the type _Bool. */\r
+#define HAVE_C99_BOOL\r
+\r
+/* Define to 1 if you have the `chflags' function. */\r
+#undef HAVE_CHFLAGS\r
+\r
+/* Define to 1 if you have the `chown' function. */\r
+#undef HAVE_CHOWN\r
+\r
+/* Define if you have the 'chroot' function. */\r
+#undef HAVE_CHROOT\r
+\r
+/* Define to 1 if you have the `clock' function. */\r
+#define HAVE_CLOCK\r
+\r
+/* Define to 1 if you have the `confstr' function. */\r
+#undef HAVE_CONFSTR\r
+\r
+/* Define to 1 if you have the <conio.h> header file. */\r
+#undef HAVE_CONIO_H\r
+\r
+/* Define to 1 if you have the `copysign' function. */\r
+#define HAVE_COPYSIGN 1\r
+\r
+/* Define to 1 if you have the `ctermid' function. */\r
+#undef HAVE_CTERMID\r
+\r
+/* Define if you have the 'ctermid_r' function. */\r
+#undef HAVE_CTERMID_R\r
+\r
+/* Define to 1 if you have the <curses.h> header file. */\r
+#undef HAVE_CURSES_H\r
+\r
+/* Define if you have the 'is_term_resized' function. */\r
+#undef HAVE_CURSES_IS_TERM_RESIZED\r
+\r
+/* Define if you have the 'resizeterm' function. */\r
+#undef HAVE_CURSES_RESIZETERM\r
+\r
+/* Define if you have the 'resize_term' function. */\r
+#undef HAVE_CURSES_RESIZE_TERM\r
+\r
+/* Define to 1 if you have the declaration of `isfinite', and to 0 if you\r
+ don't. */\r
+#define HAVE_DECL_ISFINITE 0\r
+\r
+/* Define to 1 if you have the declaration of `isinf', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_ISINF 1\r
+\r
+/* Define to 1 if you have the declaration of `isnan', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_ISNAN 1\r
+\r
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.\r
+ */\r
+#define HAVE_DECL_TZNAME 0\r
+\r
+/* Define to 1 if you have the device macros. */\r
+#undef HAVE_DEVICE_MACROS\r
+\r
+/* Define if we have /dev/ptc. */\r
+#undef HAVE_DEV_PTC\r
+\r
+/* Define if we have /dev/ptmx. */\r
+#undef HAVE_DEV_PTMX\r
+\r
+/* Define to 1 if you have the <direct.h> header file. */\r
+#undef HAVE_DIRECT_H\r
+\r
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_DIRENT_H\r
+\r
+/* Define to 1 if you have the <dlfcn.h> header file. */\r
+#undef HAVE_DLFCN_H\r
+\r
+/* Define to 1 if you have the `dlopen' function. */\r
+#undef HAVE_DLOPEN\r
+\r
+/* Define to 1 if you have the `dup2' function. */\r
+#define HAVE_DUP2 1\r
+\r
+/* Defined when any dynamic module loading is enabled. */\r
+#undef HAVE_DYNAMIC_LOADING\r
+\r
+/* Define if you have the 'epoll' functions. */\r
+#undef HAVE_EPOLL\r
+\r
+/* Define to 1 if you have the `erf' function. */\r
+#undef HAVE_ERF\r
+\r
+/* Define to 1 if you have the `erfc' function. */\r
+#undef HAVE_ERFC\r
+\r
+/* Define to 1 if you have the <errno.h> header file. */\r
+#define HAVE_ERRNO_H 1\r
+\r
+/* Define to 1 if you have the `execv' function. */\r
+#undef HAVE_EXECV\r
+\r
+/* Define to 1 if you have the `expm1' function. */\r
+#undef HAVE_EXPM1\r
+\r
+/* Define if you have the 'fchdir' function. */\r
+#undef HAVE_FCHDIR\r
+\r
+/* Define to 1 if you have the `fchmod' function. */\r
+#undef HAVE_FCHMOD\r
+\r
+/* Define to 1 if you have the `fchown' function. */\r
+#undef HAVE_FCHOWN\r
+\r
+/* Define to 1 if you have the <fcntl.h> header file. */\r
+#define HAVE_FCNTL_H 1\r
+\r
+/* Define if you have the 'fdatasync' function. */\r
+#undef HAVE_FDATASYNC\r
+\r
+/* Define to 1 if you have the `finite' function. */\r
+#define HAVE_FINITE 1\r
+\r
+/* Define to 1 if you have the `flock' function. */\r
+#undef HAVE_FLOCK\r
+\r
+/* Define to 1 if you have the `fork' function. */\r
+#undef HAVE_FORK\r
+\r
+/* Define to 1 if you have the `forkpty' function. */\r
+#undef HAVE_FORKPTY\r
+\r
+/* Define to 1 if you have the `fpathconf' function. */\r
+#undef HAVE_FPATHCONF\r
+\r
+/* Define to 1 if you have the `fseek64' function. */\r
+#undef HAVE_FSEEK64\r
+\r
+/* Define to 1 if you have the `fseeko' function. */\r
+#define HAVE_FSEEKO 1\r
+\r
+/* Define to 1 if you have the `fstatvfs' function. */\r
+#undef HAVE_FSTATVFS\r
+\r
+/* Define if you have the 'fsync' function. */\r
+#undef HAVE_FSYNC\r
+\r
+/* Define to 1 if you have the `ftell64' function. */\r
+#undef HAVE_FTELL64\r
+\r
+/* Define to 1 if you have the `ftello' function. */\r
+#define HAVE_FTELLO 1\r
+\r
+/* Define to 1 if you have the `ftime' function. */\r
+#undef HAVE_FTIME\r
+\r
+/* Define to 1 if you have the `ftruncate' function. */\r
+#undef HAVE_FTRUNCATE\r
+\r
+/* Define to 1 if you have the `gai_strerror' function. */\r
+#undef HAVE_GAI_STRERROR\r
+\r
+/* Define to 1 if you have the `gamma' function. */\r
+#undef HAVE_GAMMA\r
+\r
+/* Define if we can use gcc inline assembler to get and set x87 control word\r
+ */\r
+#undef HAVE_GCC_ASM_FOR_X87\r
+\r
+/* Define if you have the getaddrinfo function. */\r
+#undef HAVE_GETADDRINFO\r
+\r
+/* Define to 1 if you have the `getcwd' function. */\r
+#undef HAVE_GETCWD\r
+\r
+/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */\r
+#define HAVE_GETC_UNLOCKED\r
+\r
+/* Define to 1 if you have the `getgroups' function. */\r
+#undef HAVE_GETGROUPS\r
+\r
+/* Define to 1 if you have the `gethostbyname' function. */\r
+#undef HAVE_GETHOSTBYNAME\r
+\r
+/* Define this if you have some version of gethostbyname_r() */\r
+#undef HAVE_GETHOSTBYNAME_R\r
+\r
+/* Define this if you have the 3-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_3_ARG\r
+\r
+/* Define this if you have the 5-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_5_ARG\r
+\r
+/* Define this if you have the 6-arg version of gethostbyname_r(). */\r
+#undef HAVE_GETHOSTBYNAME_R_6_ARG\r
+\r
+/* Define to 1 if you have the `getitimer' function. */\r
+#undef HAVE_GETITIMER\r
+\r
+/* Define to 1 if you have the `getloadavg' function. */\r
+#undef HAVE_GETLOADAVG\r
+\r
+/* Define to 1 if you have the `getlogin' function. */\r
+#undef HAVE_GETLOGIN\r
+\r
+/* Define to 1 if you have the `getnameinfo' function. */\r
+#undef HAVE_GETNAMEINFO\r
+\r
+/* Define if you have the 'getpagesize' function. */\r
+#undef HAVE_GETPAGESIZE\r
+\r
+/* Define to 1 if you have the `getpeername' function. */\r
+#undef HAVE_GETPEERNAME\r
+\r
+/* Define to 1 if you have the `getpgid' function. */\r
+#undef HAVE_GETPGID\r
+\r
+/* Define to 1 if you have the `getpgrp' function. */\r
+#undef HAVE_GETPGRP\r
+\r
+/* Define to 1 if you have the `getpid' function. */\r
+#undef HAVE_GETPID\r
+\r
+/* Define to 1 if you have the `getpriority' function. */\r
+#undef HAVE_GETPRIORITY\r
+\r
+/* Define to 1 if you have the `getpwent' function. */\r
+#undef HAVE_GETPWENT\r
+\r
+/* Define to 1 if you have the `getresgid' function. */\r
+#undef HAVE_GETRESGID\r
+\r
+/* Define to 1 if you have the `getresuid' function. */\r
+#undef HAVE_GETRESUID\r
+\r
+/* Define to 1 if you have the `getsid' function. */\r
+#undef HAVE_GETSID\r
+\r
+/* Define to 1 if you have the `getspent' function. */\r
+#undef HAVE_GETSPENT\r
+\r
+/* Define to 1 if you have the `getspnam' function. */\r
+#undef HAVE_GETSPNAM\r
+\r
+/* Define to 1 if you have the `gettimeofday' function. */\r
+#undef HAVE_GETTIMEOFDAY\r
+\r
+/* Define to 1 if you have the `getwd' function. */\r
+#undef HAVE_GETWD\r
+\r
+/* Define to 1 if you have the <grp.h> header file. */\r
+#undef HAVE_GRP_H\r
+\r
+/* Define if you have the 'hstrerror' function. */\r
+#undef HAVE_HSTRERROR\r
+\r
+/* Define to 1 if you have the `hypot' function. */\r
+#undef HAVE_HYPOT\r
+\r
+/* Define to 1 if you have the <ieeefp.h> header file. */\r
+#undef HAVE_IEEEFP_H\r
+\r
+/* Define if you have the 'inet_aton' function. */\r
+#undef HAVE_INET_ATON\r
+\r
+/* Define if you have the 'inet_pton' function. */\r
+#undef HAVE_INET_PTON\r
+\r
+/* Define to 1 if you have the `initgroups' function. */\r
+#undef HAVE_INITGROUPS\r
+\r
+/* Define to 1 if you have the <inttypes.h> header file. */\r
+#define HAVE_INTTYPES_H 1\r
+\r
+/* Define to 1 if you have the <io.h> header file. */\r
+#undef HAVE_IO_H\r
+\r
+/* Define to 1 if you have the `kill' function. */\r
+#undef HAVE_KILL\r
+\r
+/* Define to 1 if you have the `killpg' function. */\r
+#undef HAVE_KILLPG\r
+\r
+/* Define if you have the 'kqueue' functions. */\r
+#undef HAVE_KQUEUE\r
+\r
+/* Define to 1 if you have the <langinfo.h> header file. */\r
+#define HAVE_LANGINFO_H 1\r
+\r
+/* Defined to enable large file support when an off_t is bigger than a long\r
+ and long long is available and at least as big as an off_t. You may need to\r
+ add some flags for configuration and compilation to enable this mode. (For\r
+ Solaris and Linux, the necessary defines are already defined.) */\r
+#undef HAVE_LARGEFILE_SUPPORT\r
+\r
+/* Define to 1 if you have the `lchflags' function. */\r
+#undef HAVE_LCHFLAGS\r
+\r
+/* Define to 1 if you have the `lchmod' function. */\r
+#undef HAVE_LCHMOD\r
+\r
+/* Define to 1 if you have the `lchown' function. */\r
+#undef HAVE_LCHOWN\r
+\r
+/* Define to 1 if you have the `lgamma' function. */\r
+#undef HAVE_LGAMMA\r
+\r
+/* Define to 1 if you have the `dl' library (-ldl). */\r
+#undef HAVE_LIBDL\r
+\r
+/* Define to 1 if you have the `dld' library (-ldld). */\r
+#undef HAVE_LIBDLD\r
+\r
+/* Define to 1 if you have the `ieee' library (-lieee). */\r
+#undef HAVE_LIBIEEE\r
+\r
+/* Define to 1 if you have the <libintl.h> header file. */\r
+#undef HAVE_LIBINTL_H\r
+\r
+/* Define if you have the readline library (-lreadline). */\r
+#undef HAVE_LIBREADLINE\r
+\r
+/* Define to 1 if you have the `resolv' library (-lresolv). */\r
+#undef HAVE_LIBRESOLV\r
+\r
+/* Define to 1 if you have the <libutil.h> header file. */\r
+#undef HAVE_LIBUTIL_H\r
+\r
+/* Define if you have the 'link' function. */\r
+#undef HAVE_LINK\r
+\r
+/* Define to 1 if you have the <linux/netlink.h> header file. */\r
+#undef HAVE_LINUX_NETLINK_H\r
+\r
+/* Define to 1 if you have the <linux/tipc.h> header file. */\r
+#undef HAVE_LINUX_TIPC_H\r
+\r
+/* Define to 1 if you have the `log1p' function. */\r
+#undef HAVE_LOG1P\r
+\r
+/* Define this if you have the type long double. */\r
+#define HAVE_LONG_DOUBLE\r
+\r
+/* Define this if you have the type long long. */\r
+#define HAVE_LONG_LONG\r
+\r
+/* Define to 1 if you have the `lstat' function. */\r
+#define HAVE_LSTAT 1\r
+\r
+/* Define this if you have the makedev macro. */\r
+#undef HAVE_MAKEDEV\r
+\r
+/* Define to 1 if you have the `memmove' function. */\r
+#define HAVE_MEMMOVE 1\r
+\r
+/* Define to 1 if you have the <memory.h> header file. */\r
+#undef HAVE_MEMORY_H\r
+\r
+/* Define to 1 if you have the `mkfifo' function. */\r
+#undef HAVE_MKFIFO\r
+\r
+/* Define to 1 if you have the `mknod' function. */\r
+#undef HAVE_MKNOD\r
+\r
+/* Define to 1 if you have the `mktime' function. */\r
+#define HAVE_MKTIME 1\r
+\r
+/* Define to 1 if you have the `mremap' function. */\r
+#undef HAVE_MREMAP\r
+\r
+/* Define to 1 if you have the <ncurses.h> header file. */\r
+#undef HAVE_NCURSES_H\r
+\r
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */\r
+#undef HAVE_NDIR_H\r
+\r
+/* Define to 1 if you have the <netpacket/packet.h> header file. */\r
+#undef HAVE_NETPACKET_PACKET_H\r
+\r
+/* Define to 1 if you have the `nice' function. */\r
+#undef HAVE_NICE\r
+\r
+/* Define to 1 if you have the `openpty' function. */\r
+#undef HAVE_OPENPTY\r
+\r
+/* Define if compiling using MacOS X 10.5 SDK or later. */\r
+#undef HAVE_OSX105_SDK\r
+\r
+/* Define to 1 if you have the `pathconf' function. */\r
+#undef HAVE_PATHCONF\r
+\r
+/* Define to 1 if you have the `pause' function. */\r
+#undef HAVE_PAUSE\r
+\r
+/* Define to 1 if you have the `plock' function. */\r
+#undef HAVE_PLOCK\r
+\r
+/* Define to 1 if you have the `poll' function. */\r
+#undef HAVE_POLL\r
+\r
+/* Define to 1 if you have the <poll.h> header file. */\r
+#undef HAVE_POLL_H\r
+\r
+/* Define to 1 if you have the <process.h> header file. */\r
+#undef HAVE_PROCESS_H\r
+\r
+/* Define if your compiler supports function prototype */\r
+#define HAVE_PROTOTYPES\r
+\r
+/* Define if you have GNU PTH threads. */\r
+#undef HAVE_PTH\r
+\r
+/* Defined for Solaris 2.6 bug in pthread header. */\r
+#undef HAVE_PTHREAD_DESTRUCTOR\r
+\r
+/* Define to 1 if you have the <pthread.h> header file. */\r
+#undef HAVE_PTHREAD_H\r
+\r
+/* Define to 1 if you have the `pthread_init' function. */\r
+#undef HAVE_PTHREAD_INIT\r
+\r
+/* Define to 1 if you have the `pthread_sigmask' function. */\r
+#undef HAVE_PTHREAD_SIGMASK\r
+\r
+/* Define to 1 if you have the <pty.h> header file. */\r
+#undef HAVE_PTY_H\r
+\r
+/* Define to 1 if you have the `putenv' function. */\r
+#undef HAVE_PUTENV\r
+\r
+/* Define to 1 if you have the `readlink' function. */\r
+#undef HAVE_READLINK\r
+\r
+/* Define to 1 if you have the `realpath' function. */\r
+#undef HAVE_REALPATH\r
+\r
+/* Define if you have readline 2.1 */\r
+#undef HAVE_RL_CALLBACK\r
+\r
+/* Define if you can turn off readline's signal handling. */\r
+#undef HAVE_RL_CATCH_SIGNAL\r
+\r
+/* Define if you have readline 2.2 */\r
+#undef HAVE_RL_COMPLETION_APPEND_CHARACTER\r
+\r
+/* Define if you have readline 4.0 */\r
+#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK\r
+\r
+/* Define if you have readline 4.2 */\r
+#undef HAVE_RL_COMPLETION_MATCHES\r
+\r
+/* Define if you have rl_completion_suppress_append */\r
+#undef HAVE_RL_COMPLETION_SUPPRESS_APPEND\r
+\r
+/* Define if you have readline 4.0 */\r
+#undef HAVE_RL_PRE_INPUT_HOOK\r
+\r
+/* Define to 1 if you have the `round' function. */\r
+#undef HAVE_ROUND\r
+\r
+/* Define to 1 if you have the `select' function. */\r
+#undef HAVE_SELECT\r
+\r
+/* Define to 1 if you have the `sem_getvalue' function. */\r
+#undef HAVE_SEM_GETVALUE\r
+\r
+/* Define to 1 if you have the `sem_open' function. */\r
+#undef HAVE_SEM_OPEN\r
+\r
+/* Define to 1 if you have the `sem_timedwait' function. */\r
+#undef HAVE_SEM_TIMEDWAIT\r
+\r
+/* Define to 1 if you have the `sem_unlink' function. */\r
+#undef HAVE_SEM_UNLINK\r
+\r
+/* Define to 1 if you have the `setegid' function. */\r
+#undef HAVE_SETEGID\r
+\r
+/* Define to 1 if you have the `seteuid' function. */\r
+#undef HAVE_SETEUID\r
+\r
+/* Define to 1 if you have the `setgid' function. */\r
+#undef HAVE_SETGID\r
+\r
+/* Define if you have the 'setgroups' function. */\r
+#undef HAVE_SETGROUPS\r
+\r
+/* Define to 1 if you have the `setitimer' function. */\r
+#undef HAVE_SETITIMER\r
+\r
+/* Define to 1 if you have the `setlocale' function. */\r
+#define HAVE_SETLOCALE 1\r
+\r
+/* Define to 1 if you have the `setpgid' function. */\r
+#undef HAVE_SETPGID\r
+\r
+/* Define to 1 if you have the `setpgrp' function. */\r
+#undef HAVE_SETPGRP\r
+\r
+/* Define to 1 if you have the `setregid' function. */\r
+#undef HAVE_SETREGID\r
+\r
+/* Define to 1 if you have the `setresgid' function. */\r
+#undef HAVE_SETRESGID\r
+\r
+/* Define to 1 if you have the `setresuid' function. */\r
+#undef HAVE_SETRESUID\r
+\r
+/* Define to 1 if you have the `setreuid' function. */\r
+#undef HAVE_SETREUID\r
+\r
+/* Define to 1 if you have the `setsid' function. */\r
+#undef HAVE_SETSID\r
+\r
+/* Define to 1 if you have the `setuid' function. */\r
+#undef HAVE_SETUID\r
+\r
+/* Define to 1 if you have the `setvbuf' function. */\r
+#undef HAVE_SETVBUF\r
+\r
+/* Define to 1 if you have the <shadow.h> header file. */\r
+#undef HAVE_SHADOW_H\r
+\r
+/* Define to 1 if you have the `sigaction' function. */\r
+#undef HAVE_SIGACTION\r
+\r
+/* Define to 1 if you have the `siginterrupt' function. */\r
+#undef HAVE_SIGINTERRUPT\r
+\r
+/* Define to 1 if you have the <signal.h> header file. */\r
+#define HAVE_SIGNAL_H 1\r
+\r
+/* Define to 1 if you have the `sigrelse' function. */\r
+#undef HAVE_SIGRELSE\r
+\r
+/* Define to 1 if you have the `snprintf' function. */\r
+#define HAVE_SNPRINTF 1\r
+\r
+/* Define if sockaddr has sa_len member */\r
+#undef HAVE_SOCKADDR_SA_LEN\r
+\r
+/* struct sockaddr_storage (sys/socket.h) */\r
+#undef HAVE_SOCKADDR_STORAGE\r
+\r
+/* Define if you have the 'socketpair' function. */\r
+#undef HAVE_SOCKETPAIR\r
+\r
+/* Define to 1 if you have the <spawn.h> header file. */\r
+#undef HAVE_SPAWN_H\r
+\r
+/* Define if your compiler provides ssize_t */\r
+#undef HAVE_SSIZE_T\r
+\r
+/* Define to 1 if you have the `statvfs' function. */\r
+#undef HAVE_STATVFS\r
+\r
+/* Define if you have struct stat.st_mtim.tv_nsec */\r
+#undef HAVE_STAT_TV_NSEC\r
+\r
+/* Define if you have struct stat.st_mtimensec */\r
+#undef HAVE_STAT_TV_NSEC2\r
+\r
+/* Define if your compiler supports variable length function prototypes (e.g.\r
+ void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */\r
+#define HAVE_STDARG_PROTOTYPES\r
+\r
+/* Define to 1 if you have the <stdint.h> header file. */\r
+#define HAVE_STDINT_H 1\r
+\r
+/* Define to 1 if you have the <stdlib.h> header file. */\r
+#define HAVE_STDLIB_H 1\r
+\r
+/* Define to 1 if you have the `strdup' function. */\r
+#define HAVE_STRDUP 1\r
+\r
+/* Define to 1 if you have the `strftime' function. */\r
+#define HAVE_STRFTIME 1\r
+\r
+/* Define to 1 if you have the <strings.h> header file. */\r
+#undef HAVE_STRINGS_H\r
+\r
+/* Define to 1 if you have the <string.h> header file. */\r
+#define HAVE_STRING_H 1\r
+\r
+/* Define to 1 if you have the <stropts.h> header file. */\r
+#undef HAVE_STROPTS_H\r
+\r
+/* Define to 1 if `st_birthtime' is a member of `struct stat'. */\r
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1\r
+\r
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */\r
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1\r
+\r
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_BLOCKS\r
+\r
+/* Define to 1 if `st_flags' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_FLAGS\r
+\r
+/* Define to 1 if `st_gen' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_GEN\r
+\r
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */\r
+#undef HAVE_STRUCT_STAT_ST_RDEV\r
+\r
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */\r
+#undef HAVE_STRUCT_TM_TM_ZONE\r
+\r
+/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use\r
+ `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */\r
+#undef HAVE_ST_BLOCKS\r
+\r
+/* Define if you have the 'symlink' function. */\r
+#undef HAVE_SYMLINK\r
+\r
+/* Define to 1 if you have the `sysconf' function. */\r
+#undef HAVE_SYSCONF\r
+\r
+/* Define to 1 if you have the <sysexits.h> header file. */\r
+#undef HAVE_SYSEXITS_H\r
+\r
+/* Define to 1 if you have the <sys/audioio.h> header file. */\r
+#undef HAVE_SYS_AUDIOIO_H\r
+\r
+/* Define to 1 if you have the <sys/bsdtty.h> header file. */\r
+#undef HAVE_SYS_BSDTTY_H\r
+\r
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_SYS_DIR_H\r
+\r
+/* Define to 1 if you have the <sys/epoll.h> header file. */\r
+#undef HAVE_SYS_EPOLL_H\r
+\r
+/* Define to 1 if you have the <sys/event.h> header file. */\r
+#undef HAVE_SYS_EVENT_H\r
+\r
+/* Define to 1 if you have the <sys/file.h> header file. */\r
+#undef HAVE_SYS_FILE_H\r
+\r
+/* Define to 1 if you have the <sys/loadavg.h> header file. */\r
+#undef HAVE_SYS_LOADAVG_H\r
+\r
+/* Define to 1 if you have the <sys/lock.h> header file. */\r
+#undef HAVE_SYS_LOCK_H\r
+\r
+/* Define to 1 if you have the <sys/mkdev.h> header file. */\r
+#undef HAVE_SYS_MKDEV_H\r
+\r
+/* Define to 1 if you have the <sys/modem.h> header file. */\r
+#undef HAVE_SYS_MODEM_H\r
+\r
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.\r
+ */\r
+#undef HAVE_SYS_NDIR_H\r
+\r
+/* Define to 1 if you have the <sys/param.h> header file. */\r
+#define HAVE_SYS_PARAM_H 1\r
+\r
+/* Define to 1 if you have the <sys/poll.h> header file. */\r
+#undef HAVE_SYS_POLL_H\r
+\r
+/* Define to 1 if you have the <sys/resource.h> header file. */\r
+#define HAVE_SYS_RESOURCE_H 1\r
+\r
+/* Define to 1 if you have the <sys/select.h> header file. */\r
+#undef HAVE_SYS_SELECT_H\r
+\r
+/* Define to 1 if you have the <sys/socket.h> header file. */\r
+#undef HAVE_SYS_SOCKET_H\r
+\r
+/* Define to 1 if you have the <sys/statvfs.h> header file. */\r
+#undef HAVE_SYS_STATVFS_H\r
+\r
+/* Define to 1 if you have the <sys/stat.h> header file. */\r
+#define HAVE_SYS_STAT_H 1\r
+\r
+/* Define to 1 if you have the <sys/termio.h> header file. */\r
+#undef HAVE_SYS_TERMIO_H\r
+\r
+/* Define to 1 if you have the <sys/times.h> header file. */\r
+#undef HAVE_SYS_TIMES_H\r
+\r
+/* Define to 1 if you have the <sys/time.h> header file. */\r
+#define HAVE_SYS_TIME_H 1\r
+\r
+/* Define to 1 if you have the <sys/types.h> header file. */\r
+#define HAVE_SYS_TYPES_H 1\r
+\r
+/* Define to 1 if you have the <sys/un.h> header file. */\r
+#undef HAVE_SYS_UN_H\r
+\r
+/* Define to 1 if you have the <sys/utsname.h> header file. */\r
+#undef HAVE_SYS_UTSNAME_H\r
+\r
+/* Define to 1 if you have the <sys/wait.h> header file. */\r
+#undef HAVE_SYS_WAIT_H\r
+\r
+/* Define to 1 if you have the `tcgetpgrp' function. */\r
+#undef HAVE_TCGETPGRP\r
+\r
+/* Define to 1 if you have the `tcsetpgrp' function. */\r
+#undef HAVE_TCSETPGRP\r
+\r
+/* Define to 1 if you have the `tempnam' function. */\r
+#define HAVE_TEMPNAM 1\r
+\r
+/* Define to 1 if you have the <termios.h> header file. */\r
+#define HAVE_TERMIOS_H 1\r
+\r
+/* Define to 1 if you have the <term.h> header file. */\r
+#undef HAVE_TERM_H\r
+\r
+/* Define to 1 if you have the `tgamma' function. */\r
+#undef HAVE_TGAMMA\r
+\r
+/* Define to 1 if you have the <thread.h> header file. */\r
+#undef HAVE_THREAD_H\r
+\r
+/* Define to 1 if you have the `timegm' function. */\r
+#undef HAVE_TIMEGM\r
+\r
+/* Define to 1 if you have the `times' function. */\r
+#undef HAVE_TIMES\r
+\r
+/* Define to 1 if you have the `tmpfile' function. */\r
+#define HAVE_TMPFILE 1\r
+\r
+/* Define to 1 if you have the `tmpnam' function. */\r
+#define HAVE_TMPNAM 1\r
+\r
+/* Define to 1 if you have the `tmpnam_r' function. */\r
+#undef HAVE_TMPNAM_R\r
+\r
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use\r
+ `HAVE_STRUCT_TM_TM_ZONE' instead. */\r
+#undef HAVE_TM_ZONE\r
+\r
+/* Define to 1 if you have the `truncate' function. */\r
+#undef HAVE_TRUNCATE\r
+\r
+/* Define to 1 if you don't have `tm_zone' but do have the external array\r
+ `tzname'. */\r
+#undef HAVE_TZNAME\r
+\r
+/* Define this if you have tcl and TCL_UTF_MAX==6 */\r
+#undef HAVE_UCS4_TCL\r
+\r
+/* Define to 1 if the system has the type `uintptr_t'. */\r
+#define HAVE_UINTPTR_T 1\r
+\r
+/* Define to 1 if you have the `uname' function. */\r
+#undef HAVE_UNAME\r
+\r
+/* Define to 1 if you have the <unistd.h> header file. */\r
+#undef HAVE_UNISTD_H\r
+\r
+/* Define to 1 if you have the `unsetenv' function. */\r
+#undef HAVE_UNSETENV\r
+\r
+/* Define if you have a useable wchar_t type defined in wchar.h; useable means\r
+ wchar_t must be an unsigned type with at least 16 bits. (see\r
+ Include/unicodeobject.h). */\r
+#define HAVE_USABLE_WCHAR_T\r
+\r
+/* Define to 1 if you have the <util.h> header file. */\r
+#undef HAVE_UTIL_H\r
+\r
+/* Define to 1 if you have the `utimes' function. */\r
+#undef HAVE_UTIMES\r
+\r
+/* Define to 1 if you have the <utime.h> header file. */\r
+#undef HAVE_UTIME_H\r
+\r
+/* Define to 1 if you have the `wait3' function. */\r
+#undef HAVE_WAIT3\r
+\r
+/* Define to 1 if you have the `wait4' function. */\r
+#undef HAVE_WAIT4\r
+\r
+/* Define to 1 if you have the `waitpid' function. */\r
+#undef HAVE_WAITPID\r
+\r
+/* Define if the compiler provides a wchar.h header file. */\r
+#define HAVE_WCHAR_H\r
+\r
+/* Define to 1 if you have the `wcscoll' function. */\r
+#undef HAVE_WCSCOLL\r
+\r
+/* Define if tzset() actually switches the local timezone in a meaningful way.\r
+ */\r
+#define HAVE_WORKING_TZSET\r
+\r
+/* Define if the zlib library has inflateCopy */\r
+#undef HAVE_ZLIB_COPY\r
+\r
+/* Define to 1 if you have the `_getpty' function. */\r
+#undef HAVE__GETPTY\r
+\r
+/* Define if you are using Mach cthreads directly under /include */\r
+#undef HURD_C_THREADS\r
+\r
+/* Define if you are using Mach cthreads under mach / */\r
+#undef MACH_C_THREADS\r
+\r
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.\r
+ */\r
+#undef MAJOR_IN_MKDEV\r
+\r
+/* Define to 1 if `major', `minor', and `makedev' are declared in\r
+ <sysmacros.h>. */\r
+#undef MAJOR_IN_SYSMACROS\r
+\r
+/* Define if mvwdelch in curses.h is an expression. */\r
+#undef MVWDELCH_IS_EXPRESSION\r
+\r
+/* Define to the address where bug reports for this package should be sent. */\r
+#undef PACKAGE_BUGREPORT\r
+\r
+/* Define to the full name of this package. */\r
+#define PACKAGE_NAME EDK II Python Package\r
+\r
+/* Define to the full name and version of this package. */\r
+#define PACKAGE_STRING EDK II Python Package V0.1\r
+\r
+/* Define to the one symbol short name of this package. */\r
+#define PACKAGE_TARNAME UDK_Python\r
+\r
+/* Define to the home page for this package. */\r
+#define PACKAGE_URL http://edk2.tianocore.org/toolkit/python\r
+\r
+/* Define to the version of this package. */\r
+#undef PACKAGE_VERSION V0.1\r
+\r
+/* Define if POSIX semaphores aren't enabled on your system */\r
+#define POSIX_SEMAPHORES_NOT_ENABLED\r
+\r
+/* Defined if PTHREAD_SCOPE_SYSTEM supported. */\r
+#undef PTHREAD_SYSTEM_SCHED_SUPPORTED\r
+\r
+/* Define as the preferred size in bits of long digits */\r
+#undef PYLONG_BITS_IN_DIGIT\r
+\r
+/* Define to printf format modifier for long long type */\r
+#undef PY_FORMAT_LONG_LONG\r
+\r
+/* Define to printf format modifier for Py_ssize_t */\r
+#undef PY_FORMAT_SIZE_T\r
+\r
+/* Define as the integral type used for Unicode representation. */\r
+#undef PY_UNICODE_TYPE\r
+\r
+/* Define if you want to build an interpreter with many run-time checks. */\r
+#undef Py_DEBUG\r
+\r
+/* Defined if Python is built as a shared library. */\r
+#undef Py_ENABLE_SHARED\r
+\r
+/* Define as the size of the unicode type. */\r
+#define Py_UNICODE_SIZE 2\r
+\r
+/* Define if you want to have a Unicode type. */\r
+#define Py_USING_UNICODE\r
+\r
+/* assume C89 semantics that RETSIGTYPE is always void */\r
+#undef RETSIGTYPE\r
+\r
+/* Define if setpgrp() must be called as setpgrp(0, 0). */\r
+#undef SETPGRP_HAVE_ARG\r
+\r
+/* Define this to be extension of shared libraries (including the dot!). */\r
+#undef SHLIB_EXT\r
+\r
+/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */\r
+#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS\r
+\r
+/* The size of `double', as computed by sizeof. */\r
+#undef SIZEOF_DOUBLE\r
+\r
+/* The size of `float', as computed by sizeof. */\r
+#undef SIZEOF_FLOAT\r
+\r
+/* The size of `fpos_t', as computed by sizeof. */\r
+#undef SIZEOF_FPOS_T\r
+\r
+/* The size of `int', as computed by sizeof. */\r
+#undef SIZEOF_INT\r
+\r
+/* The size of `long', as computed by sizeof. */\r
+#undef SIZEOF_LONG\r
+\r
+/* The size of `long double', as computed by sizeof. */\r
+#undef SIZEOF_LONG_DOUBLE\r
+\r
+/* The size of `long long', as computed by sizeof. */\r
+#undef SIZEOF_LONG_LONG\r
+\r
+/* The size of `off_t', as computed by sizeof. */\r
+#undef SIZEOF_OFF_T\r
+\r
+/* The size of `pid_t', as computed by sizeof. */\r
+#undef SIZEOF_PID_T\r
+\r
+/* The size of `pthread_t', as computed by sizeof. */\r
+#undef SIZEOF_PTHREAD_T\r
+\r
+/* The size of `short', as computed by sizeof. */\r
+#undef SIZEOF_SHORT\r
+\r
+/* The size of `size_t', as computed by sizeof. */\r
+#undef SIZEOF_SIZE_T\r
+\r
+/* The size of `time_t', as computed by sizeof. */\r
+#undef SIZEOF_TIME_T\r
+\r
+/* The size of `uintptr_t', as computed by sizeof. */\r
+#undef SIZEOF_UINTPTR_T\r
+\r
+/* The size of `void *', as computed by sizeof. */\r
+#undef SIZEOF_VOID_P\r
+\r
+/* The size of `wchar_t', as computed by sizeof. */\r
+#undef SIZEOF_WCHAR_T\r
+\r
+/* The size of `_Bool', as computed by sizeof. */\r
+#undef SIZEOF__BOOL\r
+\r
+/* Define to 1 if you have the ANSI C header files. */\r
+#define STDC_HEADERS 1\r
+\r
+/* Define if you can safely include both <sys/select.h> and <sys/time.h>\r
+ (which you can't on SCO ODT 3.0). */\r
+#undef SYS_SELECT_WITH_SYS_TIME\r
+\r
+/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */\r
+#undef TANH_PRESERVES_ZERO_SIGN\r
+\r
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */\r
+#undef TIME_WITH_SYS_TIME\r
+\r
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */\r
+#undef TM_IN_SYS_TIME\r
+\r
+/* Enable extensions on AIX 3, Interix. */\r
+#ifndef _ALL_SOURCE\r
+# undef _ALL_SOURCE\r
+#endif\r
+/* Enable GNU extensions on systems that have them. */\r
+#ifndef _GNU_SOURCE\r
+# undef _GNU_SOURCE\r
+#endif\r
+/* Enable threading extensions on Solaris. */\r
+#ifndef _POSIX_PTHREAD_SEMANTICS\r
+# undef _POSIX_PTHREAD_SEMANTICS\r
+#endif\r
+/* Enable extensions on HP NonStop. */\r
+#ifndef _TANDEM_SOURCE\r
+# undef _TANDEM_SOURCE\r
+#endif\r
+/* Enable general extensions on Solaris. */\r
+#ifndef __EXTENSIONS__\r
+# undef __EXTENSIONS__\r
+#endif\r
+\r
+\r
+/* Define if you want to use MacPython modules on MacOSX in unix-Python. */\r
+#undef USE_TOOLBOX_OBJECT_GLUE\r
+\r
+/* Define if a va_list is an array of some kind */\r
+#undef VA_LIST_IS_ARRAY\r
+\r
+/* Define if you want SIGFPE handled (see Include/pyfpe.h). */\r
+#undef WANT_SIGFPE_HANDLER\r
+\r
+/* Define if you want wctype.h functions to be used instead of the one\r
+ supplied by Python itself. (see Include/unicodectype.h). */\r
+#undef WANT_WCTYPE_FUNCTIONS\r
+\r
+/* Define if WINDOW in curses.h offers a field _flags. */\r
+#undef WINDOW_HAS_FLAGS\r
+\r
+/* Define if you want documentation strings in extension modules */\r
+#undef WITH_DOC_STRINGS\r
+\r
+/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic\r
+ linker (dyld) instead of the old-style (NextStep) dynamic linker (rld).\r
+ Dyld is necessary to support frameworks. */\r
+#undef WITH_DYLD\r
+\r
+/* Define to 1 if libintl is needed for locale functions. */\r
+#undef WITH_LIBINTL\r
+\r
+/* Define if you want to produce an OpenStep/Rhapsody framework (shared\r
+ library plus accessory files). */\r
+#undef WITH_NEXT_FRAMEWORK\r
+\r
+/* Define if you want to compile in Python-specific mallocs */\r
+#undef WITH_PYMALLOC\r
+\r
+/* Define if you want to compile in rudimentary thread support */\r
+#undef WITH_THREAD\r
+\r
+/* Define to profile with the Pentium timestamp counter */\r
+#undef WITH_TSC\r
+\r
+/* Define if you want pymalloc to be disabled when running under valgrind */\r
+#undef WITH_VALGRIND\r
+\r
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most\r
+ significant byte first (like Motorola and SPARC, unlike Intel). */\r
+#if defined AC_APPLE_UNIVERSAL_BUILD\r
+# if defined __BIG_ENDIAN__\r
+# define WORDS_BIGENDIAN 1\r
+# endif\r
+#else\r
+# ifndef WORDS_BIGENDIAN\r
+# undef WORDS_BIGENDIAN\r
+# endif\r
+#endif\r
+\r
+/* Define if arithmetic is subject to x87-style double rounding issue */\r
+#undef X87_DOUBLE_ROUNDING\r
+\r
+/* Define on OpenBSD to activate all library features */\r
+#undef _BSD_SOURCE\r
+\r
+/* Define on Irix to enable u_int */\r
+#undef _BSD_TYPES\r
+\r
+/* Define on Darwin to activate all library features */\r
+#undef _DARWIN_C_SOURCE\r
+\r
+/* This must be set to 64 on some systems to enable large file support. */\r
+#undef _FILE_OFFSET_BITS\r
+\r
+/* Define on Linux to activate all library features */\r
+#undef _GNU_SOURCE\r
+\r
+/* This must be defined on some systems to enable large file support. */\r
+#undef _LARGEFILE_SOURCE\r
+\r
+/* Define to 1 if on MINIX. */\r
+#undef _MINIX\r
+\r
+/* Define on NetBSD to activate all library features */\r
+#define _NETBSD_SOURCE\r
+\r
+/* Define _OSF_SOURCE to get the makedev macro. */\r
+#undef _OSF_SOURCE\r
+\r
+/* Define to 2 if the system does not provide POSIX.1 features except with\r
+ this defined. */\r
+#undef _POSIX_1_SOURCE\r
+\r
+/* Define to activate features from IEEE Stds 1003.1-2001 */\r
+#undef _POSIX_C_SOURCE\r
+\r
+/* Define to 1 if you need to in order for `stat' and other things to work. */\r
+#undef _POSIX_SOURCE\r
+\r
+/* Define if you have POSIX threads, and your system does not define that. */\r
+#undef _POSIX_THREADS\r
+\r
+/* Define to force use of thread-safe errno, h_errno, and other functions */\r
+#undef _REENTRANT\r
+\r
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,\r
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the\r
+ #define below would cause a syntax error. */\r
+#undef _UINT32_T\r
+\r
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,\r
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the\r
+ #define below would cause a syntax error. */\r
+#undef _UINT64_T\r
+\r
+/* Define to the level of X/Open that your system supports */\r
+#undef _XOPEN_SOURCE\r
+\r
+/* Define to activate Unix95-and-earlier features */\r
+#undef _XOPEN_SOURCE_EXTENDED\r
+\r
+/* Define on FreeBSD to activate all library features */\r
+#undef __BSD_VISIBLE\r
+\r
+/* Define to 1 if type `char' is unsigned and you are not using gcc. */\r
+#ifndef __CHAR_UNSIGNED__\r
+# undef __CHAR_UNSIGNED__\r
+#endif\r
+\r
+/* Defined on Solaris to see additional function prototypes. */\r
+#undef __EXTENSIONS__\r
+\r
+/* Define to 'long' if <time.h> doesn't define. */\r
+#undef clock_t\r
+\r
+/* Define to empty if `const' does not conform to ANSI C. */\r
+#undef const\r
+\r
+/* Define to `int' if <sys/types.h> doesn't define. */\r
+#undef gid_t\r
+\r
+/* Define to the type of a signed integer type of width exactly 32 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef int32_t\r
+\r
+/* Define to the type of a signed integer type of width exactly 64 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef int64_t\r
+\r
+/* Define to `int' if <sys/types.h> does not define. */\r
+#undef mode_t\r
+\r
+/* Define to `long int' if <sys/types.h> does not define. */\r
+#undef off_t\r
+\r
+/* Define to `int' if <sys/types.h> does not define. */\r
+#undef pid_t\r
+\r
+/* Define to empty if the keyword does not work. */\r
+#undef signed\r
+\r
+/* Define to `unsigned int' if <sys/types.h> does not define. */\r
+#undef size_t\r
+\r
+/* Define to `int' if <sys/socket.h> does not define. */\r
+#undef socklen_t\r
+\r
+/* Define to `int' if <sys/types.h> doesn't define. */\r
+#undef uid_t\r
+\r
+/* Define to the type of an unsigned integer type of width exactly 32 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef uint32_t\r
+\r
+/* Define to the type of an unsigned integer type of width exactly 64 bits if\r
+ such a type exists and the standard includes do not define it. */\r
+#undef uint64_t\r
+\r
+/* Define to empty if the keyword does not work. */\r
+#undef volatile\r
+\r
+\r
+/* Define the macros needed if on a UnixWare 7.x system. */\r
+#if defined(__USLC__) && defined(__SCO_VERSION__)\r
+#define STRICT_SYSV_CURSES /* Don't use ncurses extensions */\r
+#endif\r
+\r
+#endif /*Py_PYCONFIG_H*/\r
+\r