PageRenderTime 11ms CodeModel.GetById 9ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/tags/rel-1-3-29/SWIG/Examples/test-suite/cpp_broken.i

#
Swig | 75 lines | 56 code | 17 blank | 2 comment | 0 complexity | a6013352cbf9904f4836b2a374a6a75b MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
 1%module cpp_broken
 2
 3
 4// bug #1060789
 5%inline %{
 6#define MASK(shift, size) (((1 << (size)) - 1) << (shift))
 7#define SOME_MASK_DEF (80*MASK(8, 10))
 8%}
 9
10// bug #1060079
11%inline %{
12#define FIELD(name, width) unsigned int name:width
13#define SOME_CONST 2
14#define NEXT_CONST (2 * SOME_CONST)
15
16typedef struct {
17FIELD(a, SOME_CONST);
18FIELD(b, NEXT_CONST);
19} MyStruct_t;
20%}
21
22%{
23#ifdef max
24#undef max
25#endif
26%}
27
28// bug #994301
29%inline %{
30#define max(a,b) ((a) > (b) ? (a) : (b))
31%}
32
33
34// bug #940318
35%inline %{
36typedef enum {
37eZero = 0
38#define ONE 1
39} EFoo;
40%}
41
42
43// bug #754443
44
45%inline %{
46#define MAG_STYLE_BORDER_OFFS 0
47#define MAG_STYLE_BORDER_BITS 3
48#define MAG_STYLE_BORDER_MASK (((1UL<<MAG_STYLE_BORDER_BITS)-1)<<MAG_STYLE_BORDER_OFFS)
49
50/* these CANNOT be combined */
51#define MAG_STYLE_BORDER_NONE       (1 << MAG_STYLE_BORDER_OFFS)
52#define MAG_STYLE_BORDER_STATIC     (2 << MAG_STYLE_BORDER_OFFS)
53#define MAG_STYLE_BORDER_SIMPLE     (3 << MAG_STYLE_BORDER_OFFS)
54#define MAG_STYLE_BORDER_RAISED     (4 << MAG_STYLE_BORDER_OFFS)
55#define MAG_STYLE_BORDER_DOUBLE     (5 << MAG_STYLE_BORDER_OFFS)
56#define MAG_STYLE_BORDER_DEFAULT    MAG_STYLE_BORDER_SIMPLE
57
58
59#define MAG_STYLE_CAPTION_OFFS ( MAG_STYLE_BORDER_OFFS + MAG_STYLE_BORDER_BITS )
60#define MAG_STYLE_CAPTION_BITS 8
61#define MAG_STYLE_CAPTION_MASK (((1UL<<MAG_STYLE_CAPTION_BITS)-1)<<MAG_STYLE_CAPTION_OFFS)
62
63/* these CAN be combined */
64#define MAG_STYLE_CAPTION_NONE      ( 1 << ( 0 + MAG_STYLE_CAPTION_OFFS ))
65#define MAG_STYLE_CAPTION_PRESENT   ( 1 << ( 1 + MAG_STYLE_CAPTION_OFFS ))
66#define MAG_STYLE_CAPTION_SYSMENU   ( 1 << ( 2 + MAG_STYLE_CAPTION_OFFS ))
67#define MAG_STYLE_CAPTION_MINIMIZE  ( 1 << ( 3 + MAG_STYLE_CAPTION_OFFS ))
68#define MAG_STYLE_CAPTION_MAXIMIZE  ( 1 << ( 4 + MAG_STYLE_CAPTION_OFFS ))
69#define MAG_STYLE_CAPTION_RESIZE    ( 1 << ( 5 + MAG_STYLE_CAPTION_OFFS ))
70#define MAG_STYLE_CAPTION_TINYHOR   ( 1 << ( 6 + MAG_STYLE_CAPTION_OFFS ))
71#define MAG_STYLE_CAPTION_TINYVER   ( 1 << ( 7 + MAG_STYLE_CAPTION_OFFS ))
72#define MAG_STYLE_CAPTION_DEFAULT   ( MAG_STYLE_CAPTION_RESIZE + MAG_STYLE_CAPTION_MAXIMIZE + MAG_STYLE_CAPTION_MINIMIZE + MAG_STYLE_CAPTION_SYSMENU + MAG_STYLE_CAPTION_PRESENT )
73
74
75%}