PageRenderTime 8ms CodeModel.GetById 2ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/arrays_global_twodim.i

#
Swig | 61 lines | 45 code | 13 blank | 3 comment | 0 complexity | 9ec491645a2058a905f668718347d719 MD5 | raw file
 1/*
 2Two dimension arrays
 3*/
 4
 5%module arrays_global_twodim
 6
 7%inline %{
 8#define ARRAY_LEN_X 2
 9#define ARRAY_LEN_Y 4
10
11typedef enum {One, Two, Three, Four, Five} finger;
12
13typedef struct {
14    double         double_field;
15} SimpleStruct;
16
17char           array_c [ARRAY_LEN_X][ARRAY_LEN_Y];
18signed char    array_sc[ARRAY_LEN_X][ARRAY_LEN_Y];
19unsigned char  array_uc[ARRAY_LEN_X][ARRAY_LEN_Y];
20short          array_s [ARRAY_LEN_X][ARRAY_LEN_Y];
21unsigned short array_us[ARRAY_LEN_X][ARRAY_LEN_Y];
22int            array_i [ARRAY_LEN_X][ARRAY_LEN_Y];
23unsigned int   array_ui[ARRAY_LEN_X][ARRAY_LEN_Y];
24long           array_l [ARRAY_LEN_X][ARRAY_LEN_Y];
25unsigned long  array_ul[ARRAY_LEN_X][ARRAY_LEN_Y];
26long long      array_ll[ARRAY_LEN_X][ARRAY_LEN_Y];
27float          array_f [ARRAY_LEN_X][ARRAY_LEN_Y];
28double         array_d [ARRAY_LEN_X][ARRAY_LEN_Y];
29SimpleStruct   array_struct[ARRAY_LEN_X][ARRAY_LEN_Y];
30SimpleStruct*  array_structpointers[ARRAY_LEN_X][ARRAY_LEN_Y];
31int*           array_ipointers [ARRAY_LEN_X][ARRAY_LEN_Y];
32finger         array_enum[ARRAY_LEN_X][ARRAY_LEN_Y];
33finger*        array_enumpointers[ARRAY_LEN_X][ARRAY_LEN_Y];
34const int      array_const_i[ARRAY_LEN_X][ARRAY_LEN_Y] = { {10, 11, 12, 13}, {14, 15, 16, 17} };
35
36void fn_taking_arrays(SimpleStruct array_struct[ARRAY_LEN_X][ARRAY_LEN_Y]) {}
37
38int get_2d_array(int (*array)[ARRAY_LEN_Y], int x, int y){
39    return array[x][y];
40}
41%}
42
43#ifdef __cplusplus
44%inline 
45{
46
47  struct Material
48  {
49  };
50
51  enum {
52    Size = 32
53  };
54  
55  const Material * chitMat[Size][Size];
56  Material hitMat_val[Size][Size];
57  Material *hitMat[Size][Size];
58}
59
60#endif
61