scilab: constants example same as in other languages
This commit is contained in:
parent
bb4b6742eb
commit
d8a0594254
2 changed files with 6 additions and 9 deletions
|
|
@ -1,9 +1,6 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
/* Wraps constants as Scilab variables (instead of getter functions) */
|
||||
%scilabconst(1);
|
||||
|
||||
#define ICONST 42
|
||||
#define FCONST 2.1828
|
||||
#define SCONST "Hello World"
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ exec loader.sce;
|
|||
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("SCONST = ''%s'' (should be ''Hello World'')\n", SCONST);
|
||||
printf("EXPR = %5.4f (should be 48.5484)\n", EXPR);
|
||||
printf("iconst = %i (should be 37)\n", iconst);
|
||||
printf("fconst = %3.2f (should be 42.20)\n", fconst);
|
||||
printf("ICONST_get() = %i (should be 42)\n", ICONST_get());
|
||||
printf("FCONST_get() = %5.4f (should be 2.1828)\n", FCONST_get());
|
||||
printf("SCONST_get() = ''%s'' (should be ''Hello World'')\n", SCONST_get());
|
||||
printf("EXPR_get() = %5.4f (should be 48.5484)\n", EXPR_get());
|
||||
printf("iconst_get() = %i (should be 37)\n", iconst_get());
|
||||
printf("fconst_get() = %3.2f (should be 42.20)\n", fconst_get());
|
||||
|
||||
exit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue