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