diff options
author | Simon Marchetto <simon.marchetto@scilab-enterprises.com> | 2014-02-17 16:29:11 +0100 |
---|---|---|
committer | Simon Marchetto <simon.marchetto@scilab-enterprises.com> | 2014-02-17 16:29:11 +0100 |
commit | 4aa870c318747364d048fa8b0d70f7305fecf12c (patch) | |
tree | 3f26d93b48f427682dfeb522da739df1b0166a51 /Examples/scilab | |
parent | d8135e738758705f47593938a7bbf769e04bdfdf (diff) | |
download | swig-4aa870c318747364d048fa8b0d70f7305fecf12c.tar.gz |
scilab: remove constants tests from example
Diffstat (limited to 'Examples/scilab')
-rw-r--r-- | Examples/scilab/constants/example.i | 28 | ||||
-rw-r--r-- | Examples/scilab/constants/runme.sci | 16 |
2 files changed, 9 insertions, 35 deletions
diff --git a/Examples/scilab/constants/example.i b/Examples/scilab/constants/example.i index 77434fc34..36e6d83c1 100644 --- a/Examples/scilab/constants/example.i +++ b/Examples/scilab/constants/example.i @@ -1,29 +1,17 @@ /* File : example.i */ %module example -/* Forces to wrap constants as Scilab variables (instead of functions) */ +/* Wraps constants as Scilab variables (instead of getter functions) */ %scilabconst(1); -#define ICONST 42 -#define FCONST 2.1828 -#define CCONST 'x' -#define CCONST2 '\n' -#define SCONST "Hello World" -#define SCONST2 "\"Hello World\"" +#define ICONST 42 +#define FCONST 2.1828 +#define SCONST "Hello World" -/* This should work just fine */ -#define EXPR ICONST + 3*(FCONST) - -/* This shouldn't do anything */ -#define EXTERN extern - -/* Neither should this (BAR isn't defined) */ -#define FOO (ICONST + BAR) - -/* The following directives also produce constants */ +// Constants expressions are also accepted +#define EXPR ICONST + 3*FCONST +// SWIG also offers to define constants %constant int iconst = 37; -%constant double fconst = 3.14; - - +%constant double fconst = 42.2; diff --git a/Examples/scilab/constants/runme.sci b/Examples/scilab/constants/runme.sci index 788da828b..9b83a004c 100644 --- a/Examples/scilab/constants/runme.sci +++ b/Examples/scilab/constants/runme.sci @@ -6,23 +6,9 @@ example_Init(); printf("\nConstants are wrapped by functions:\n"); printf("ICONST = %i (should be 42)\n", ICONST); printf("FCONST = %5.4f (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 = %5.4f (should be 48.5484)\n", EXPR); printf("iconst = %i (should be 37)\n", iconst); -printf("fconst = %3.2f (should be 3.14)\n", fconst); - -try - printf("EXTERN = %s (Arg! This should not printf(anything)\n", EXTERN); -catch - printf("EXTERN is not defined (good)\n"); -end -try - printf("FOO = %i (Arg! This should not printf(anything)\n", FOO); -catch - printf("FOO is not defined (good)\n"); -end +printf("fconst = %3.2f (should be 42.20)\n", fconst); exit |