Have just one Scilab constants example
Same example as other languages, but using %scilabconst(1)
This commit is contained in:
parent
2831d891cd
commit
d3a54e50f8
8 changed files with 30 additions and 145 deletions
|
|
@ -1,14 +1,30 @@
|
|||
/* File : example.i */
|
||||
%module example
|
||||
|
||||
#define ICONST 42
|
||||
#define FCONST 2.1828
|
||||
#define SCONST "Hello World"
|
||||
/* Wraps enums and constants as Scilab variables (instead of functions) */
|
||||
%scilabconst(1);
|
||||
|
||||
// Constants expressions are also accepted
|
||||
#define EXPR ICONST + 3*FCONST
|
||||
/* A few preprocessor macros */
|
||||
|
||||
#define ICONST 42
|
||||
#define FCONST 2.1828
|
||||
#define CCONST 'x'
|
||||
#define CCONST2 '\n'
|
||||
#define SCONST "Hello World"
|
||||
#define SCONST2 "\"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 */
|
||||
|
||||
// SWIG also offers to define constants
|
||||
%constant int iconst = 37;
|
||||
%constant double fconst = 42.2;
|
||||
%constant double fconst = 3.14;
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue