On Fri, 26 Sep 2003, Frank Gevaerts wrote:
> Here it is. Contact me if you need more information
It looks like a varargs problem to me. Please try the attached patch and
let me know if it works. Also, please note if there are any errors when
compiling luaextl/luaextl.c.
What I'm trying to do is explained here, under "Varargs and coercion":
<http://www.qnx.com/developer/docs/momentics621_docs/neutrino/lib_ref/v/va_arg.html>.
diff -urN ion-devel-0.0.20030814.orig/luaextl/luaextl.c
ion-devel-0.0.20030814/luaextl/luaextl.c
--- ion-devel-0.0.20030814.orig/luaextl/luaextl.c 2003-09-26 19:36:52.000000000
+0200
+++ ion-devel-0.0.20030814/luaextl/luaextl.c 2003-09-26 22:39:41.000000000 +0200
@@ -777,13 +777,26 @@
bool extl_table_get_vararg(ExtlTab ref, char itype, char type, va_list args)
{
TableParams2 params;
+ bool result;
+#ifdef CF_HAS_VA_COPY
+ va_list tmp;
+#endif
params.ref=ref;
params.itype=itype;
params.type=type;
+#ifdef CF_HAS_VA_COPY
+ va_copy(tmp, args);
+ params.argsp=&tmp;
+#else
params.argsp=&args;
+#endif
- return extl_cpcall(l_st, (ExtlCPCallFn*)extl_table_dodo_get2, ¶ms);
+ result = extl_cpcall(l_st, (ExtlCPCallFn*)extl_table_dodo_get2, ¶ms);
+#ifdef CF_HAS_VA_COPY
+ va_end(tmp);
+#endif
+ return result;
}
@@ -930,13 +943,26 @@
bool extl_table_set_vararg(ExtlTab ref, char itype, char type, va_list args)
{
TableParams2 params;
+ bool result;
+#ifdef CF_HAS_VA_COPY
+ va_list tmp;
+#endif
params.ref=ref;
params.itype=itype;
params.type=type;
+#ifdef CF_HAS_VA_COPY
+ va_copy(tmp, args);
+ params.argsp=&tmp;
+#else
params.argsp=&args;
+#endif
- return extl_cpcall(l_st, (ExtlCPCallFn*)extl_table_dodo_set2, ¶ms);
+ result = extl_cpcall(l_st, (ExtlCPCallFn*)extl_table_dodo_set2, ¶ms);
+#ifdef CF_HAS_VA_COPY
+ va_end(tmp);
+#endif
+ return result;
}
@@ -1043,13 +1069,26 @@
bool extl_table_clear_vararg(ExtlTab ref, char itype, va_list args)
{
TableParams2 params;
+ bool result;
+#ifdef CF_HAS_VA_COPY
+ va_list tmp;
+#endif
params.ref=ref;
params.itype=itype;
/*params.type='?';*/
+#ifdef CF_HAS_VA_COPY
+ va_copy(tmp, args);
+ params.argsp=&tmp;
+#else
params.argsp=&args;
+#endif
- return extl_cpcall(l_st, (ExtlCPCallFn*)extl_table_dodo_clear2, ¶ms);
+ result = extl_cpcall(l_st, (ExtlCPCallFn*)extl_table_dodo_clear2, ¶ms);
+#ifdef CF_HAS_VA_COPY
+ va_end(tmp);
+#endif
+ return result;
}
bool extl_table_clear(ExtlTab ref, char itype, ...)
@@ -1241,16 +1280,29 @@
const char *rspec, va_list args)
{
ExtlDoCallParam param;
+ bool result;
+#ifdef CF_HAS_VA_COPY
+ va_list tmp;
+#endif
if(fnref==LUA_NOREF || fnref==LUA_REFNIL)
return FALSE;
param.spec=spec;
param.rspec=rspec;
+#ifdef CF_HAS_VA_COPY
+ va_copy(tmp, args);
+ param.args=&tmp;
+#else
param.args=&args;
+#endif
param.misc=(void*)&fnref;
- return extl_cpcall_call(l_st, (ExtlCPCallFn*)extl_do_call_vararg, ¶m);
+ result = extl_cpcall_call(l_st, (ExtlCPCallFn*)extl_do_call_vararg, ¶m);
+#ifdef CF_HAS_VA_COPY
+ va_end(tmp);
+#endif
+ return result;
}
@@ -1284,13 +1336,26 @@
const char *rspec, va_list
args)
{
ExtlDoCallParam param;
+ bool result;
+#ifdef CF_HAS_VA_COPY
+ va_list tmp;
+#endif
param.spec=spec;
param.rspec=rspec;
+#ifdef CF_HAS_VA_COPY
+ va_copy(tmp, args);
+ param.args=&tmp;
+#else
param.args=&args;
+#endif
param.misc=(void*)name;
- return extl_cpcall_call(l_st, (ExtlCPCallFn*)extl_do_call_named_vararg,
- ¶m);
+ result = extl_cpcall_call(l_st, (ExtlCPCallFn*)extl_do_call_named_vararg,
+ ¶m);
+#ifdef CF_HAS_VA_COPY
+ va_end(tmp);
+#endif
+ return result;
}