summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2006-10-27 14:56:50 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2006-10-27 14:56:50 +0900
commit4deebb9ebba5b402f16d3ee8fedd3bdd35e467d8 (patch)
tree654725e9eb2e7601c197ecdd2fd2c7d415f11009
parent5cf4a57dd9703326a9acf5a192f0ef5ff612705a (diff)
downloadlibhangul-4deebb9ebba5b402f16d3ee8fedd3bdd35e467d8.tar.gz
hangul_ic_flush()의 바뀐점 적용
git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@84 8f00fcd2-89fc-0310-932e-b01be5b65e01
-rw-r--r--bindings/python/pyhangul.c21
-rw-r--r--bindings/python/setup.py4
2 files changed, 20 insertions, 5 deletions
diff --git a/bindings/python/pyhangul.c b/bindings/python/pyhangul.c
index b91944e..a500869 100644
--- a/bindings/python/pyhangul.c
+++ b/bindings/python/pyhangul.c
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <alloca.h>
-#include "../hangul/hangul.h"
+#include <hangul.h>
static PyObject *_pyhangul_error;
@@ -102,9 +102,24 @@ static PyObject *_pyhangulic_reset(PY_HANGULIC *self, PyObject *args)
static PyObject *_pyhangulic_flush(PY_HANGULIC *self, PyObject *args)
{
- hangul_ic_flush(self->hic);
+#ifndef Py_UNICODE_WIDE
+ int i;
+ Py_UNICODE *buf;
+#endif /* !Py_UNICODE_WIDE */
+ int len;
+ const ucschar *str;
- return Py_None;
+ str = hangul_ic_flush(self->hic);
+ len = ucscharlen(str);
+
+#ifdef Py_UNICODE_WIDE
+ return PyUnicode_FromUnicode((Py_UNICODE*)str, len);
+#else /* Py_UNICODE_WIDE */
+ buf = alloca(sizeof(Py_UNICODE) * len);
+ for (i = 0; i < len; i++)
+ buf[i] = str[i];
+ return PyUnicode_FromUnicode(buf, len);
+#endif /* Py_UNICODE_WIDE */
}
static PyObject *_pyhangulic_backspace(PY_HANGULIC *self, PyObject *args)
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 59add16..2725360 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -21,8 +21,8 @@ if sys.platform == "win32": # for MinGW
data_files = []
else:
- include_dirs = [ '../hangul' ]
- library_dirs = [ '../hangul/.libs' ]
+ include_dirs = [ '../../hangul' ]
+ library_dirs = [ '../../hangul/.libs' ]
libraries = ['hangul']
data_files = []