Added some missing multi-argument typemaps: (char *STRING, size_t LENGTH) and (char *STRING, int LENGTH) - Java patch is from Volker Grabsch. Elements of the primitive_types.i testcase for this moved into char_binary.i. Documentation for this enhanced.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12393 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9adb494558
commit
ef865e06d5
15 changed files with 194 additions and 37 deletions
36
Examples/test-suite/python/char_binary_runme.py
Normal file
36
Examples/test-suite/python/char_binary_runme.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
from char_binary import *
|
||||
|
||||
t = Test()
|
||||
if t.strlen('hile') != 4:
|
||||
print t.strlen('hile')
|
||||
raise RuntimeError, "bad multi-arg typemap"
|
||||
|
||||
if t.strlen('hil\0') != 4:
|
||||
raise RuntimeError, "bad multi-arg typemap"
|
||||
|
||||
#
|
||||
# creating a raw char*
|
||||
#
|
||||
pc = new_pchar(5)
|
||||
pchar_setitem(pc, 0, 'h')
|
||||
pchar_setitem(pc, 1, 'o')
|
||||
pchar_setitem(pc, 2, 'l')
|
||||
pchar_setitem(pc, 3, 'a')
|
||||
pchar_setitem(pc, 4, 0)
|
||||
|
||||
|
||||
if t.strlen(pc) != 4:
|
||||
raise RuntimeError, "bad multi-arg typemap"
|
||||
|
||||
cvar.var_pchar = pc
|
||||
if cvar.var_pchar != "hola":
|
||||
print cvar.var_pchar
|
||||
raise RuntimeError, "bad pointer case"
|
||||
|
||||
cvar.var_namet = pc
|
||||
#if cvar.var_namet != "hola\0":
|
||||
if cvar.var_namet != "hola":
|
||||
raise RuntimeError, "bad pointer case"
|
||||
|
||||
delete_pchar(pc)
|
||||
|
||||
|
|
@ -188,14 +188,6 @@ if t.var_namet != 'hol':
|
|||
raise RuntimeError
|
||||
|
||||
|
||||
if t.strlen('hile') != 4:
|
||||
print t.strlen('hile')
|
||||
raise RuntimeError, "bad string typemap"
|
||||
|
||||
if t.strlen('hil\0') != 4:
|
||||
raise RuntimeError, "bad string typemap"
|
||||
|
||||
|
||||
cvar.var_char = '\0'
|
||||
if cvar.var_char != '\0':
|
||||
raise RuntimeError, "bad char '0' case"
|
||||
|
|
@ -244,9 +236,6 @@ pchar_setitem(pc, 3, 'a')
|
|||
pchar_setitem(pc, 4, 0)
|
||||
|
||||
|
||||
if t.strlen(pc) != 4:
|
||||
raise RuntimeError, "bad string typemap"
|
||||
|
||||
cvar.var_pchar = pc
|
||||
if cvar.var_pchar != "hola":
|
||||
print cvar.var_pchar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue