Kaydet (Commit) a43190bc authored tarafından Martin v. Löwis's avatar Martin v. Löwis

Patch #1492356: Port to Windows CE (patch set 1).

üst f90347fd
......@@ -35,7 +35,9 @@
#endif
#include <string.h>
#ifndef DONT_HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
......
......@@ -685,4 +685,16 @@ typedef struct fd_set {
#pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED)
#endif
/*
* Older Microsoft compilers don't support the C99 long long literal suffixes,
* so these will be defined in PC/pyconfig.h for those compilers.
*/
#ifndef Py_LL
#define Py_LL(x) x##LL
#endif
#ifndef Py_ULL
#define Py_ULL(x) Py_LL(x##U)
#endif
#endif /* Py_PYPORT_H */
......@@ -167,6 +167,7 @@ John DuBois
Paul Dubois
Quinn Dunkan
Robin Dunn
Luke Dunstan
Andy Dustman
Gary Duzan
Eugene Dvurechenski
......
......@@ -81,6 +81,8 @@ Library
Build
-----
- Patch #1492356: Port to Windows CE.
- Bug/Patch #1481770: Use .so extension for shared libraries on HP-UX for ia64.
- Patch #1471883: Add --enable-universalsdk.
......
......@@ -12,11 +12,14 @@ This software comes with no warranty. Use at your own risk.
#include "Python.h"
#include <stdio.h>
#include <errno.h>
#include <locale.h>
#include <string.h>
#include <ctype.h>
#ifndef DONT_HAVE_ERRNO_H
#include <errno.h>
#endif
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
#endif
......
......@@ -10,8 +10,10 @@
#endif
#if defined(MS_WINDOWS) || defined(__CYGWIN__)
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#endif
#if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS)
#define PYTHONHOMEHELP "<prefix>\\lib"
......
......@@ -4789,7 +4789,7 @@ _PyPopen(char *cmdstring, int mode, int n)
switch (mode & (_O_RDONLY | _O_TEXT | _O_BINARY | _O_WRONLY)) {
case _O_WRONLY | _O_TEXT:
/* Case for writing to child Stdin in text mode. */
fd1 = _open_osfhandle((intptr_t)hChildStdinWrDup, mode);
fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode);
f1 = _fdopen(fd1, "w");
f = PyFile_FromFile(f1, cmdstring, "w", _PyPclose);
PyFile_SetBufSize(f, 0);
......@@ -4800,7 +4800,7 @@ _PyPopen(char *cmdstring, int mode, int n)
case _O_RDONLY | _O_TEXT:
/* Case for reading from child Stdout in text mode. */
fd1 = _open_osfhandle((intptr_t)hChildStdoutRdDup, mode);
fd1 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode);
f1 = _fdopen(fd1, "r");
f = PyFile_FromFile(f1, cmdstring, "r", _PyPclose);
PyFile_SetBufSize(f, 0);
......@@ -4811,7 +4811,7 @@ _PyPopen(char *cmdstring, int mode, int n)
case _O_RDONLY | _O_BINARY:
/* Case for readinig from child Stdout in binary mode. */
fd1 = _open_osfhandle((intptr_t)hChildStdoutRdDup, mode);
fd1 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode);
f1 = _fdopen(fd1, "rb");
f = PyFile_FromFile(f1, cmdstring, "rb", _PyPclose);
PyFile_SetBufSize(f, 0);
......@@ -4822,7 +4822,7 @@ _PyPopen(char *cmdstring, int mode, int n)
case _O_WRONLY | _O_BINARY:
/* Case for writing to child Stdin in binary mode. */
fd1 = _open_osfhandle((intptr_t)hChildStdinWrDup, mode);
fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode);
f1 = _fdopen(fd1, "wb");
f = PyFile_FromFile(f1, cmdstring, "wb", _PyPclose);
PyFile_SetBufSize(f, 0);
......@@ -4848,9 +4848,9 @@ _PyPopen(char *cmdstring, int mode, int n)
m2 = "wb";
}
fd1 = _open_osfhandle((intptr_t)hChildStdinWrDup, mode);
fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode);
f1 = _fdopen(fd1, m2);
fd2 = _open_osfhandle((intptr_t)hChildStdoutRdDup, mode);
fd2 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode);
f2 = _fdopen(fd2, m1);
p1 = PyFile_FromFile(f1, cmdstring, m2, _PyPclose);
PyFile_SetBufSize(p1, 0);
......@@ -4880,11 +4880,11 @@ _PyPopen(char *cmdstring, int mode, int n)
m2 = "wb";
}
fd1 = _open_osfhandle((intptr_t)hChildStdinWrDup, mode);
fd1 = _open_osfhandle((Py_intptr_t)hChildStdinWrDup, mode);
f1 = _fdopen(fd1, m2);
fd2 = _open_osfhandle((intptr_t)hChildStdoutRdDup, mode);
fd2 = _open_osfhandle((Py_intptr_t)hChildStdoutRdDup, mode);
f2 = _fdopen(fd2, m1);
fd3 = _open_osfhandle((intptr_t)hChildStderrRdDup, mode);
fd3 = _open_osfhandle((Py_intptr_t)hChildStderrRdDup, mode);
f3 = _fdopen(fd3, m1);
p1 = PyFile_FromFile(f1, cmdstring, m2, _PyPclose);
p2 = PyFile_FromFile(f2, cmdstring, m1, _PyPclose);
......@@ -5488,7 +5488,7 @@ PyDoc_STRVAR(posix_waitpid__doc__,
static PyObject *
posix_waitpid(PyObject *self, PyObject *args)
{
intptr_t pid;
Py_intptr_t pid;
int status, options;
if (!PyArg_ParseTuple(args, "ii:waitpid", &pid, &options))
......
This diff is collapsed.
......@@ -14,6 +14,7 @@ the following #defines
MS_WIN64 - Code specific to the MS Win64 API
MS_WIN32 - Code specific to the MS Win32 (and Win64) API (obsolete, this covers all supported APIs)
MS_WINDOWS - Code specific to Windows, but all versions.
MS_WINCE - Code specific to Windows CE
Py_ENABLE_SHARED - Code if the Python core is built as a DLL.
Also note that neither "_M_IX86" or "_MSC_VER" should be used for
......@@ -27,6 +28,10 @@ MS_CORE_DLL.
*/
#ifdef _WIN32_WCE
#define MS_WINCE
#endif
/* Visual Studio 2005 introduces deprecation warnings for
"insecure" and POSIX functions. The insecure functions should
be replaced by *_s versions (according to Microsoft); the
......@@ -37,15 +42,23 @@ MS_CORE_DLL.
#define _CRT_SECURE_NO_DEPRECATE 1
#define _CRT_NONSTDC_NO_DEPRECATE 1
#include <io.h>
/* Windows CE does not have these */
#ifndef MS_WINCE
#define HAVE_IO_H
#define HAVE_SYS_UTIME_H
#define HAVE_HYPOT
#define HAVE_TEMPNAM
#define HAVE_TMPFILE
#define HAVE_TMPNAM
#define HAVE_CLOCK
#define HAVE_STRFTIME
#define HAVE_STRERROR
#endif
#ifdef HAVE_IO_H
#include <io.h>
#endif
#define HAVE_HYPOT
#define HAVE_STRFTIME
#define DONT_HAVE_SIG_ALARM
#define DONT_HAVE_SIG_PAUSE
#define LONG_BIT 32
......@@ -64,6 +77,11 @@ MS_CORE_DLL.
#define USE_SOCKET
#endif
#ifdef MS_WINCE
#define DONT_HAVE_SYS_STAT_H
#define DONT_HAVE_ERRNO_H
#endif
/* Compiler specific defines */
/* ------------------------------------------------------------------------*/
......@@ -117,6 +135,11 @@ MS_CORE_DLL.
#endif
#endif /* MS_WIN64 */
/* _W64 is not defined for VC6 or eVC4 */
#ifndef _W64
#define _W64
#endif
/* Define like size_t, omitting the "unsigned" */
#ifdef MS_WIN64
typedef __int64 ssize_t;
......@@ -297,11 +320,16 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#define SIZEOF_LONG_LONG 8
/* VC 7.1 has them and VC 6.0 does not. VC 6.0 has a version number of 1200.
Microsoft eMbedded Visual C++ 4.0 has a version number of 1201 and doesn't
define these.
If some compiler does not provide them, modify the #if appropriately. */
#if defined(_MSC_VER)
#if _MSC_VER > 1200
#if _MSC_VER > 1201
#define HAVE_UINTPTR_T 1
#define HAVE_INTPTR_T 1
#else
/* VC6 & eVC4 don't support the C99 LL suffix for 64-bit integer literals */
#define Py_LL(x) x##I64
#endif /* _MSC_VER > 1200 */
#endif /* _MSC_VER */
......@@ -397,7 +425,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* #define HAVE_ALTZONE */
/* Define if you have the putenv function. */
#ifndef MS_WINCE
#define HAVE_PUTENV
#endif
/* Define if your compiler supports function prototypes */
#define HAVE_PROTOTYPES
......@@ -445,7 +475,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
#define HAVE_DYNAMIC_LOADING
/* Define if you have ftime. */
#ifndef MS_WINCE
#define HAVE_FTIME
#endif
/* Define if you have getpeername. */
#define HAVE_GETPEERNAME
......@@ -454,7 +486,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* #undef HAVE_GETPGRP */
/* Define if you have getpid. */
#ifndef MS_WINCE
#define HAVE_GETPID
#endif
/* Define if you have gettimeofday. */
/* #undef HAVE_GETTIMEOFDAY */
......@@ -511,13 +545,17 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* #undef HAVE_WAITPID */
/* Define to 1 if you have the `wcscoll' function. */
#ifndef MS_WINCE
#define HAVE_WCSCOLL 1
#endif
/* Define if you have the <dlfcn.h> header file. */
/* #undef HAVE_DLFCN_H */
/* Define if you have the <fcntl.h> header file. */
#ifndef MS_WINCE
#define HAVE_FCNTL_H 1
#endif
/* Define if you have the <stdarg.h> prototypes. */
#define HAVE_STDARG_PROTOTYPES
......
......@@ -170,7 +170,7 @@ bootstrap(void *call)
long
PyThread_start_new_thread(void (*func)(void *), void *arg)
{
uintptr_t rv;
Py_uintptr_t rv;
callobj obj;
dprintf(("%ld: PyThread_start_new_thread called\n",
......@@ -186,7 +186,7 @@ PyThread_start_new_thread(void (*func)(void *), void *arg)
return -1;
rv = _beginthread(bootstrap, 0, &obj); /* use default stack size */
if (rv == (uintptr_t)-1) {
if (rv == (Py_uintptr_t)-1) {
/* I've seen errno == EAGAIN here, which means "there are
* too many threads".
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment