now use the new argcargv.i

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5707 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-02-10 09:55:58 +00:00
commit 4e3d516cee
2 changed files with 9 additions and 32 deletions

View file

@ -187,7 +187,7 @@
#define def_float 1
#define def_double 1
#define def_char 'H'
#define def_pint (int*)0
#define def_pint 0
#define def_sizet 1
#define def_hello Hola
#define def_myint 1
@ -338,7 +338,6 @@ macro(size_t, pfx, sizet)
#ifdef SWIGPYTHON
%apply (char *STRING, int LENGTH) { (const char *str, size_t len) }
%apply (int ARGC, char **ARGV) { (size_t argc, const char **argv) }
#endif
%inline {
@ -398,15 +397,6 @@ macro(size_t, pfx, sizet)
return len;
}
int mainc(size_t argc, const char **argv)
{
return argc;
}
const char* mainv(size_t argc, const char **argv, int idx)
{
return argv[idx];
}
};

View file

@ -194,17 +194,13 @@ if t.var_namet != 'hol\0\0':
print "bad namet", t.var_namet
raise RuntimeError
largs=['hi','hola','hello']
if t.mainc(largs) != 3:
raise RuntimeError, "bad main typemap"
targs=('hi','hola')
if t.mainv(targs,1) != 'hola':
raise RuntimeError, "bad main typemap"
if t.strlen('hile') != 4:
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':
@ -250,31 +246,22 @@ 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":
raise RuntimeError, "bad char empty case"
raise RuntimeError, "bad pointer case"
cvar.var_namet = pc
if cvar.var_namet != "hola\0":
raise RuntimeError, "bad char empty case"
raise RuntimeError, "bad pointer case"
targs=('hi', pc)
if t.mainv(targs,1) != 'hola':
raise RuntimeError, "bad main typemap"
#
# Now when things should fail
#
try:
error = 0
t.mainv('hello',1)
error = 1
except TypeError:
pass
if error:
raise RuntimeError, "bad main typemap"
try:
error = 0