comparison src/if_python3.c @ 2340:99c1eba60b2d vim73

Make automatic prototype generation work with more interfaces.
author Bram Moolenaar <bram@vim.org>
date Sun, 18 Jul 2010 18:04:50 +0200
parents ea4bf6df1a8a
children f6540762173d
comparison
equal deleted inserted replaced
2339:01e4b4d37842 2340:99c1eba60b2d
40 40
41 #ifdef _DEBUG 41 #ifdef _DEBUG
42 # undef _DEBUG 42 # undef _DEBUG
43 #endif 43 #endif
44 44
45 #define PY_SSIZE_T_CLEAN
46
47 #ifdef F_BLANK
48 # undef F_BLANK
49 #endif
50
45 #ifdef HAVE_STDARG_H 51 #ifdef HAVE_STDARG_H
46 # undef HAVE_STDARG_H /* Python's config.h defines it as well. */ 52 # undef HAVE_STDARG_H /* Python's config.h defines it as well. */
47 #endif 53 #endif
48
49 #define PY_SSIZE_T_CLEAN
50
51 #ifdef F_BLANK
52 # undef F_BLANK
53 #endif
54
55 #ifdef _POSIX_C_SOURCE /* defined in feature.h */ 54 #ifdef _POSIX_C_SOURCE /* defined in feature.h */
56 # undef _POSIX_C_SOURCE 55 # undef _POSIX_C_SOURCE
56 #endif
57 #ifdef _XOPEN_SOURCE
58 # undef _XOPEN_SOURCE /* pyconfig.h defines it as well. */
57 #endif 59 #endif
58 60
59 #include <Python.h> 61 #include <Python.h>
60 #if defined(MACOS) && !defined(MACOS_X_UNIX) 62 #if defined(MACOS) && !defined(MACOS_X_UNIX)
61 # include "macglue.h" 63 # include "macglue.h"
434 static Py_ssize_t RangeEnd; 436 static Py_ssize_t RangeEnd;
435 437
436 static void PythonIO_Flush(void); 438 static void PythonIO_Flush(void);
437 static int PythonIO_Init(void); 439 static int PythonIO_Init(void);
438 static void PythonIO_Fini(void); 440 static void PythonIO_Fini(void);
439 PyMODINIT_FUNC Py3Init_vim(void); 441 static PyMODINIT_FUNC Py3Init_vim(void);
440 442
441 /* Utility functions for the vim/python interface 443 /* Utility functions for the vim/python interface
442 * ---------------------------------------------- 444 * ----------------------------------------------
443 */ 445 */
444 static PyObject *GetBufferLine(buf_T *, Py_ssize_t); 446 static PyObject *GetBufferLine(buf_T *, Py_ssize_t);
628 theend: 630 theend:
629 return; /* keeps lint happy */ 631 return; /* keeps lint happy */
630 } 632 }
631 633
632 /* 634 /*
633 * ":python" 635 * ":python3"
634 */ 636 */
635 void ex_python3(exarg_T *eap) 637 void ex_python3(exarg_T *eap)
636 { 638 {
637 char_u *script; 639 char_u *script;
638 640
648 } 650 }
649 651
650 #define BUFFER_SIZE 2048 652 #define BUFFER_SIZE 2048
651 653
652 /* 654 /*
653 * ":pyfile" 655 * ":py3file"
654 */ 656 */
655 void 657 void
656 ex_py3file(exarg_T *eap) 658 ex_py3file(exarg_T *eap)
657 { 659 {
658 static char buffer[BUFFER_SIZE]; 660 static char buffer[BUFFER_SIZE];
2218 2220
2219 PyDoc_STRVAR(vim_module_doc,"vim python interface\n"); 2221 PyDoc_STRVAR(vim_module_doc,"vim python interface\n");
2220 2222
2221 static struct PyModuleDef vimmodule; 2223 static struct PyModuleDef vimmodule;
2222 2224
2223 PyMODINIT_FUNC Py3Init_vim(void) 2225 static PyMODINIT_FUNC Py3Init_vim(void)
2224 { 2226 {
2225 PyObject *mod; 2227 PyObject *mod;
2226 /* The special value is removed from sys.path in Python3_Init(). */ 2228 /* The special value is removed from sys.path in Python3_Init(). */
2227 static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL}; 2229 static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL};
2228 2230