summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChoe Hwanjin <choe.hwanjin@gmail.com>2008-01-31 22:23:21 +0900
committerChoe Hwanjin <choe.hwanjin@gmail.com>2008-01-31 22:23:21 +0900
commit87cf2a1cdb1ea5a1e0468b572037744026b4715c (patch)
tree94bc508d9bb0a9a08a1139cfc693725ce7c7a34b
parent09c45f38dce45e6922c74fcdb2a977608fa971d4 (diff)
downloadlibhangul-87cf2a1cdb1ea5a1e0468b572037744026b4715c.tar.gz
python binding update:
* MinGW include, lib path 업데이트 (#304663) * pyhangul.c 새로운 api에 맞게 수정 (#304665) * test 코드도 새로운 api에 맞게 수정 (#304667) git-svn-id: http://kldp.net/svn/hangul/libhangul/trunk@150 8f00fcd2-89fc-0310-932e-b01be5b65e01
-rw-r--r--bindings/python/pyhangul.c10
-rw-r--r--bindings/python/setup.py4
-rw-r--r--bindings/python/test_pyhangul.py6
3 files changed, 7 insertions, 13 deletions
diff --git a/bindings/python/pyhangul.c b/bindings/python/pyhangul.c
index a500869..0139376 100644
--- a/bindings/python/pyhangul.c
+++ b/bindings/python/pyhangul.c
@@ -35,9 +35,9 @@ static int ucscharlen(const ucschar *str)
static PyObject *_create_ic(PY_HANGUL *self, PyObject *args)
{
PY_HANGULIC *imObject;
- int keyboard;
+ const char* keyboard = NULL;
- if(!PyArg_ParseTuple(args,"i",&keyboard)) {
+ if(!PyArg_ParseTuple(args,"s",&keyboard)) {
PyErr_SetString(_pyhangul_error,
"Usage: create_ic(keyboard)\n"
"\tkeyboard: hangul2, hangul3{2,90,f,s}");
@@ -65,12 +65,6 @@ void inithangul(void)
PyObject *m, *d;
m = Py_InitModule("hangul", _pyhangul_methods);
- PyModule_AddIntConstant(m, "hangul2", HANGUL_KEYBOARD_2);
- PyModule_AddIntConstant(m, "hangul32", HANGUL_KEYBOARD_32);
- PyModule_AddIntConstant(m, "hangul390", HANGUL_KEYBOARD_390);
- PyModule_AddIntConstant(m, "hangul3f", HANGUL_KEYBOARD_3FINAL);
- PyModule_AddIntConstant(m, "hangul3s", HANGUL_KEYBOARD_3NOSHIFT);
- /* PyModule_AddIntConstant(m, "Hangul3_Yetgeul", HANGUL_KEYBOARD_3YETGUL); */
d = PyModule_GetDict(m);
_pyhangul_error = PyErr_NewException("_pyhangul.error", NULL, NULL);
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 2725360..f353e4f 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -15,8 +15,8 @@ Operating System :: Unix
"""
if sys.platform == "win32": # for MinGW
- include_dirs = [r'\MinGW\include', r'..\hangul']
- library_dirs = [r'\MinGW\lib', r'..\hangul']
+ include_dirs = [r'\MinGW\include', r'..\..\hangul']
+ library_dirs = [r'\MinGW\lib', r'..\..\hangul']
libraries = ['hangul']
data_files = []
diff --git a/bindings/python/test_pyhangul.py b/bindings/python/test_pyhangul.py
index 9fd5b24..448b2e3 100644
--- a/bindings/python/test_pyhangul.py
+++ b/bindings/python/test_pyhangul.py
@@ -9,18 +9,18 @@ import unittest
class TestHangul(unittest.TestCase):
def setUp(self):
- self.ic = hangul.create_ic(hangul.hangul2)
+ self.ic = hangul.create_ic('hangul2')
def testSimpleString(self):
input = u"vkdlTjs gksrmf fkdlqmfjfl xptmxm"
output = u"파이썬 한글 라이브러리 테스트"
buffer = u''
for i in input:
- ret = self.ic.filter(ord(i))
+ ret = self.ic.process(ord(i))
buffer += self.ic.commit_string()
if not ret:
buffer += str(i)
- self.ic.flush()
+ buffer += self.ic.flush()
buffer += self.ic.commit_string()
self.assertEqual(output, buffer)