python: function needed to make both ucs2 and ucs4 python builds work

db4
Björn Lindqvist 2014-01-20 19:24:22 +01:00 committed by John Benediktsson
parent da1ef0ae95
commit bd8d0b5d84
2 changed files with 6 additions and 3 deletions

View File

@ -34,6 +34,9 @@ FUNCTION: PyObject* PyImport_AddModule ( c-string name ) ;
FUNCTION: long PyImport_GetMagicNumber ( ) ;
FUNCTION: PyObject* PyImport_ImportModule ( c-string name ) ;
! Sys module
FUNCTION: PyObject* PySys_GetObject ( c-string name ) ;
! Dicts
FUNCTION: PyObject* PyDict_GetItemString ( PyObject* d, c-string key ) ;
FUNCTION: PyObject* PyDict_New ( ) ;
@ -70,7 +73,7 @@ FUNCTION: PyObject* PyObject_GetAttrString ( PyObject* callable,
FUNCTION: PyObject* PyObject_Str ( PyObject* o ) ;
! Strings
FUNCTION: void* PyString_AsString ( PyObject* string ) ;
FUNCTION: c-string PyString_AsString ( PyObject* string ) ;
FUNCTION: PyObject* PyString_FromString ( c-string v ) ;
! Unicode

View File

@ -86,7 +86,7 @@ ERROR: python-error type message ;
! Data marshalling to Python
GENERIC: (>py) ( obj -- obj' )
M: string (>py) PyUnicodeUCS4_FromString ;
M: string (>py) PyUnicodeUCS2_FromString ;
M: math:fixnum (>py) PyLong_FromLong ;
M: math:float (>py) PyFloat_FromDouble ;
@ -125,7 +125,7 @@ DEFER: >factor
dup py-tuple-size iota [ py-tuple-get-item >factor ] with map
] }
{ "unicode" [
PyUnicodeUCS4_AsUTF8String (check-return)
PyUnicodeUCS2_AsUTF8String (check-return)
PyString_AsString (check-return)
] }
} clone ;