Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

Location:
python/vendor/current/PC/os2emx
Files:
8 edited
1 moved

Legend:

Unmodified
Added
Removed
  • python/vendor/current/PC/os2emx/Makefile

    r2 r388  
    238238# Output file names
    239239PYTHON_VER=     2.6
    240 PYTHON_LIB=     python26
     240PYTHON_LIB=     python27
    241241PYTHON.LIB=     $(PYTHON_LIB)_s$A
    242242PYTHON.IMPLIB=  $(PYTHON_LIB)$A
     
    352352                Python/getcompiler.c \
    353353                Python/getcopyright.c \
    354                 Python/getmtime.c \
    355354                Python/getplatform.c \
    356355                Python/getversion.c \
     
    364363                Python/peephole.c \
    365364                Python/pyarena.c \
     365                Python/pyctype.c \
    366366                Python/pyfpe.c \
    367367                Python/pymath.c \
     
    385385                Objects/cellobject.c \
    386386                Objects/classobject.c \
     387                Objects/capsule.c \
    387388                Objects/cobject.c \
    388389                Objects/codeobject.c \
  • python/vendor/current/PC/os2emx/README.os2emx

    r2 r388  
    310310   the value of the Makefile variable EXE_DIR to the appropriate directory.
    311311
    312 3. If you wish the Python core DLL (python26.dll) to be installed in a
     3123. If you wish the Python core DLL (python27.dll) to be installed in a
    313313   directory other than the directory in which the Python executables are
    314314   installed (by default, the PYTHONHOME directory), set the value of the
  • python/vendor/current/PC/os2emx/config.c

    r2 r388  
    103103struct _inittab _PyImport_Inittab[] = {
    104104
    105         {"os2", initos2},
    106         {"signal", initsignal},
     105    {"os2", initos2},
     106    {"signal", initsignal},
    107107#ifdef WITH_THREAD
    108         {"thread", initthread},
     108    {"thread", initthread},
    109109#endif
    110         {"_codecs", init_codecs},
    111         {"_csv", init_csv},
    112         {"_locale", init_locale},
    113         {"_random", init_random},
    114         {"_sre", init_sre},
    115         {"_symtable", init_symtable},
    116         {"_weakref", init_weakref},
    117         {"array", initarray},
    118         {"binascii", initbinascii},
    119         {"cPickle", initcPickle},
    120         {"cStringIO", initcStringIO},
    121         {"_collections", init_collections},
    122         {"cmath", initcmath},
    123         {"datetime", initdatetime},
    124         {"dl", initdl},
    125         {"errno", initerrno},
    126         {"fcntl", initfcntl},
    127         {"_fileio", init_fileio},
    128         {"_functools", init_functools},
    129         {"_heapq", init_heapq},
    130         {"imageop", initimageop},
    131         {"itertools", inititertools},
    132         {"math", initmath},
    133         {"_md5", init_md5},
    134         {"operator", initoperator},
    135         {"_sha", init_sha},
    136         {"_sha256", init_sha256},
    137         {"_sha512", init_sha512},
    138         {"strop", initstrop},
    139         {"_struct", init_struct},
    140         {"termios", inittermios},
    141         {"time", inittime},
    142         {"timing", inittiming},
    143         {"xxsubtype", initxxsubtype},
    144         {"zipimport", initzipimport},
     110    {"_codecs", init_codecs},
     111    {"_csv", init_csv},
     112    {"_locale", init_locale},
     113    {"_random", init_random},
     114    {"_sre", init_sre},
     115    {"_symtable", init_symtable},
     116    {"_weakref", init_weakref},
     117    {"array", initarray},
     118    {"binascii", initbinascii},
     119    {"cPickle", initcPickle},
     120    {"cStringIO", initcStringIO},
     121    {"_collections", init_collections},
     122    {"cmath", initcmath},
     123    {"datetime", initdatetime},
     124    {"dl", initdl},
     125    {"errno", initerrno},
     126    {"fcntl", initfcntl},
     127    {"_fileio", init_fileio},
     128    {"_functools", init_functools},
     129    {"_heapq", init_heapq},
     130    {"imageop", initimageop},
     131    {"itertools", inititertools},
     132    {"math", initmath},
     133    {"_md5", init_md5},
     134    {"operator", initoperator},
     135    {"_sha", init_sha},
     136    {"_sha256", init_sha256},
     137    {"_sha512", init_sha512},
     138    {"strop", initstrop},
     139    {"_struct", init_struct},
     140    {"termios", inittermios},
     141    {"time", inittime},
     142    {"timing", inittiming},
     143    {"xxsubtype", initxxsubtype},
     144    {"zipimport", initzipimport},
    145145#if !HAVE_DYNAMIC_LOADING
    146         {"_curses", init_curses},
    147         {"_curses_panel", init_curses_panel},
    148         {"_hotshot", init_hotshot},
    149         {"_testcapi", init_testcapi},
    150         {"bsddb185", initbsddb185},
    151         {"bz2", initbz2},
    152         {"fpectl", initfpectl},
    153         {"fpetest", initfpetest},
    154         {"parser", initparser},
    155         {"pwd", initpwd},
    156         {"unicodedata", initunicodedata},
    157         {"zlib", initzlib},
     146    {"_curses", init_curses},
     147    {"_curses_panel", init_curses_panel},
     148    {"_hotshot", init_hotshot},
     149    {"_testcapi", init_testcapi},
     150    {"bsddb185", initbsddb185},
     151    {"bz2", initbz2},
     152    {"fpectl", initfpectl},
     153    {"fpetest", initfpetest},
     154    {"parser", initparser},
     155    {"pwd", initpwd},
     156    {"unicodedata", initunicodedata},
     157    {"zlib", initzlib},
    158158#ifdef USE_SOCKET
    159         {"_socket", init_socket},
    160         {"select", initselect},
     159    {"_socket", init_socket},
     160    {"select", initselect},
    161161#endif
    162162#endif
    163163/* -- ADDMODULE MARKER 2 -- */
    164164
    165         /* This module "lives in" with marshal.c */
    166         {"marshal", PyMarshal_Init},
     165    /* This module "lives in" with marshal.c */
     166    {"marshal", PyMarshal_Init},
    167167
    168         /* This lives it with import.c */
    169         {"imp", initimp},
     168    /* This lives it with import.c */
     169    {"imp", initimp},
    170170
    171         /* These entries are here for sys.builtin_module_names */
    172         {"__main__", NULL},
    173         {"__builtin__", NULL},
    174         {"sys", NULL},
    175         {"exceptions", NULL},
     171    /* These entries are here for sys.builtin_module_names */
     172    {"__main__", NULL},
     173    {"__builtin__", NULL},
     174    {"sys", NULL},
     175    {"exceptions", NULL},
    176176
    177         /* This lives in gcmodule.c */
    178         {"gc", initgc},
     177    /* This lives in gcmodule.c */
     178    {"gc", initgc},
    179179
    180         /* Sentinel */
    181         {0, 0}
     180    /* Sentinel */
     181    {0, 0}
    182182};
  • python/vendor/current/PC/os2emx/dlfcn.c

    r2 r388  
    4747
    4848typedef struct _track_rec {
    49         char *name;
    50         HMODULE handle;
    51         void *id;
    52         struct _track_rec *next;
     49    char *name;
     50    HMODULE handle;
     51    void *id;
     52    struct _track_rec *next;
    5353} tDLLchain, *DLLchain;
    5454
    55 static DLLchain dlload = NULL;  /* A simple chained list of DLL names */
    56 static char dlerr [256];        /* last error text string */
     55static DLLchain dlload = NULL;  /* A simple chained list of DLL names */
     56static char dlerr [256];        /* last error text string */
    5757static void *last_id;
    5858
    5959static DLLchain find_id(void *id)
    6060{
    61         DLLchain tmp;
    62 
    63         for (tmp = dlload; tmp; tmp = tmp->next)
    64                 if (id == tmp->id)
    65                         return tmp;
    66 
    67         return NULL;
     61    DLLchain tmp;
     62
     63    for (tmp = dlload; tmp; tmp = tmp->next)
     64        if (id == tmp->id)
     65            return tmp;
     66
     67    return NULL;
    6868}
    6969
     
    7171void *dlopen(char *filename, int flags)
    7272{
    73         HMODULE hm;
    74         DLLchain tmp;
    75         char err[256];
    76         char *errtxt;
    77         int rc = 0, set_chain = 0;
    78 
    79         for (tmp = dlload; tmp; tmp = tmp->next)
    80                 if (strnicmp(tmp->name, filename, 999) == 0)
    81                         break;
    82 
    83         if (!tmp)
    84         {
    85                 tmp = (DLLchain) malloc(sizeof(tDLLchain));
    86                 if (!tmp)
    87                         goto nomem;
    88                 tmp->name = strdup(filename);
    89                 tmp->next = dlload;
    90                 set_chain = 1;
    91         }
    92 
    93         switch (rc = DosLoadModule((PSZ)&err, sizeof(err), filename, &hm))
    94         {
    95                 case NO_ERROR:
    96                         tmp->handle = hm;
    97                         if (set_chain)
    98                         {
    99                                 do
    100                                         last_id++;
    101                                 while ((last_id == 0) || (find_id(last_id)));
    102                                 tmp->id = last_id;
    103                                 dlload = tmp;
    104                         }
    105                         return tmp->id;
    106                 case ERROR_FILE_NOT_FOUND:
    107                 case ERROR_PATH_NOT_FOUND:
    108                         errtxt = "module `%s' not found";
    109                         break;
    110                 case ERROR_TOO_MANY_OPEN_FILES:
    111                 case ERROR_NOT_ENOUGH_MEMORY:
    112                 case ERROR_SHARING_BUFFER_EXCEEDED:
     73    HMODULE hm;
     74    DLLchain tmp;
     75    char err[256];
     76    char *errtxt;
     77    int rc = 0, set_chain = 0;
     78
     79    for (tmp = dlload; tmp; tmp = tmp->next)
     80        if (strnicmp(tmp->name, filename, 999) == 0)
     81            break;
     82
     83    if (!tmp)
     84    {
     85        tmp = (DLLchain) malloc(sizeof(tDLLchain));
     86        if (!tmp)
     87            goto nomem;
     88        tmp->name = strdup(filename);
     89        tmp->next = dlload;
     90        set_chain = 1;
     91    }
     92
     93    switch (rc = DosLoadModule((PSZ)&err, sizeof(err), filename, &hm))
     94    {
     95        case NO_ERROR:
     96            tmp->handle = hm;
     97            if (set_chain)
     98            {
     99                do
     100                    last_id++;
     101                while ((last_id == 0) || (find_id(last_id)));
     102                tmp->id = last_id;
     103                dlload = tmp;
     104            }
     105            return tmp->id;
     106        case ERROR_FILE_NOT_FOUND:
     107        case ERROR_PATH_NOT_FOUND:
     108            errtxt = "module `%s' not found";
     109            break;
     110        case ERROR_TOO_MANY_OPEN_FILES:
     111        case ERROR_NOT_ENOUGH_MEMORY:
     112        case ERROR_SHARING_BUFFER_EXCEEDED:
    113113nomem:
    114                         errtxt = "out of system resources";
    115                         break;
    116                 case ERROR_ACCESS_DENIED:
    117                         errtxt = "access denied";
    118                         break;
    119                 case ERROR_BAD_FORMAT:
    120                 case ERROR_INVALID_SEGMENT_NUMBER:
    121                 case ERROR_INVALID_ORDINAL:
    122                 case ERROR_INVALID_MODULETYPE:
    123                 case ERROR_INVALID_EXE_SIGNATURE:
    124                 case ERROR_EXE_MARKED_INVALID:
    125                 case ERROR_ITERATED_DATA_EXCEEDS_64K:
    126                 case ERROR_INVALID_MINALLOCSIZE:
    127                 case ERROR_INVALID_SEGDPL:
    128                 case ERROR_AUTODATASEG_EXCEEDS_64K:
    129                 case ERROR_RELOCSRC_CHAIN_EXCEEDS_SEGLIMIT:
    130                         errtxt = "invalid module format";
    131                         break;
    132                 case ERROR_INVALID_NAME:
    133                         errtxt = "filename doesn't match module name";
    134                         break;
    135                 case ERROR_SHARING_VIOLATION:
    136                 case ERROR_LOCK_VIOLATION:
    137                         errtxt = "sharing violation";
    138                         break;
    139                 case ERROR_INIT_ROUTINE_FAILED:
    140                         errtxt = "module initialization failed";
    141                         break;
    142                 default:
    143                         errtxt = "cause `%s', error code = %d";
    144                         break;
    145         }
    146         snprintf(dlerr, sizeof(dlerr), errtxt, &err, rc);
    147         if (tmp)
    148         {
    149                 if (tmp->name)
    150                         free(tmp->name);
    151                 free(tmp);
    152         }
    153         return 0;
     114            errtxt = "out of system resources";
     115            break;
     116        case ERROR_ACCESS_DENIED:
     117            errtxt = "access denied";
     118            break;
     119        case ERROR_BAD_FORMAT:
     120        case ERROR_INVALID_SEGMENT_NUMBER:
     121        case ERROR_INVALID_ORDINAL:
     122        case ERROR_INVALID_MODULETYPE:
     123        case ERROR_INVALID_EXE_SIGNATURE:
     124        case ERROR_EXE_MARKED_INVALID:
     125        case ERROR_ITERATED_DATA_EXCEEDS_64K:
     126        case ERROR_INVALID_MINALLOCSIZE:
     127        case ERROR_INVALID_SEGDPL:
     128        case ERROR_AUTODATASEG_EXCEEDS_64K:
     129        case ERROR_RELOCSRC_CHAIN_EXCEEDS_SEGLIMIT:
     130            errtxt = "invalid module format";
     131            break;
     132        case ERROR_INVALID_NAME:
     133            errtxt = "filename doesn't match module name";
     134            break;
     135        case ERROR_SHARING_VIOLATION:
     136        case ERROR_LOCK_VIOLATION:
     137            errtxt = "sharing violation";
     138            break;
     139        case ERROR_INIT_ROUTINE_FAILED:
     140            errtxt = "module initialization failed";
     141            break;
     142        default:
     143            errtxt = "cause `%s', error code = %d";
     144            break;
     145    }
     146    snprintf(dlerr, sizeof(dlerr), errtxt, &err, rc);
     147    if (tmp)
     148    {
     149        if (tmp->name)
     150            free(tmp->name);
     151        free(tmp);
     152    }
     153    return 0;
    154154}
    155155
     
    157157void *dlsym(void *handle, char *symbol)
    158158{
    159         int rc = 0;
    160         PFN addr;
    161         char *errtxt;
    162         int symord = 0;
    163         DLLchain tmp = find_id(handle);
    164 
    165         if (!tmp)
    166                 goto inv_handle;
    167 
    168         if (*symbol == '#')
    169                 symord = atoi(symbol + 1);
    170 
    171         switch (rc = DosQueryProcAddr(tmp->handle, symord, symbol, &addr))
    172         {
    173                 case NO_ERROR:
    174                         return (void *)addr;
    175                 case ERROR_INVALID_HANDLE:
     159    int rc = 0;
     160    PFN addr;
     161    char *errtxt;
     162    int symord = 0;
     163    DLLchain tmp = find_id(handle);
     164
     165    if (!tmp)
     166        goto inv_handle;
     167
     168    if (*symbol == '#')
     169        symord = atoi(symbol + 1);
     170
     171    switch (rc = DosQueryProcAddr(tmp->handle, symord, symbol, &addr))
     172    {
     173        case NO_ERROR:
     174            return (void *)addr;
     175        case ERROR_INVALID_HANDLE:
    176176inv_handle:
    177                         errtxt = "invalid module handle";
    178                         break;
    179                 case ERROR_PROC_NOT_FOUND:
    180                 case ERROR_INVALID_NAME:
    181                         errtxt = "no symbol `%s' in module";
    182                         break;
    183                 default:
    184                         errtxt = "symbol `%s', error code = %d";
    185                         break;
    186         }
    187         snprintf(dlerr, sizeof(dlerr), errtxt, symbol, rc);
    188         return NULL;
    189 }
    190 
    191 /* free dynamicaly-linked library */
     177            errtxt = "invalid module handle";
     178            break;
     179        case ERROR_PROC_NOT_FOUND:
     180        case ERROR_INVALID_NAME:
     181            errtxt = "no symbol `%s' in module";
     182            break;
     183        default:
     184            errtxt = "symbol `%s', error code = %d";
     185            break;
     186    }
     187    snprintf(dlerr, sizeof(dlerr), errtxt, symbol, rc);
     188    return NULL;
     189}
     190
     191/* free dynamically-linked library */
    192192int dlclose(void *handle)
    193193{
    194         int rc;
    195         DLLchain tmp = find_id(handle);
    196 
    197         if (!tmp)
    198                 goto inv_handle;
    199 
    200         switch (rc = DosFreeModule(tmp->handle))
    201         {
    202                 case NO_ERROR:
    203                         free(tmp->name);
    204                         dlload = tmp->next;
    205                         free(tmp);
    206                         return 0;
    207                 case ERROR_INVALID_HANDLE:
     194    int rc;
     195    DLLchain tmp = find_id(handle);
     196
     197    if (!tmp)
     198        goto inv_handle;
     199
     200    switch (rc = DosFreeModule(tmp->handle))
     201    {
     202        case NO_ERROR:
     203            free(tmp->name);
     204            dlload = tmp->next;
     205            free(tmp);
     206            return 0;
     207        case ERROR_INVALID_HANDLE:
    208208inv_handle:
    209                         strcpy(dlerr, "invalid module handle");
    210                         return -1;
    211                 case ERROR_INVALID_ACCESS:
    212                         strcpy(dlerr, "access denied");
    213                         return -1;
    214                 default:
    215                         return -1;
    216         }
     209            strcpy(dlerr, "invalid module handle");
     210            return -1;
     211        case ERROR_INVALID_ACCESS:
     212            strcpy(dlerr, "access denied");
     213            return -1;
     214        default:
     215            return -1;
     216    }
    217217}
    218218
     
    220220char *dlerror()
    221221{
    222         return dlerr;
    223 }
     222    return dlerr;
     223}
  • python/vendor/current/PC/os2emx/dlfcn.h

    r2 r388  
    4343void *dlsym(void *handle, char *symbol);
    4444
    45 /* free dynamicaly-linked library */
     45/* free dynamically-linked library */
    4646int dlclose(void *handle);
    4747
  • python/vendor/current/PC/os2emx/dllentry.c

    r2 r388  
    55#define NULL 0
    66
    7 #define REF(s)  extern void s(); void *____ref_##s = &s;
     7#define REF(s)  extern void s(); void *____ref_##s = &s;
    88
    99/* Make references to imported symbols to pull them from static library */
     
    1919unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag)
    2020{
    21         switch (flag)
    22         {
    23                 case 0:
    24                         if (_CRT_init())
    25                                 return 0;
    26                         __ctordtorInit();
     21    switch (flag)
     22    {
     23        case 0:
     24            if (_CRT_init())
     25                return 0;
     26            __ctordtorInit();
    2727
    28                         /* Ignore fatal signals */
    29                         signal(SIGSEGV, SIG_IGN);
    30                         signal(SIGFPE, SIG_IGN);
     28            /* Ignore fatal signals */
     29            signal(SIGSEGV, SIG_IGN);
     30            signal(SIGFPE, SIG_IGN);
    3131
    32                         return 1;
     32            return 1;
    3333
    34                 case 1:
    35                         __ctordtorTerm();
    36                         _CRT_term();
    37                         return 1;
     34        case 1:
     35            __ctordtorTerm();
     36            _CRT_term();
     37            return 1;
    3838
    39                 default:
    40                         return 0;
    41         }
     39        default:
     40            return 0;
     41    }
    4242}
  • python/vendor/current/PC/os2emx/getpathp.c

    r2 r388  
    55/* ----------------------------------------------------------------
    66   PATH RULES FOR OS/2+EMX:
    7    This describes how sys.path is formed on OS/2+EMX.  It describes the 
    8    functionality, not the implementation (ie, the order in which these 
     7   This describes how sys.path is formed on OS/2+EMX.  It describes the
     8   functionality, not the implementation (ie, the order in which these
    99   are actually fetched is different)
    1010
     
    1717     is set, we believe it.  Otherwise, we use the path of our host .EXE's
    1818     to try and locate our "landmark" (lib\\os.py) and deduce our home.
    19      - If we DO have a Python Home: The relevant sub-directories (Lib, 
     19     - If we DO have a Python Home: The relevant sub-directories (Lib,
    2020       plat-win, lib-tk, etc) are based on the Python Home
    2121     - If we DO NOT have a Python Home, the core Python Path is
    22        loaded from the registry.  This is the main PythonPath key, 
     22       loaded from the registry.  This is the main PythonPath key,
    2323       and both HKLM and HKCU are combined to form the path)
    2424
     
    3333    the core path is deduced.
    3434
    35   * When Python is hosted in another exe (different directory, embedded via 
     35  * When Python is hosted in another exe (different directory, embedded via
    3636    COM, etc), the Python Home will not be deduced, so the core path from
    37     the registry is used.  Other "application paths "in the registry are 
     37    the registry is used.  Other "application paths "in the registry are
    3838    always read.
    3939
     
    8686
    8787static int
    88 is_sep(char ch) /* determine if "ch" is a separator character */
     88is_sep(char ch) /* determine if "ch" is a separator character */
    8989{
    9090#ifdef ALTSEP
    91         return ch == SEP || ch == ALTSEP;
     91    return ch == SEP || ch == ALTSEP;
    9292#else
    93         return ch == SEP;
     93    return ch == SEP;
    9494#endif
    9595}
     
    101101reduce(char *dir)
    102102{
    103         size_t i = strlen(dir);
    104         while (i > 0 && !is_sep(dir[i]))
    105                 --i;
    106         dir[i] = '\0';
    107 }
    108        
     103    size_t i = strlen(dir);
     104    while (i > 0 && !is_sep(dir[i]))
     105        --i;
     106    dir[i] = '\0';
     107}
     108
    109109static int
    110110exists(char *filename)
    111111{
    112         struct stat buf;
    113         return stat(filename, &buf) == 0;
     112    struct stat buf;
     113    return stat(filename, &buf) == 0;
    114114}
    115115
    116116/* Is module  (check for .pyc/.pyo too)
    117  * Assumes 'filename' MAXPATHLEN+1 bytes long - 
     117 * Assumes 'filename' MAXPATHLEN+1 bytes long -
    118118 * may extend 'filename' by one character.
    119119 */
     
    121121ismodule(char *filename)
    122122{
    123         if (exists(filename))
    124                 return 1;
    125 
    126         /* Check for the compiled version of prefix. */
    127         if (strlen(filename) < MAXPATHLEN) {
    128                 strcat(filename, Py_OptimizeFlag ? "o" : "c");
    129                 if (exists(filename))
    130                         return 1;
    131         }
    132         return 0;
     123    if (exists(filename))
     124        return 1;
     125
     126    /* Check for the compiled version of prefix. */
     127    if (strlen(filename) < MAXPATHLEN) {
     128        strcat(filename, Py_OptimizeFlag ? "o" : "c");
     129        if (exists(filename))
     130            return 1;
     131    }
     132    return 0;
    133133}
    134134
     
    146146join(char *buffer, char *stuff)
    147147{
    148         size_t n, k;
    149         if (is_sep(stuff[0]))
    150                 n = 0;
    151         else {
    152                 n = strlen(buffer);
    153                 if (n > 0 && !is_sep(buffer[n-1]) && n < MAXPATHLEN)
    154                         buffer[n++] = SEP;
    155         }
    156         if (n > MAXPATHLEN)
    157                 Py_FatalError("buffer overflow in getpathp.c's joinpath()");
    158         k = strlen(stuff);
    159         if (n + k > MAXPATHLEN)
    160                 k = MAXPATHLEN - n;
    161         strncpy(buffer+n, stuff, k);
    162         buffer[n+k] = '\0';
     148    size_t n, k;
     149    if (is_sep(stuff[0]))
     150        n = 0;
     151    else {
     152        n = strlen(buffer);
     153        if (n > 0 && !is_sep(buffer[n-1]) && n < MAXPATHLEN)
     154            buffer[n++] = SEP;
     155    }
     156    if (n > MAXPATHLEN)
     157        Py_FatalError("buffer overflow in getpathp.c's joinpath()");
     158    k = strlen(stuff);
     159    if (n + k > MAXPATHLEN)
     160        k = MAXPATHLEN - n;
     161    strncpy(buffer+n, stuff, k);
     162    buffer[n+k] = '\0';
    163163}
    164164
     
    170170gotlandmark(char *landmark)
    171171{
    172         int n, ok;
    173 
    174         n = strlen(prefix);
    175         join(prefix, landmark);
    176         ok = ismodule(prefix);
    177         prefix[n] = '\0';
    178         return ok;
    179 }
    180 
    181 /* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd. 
     172    int n, ok;
     173
     174    n = strlen(prefix);
     175    join(prefix, landmark);
     176    ok = ismodule(prefix);
     177    prefix[n] = '\0';
     178    return ok;
     179}
     180
     181/* assumes argv0_path is MAXPATHLEN+1 bytes long, already \0 term'd.
    182182 * assumption provided by only caller, calculate_path()
    183183 */
     
    185185search_for_prefix(char *argv0_path, char *landmark)
    186186{
    187         /* Search from argv0_path, until landmark is found */
    188         strcpy(prefix, argv0_path);
    189         do {
    190                 if (gotlandmark(landmark))
    191                         return 1;
    192                 reduce(prefix);
    193         } while (prefix[0]);
    194         return 0;
     187    /* Search from argv0_path, until landmark is found */
     188    strcpy(prefix, argv0_path);
     189    do {
     190        if (gotlandmark(landmark))
     191            return 1;
     192        reduce(prefix);
     193    } while (prefix[0]);
     194    return 0;
    195195}
    196196
     
    199199get_progpath(void)
    200200{
    201         extern char *Py_GetProgramName(void);
    202         char *path = getenv("PATH");
    203         char *prog = Py_GetProgramName();
    204 
    205         PPIB pib;
    206         if ((DosGetInfoBlocks(NULL, &pib) == 0) &&
    207             (DosQueryModuleName(pib->pib_hmte, sizeof(progpath), progpath) == 0))
    208                 return;
    209 
    210         if (prog == NULL || *prog == '\0')
    211                 prog = "python";
    212 
    213         /* If there is no slash in the argv0 path, then we have to
    214         * assume python is on the user's $PATH, since there's no
    215         * other way to find a directory to start the search from.  If
    216         * $PATH isn't exported, you lose.
    217         */
     201    extern char *Py_GetProgramName(void);
     202    char *path = getenv("PATH");
     203    char *prog = Py_GetProgramName();
     204
     205    PPIB pib;
     206    if ((DosGetInfoBlocks(NULL, &pib) == 0) &&
     207        (DosQueryModuleName(pib->pib_hmte, sizeof(progpath), progpath) == 0))
     208        return;
     209
     210    if (prog == NULL || *prog == '\0')
     211        prog = "python";
     212
     213    /* If there is no slash in the argv0 path, then we have to
     214    * assume python is on the user's $PATH, since there's no
     215    * other way to find a directory to start the search from.  If
     216    * $PATH isn't exported, you lose.
     217    */
    218218#ifdef ALTSEP
    219         if (strchr(prog, SEP) || strchr(prog, ALTSEP))
     219    if (strchr(prog, SEP) || strchr(prog, ALTSEP))
    220220#else
    221         if (strchr(prog, SEP))
    222 #endif
    223                 strncpy(progpath, prog, MAXPATHLEN);
    224         else if (path) {
    225                 while (1) {
    226                         char *delim = strchr(path, DELIM);
    227 
    228                         if (delim) {
    229                                 size_t len = delim - path;
    230                                 /* ensure we can't overwrite buffer */
     221    if (strchr(prog, SEP))
     222#endif
     223        strncpy(progpath, prog, MAXPATHLEN);
     224    else if (path) {
     225        while (1) {
     226            char *delim = strchr(path, DELIM);
     227
     228            if (delim) {
     229                size_t len = delim - path;
     230                /* ensure we can't overwrite buffer */
    231231#if !defined(PYCC_GCC)
    232                                 len = min(MAXPATHLEN,len);
     232                len = min(MAXPATHLEN,len);
    233233#else
    234                                 len = MAXPATHLEN < len ? MAXPATHLEN : len;
    235 #endif
    236                                 strncpy(progpath, path, len);
    237                                 *(progpath + len) = '\0';
    238                         }
    239                         else
    240                                 strncpy(progpath, path, MAXPATHLEN);
    241 
    242                         /* join() is safe for MAXPATHLEN+1 size buffer */
    243                         join(progpath, prog);
    244                         if (exists(progpath))
    245                                 break;
    246 
    247                         if (!delim) {
    248                                 progpath[0] = '\0';
    249                                 break;
    250                         }
    251                         path = delim + 1;
    252                 }
    253         }
    254         else
    255                 progpath[0] = '\0';
     234                len = MAXPATHLEN < len ? MAXPATHLEN : len;
     235#endif
     236                strncpy(progpath, path, len);
     237                *(progpath + len) = '\0';
     238            }
     239            else
     240                strncpy(progpath, path, MAXPATHLEN);
     241
     242            /* join() is safe for MAXPATHLEN+1 size buffer */
     243            join(progpath, prog);
     244            if (exists(progpath))
     245                break;
     246
     247            if (!delim) {
     248                progpath[0] = '\0';
     249                break;
     250            }
     251            path = delim + 1;
     252        }
     253    }
     254    else
     255        progpath[0] = '\0';
    256256}
    257257
     
    259259calculate_path(void)
    260260{
    261         char argv0_path[MAXPATHLEN+1];
    262         char *buf;
    263         size_t bufsz;
    264         char *pythonhome = Py_GetPythonHome();
    265         char *envpath = getenv("PYTHONPATH");
    266         char zip_path[MAXPATHLEN+1];
    267         size_t len;
    268 
    269         get_progpath();
    270         /* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */
    271         strcpy(argv0_path, progpath);
    272         reduce(argv0_path);
    273         if (pythonhome == NULL || *pythonhome == '\0') {
    274                 if (search_for_prefix(argv0_path, LANDMARK))
    275                         pythonhome = prefix;
    276                 else
    277                         pythonhome = NULL;
    278         }
    279         else
    280                 strncpy(prefix, pythonhome, MAXPATHLEN);
    281 
    282         if (envpath && *envpath == '\0')
    283                 envpath = NULL;
    284 
    285         /* Calculate zip archive path */
    286         strncpy(zip_path, progpath, MAXPATHLEN);
    287         zip_path[MAXPATHLEN] = '\0';
    288         len = strlen(zip_path);
    289         if (len > 4) {
    290                 zip_path[len-3] = 'z';  /* change ending to "zip" */
    291                 zip_path[len-2] = 'i';
    292                 zip_path[len-1] = 'p';
    293         }
    294         else {
    295                 zip_path[0] = 0;
    296         }
    297 
    298         /* We need to construct a path from the following parts.
    299         * (1) the PYTHONPATH environment variable, if set;
    300         * (2) the zip archive file path;
    301         * (3) the PYTHONPATH config macro, with the leading "."
    302         *     of each component replaced with pythonhome, if set;
    303         * (4) the directory containing the executable (argv0_path).
    304         * The length calculation calculates #3 first.
    305         */
    306 
    307         /* Calculate size of return buffer */
    308         if (pythonhome != NULL) {
    309                 char *p;
    310                 bufsz = 1;     
    311                 for (p = PYTHONPATH; *p; p++) {
    312                         if (*p == DELIM)
    313                                 bufsz++; /* number of DELIM plus one */
    314                 }
    315                 bufsz *= strlen(pythonhome);
    316         }
    317         else
    318                 bufsz = 0;
    319         bufsz += strlen(PYTHONPATH) + 1;
    320         bufsz += strlen(argv0_path) + 1;
    321         bufsz += strlen(zip_path) + 1;
    322         if (envpath != NULL)
    323                 bufsz += strlen(envpath) + 1;
    324 
    325         module_search_path = buf = malloc(bufsz);
    326         if (buf == NULL) {
    327                 /* We can't exit, so print a warning and limp along */
    328                 fprintf(stderr, "Can't malloc dynamic PYTHONPATH.\n");
    329                 if (envpath) {
    330                         fprintf(stderr, "Using environment $PYTHONPATH.\n");
    331                         module_search_path = envpath;
    332                 }
    333                 else {
    334                         fprintf(stderr, "Using default static path.\n");
    335                         module_search_path = PYTHONPATH;
    336                 }
    337                 return;
    338         }
    339 
    340         if (envpath) {
    341                 strcpy(buf, envpath);
    342                 buf = strchr(buf, '\0');
    343                 *buf++ = DELIM;
    344         }
    345         if (zip_path[0]) {
    346                 strcpy(buf, zip_path);
    347                 buf = strchr(buf, '\0');
    348                 *buf++ = DELIM;
    349         }
    350 
    351         if (pythonhome == NULL) {
    352                 strcpy(buf, PYTHONPATH);
    353                 buf = strchr(buf, '\0');
    354         }
    355         else {
    356                 char *p = PYTHONPATH;
    357                 char *q;
    358                 size_t n;
    359                 for (;;) {
    360                         q = strchr(p, DELIM);
    361                         if (q == NULL)
    362                                 n = strlen(p);
    363                         else
    364                                 n = q-p;
    365                         if (p[0] == '.' && is_sep(p[1])) {
    366                                 strcpy(buf, pythonhome);
    367                                 buf = strchr(buf, '\0');
    368                                 p++;
    369                                 n--;
    370                         }
    371                         strncpy(buf, p, n);
    372                         buf += n;
    373                         if (q == NULL)
    374                                 break;
    375                         *buf++ = DELIM;
    376                         p = q+1;
    377                 }
    378         }
    379         if (argv0_path) {
    380                 *buf++ = DELIM;
    381                 strcpy(buf, argv0_path);
    382                 buf = strchr(buf, '\0');
    383         }
    384         *buf = '\0';
     261    char argv0_path[MAXPATHLEN+1];
     262    char *buf;
     263    size_t bufsz;
     264    char *pythonhome = Py_GetPythonHome();
     265    char *envpath = getenv("PYTHONPATH");
     266    char zip_path[MAXPATHLEN+1];
     267    size_t len;
     268
     269    get_progpath();
     270    /* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */
     271    strcpy(argv0_path, progpath);
     272    reduce(argv0_path);
     273    if (pythonhome == NULL || *pythonhome == '\0') {
     274        if (search_for_prefix(argv0_path, LANDMARK))
     275            pythonhome = prefix;
     276        else
     277            pythonhome = NULL;
     278    }
     279    else
     280        strncpy(prefix, pythonhome, MAXPATHLEN);
     281
     282    if (envpath && *envpath == '\0')
     283        envpath = NULL;
     284
     285    /* Calculate zip archive path */
     286    strncpy(zip_path, progpath, MAXPATHLEN);
     287    zip_path[MAXPATHLEN] = '\0';
     288    len = strlen(zip_path);
     289    if (len > 4) {
     290        zip_path[len-3] = 'z';  /* change ending to "zip" */
     291        zip_path[len-2] = 'i';
     292        zip_path[len-1] = 'p';
     293    }
     294    else {
     295        zip_path[0] = 0;
     296    }
     297
     298    /* We need to construct a path from the following parts.
     299    * (1) the PYTHONPATH environment variable, if set;
     300    * (2) the zip archive file path;
     301    * (3) the PYTHONPATH config macro, with the leading "."
     302    *     of each component replaced with pythonhome, if set;
     303    * (4) the directory containing the executable (argv0_path).
     304    * The length calculation calculates #3 first.
     305    */
     306
     307    /* Calculate size of return buffer */
     308    if (pythonhome != NULL) {
     309        char *p;
     310        bufsz = 1;
     311        for (p = PYTHONPATH; *p; p++) {
     312            if (*p == DELIM)
     313                bufsz++; /* number of DELIM plus one */
     314        }
     315        bufsz *= strlen(pythonhome);
     316    }
     317    else
     318        bufsz = 0;
     319    bufsz += strlen(PYTHONPATH) + 1;
     320    bufsz += strlen(argv0_path) + 1;
     321    bufsz += strlen(zip_path) + 1;
     322    if (envpath != NULL)
     323        bufsz += strlen(envpath) + 1;
     324
     325    module_search_path = buf = malloc(bufsz);
     326    if (buf == NULL) {
     327        /* We can't exit, so print a warning and limp along */
     328        fprintf(stderr, "Can't malloc dynamic PYTHONPATH.\n");
     329        if (envpath) {
     330            fprintf(stderr, "Using environment $PYTHONPATH.\n");
     331            module_search_path = envpath;
     332        }
     333        else {
     334            fprintf(stderr, "Using default static path.\n");
     335            module_search_path = PYTHONPATH;
     336        }
     337        return;
     338    }
     339
     340    if (envpath) {
     341        strcpy(buf, envpath);
     342        buf = strchr(buf, '\0');
     343        *buf++ = DELIM;
     344    }
     345    if (zip_path[0]) {
     346        strcpy(buf, zip_path);
     347        buf = strchr(buf, '\0');
     348        *buf++ = DELIM;
     349    }
     350
     351    if (pythonhome == NULL) {
     352        strcpy(buf, PYTHONPATH);
     353        buf = strchr(buf, '\0');
     354    }
     355    else {
     356        char *p = PYTHONPATH;
     357        char *q;
     358        size_t n;
     359        for (;;) {
     360            q = strchr(p, DELIM);
     361            if (q == NULL)
     362                n = strlen(p);
     363            else
     364                n = q-p;
     365            if (p[0] == '.' && is_sep(p[1])) {
     366                strcpy(buf, pythonhome);
     367                buf = strchr(buf, '\0');
     368                p++;
     369                n--;
     370            }
     371            strncpy(buf, p, n);
     372            buf += n;
     373            if (q == NULL)
     374                break;
     375            *buf++ = DELIM;
     376            p = q+1;
     377        }
     378    }
     379    if (argv0_path) {
     380        *buf++ = DELIM;
     381        strcpy(buf, argv0_path);
     382        buf = strchr(buf, '\0');
     383    }
     384    *buf = '\0';
    385385}
    386386
     
    391391Py_GetPath(void)
    392392{
    393         if (!module_search_path)
    394                 calculate_path();
    395         return module_search_path;
     393    if (!module_search_path)
     394        calculate_path();
     395    return module_search_path;
    396396}
    397397
     
    399399Py_GetPrefix(void)
    400400{
    401         if (!module_search_path)
    402                 calculate_path();
    403         return prefix;
     401    if (!module_search_path)
     402        calculate_path();
     403    return prefix;
    404404}
    405405
     
    407407Py_GetExecPrefix(void)
    408408{
    409         return Py_GetPrefix();
     409    return Py_GetPrefix();
    410410}
    411411
     
    413413Py_GetProgramFullPath(void)
    414414{
    415         if (!module_search_path)
    416                 calculate_path();
    417         return progpath;
    418 }
     415    if (!module_search_path)
     416        calculate_path();
     417    return progpath;
     418}
  • python/vendor/current/PC/os2emx/python27.def

    r385 r388  
    1 LIBRARY python26 INITINSTANCE TERMINSTANCE
     1LIBRARY python27 INITINSTANCE TERMINSTANCE
    22DESCRIPTION "Python 2.6 Core DLL"
    33PROTMODE
     
    55EXPORTS
    66
    7 ; From python26_s.lib(config)
     7; From python27_s.lib(config)
    88  "_PyImport_Inittab"
    99
    10 ; From python26_s.lib(dlfcn)
     10; From python27_s.lib(dlfcn)
    1111;  "dlopen"
    1212;  "dlsym"
     
    1414;  "dlerror"
    1515
    16 ; From python26_s.lib(getpathp)
     16; From python27_s.lib(getpathp)
    1717  "Py_GetProgramFullPath"
    1818  "Py_GetPrefix"
     
    2020  "Py_GetPath"
    2121
    22 ; From python26_s.lib(getbuildinfo)
     22; From python27_s.lib(getbuildinfo)
    2323  "Py_GetBuildInfo"
    2424  "_Py_svnversion"
    2525
    26 ; From python26_s.lib(main)
     26; From python27_s.lib(main)
    2727  "Py_Main"
    2828  "Py_GetArgcArgv"
    2929
    30 ; From python26_s.lib(acceler)
     30; From python27_s.lib(acceler)
    3131  "PyGrammar_AddAccelerators"
    3232  "PyGrammar_RemoveAccelerators"
    3333
    34 ; From python26_s.lib(grammar1)
     34; From python27_s.lib(grammar1)
    3535  "PyGrammar_FindDFA"
    3636  "PyGrammar_LabelRepr"
    3737
    38 ; From python26_s.lib(listnode)
     38; From python27_s.lib(listnode)
    3939  "PyNode_ListTree"
    4040
    41 ; From python26_s.lib(node)
     41; From python27_s.lib(node)
    4242  "PyNode_New"
    4343  "PyNode_AddChild"
    4444  "PyNode_Free"
    4545
    46 ; From python26_s.lib(parser)
     46; From python27_s.lib(parser)
    4747  "PyParser_AddToken"
    4848  "PyParser_New"
    4949  "PyParser_Delete"
    5050
    51 ; From python26_s.lib(parsetok)
     51; From python27_s.lib(parsetok)
    5252  "Py_TabcheckFlag"
    5353  "PyParser_ParseString"
     
    5757  "PyParser_ParseStringFlags"
    5858
    59 ; From python26_s.lib(bitset)
     59; From python27_s.lib(bitset)
    6060  "_Py_newbitset"
    6161  "_Py_delbitset"
     
    6464  "_Py_mergebitset"
    6565
    66 ; From python26_s.lib(metagrammar)
     66; From python27_s.lib(metagrammar)
    6767  "_Py_meta_grammar"
    6868  "Py_meta_grammar"
    6969
    70 ; From python26_s.lib(tokenizer)
     70; From python27_s.lib(tokenizer)
    7171  "PyToken_OneChar"
    7272  "PyToken_TwoChars"
     
    7878  "_PyParser_TokenNames"
    7979
    80 ; From python26_s.lib(myreadline)
     80; From python27_s.lib(myreadline)
    8181  "_PyOS_ReadlineTState"
    8282  "PyOS_ReadlineFunctionPointer"
     
    8585  "PyOS_InputHook"
    8686
    87 ; From python26_s.lib(abstract)
     87; From python27_s.lib(abstract)
    8888  "_PyObject_LengthHint"
    8989  "PyMapping_Size"
     
    176176  "PyObject_IsSubclass"
    177177
    178 ; From python26_s.lib(boolobject)
     178; From python27_s.lib(boolobject)
    179179  "PyBool_FromLong"
    180180  "PyBool_Type"
     
    182182  "_Py_TrueStruct"
    183183
    184 ; From python26_s.lib(bufferobject)
     184; From python27_s.lib(bufferobject)
    185185  "PyBuffer_FromObject"
    186186  "PyBuffer_FromReadWriteObject"
     
    190190  "PyBuffer_Type"
    191191
    192 ; From python26_s.lib(cellobject)
     192; From python27_s.lib(cellobject)
    193193  "PyCell_New"
    194194  "PyCell_Get"
     
    196196  "PyCell_Type"
    197197
    198 ; From python26_s.lib(classobject)
     198; From python27_s.lib(classobject)
    199199  "PyClass_New"
    200200  "PyClass_IsSubclass"
     
    211211  "PyMethod_Type"
    212212
    213 ; From python26_s.lib(cobject)
     213; From python27_s.lib(capsule)
     214  "PyCapsule_GetContext"
     215  "PyCapsule_GetDestructor"
     216  "PyCapsule_GetName"
     217  "PyCapsule_GetPointer"
     218  "PyCapsule_Import"
     219  "PyCapsule_IsValid"
     220  "PyCapsule_New"
     221  "PyCapsule_SetContext"
     222  "PyCapsule_SetDestructor"
     223  "PyCapsule_SetName"
     224  "PyCapsule_SetPointer"
     225
     226; From python27_s.lib(cobject)
    214227  "PyCObject_FromVoidPtr"
    215228  "PyCObject_FromVoidPtrAndDesc"
     
    220233  "PyCObject_Type"
    221234
    222 ; From python26_s.lib(codeobject)
     235; From python27_s.lib(codeobject)
    223236  "PyCode_New"
    224237  "PyCode_Addr2Line"
     
    226239  "PyCode_Type"
    227240
    228 ; From python26_s.lib(complexobject)
     241; From python27_s.lib(complexobject)
    229242  "_Py_c_pow"
    230243  "_Py_c_sum"
     
    240253  "PyComplex_Type"
    241254
    242 ; From python26_s.lib(descrobject)
     255; From python27_s.lib(descrobject)
    243256  "PyWrapper_New"
    244257  "PyDescr_NewMethod"
     
    251264  "PyProperty_Type"
    252265
    253 ; From python26_s.lib(dictobject)
     266; From python27_s.lib(dictobject)
    254267  "PyDict_New"
    255268  "PyDict_GetItem"
     
    275288  "PyDictIterItem_Type"
    276289
    277 ; From python26_s.lib(enumobject)
     290; From python27_s.lib(enumobject)
    278291  "PyEnum_Type"
    279292  "PyReversed_Type"
    280293
    281 ; From python26_s.lib(fileobject)
     294; From python27_s.lib(fileobject)
    282295  "PyFile_FromString"
    283296  "Py_UniversalNewlineFread"
     
    295308  "PyFile_Type"
    296309
    297 ; From python26_s.lib(floatobject)
     310; From python27_s.lib(floatobject)
    298311  "PyFloat_FromString"
    299312  "PyFloat_AsDouble"
     
    307320  "PyFloat_AsString"
    308321  "_PyFloat_Init"
    309   "PyFloat_AsStringEx"
    310322  "PyFloat_Type"
    311323
    312 ; From python26_s.lib(frameobject)
     324; From python27_s.lib(frameobject)
    313325  "PyFrame_New"
    314326  "PyFrame_FastToLocals"
     
    320332  "PyFrame_Type"
    321333
    322 ; From python26_s.lib(funcobject)
     334; From python27_s.lib(funcobject)
    323335  "PyFunction_New"
    324336  "PyFunction_GetCode"
     
    335347  "PyStaticMethod_Type"
    336348
    337 ; From python26_s.lib(genobject)
     349; From python27_s.lib(genobject)
    338350  "PyGen_New"
    339351  "PyGen_NeedsFinalizing"
    340352  "PyGen_Type"
    341353
    342 ; From python26_s.lib(intobject)
     354; From python27_s.lib(intobject)
    343355  "PyInt_AsLong"
    344356  "PyInt_AsUnsignedLongMask"
     
    355367  "PyInt_Type"
    356368
    357 ; From python26_s.lib(iterobject)
     369; From python27_s.lib(iterobject)
    358370  "PySeqIter_New"
    359371  "PyCallIter_New"
     
    361373  "PyCallIter_Type"
    362374
    363 ; From python26_s.lib(listobject)
     375; From python27_s.lib(listobject)
    364376  "PyList_New"
    365377  "PyList_Append"
     
    379391  "PyListRevIter_Type"
    380392
    381 ; From python26_s.lib(longobject)
     393; From python27_s.lib(longobject)
    382394  "PyLong_FromDouble"
    383395  "PyLong_AsLong"
     
    409421  "_PyLong_DigitValue"
    410422
    411 ; From python26_s.lib(methodobject)
     423; From python27_s.lib(methodobject)
    412424  "PyCFunction_Call"
    413425  "Py_FindMethodInChain"
     
    421433  "PyCFunction_Type"
    422434
    423 ; From python26_s.lib(moduleobject)
     435; From python27_s.lib(moduleobject)
    424436  "PyModule_New"
    425437  "_PyModule_Clear"
     
    429441  "PyModule_Type"
    430442
    431 ; From python26_s.lib(object)
     443; From python27_s.lib(object)
    432444  "Py_DivisionWarningFlag"
    433445  "PyObject_Str"
     
    482494  "_PyTrash_delete_later"
    483495
    484 ; From python26_s.lib(obmalloc)
     496; From python27_s.lib(obmalloc)
    485497  "PyObject_Malloc"
    486498  "PyObject_Free"
    487499  "PyObject_Realloc"
    488500
    489 ; From python26_s.lib(rangeobject)
     501; From python27_s.lib(rangeobject)
    490502  "PyRange_Type"
    491503
    492 ; From python26_s.lib(setobject)
     504; From python27_s.lib(setobject)
    493505  "PySet_Pop"
    494506  "PySet_New"
     
    505517  "PyFrozenSet_Type"
    506518
    507 ; From python26_s.lib(sliceobject)
     519; From python27_s.lib(sliceobject)
    508520  "_PySlice_FromIndices"
    509521  "PySlice_GetIndices"
     
    513525  "PySlice_Type"
    514526
    515 ; From python26_s.lib(stringobject)
     527; From python27_s.lib(stringobject)
    516528  "PyString_FromStringAndSize"
    517529  "PyString_InternInPlace"
     
    544556  "PyBaseString_Type"
    545557
    546 ; From python26_s.lib(structseq)
     558; From python27_s.lib(structseq)
    547559  "PyStructSequence_InitType"
    548560  "PyStructSequence_New"
    549561  "PyStructSequence_UnnamedField"
    550562
    551 ; From python26_s.lib(tupleobject)
     563; From python27_s.lib(tupleobject)
    552564  "PyTuple_New"
    553565  "PyTuple_Pack"
     
    561573  "PyTupleIter_Type"
    562574
    563 ; From python26_s.lib(typeobject)
     575; From python27_s.lib(typeobject)
    564576  "PyType_IsSubtype"
    565577  "_PyType_Lookup"
     
    572584  "PySuper_Type"
    573585
    574 ; From python26_s.lib(unicodeobject)
     586; From python27_s.lib(unicodeobject)
    575587  "PyUnicodeUCS2_Resize"
    576588  "PyUnicodeUCS2_FromOrdinal"
     
    638650  "PyUnicode_Type"
    639651
    640 ; From python26_s.lib(unicodectype)
     652; From python27_s.lib(unicodectype)
    641653  "_PyUnicode_TypeRecords"
    642654  "_PyUnicodeUCS2_ToNumeric"
     
    656668  "_PyUnicodeUCS2_IsAlpha"
    657669
    658 ; From python26_s.lib(weakrefobject)
     670; From python27_s.lib(weakrefobject)
    659671  "PyWeakref_NewRef"
    660672  "PyWeakref_NewProxy"
     
    667679  "_PyWeakref_CallableProxyType"
    668680
    669 ; From python26_s.lib(Python-ast)
     681; From python27_s.lib(Python-ast)
    670682;  "init_ast"
    671683  "Module"
     
    726738  "PyAST_mod2obj"
    727739
    728 ; From python26_s.lib(asdl)
     740; From python27_s.lib(asdl)
    729741  "asdl_seq_new"
    730742  "asdl_int_seq_new"
    731743
    732 ; From python26_s.lib(ast)
     744; From python27_s.lib(ast)
    733745  "PyAST_FromNode"
    734746
    735 ; From python26_s.lib(bltinmodule)
     747; From python27_s.lib(bltinmodule)
    736748  "_PyBuiltin_Init"
    737749  "Py_FileSystemDefaultEncoding"
    738750
    739 ; From python26_s.lib(exceptions)
     751; From python27_s.lib(exceptions)
    740752  "PyUnicodeEncodeError_GetStart"
    741753  "PyUnicodeDecodeError_GetStart"
     
    813825  "PyExc_MemoryErrorInst"
    814826
    815 ; From python26_s.lib(ceval)
     827; From python27_s.lib(ceval)
    816828  "PyEval_EvalFrameEx"
    817829  "PyEval_CallObjectWithKeywords"
     
    852864  "_Py_Ticker"
    853865
    854 ; From python26_s.lib(compile)
     866; From python27_s.lib(compile)
    855867  "_Py_Mangle"
    856868  "PyAST_Compile"
     
    858870  "Py_OptimizeFlag"
    859871
    860 ; From python26_s.lib(codecs)
     872; From python27_s.lib(codecs)
    861873  "_PyCodec_Lookup"
    862874  "PyCodec_Encode"
     
    877889  "PyCodec_StrictErrors"
    878890
    879 ; From python26_s.lib(errors)
     891; From python27_s.lib(errors)
    880892  "PyErr_SetNone"
    881893  "PyErr_SetString"
     
    903915  "PyErr_WarnExplicit"
    904916
    905 ; From python26_s.lib(frozen)
     917; From python27_s.lib(frozen)
    906918  "PyImport_FrozenModules"
    907919
    908 ; From python26_s.lib(frozenmain)
     920; From python27_s.lib(frozenmain)
    909921  "Py_FrozenMain"
    910922
    911 ; From python26_s.lib(future)
     923; From python27_s.lib(future)
    912924  "PyFuture_FromAST"
    913925
    914 ; From python26_s.lib(getargs)
     926; From python27_s.lib(getargs)
    915927  "PyArg_Parse"
    916928  "_PyArg_Parse_SizeT"
     
    926938  "_PyArg_VaParseTupleAndKeywords_SizeT"
    927939
    928 ; From python26_s.lib(getcompiler)
     940; From python27_s.lib(getcompiler)
    929941  "Py_GetCompiler"
    930942
    931 ; From python26_s.lib(getcopyright)
     943; From python27_s.lib(getcopyright)
    932944  "Py_GetCopyright"
    933945
    934 ; From python26_s.lib(getmtime)
    935   "PyOS_GetLastModificationTime"
    936 
    937 ; From python26_s.lib(getplatform)
     946; From python27_s.lib(getplatform)
    938947  "Py_GetPlatform"
    939948
    940 ; From python26_s.lib(getversion)
     949; From python27_s.lib(getversion)
    941950  "Py_GetVersion"
    942951
    943 ; From python26_s.lib(graminit)
     952; From python27_s.lib(graminit)
    944953  "_PyParser_Grammar"
    945954
    946 ; From python26_s.lib(import)
     955; From python27_s.lib(import)
    947956  "_PyImport_Init"
    948957  "_PyImportHooks_Init"
     
    971980  "_PyImport_Filetab"
    972981
    973 ; From python26_s.lib(importdl)
     982; From python27_s.lib(importdl)
    974983  "_PyImport_LoadDynamicModule"
    975984
    976 ; From python26_s.lib(marshal)
     985; From python27_s.lib(marshal)
    977986  "PyMarshal_ReadLongFromFile"
    978987  "PyMarshal_WriteObjectToString"
     
    985994  "PyMarshal_Init"
    986995
    987 ; From python26_s.lib(modsupport)
     996; From python27_s.lib(modsupport)
    988997  "Py_InitModule4"
    989998  "Py_BuildValue"
     
    9981007  "_Py_PackageContext"
    9991008
    1000 ; From python26_s.lib(mysnprintf)
     1009; From python27_s.lib(mysnprintf)
    10011010  "PyOS_snprintf"
    10021011  "PyOS_vsnprintf"
    10031012
    1004 ; From python26_s.lib(mystrtoul)
     1013; From python27_s.lib(mystrtoul)
    10051014  "PyOS_strtoul"
    10061015  "PyOS_strtol"
    10071016
    1008 ; From python26_s.lib(pyarena)
     1017; From python27_s.lib(pyarena)
    10091018  "PyArena_New"
    10101019  "PyArena_Free"
     
    10121021  "PyArena_AddPyObject"
    10131022
    1014 ; From python26_s.lib(pyfpe)
     1023; From python27_s.lib(pyfpe)
    10151024  "PyFPE_dummy"
    10161025
    1017 ; From python26_s.lib(pystate)
     1026; From python27_s.lib(pystate)
    10181027  "PyInterpreterState_Clear"
    10191028  "PyThreadState_Clear"
     
    10401049  "_PyThreadState_GetFrame"
    10411050
    1042 ; From python26_s.lib(pystrtod)
     1051; From python27_s.lib(pystrtod)
    10431052  "PyOS_ascii_strtod"
    10441053  "PyOS_ascii_formatd"
    10451054  "PyOS_ascii_atof"
    10461055
    1047 ; From python26_s.lib(pythonrun)
     1056; From python27_s.lib(pythonrun)
    10481057  "Py_IgnoreEnvironmentFlag"
    10491058  "Py_DebugFlag"
     
    11071116  "_Py_QnewFlag"
    11081117
    1109 ; From python26_s.lib(structmember)
     1118; From python27_s.lib(structmember)
    11101119  "PyMember_Get"
    11111120  "PyMember_GetOne"
     
    11131122  "PyMember_Set"
    11141123
    1115 ; From python26_s.lib(symtable)
     1124; From python27_s.lib(symtable)
    11161125  "PySymtable_Build"
    11171126  "PySymtable_Free"
     
    11201129  "PySTEntry_Type"
    11211130
    1122 ; From python26_s.lib(sysmodule)
     1131; From python27_s.lib(sysmodule)
    11231132  "_PySys_Init"
    11241133  "PySys_WriteStderr"
     
    11341143  "PySys_AddWarnOption"
    11351144
    1136 ; From python26_s.lib(traceback)
     1145; From python27_s.lib(traceback)
    11371146  "PyTraceBack_Here"
    11381147  "PyTraceBack_Print"
    11391148  "PyTraceBack_Type"
    11401149
    1141 ; From python26_s.lib(getopt)
     1150; From python27_s.lib(getopt)
    11421151  "_PyOS_GetOpt"
    11431152  "_PyOS_opterr"
     
    11451154  "_PyOS_optarg"
    11461155
    1147 ; From python26_s.lib(dynload_shlib)
     1156; From python27_s.lib(dynload_shlib)
    11481157  "_PyImport_DynLoadFiletab"
    11491158  "_PyImport_GetDynLoadFunc"
    11501159
    1151 ; From python26_s.lib(thread)
     1160; From python27_s.lib(thread)
    11521161  "PyThread_delete_key_value"
    11531162  "PyThread_init_thread"
     
    11651174  "PyThread_set_key_value"
    11661175  "PyThread_get_key_value"
    1167   "PyThread__exit_thread"
    1168 
    1169 ; From python26_s.lib(gcmodule)
     1176
     1177; From python27_s.lib(gcmodule)
    11701178;  "initgc"
    11711179  "_PyObject_GC_New"
     
    11831191  "_PyGC_generation0"
    11841192
    1185 ; From python26_s.lib(signalmodule)
     1193; From python27_s.lib(signalmodule)
    11861194;  "initsignal"
    11871195  "PyErr_CheckSignals"
     
    11921200  "PyOS_AfterFork"
    11931201
    1194 ; From python26_s.lib(posixmodule)
     1202; From python27_s.lib(posixmodule)
    11951203;  "initos2"
    11961204
    1197 ; From python26_s.lib(threadmodule)
     1205; From python27_s.lib(threadmodule)
    11981206;  "initthread"
    11991207
    1200 ; From python26_s.lib(arraymodule)
     1208; From python27_s.lib(arraymodule)
    12011209;  "initarray"
    12021210;  "array_methods"
    12031211
    1204 ; From python26_s.lib(binascii)
     1212; From python27_s.lib(binascii)
    12051213;  "initbinascii"
    12061214
    1207 ; From python26_s.lib(cmathmodule)
     1215; From python27_s.lib(cmathmodule)
    12081216;  "initcmath"
    12091217
    1210 ; From python26_s.lib(_codecsmodule)
     1218; From python27_s.lib(_codecsmodule)
    12111219;  "init_codecs"
    12121220
    1213 ; From python26_s.lib(collectionsmodule)
     1221; From python27_s.lib(collectionsmodule)
    12141222;  "initcollections"
    12151223  "dequeiter_type"
    12161224  "dequereviter_type"
    12171225
    1218 ; From python26_s.lib(cPickle)
     1226; From python27_s.lib(cPickle)
    12191227;  "initcPickle"
    12201228;  "fast_save_leave"
    12211229
    1222 ; From python26_s.lib(cStringIO)
     1230; From python27_s.lib(cStringIO)
    12231231;  "initcStringIO"
    12241232
    1225 ; From python26_s.lib(_csv)
     1233; From python27_s.lib(_csv)
    12261234;  "init_csv"
    12271235
    1228 ; From python26_s.lib(datetimemodule)
     1236; From python27_s.lib(datetimemodule)
    12291237;  "initdatetime"
    12301238
    1231 ; From python26_s.lib(dlmodule)
     1239; From python27_s.lib(dlmodule)
    12321240;  "initdl"
    12331241
    1234 ; From python26_s.lib(errnomodule)
     1242; From python27_s.lib(errnomodule)
    12351243;  "initerrno"
    12361244
    1237 ; From python26_s.lib(fcntlmodule)
     1245; From python27_s.lib(fcntlmodule)
    12381246;  "initfcntl"
    12391247
    1240 ; From python26_s.lib(_functoolsmodule)
     1248; From python27_s.lib(_functoolsmodule)
    12411249;  "init_functools"
    12421250
    1243 ; From python26_s.lib(_heapqmodule)
     1251; From python27_s.lib(_heapqmodule)
    12441252;  "init_heapq"
    12451253
    1246 ; From python26_s.lib(imageop)
     1254; From python27_s.lib(imageop)
    12471255;  "initimageop"
    12481256
    1249 ; From python26_s.lib(itertoolsmodule)
     1257; From python27_s.lib(itertoolsmodule)
    12501258;  "inititertools"
    12511259
    1252 ; From python26_s.lib(_localemodule)
     1260; From python27_s.lib(_localemodule)
    12531261;  "init_locale"
    12541262
    1255 ; From python26_s.lib(mathmodule)
     1263; From python27_s.lib(mathmodule)
    12561264;  "initmath"
    12571265
    1258 ; From python26_s.lib(md5)
     1266; From python27_s.lib(md5)
    12591267  "md5_finish"
    12601268  "md5_init"
    12611269  "md5_append"
    12621270
    1263 ; From python26_s.lib(md5module)
     1271; From python27_s.lib(md5module)
    12641272;  "init_md5"
    12651273
    1266 ; From python26_s.lib(operator)
     1274; From python27_s.lib(operator)
    12671275;  "initoperator"
    12681276
    1269 ; From python26_s.lib(_randommodule)
     1277; From python27_s.lib(_randommodule)
    12701278;  "init_random"
    12711279
    1272 ; From python26_s.lib(rgbimgmodule)
     1280; From python27_s.lib(rgbimgmodule)
    12731281;  "initrgbimg"
    12741282
    1275 ; From python26_s.lib(shamodule)
     1283; From python27_s.lib(shamodule)
    12761284;  "init_sha"
    12771285
    1278 ; From python26_s.lib(sha256module)
     1286; From python27_s.lib(sha256module)
    12791287;  "init_sha256"
    12801288
    1281 ; From python26_s.lib(sha512module)
     1289; From python27_s.lib(sha512module)
    12821290;  "init_sha512"
    12831291
    1284 ; From python26_s.lib(_sre)
     1292; From python27_s.lib(_sre)
    12851293;  "init_sre"
    12861294
    1287 ; From python26_s.lib(stropmodule)
     1295; From python27_s.lib(stropmodule)
    12881296;  "initstrop"
    12891297
    1290 ; From python26_s.lib(_struct)
     1298; From python27_s.lib(_struct)
    12911299;  "init_struct"
    12921300
    1293 ; From python26_s.lib(symtablemodule)
     1301; From python27_s.lib(symtablemodule)
    12941302;  "init_symtable"
    12951303
    1296 ; From python26_s.lib(termios)
     1304; From python27_s.lib(termios)
    12971305;  "inittermios"
    12981306
    1299 ; From python26_s.lib(timemodule)
     1307; From python27_s.lib(timemodule)
    13001308;  "inittime"
    13011309  "_PyTime_DoubleToTimet"
    13021310;  "inittimezone"
    13031311
    1304 ; From python26_s.lib(timingmodule)
     1312; From python27_s.lib(timingmodule)
    13051313;  "inittiming"
    13061314
    1307 ; From python26_s.lib(_weakref)
     1315; From python27_s.lib(_weakref)
    13081316;  "init_weakref"
    13091317
    1310 ; From python26_s.lib(xxsubtype)
     1318; From python27_s.lib(xxsubtype)
    13111319;  "initxxsubtype"
    13121320
    1313 ; From python26_s.lib(zipimport)
     1321; From python27_s.lib(zipimport)
    13141322;  "initzipimport"
  • python/vendor/current/PC/os2emx/pythonpm.c

    r2 r388  
    2828typedef struct
    2929{
    30         int argc;
    31         char **argv;
    32         HWND Frame;
    33         int running;
     30    int argc;
     31    char **argv;
     32    HWND Frame;
     33    int running;
    3434} arglist;
    3535
     
    4646main(int argc, char **argv)
    4747{
    48         ULONG FrameFlags = FCF_TITLEBAR |
    49                            FCF_SYSMENU |
    50                            FCF_SIZEBORDER |
    51                            FCF_HIDEBUTTON |
    52                            FCF_SHELLPOSITION |
    53                            FCF_TASKLIST;
    54         HAB hab;
    55         HMQ hmq;
    56         HWND Client;
    57         QMSG qmsg;
    58         arglist args;
    59         int python_tid;
     48    ULONG FrameFlags = FCF_TITLEBAR |
     49                       FCF_SYSMENU |
     50                       FCF_SIZEBORDER |
     51                       FCF_HIDEBUTTON |
     52                       FCF_SHELLPOSITION |
     53                       FCF_TASKLIST;
     54    HAB hab;
     55    HMQ hmq;
     56    HWND Client;
     57    QMSG qmsg;
     58    arglist args;
     59    int python_tid;
    6060
    61         /* init PM and create message queue */
    62         hab = WinInitialize(0);
    63         hmq = WinCreateMsgQueue(hab, 0);
     61    /* init PM and create message queue */
     62    hab = WinInitialize(0);
     63    hmq = WinCreateMsgQueue(hab, 0);
    6464
    65         /* create a (hidden) Window to house the window procedure */
    66         args.Frame = WinCreateStdWindow(HWND_DESKTOP,
    67                                         0,
    68                                         &FrameFlags,
    69                                         NULL,
    70                                         "PythonPM",
    71                                         0L,
    72                                         0,
    73                                         0,
    74                                         &Client);
     65    /* create a (hidden) Window to house the window procedure */
     66    args.Frame = WinCreateStdWindow(HWND_DESKTOP,
     67                                    0,
     68                                    &FrameFlags,
     69                                    NULL,
     70                                    "PythonPM",
     71                                    0L,
     72                                    0,
     73                                    0,
     74                                    &Client);
    7575
    76         /* run Python interpreter in a thread */
    77         args.argc = argc;
    78         args.argv = argv;
    79         args.running = 0;
    80         if (-1 == (python_tid = _beginthread(PythonThread, NULL, 1024 * 1024, &args)))
    81         {
    82                 /* couldn't start thread */
    83                 WinAlarm(HWND_DESKTOP, WA_ERROR);
    84                 PythonRC = 1;
    85         }
    86         else
    87         {
    88                 /* process PM messages, until Python exits */
    89                 while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
    90                         WinDispatchMsg(hab, &qmsg);
    91                 if (args.running > 0)
    92                         DosKillThread(python_tid);
    93         }
    94                
    95         /* destroy window, shutdown message queue and PM */
    96         WinDestroyWindow(args.Frame);
    97         WinDestroyMsgQueue(hmq);
    98         WinTerminate(hab);
     76    /* run Python interpreter in a thread */
     77    args.argc = argc;
     78    args.argv = argv;
     79    args.running = 0;
     80    if (-1 == (python_tid = _beginthread(PythonThread, NULL, 1024 * 1024, &args)))
     81    {
     82        /* couldn't start thread */
     83        WinAlarm(HWND_DESKTOP, WA_ERROR);
     84        PythonRC = 1;
     85    }
     86    else
     87    {
     88        /* process PM messages, until Python exits */
     89        while (WinGetMsg(hab, &qmsg, NULLHANDLE, 0, 0))
     90            WinDispatchMsg(hab, &qmsg);
     91        if (args.running > 0)
     92            DosKillThread(python_tid);
     93    }
    9994
    100         return PythonRC;
     95    /* destroy window, shutdown message queue and PM */
     96    WinDestroyWindow(args.Frame);
     97    WinDestroyMsgQueue(hmq);
     98    WinTerminate(hab);
     99
     100    return PythonRC;
    101101}
    102102
    103103void PythonThread(void *argl)
    104104{
    105         HAB hab;
    106         arglist *args;
     105    HAB hab;
     106    arglist *args;
    107107
    108         /* PM initialisation */
    109         hab = WinInitialize(0);
     108    /* PM initialisation */
     109    hab = WinInitialize(0);
    110110
    111         /* start Python */
    112         args = (arglist *)argl;
    113         args->running = 1;
    114         PythonRC = Py_Main(args->argc, args->argv);
     111    /* start Python */
     112    args = (arglist *)argl;
     113    args->running = 1;
     114    PythonRC = Py_Main(args->argc, args->argv);
    115115
    116         /* enter a critical section and send the termination message */
    117         DosEnterCritSec();
    118         args->running = 0;
    119         WinPostMsg(args->Frame, WM_QUIT, NULL, NULL);
     116    /* enter a critical section and send the termination message */
     117    DosEnterCritSec();
     118    args->running = 0;
     119    WinPostMsg(args->Frame, WM_QUIT, NULL, NULL);
    120120
    121         /* shutdown PM and terminate thread */
    122         WinTerminate(hab);
    123         _endthread();
     121    /* shutdown PM and terminate thread */
     122    WinTerminate(hab);
     123    _endthread();
    124124}
Note: See TracChangeset for help on using the changeset viewer.