diff --git a/Doc/Manual/Scilab.html b/Doc/Manual/Scilab.html index d759786b1..215dae55c 100644 --- a/Doc/Manual/Scilab.html +++ b/Doc/Manual/Scilab.html @@ -408,9 +408,8 @@ ans = 4
- C constants are not really constant in Scilab. When dealing with the constants, a get function will be generated. For example given some constants: +There is no constant in Scilab. By default, C/C++ constants are wrapped as getter functions. For example for the following constants:
@@ -423,7 +422,9 @@ ans = 4 #define SCONST2 "\"Hello World\""
It is easy to use them in Scilab:
++The following getter functions are generated: +
--> exec loader.sce; @@ -448,33 +449,98 @@ ans= 37 ans= 3.14
The way SWIG deals with the enums is similar to constants. For example: +
+There is another mode in which constants are wrapped as Scilab variables. +The variables are easier to use than functions, but the little drawback is that variables are not constant and so can be modified. +This mode can be enabled/disabled at any time in the interface file with the feature %scilabconst() (argument value "1" to enable, "0" to disable). +For example in this mode the previous constants:
-%module example
-typedef enum { RED, BLUE, GREEN } color;
+
+%module example
+
+%scilabconst(1);
+#define ICONST 42
+#define FCONST 2.1828
+#define CCONST 'x'
+#define CCONST2 '\n'
+#define SCONST "Hello World"
+#define SCONST2 "\"Hello World\""
- Some code like RED_get(), BLUE_get(),GREEN_get() will be generated. It can be used as the following:
+Are mapped to Scilab variables, with the same name:
+
+--> exec loader.sce;
+--> ICONST;
+ans= 42
+--> FCONST;
+ans= 2.1828
+--> CCONST;
+ans=x
+--> CCONST2;
+ans=
+
+--> SCONST;
+ans= Hello World
+--> SCONST2;
+ans= "Hello World"
+--> EXPR;
+ans= 48.5484
+--> iconst;
+ans= 37
+--> fconst;
+ans= 3.14
+
+
+37.3.8 Enums
+
+
+The wrapping of enums is quite the same as for constants.
+In the default mode, the enums are wrapped as getter functions.
+For example on the following enumeration:
+
+
+%module example
+typedef enum { RED, BLUE, GREEN } color;
+
+
+
+A getter function will be generated for each value of the enumeration:
+
--> exec loader.sce;
--> printf(" RED = %i\n", RED_get());
- RED = 0
-
+ RED = 0.
--> printf(" BLUE = %i\n", BLUE_get());
- BLUE = 1
-
+ BLUE = 1.
--> printf(" GREEN = %i\n", GREEN_get());
- GREEN = 2
+ GREEN = 2.
+
+The feature %scilabconst() is also available for enumerations:
+
+
+%module example
+%scilabconst(1);
+typedef enum { RED, BLUE, GREEN } color;
+
+
+
+
+--> exec loader.sce;
+--> printf(" RED = %i\n", RED);
+ RED = 0.
+--> printf(" BLUE = %i\n", BLUE);
+ BLUE = 1.
+--> printf(" GREEN = %i\n", GREEN);
+ GREEN = 2.
+
+
37.3.9 Pointers