a better way to deal with constants and enums and some change about the doc

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11515 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-08-08 13:25:29 +00:00
commit b1a384dc3c
10 changed files with 223 additions and 255 deletions

View file

@ -24,10 +24,5 @@
%constant int iconst = 37;
%constant double fconst = 3.14;
%inline %{
void constant_test(const int x) {
printf("%i", x);
}
%}

View file

@ -1,24 +1,23 @@
// loader the *.so
exec loader.sce;
exec example.sce;
printf("ICONST = %i (should be 42)\n", ICONST);
printf("FCONST = %f (should be 2.1828)\n", FCONST);
printf("CCONST = %c (should be ''x'')\n", CCONST);
printf("CCONST2 = %s (this should be on a new line)\n", CCONST2);
printf("SCONST = %s (should be ''Hello World'')\n", SCONST);
printf("SCONST2 = %s (should be "'""Hello World"""')\n", SCONST2);
printf("EXPR = %f (should be 48.5484)\n", EXPR);
printf("iconst = %i (should be 37)\n", iconst);
printf("fconst = %f (should be 3.14)\n", fconst);
printf("ICONST = %i (should be 42)\n", ICONST_get());
printf("FCONST = %f (should be 2.1828)\n", FCONST_get());
printf("CCONST = %c (should be ''x'')\n", CCONST_get());
printf("CCONST2 = %s (this should be on a new line)\n", CCONST2_get());
printf("SCONST = %s (should be ''Hello World'')\n", SCONST_get());
printf("SCONST2 = %s (should be "'""Hello World"""')\n", SCONST2_get());
printf("EXPR = %f (should be 48.5484)\n", EXPR_get());
printf("iconst = %i (should be 37)\n", iconst_get());
printf("fconst = %f (should be 3.14)\n", fconst_get());
try
printf("EXTERN = %s (Arg! This should not printf(anything)\n", EXTERN);
printf("EXTERN = %s (Arg! This should not printf(anything)\n", EXTERN_get());
catch
printf("EXTERN is not defined (good)\n");
end
try
printf("FOO = %i (Arg! This should not printf(anything)\n", FOO);
printf("FOO = %i (Arg! This should not printf(anything)\n", FOO_get());
catch
printf("FOO is not defined (good)\n");
end