/trunk/Examples/test-suite/simple_array.i
Swig | 42 lines | 30 code | 12 blank | 0 comment | 0 complexity | 1a214d4bc92dc6d2241c70b8c571436c MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- %module simple_array
- extern int x[10];
- extern double y[7];
- %inline %{
- struct BarArray {
- int i;
- double d;
- };
- extern struct BarArray bars[2];
- int x[10];
- double y[7];
- struct BarArray bars[2];
- void
- initArray()
- {
- int i, n;
- n = sizeof(x)/sizeof(x[0]);
- for(i = 0; i < n; i++)
- x[i] = i;
- n = sizeof(y)/sizeof(y[0]);
- for(i = 0; i < n; i++)
- y[i] = ((double) i)/ ((double) n);
- n = sizeof(bars)/sizeof(bars[0]);
- for(i = 0; i < n; i++) {
- bars[i].i = x[i+2];
- bars[i].d = y[i+2];
- }
- return;
- }
- %}