Karsten Hopp 8e0a01
To: vim_dev@googlegroups.com
Karsten Hopp 8e0a01
Subject: Patch 7.3.581
Karsten Hopp 8e0a01
Fcc: outbox
Karsten Hopp 8e0a01
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 8e0a01
Mime-Version: 1.0
Karsten Hopp 8e0a01
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 8e0a01
Content-Transfer-Encoding: 8bit
Karsten Hopp 8e0a01
------------
Karsten Hopp 8e0a01
Karsten Hopp 8e0a01
Patch 7.3.581
Karsten Hopp 8e0a01
Problem:    Problems compiling with Python.
Karsten Hopp 8e0a01
Solution:   Pick UCS2 or UCS4 function at runtime. (lilydjwg)
Karsten Hopp 8e0a01
Files:	    src/if_python.c
Karsten Hopp 8e0a01
Karsten Hopp 8e0a01
Karsten Hopp 8e0a01
*** ../vim-7.3.580/src/if_python.c	2012-06-29 16:28:23.000000000 +0200
Karsten Hopp 8e0a01
--- src/if_python.c	2012-06-29 19:10:53.000000000 +0200
Karsten Hopp 8e0a01
***************
Karsten Hopp 8e0a01
*** 196,202 ****
Karsten Hopp 8e0a01
  # define PyString_Size dll_PyString_Size
Karsten Hopp 8e0a01
  # define PyString_Type (*dll_PyString_Type)
Karsten Hopp 8e0a01
  # define PyUnicode_Type (*dll_PyUnicode_Type)
Karsten Hopp 8e0a01
! # define PyUnicodeUCS4_AsEncodedString (*dll_PyUnicodeUCS4_AsEncodedString)
Karsten Hopp 8e0a01
  # define PyFloat_AsDouble dll_PyFloat_AsDouble
Karsten Hopp 8e0a01
  # define PyFloat_FromDouble dll_PyFloat_FromDouble
Karsten Hopp 8e0a01
  # define PyFloat_Type (*dll_PyFloat_Type)
Karsten Hopp 8e0a01
--- 196,203 ----
Karsten Hopp 8e0a01
  # define PyString_Size dll_PyString_Size
Karsten Hopp 8e0a01
  # define PyString_Type (*dll_PyString_Type)
Karsten Hopp 8e0a01
  # define PyUnicode_Type (*dll_PyUnicode_Type)
Karsten Hopp 8e0a01
! # undef PyUnicode_AsEncodedString
Karsten Hopp 8e0a01
! # define PyUnicode_AsEncodedString py_PyUnicode_AsEncodedString
Karsten Hopp 8e0a01
  # define PyFloat_AsDouble dll_PyFloat_AsDouble
Karsten Hopp 8e0a01
  # define PyFloat_FromDouble dll_PyFloat_FromDouble
Karsten Hopp 8e0a01
  # define PyFloat_Type (*dll_PyFloat_Type)
Karsten Hopp 8e0a01
***************
Karsten Hopp 8e0a01
*** 290,296 ****
Karsten Hopp 8e0a01
  static PyInt(*dll_PyString_Size)(PyObject *);
Karsten Hopp 8e0a01
  static PyTypeObject* dll_PyString_Type;
Karsten Hopp 8e0a01
  static PyTypeObject* dll_PyUnicode_Type;
Karsten Hopp 8e0a01
! static PyObject *(*PyUnicodeUCS4_AsEncodedString)(PyObject *, char *, char *);
Karsten Hopp 8e0a01
  static double(*dll_PyFloat_AsDouble)(PyObject *);
Karsten Hopp 8e0a01
  static PyObject*(*dll_PyFloat_FromDouble)(double);
Karsten Hopp 8e0a01
  static PyTypeObject* dll_PyFloat_Type;
Karsten Hopp 8e0a01
--- 291,297 ----
Karsten Hopp 8e0a01
  static PyInt(*dll_PyString_Size)(PyObject *);
Karsten Hopp 8e0a01
  static PyTypeObject* dll_PyString_Type;
Karsten Hopp 8e0a01
  static PyTypeObject* dll_PyUnicode_Type;
Karsten Hopp 8e0a01
! static PyObject *(*py_PyUnicode_AsEncodedString)(PyObject *, char *, char *);
Karsten Hopp 8e0a01
  static double(*dll_PyFloat_AsDouble)(PyObject *);
Karsten Hopp 8e0a01
  static PyObject*(*dll_PyFloat_FromDouble)(double);
Karsten Hopp 8e0a01
  static PyTypeObject* dll_PyFloat_Type;
