mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Some VS 6.0 compatibility fixes from Hirokazu Yamamoto which are also useful for later versions of MSVC. VS6 claims that fortran is a reserved word
This commit is contained in:
parent
8fd7b0c1a7
commit
c36625b05d
6 changed files with 19 additions and 6 deletions
|
@ -570,11 +570,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
error (i.e. the object does not have a buffer interface or
|
error (i.e. the object does not have a buffer interface or
|
||||||
it is not working).
|
it is not working).
|
||||||
|
|
||||||
If fortran is 'F', then if the object is multi-dimensional,
|
If fort is 'F', then if the object is multi-dimensional,
|
||||||
then the data will be copied into the array in
|
then the data will be copied into the array in
|
||||||
Fortran-style (first dimension varies the fastest). If
|
Fortran-style (first dimension varies the fastest). If
|
||||||
fortran is 'C', then the data will be copied into the array
|
fort is 'C', then the data will be copied into the array
|
||||||
in C-style (last dimension varies the fastest). If fortran
|
in C-style (last dimension varies the fastest). If fort
|
||||||
is 'A', then it does not matter and the copy will be made
|
is 'A', then it does not matter and the copy will be made
|
||||||
in whatever way is more efficient.
|
in whatever way is more efficient.
|
||||||
|
|
||||||
|
@ -585,7 +585,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
/* Copy the data from the src buffer to the buffer of destination
|
/* Copy the data from the src buffer to the buffer of destination
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fortran);
|
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort);
|
||||||
|
|
||||||
|
|
||||||
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
|
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
|
||||||
|
@ -595,7 +595,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
|
||||||
char fort);
|
char fort);
|
||||||
|
|
||||||
/* Fill the strides array with byte-strides of a contiguous
|
/* Fill the strides array with byte-strides of a contiguous
|
||||||
(Fortran-style if fortran is 'F' or C-style otherwise)
|
(Fortran-style if fort is 'F' or C-style otherwise)
|
||||||
array of the given shape with the given number of bytes
|
array of the given shape with the given number of bytes
|
||||||
per element.
|
per element.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
/* Windows socket errors (WSA*) */
|
/* Windows socket errors (WSA*) */
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ extern void bzero(void *, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <winsock.h>
|
# include <winsock.h>
|
||||||
#else
|
#else
|
||||||
# define SOCKET int
|
# define SOCKET int
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
# define HAVE_GETNAMEINFO
|
# define HAVE_GETNAMEINFO
|
||||||
# define ENABLE_IPV6
|
# define ENABLE_IPV6
|
||||||
#else
|
#else
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
# include <winsock.h>
|
# include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3530,7 +3530,7 @@ long_getnewargs(PyLongObject *v)
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
long_getN(PyLongObject *v, void *context) {
|
long_getN(PyLongObject *v, void *context) {
|
||||||
return PyLong_FromLong((intptr_t)context);
|
return PyLong_FromLong((Py_intptr_t)context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
|
|
|
@ -145,6 +145,7 @@ msvcrt_getch(PyObject *self, PyObject *args)
|
||||||
return PyString_FromStringAndSize(s, 1);
|
return PyString_FromStringAndSize(s, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1300
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_getwch(PyObject *self, PyObject *args)
|
msvcrt_getwch(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -160,6 +161,7 @@ msvcrt_getwch(PyObject *self, PyObject *args)
|
||||||
u[0] = ch;
|
u[0] = ch;
|
||||||
return PyUnicode_FromUnicode(u, 1);
|
return PyUnicode_FromUnicode(u, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_getche(PyObject *self, PyObject *args)
|
msvcrt_getche(PyObject *self, PyObject *args)
|
||||||
|
@ -177,6 +179,7 @@ msvcrt_getche(PyObject *self, PyObject *args)
|
||||||
return PyString_FromStringAndSize(s, 1);
|
return PyString_FromStringAndSize(s, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1300
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_getwche(PyObject *self, PyObject *args)
|
msvcrt_getwche(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -192,6 +195,7 @@ msvcrt_getwche(PyObject *self, PyObject *args)
|
||||||
s[0] = ch;
|
s[0] = ch;
|
||||||
return PyUnicode_FromUnicode(s, 1);
|
return PyUnicode_FromUnicode(s, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_putch(PyObject *self, PyObject *args)
|
msvcrt_putch(PyObject *self, PyObject *args)
|
||||||
|
@ -207,6 +211,7 @@ msvcrt_putch(PyObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1300
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_putwch(PyObject *self, PyObject *args)
|
msvcrt_putwch(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -225,6 +230,7 @@ msvcrt_putwch(PyObject *self, PyObject *args)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_ungetch(PyObject *self, PyObject *args)
|
msvcrt_ungetch(PyObject *self, PyObject *args)
|
||||||
|
@ -240,6 +246,7 @@ msvcrt_ungetch(PyObject *self, PyObject *args)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _MSC_VER >= 1300
|
||||||
static PyObject *
|
static PyObject *
|
||||||
msvcrt_ungetwch(PyObject *self, PyObject *args)
|
msvcrt_ungetwch(PyObject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
|
@ -253,6 +260,7 @@ msvcrt_ungetwch(PyObject *self, PyObject *args)
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
insertint(PyObject *d, char *name, int value)
|
insertint(PyObject *d, char *name, int value)
|
||||||
|
@ -341,10 +349,12 @@ static struct PyMethodDef msvcrt_functions[] = {
|
||||||
{"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS},
|
{"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS},
|
||||||
{"set_error_mode", msvcrt_seterrormode, METH_VARARGS},
|
{"set_error_mode", msvcrt_seterrormode, METH_VARARGS},
|
||||||
#endif
|
#endif
|
||||||
|
#if _MSC_VER >= 1300
|
||||||
{"getwch", msvcrt_getwch, METH_VARARGS},
|
{"getwch", msvcrt_getwch, METH_VARARGS},
|
||||||
{"getwche", msvcrt_getwche, METH_VARARGS},
|
{"getwche", msvcrt_getwche, METH_VARARGS},
|
||||||
{"putwch", msvcrt_putwch, METH_VARARGS},
|
{"putwch", msvcrt_putwch, METH_VARARGS},
|
||||||
{"ungetwch", msvcrt_ungetwch, METH_VARARGS},
|
{"ungetwch", msvcrt_ungetwch, METH_VARARGS},
|
||||||
|
#endif
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue