summaryrefslogtreecommitdiff
path: root/Examples/test-suite/scilab_consts.i
blob: 11f2504b7c71857785102d8eaf2aad536380fc0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
%module scilab_consts

/* Default mode: constants are wrapped as getter functions */
%scilabconst(0);

#define ICONST0   42
#define FCONST0   2.1828
#define CCONST0   'x'
#define CCONST0_2 '\n'
#define SCONST0   "Hello World"
#define SCONST0_2 "\"Hello World\""

/* Constants with type */
#define UNSIGNED0 0x5FFFU
#define LONG0 0x3FFF0000L
#define ULONG0 0x5FF0000UL

/* Expressions should work too */
#define EXPR0 ICONST0 + 3*FCONST0

/* This shouldn't do anything, bar is not defined */
#define BAR0 bar

/* SWIG directive %constant produces constants too */
%constant int iconst0 = 37;
%constant double fconst0 = 42.2;


/* Alternative mode: constants are wrapped as variables */
%scilabconst(1);

#define ICONST1   42
#define FCONST1   2.1828
#define CCONST1   'x'
#define CCONST1_2 '\n'
#define SCONST1   "Hello World"
#define SCONST1_2 "\"Hello World\""

/* Constants with type */
#define UNSIGNED1 0x5FFFU
#define LONG1 0x3FFF0000L
#define ULONG1 0x5FF0000UL

/* Expressions should work too */
#define EXPR1 ICONST1 + 3*FCONST1

/* This shouldn't do anything, bar is not defined */
#define BAR1 bar

/* SWIG directive %constant produces constants too */
%constant int iconst1 = 37;
%constant double fconst1 = 42.2;