Karsten Hopp 8e0a01
***************
Karsten Hopp 8e0a01
*** 406,412 ****
Karsten Hopp 8e0a01
      {"PyString_Size", (PYTHON_PROC*)&dll_PyString_Size},
Karsten Hopp 8e0a01
      {"PyString_Type", (PYTHON_PROC*)&dll_PyString_Type},
Karsten Hopp 8e0a01
      {"PyUnicode_Type", (PYTHON_PROC*)&dll_PyUnicode_Type},
Karsten Hopp 8e0a01
-     {"PyUnicodeUCS4_AsEncodedString", (PYTHON_PROC*)&dll_PyUnicodeUCS4_AsEncodedString},
Karsten Hopp 8e0a01
      {"PyFloat_Type", (PYTHON_PROC*)&dll_PyFloat_Type},
Karsten Hopp 8e0a01
      {"PyFloat_AsDouble", (PYTHON_PROC*)&dll_PyFloat_AsDouble},
Karsten Hopp 8e0a01
      {"PyFloat_FromDouble", (PYTHON_PROC*)&dll_PyFloat_FromDouble},
Karsten Hopp 8e0a01
--- 407,412 ----
Karsten Hopp 8e0a01
***************
Karsten Hopp 8e0a01
*** 471,476 ****
Karsten Hopp 8e0a01
--- 471,477 ----
Karsten Hopp 8e0a01
  python_runtime_link_init(char *libname, int verbose)
Karsten Hopp 8e0a01
  {
Karsten Hopp 8e0a01
      int i;
Karsten Hopp 8e0a01
+     void *ucs_as_encoded_string;
Karsten Hopp 8e0a01
  
Karsten Hopp 8e0a01
  #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
Karsten Hopp 8e0a01
      /* Can't have Python and Python3 loaded at the same time.
Karsten Hopp 8e0a01
***************
Karsten Hopp 8e0a01
*** 506,511 ****
Karsten Hopp 8e0a01
--- 507,531 ----
Karsten Hopp 8e0a01
  	    return FAIL;
Karsten Hopp 8e0a01
  	}
Karsten Hopp 8e0a01
      }
Karsten Hopp 8e0a01
+ 
Karsten Hopp 8e0a01
+     /* Load unicode functions separately as only the ucs2 or the ucs4 functions
Karsten Hopp 8e0a01
+      * will be present in the library. */
Karsten Hopp 8e0a01
+     ucs_as_encoded_string = symbol_from_dll(hinstPython,
Karsten Hopp 8e0a01
+ 					     "PyUnicodeUCS2_AsEncodedString");
Karsten Hopp 8e0a01
+     if (ucs_as_encoded_string == NULL)
Karsten Hopp 8e0a01
+ 	ucs_as_encoded_string = symbol_from_dll(hinstPython,
Karsten Hopp 8e0a01
+ 					     "PyUnicodeUCS4_AsEncodedString");
Karsten Hopp 8e0a01
+     if (ucs_as_encoded_string != NULL)
Karsten Hopp 8e0a01
+ 	py_PyUnicode_AsEncodedString = ucs_as_encoded_string;
Karsten Hopp 8e0a01
+     else
Karsten Hopp 8e0a01
+     {
Karsten Hopp 8e0a01
+ 	close_dll(hinstPython);
Karsten Hopp 8e0a01
+ 	hinstPython = 0;
Karsten Hopp 8e0a01
+ 	if (verbose)
Karsten Hopp 8e0a01
+ 	    EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*");
Karsten Hopp 8e0a01
+ 	return FAIL;
Karsten Hopp 8e0a01
+     }
Karsten Hopp 8e0a01
+ 
Karsten Hopp 8e0a01
      return OK;
Karsten Hopp 8e0a01
  }
Karsten Hopp 8e0a01
  
Karsten Hopp 8e0a01
*** ../vim-7.3.580/src/version.c	2012-06-29 17:51:58.000000000 +0200
Karsten Hopp 8e0a01
--- src/version.c	2012-06-29 19:13:47.000000000 +0200
Karsten Hopp 8e0a01
***************
Karsten Hopp 8e0a01
*** 716,717 ****
Karsten Hopp 8e0a01
--- 716,719 ----
Karsten Hopp 8e0a01
  {   /* Add new patch number below this line */
Karsten Hopp 8e0a01
+ /**/
Karsten Hopp 8e0a01
+     581,
Karsten Hopp 8e0a01
  /**/
Karsten Hopp 8e0a01
Karsten Hopp 8e0a01
-- 
Karsten Hopp 8e0a01
ASCII stupid question, get a stupid ANSI.
Karsten Hopp 8e0a01
Karsten Hopp 8e0a01
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 8e0a01
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 8e0a01
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 8e0a01
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///