| 12
 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
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 
 | %module preproc_line_file
// Test __LINE__ and __FILE__ (don't change line numbering in here else runtime tests will need modifying)
#define MYLINE __LINE__
#define MYLINE_ADJUSTED __LINE__ + 100
#define MYFILE __FILE__
#define MYFILE_ADJUSTED __FILE__ ".bak"
#define STRINGNUM_HELP(a,b) #a#b
#define STRINGNUM(a,b) STRINGNUM_HELP(a,b)
#define STRINGNUM_UNIQUE(a) STRINGNUM(a,__LINE__)
#define MY_STRINGNUM_A STRINGNUM_UNIQUE(my)
#define MY_STRINGNUM_B STRINGNUM_UNIQUE(my)
#define NUMBER_HELP(a,b) a##b
#define NUMBER(a,b) NUMBER_HELP(a,b)
#define NUMBER_UNIQUE(a) NUMBER(a,__LINE__)
%{
const int thing27 = -1;
const int thing28 = -2;
%}
const int NUMBER_UNIQUE(thing) = -1; /* resolves to thing27 */
const int NUMBER_UNIQUE(thing) = -2; /* resolves to thing28 */
#define MYLINE2 __LINE__
#if defined (SWIGJAVA)
%javaconst(1);
#elif defined(SWIGCSHARP)
%csconst(1);
#elif defined(SWIGD)
%dmanifestconst;
#else
%ignore LINE_NUMBER;
%ignore LINE_NUM;
/* spare space */
#endif
%{
struct SillyStruct {
  int num;
  /* static const int line_num = __LINE__; */
};
%}
struct SillyStruct {
  int num;
  static const int LINE_NUMBER = __LINE__; /* This is a C test case, but we can still use a C++ feature to wrap a constant to test __LINE__ here */
};
#define SILLY_CLASS struct SillyMacroClass { int num; static const int LINE_NUM = __LINE__; };
SILLY_CLASS
%{
#define SILLY_CLASS struct SillyMacroClass { int num; };
SILLY_CLASS
%}
%inline %{
#ifdef SWIG
%define BODY
  int num;
  static const int LINE_NUM = __LINE__;
%enddef
%define KLASS(NAME)
struct NAME {
  BODY
};
%enddef
#else
#define KLASS(NAME) \
struct NAME { \
  int num; \
};
#endif
KLASS(SillyMulMacroStruc)
%}
%inline %{
#define INLINE_FILE __FILE__
#define INLINE_LINE __LINE__
%}
#define MACRO_END_WITH_SLASH ABCD/
%inline %{
KLASS(Slash)
%}
 |