add 'funcptr, inctest, integers, preproc, name' testcases and fix the empty testcase

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11566 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-08-14 09:22:36 +00:00
commit 0623fdff8b
7 changed files with 78 additions and 10 deletions

View file

@ -1152,7 +1152,10 @@ SCILAB = @SCILAB@
scilab: $(SRCS)
$(SWIG) -scilab $(SWIGOPT) $(INTERFACEPATH)
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce
if [ -f builder.sce ]; then \
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH SCILABPATH=$(srcdir):$$SCILABPATH $(SCILAB) -nwni -nb -f builder.sce; \
fi
# -----------------------------------------------------------------
# Running a Scilab example
# -----------------------------------------------------------------

View file

@ -0,0 +1,6 @@
exec loader.sce;
if add(7, 9) <> 16 then pause, end
if do_op(7, 9, funcvar_get()) <> 16 then pause, end
exit

View file

@ -0,0 +1,19 @@
exec loader.sce;
try
a = new_A();
catch
printf("did not find A\ntherefore, I did not include ""testdir/subdir1/hello.i""\n");
end
try
b = new_B();
catch
printf("did not find B\ntherefore, I did not include ""testdir/subdir2/hello.i""\n");
end
if importtest1(5) <> 15 then pause, end
if importtest2("black") <> "white" then pause, end
exit

View file

@ -0,0 +1,13 @@
exec loader.sce;
if signed_char_identity(-13) <> -13 then pause, end
if unsigned_char_identity(251) <> 251 then pause, end
if signed_short_identity(-31000) <> -31000 then pause, end
if unsigned_short_identity(61000) <> 61000 then pause, end
if signed_int_identity(42) <> 42 then pause, end
if unsigned_int_identity(123456) <> 123456 then pause, end
if signed_long_identity(65537) <> 65537 then pause, end
if unsigned_long_identity(654321) <> 654321 then pause, end
exit

View file

@ -0,0 +1,7 @@
exec loader.sce;
foo_2();
if bar_2_get() <> 17 then pause, end
if Baz_2_get() <> 47 then pause, end
exit

View file

@ -0,0 +1,8 @@
exec loader.sce;
if endif_get() <> 1 then pause, end
if define_get() <> 1 then pause, end
if defined_get() <> 1 then pause ,end
if 2 * one_get() <> two_get() then pause, end
exit

View file

@ -26,10 +26,11 @@ private:
File *f_init;
String *f_builder_code;
bool hasfunction_flag;
public:
SCILAB():
f_builder_code(NewString("")) {
f_builder_code(NewString("")), hasfunction_flag(false) {
allow_overloading();
}
@ -110,14 +111,19 @@ public:
Language::top(n);
/* create the file to generate the module: "builder.sce" */
Printf(f_builder_code, "];\n");
Printf(f_builder_code, "ilib_build(ilib_name,table,files,libs);\n");
Printf(f_builder_code, "exit");
File *f_builder=NewFile(NewStringf("%sbuilder.sce", SWIG_output_directory()), "w", SWIG_output_files());
Printv(f_builder, f_builder_code, NIL);
Close(f_builder);
Delete(f_builder);
Delete(f_builder_code);
if(hasfunction_flag) {
Printf(f_builder_code, "];\n");
Printf(f_builder_code, "ilib_build(ilib_name,table,files,libs);\n");
Printf(f_builder_code, "exit");
File *f_builder=NewFile(NewStringf("%sbuilder.sce", SWIG_output_directory()), "w", SWIG_output_files());
Printv(f_builder, f_builder_code, NIL);
Close(f_builder);
Delete(f_builder);
Delete(f_builder_code);
}
else {
Delete(f_builder_code);
}
/* Dump out all the files */
SwigType_emit_type_table(f_runtime, f_wrappers);
@ -143,6 +149,8 @@ public:
virtual int functionWrapper(Node *n) {
hasfunction_flag = true;
/* A new wrapper function object */
Wrapper *f = NewWrapper();
Parm *p;
@ -366,6 +374,8 @@ public:
virtual int variableWrapper(Node *n) {
hasfunction_flag = true;
/* Get the useful information from the node */
String *name = Getattr(n, "name");
String *iname = Getattr(n, "sym:name");
@ -479,6 +489,8 @@ public:
virtual int constantWrapper(Node *n) {
hasfunction_flag = true;
/* Get the useful information from the node */
String *name = Getattr(n, "name");
String *iname = Getattr(n, "sym:name");