LLVM Ada language bindings. Credit to Rod Kay and the AuroraUX team.
[oota-llvm.git] / bindings / ada / bitwriter / llvm_bitwriter_wrap.cxx
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 1.3.36
4  * 
5  * This file is not intended to be easily readable and contains a number of 
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG 
8  * interface file instead. 
9  * ----------------------------------------------------------------------------- */
10
11
12 #ifdef __cplusplus
13 template<typename T> class SwigValueWrapper {
14     T *tt;
15 public:
16     SwigValueWrapper() : tt(0) { }
17     SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
18     SwigValueWrapper(const T& t) : tt(new T(t)) { }
19     ~SwigValueWrapper() { delete tt; } 
20     SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
21     operator T&() const { return *tt; }
22     T *operator&() { return tt; }
23 private:
24     SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
25 };
26
27 template <typename T> T SwigValueInit() {
28   return T();
29 }
30 #endif
31
32 /* -----------------------------------------------------------------------------
33  *  This section contains generic SWIG labels for method/variable
34  *  declarations/attributes, and other compiler dependent labels.
35  * ----------------------------------------------------------------------------- */
36
37 /* template workaround for compilers that cannot correctly implement the C++ standard */
38 #ifndef SWIGTEMPLATEDISAMBIGUATOR
39 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
40 #  define SWIGTEMPLATEDISAMBIGUATOR template
41 # elif defined(__HP_aCC)
42 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
43 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
44 #  define SWIGTEMPLATEDISAMBIGUATOR template
45 # else
46 #  define SWIGTEMPLATEDISAMBIGUATOR
47 # endif
48 #endif
49
50 /* inline attribute */
51 #ifndef SWIGINLINE
52 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
53 #   define SWIGINLINE inline
54 # else
55 #   define SWIGINLINE
56 # endif
57 #endif
58
59 /* attribute recognised by some compilers to avoid 'unused' warnings */
60 #ifndef SWIGUNUSED
61 # if defined(__GNUC__)
62 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
63 #     define SWIGUNUSED __attribute__ ((__unused__)) 
64 #   else
65 #     define SWIGUNUSED
66 #   endif
67 # elif defined(__ICC)
68 #   define SWIGUNUSED __attribute__ ((__unused__)) 
69 # else
70 #   define SWIGUNUSED 
71 # endif
72 #endif
73
74 #ifndef SWIGUNUSEDPARM
75 # ifdef __cplusplus
76 #   define SWIGUNUSEDPARM(p)
77 # else
78 #   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
79 # endif
80 #endif
81
82 /* internal SWIG method */
83 #ifndef SWIGINTERN
84 # define SWIGINTERN static SWIGUNUSED
85 #endif
86
87 /* internal inline SWIG method */
88 #ifndef SWIGINTERNINLINE
89 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
90 #endif
91
92 /* exporting methods */
93 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
94 #  ifndef GCC_HASCLASSVISIBILITY
95 #    define GCC_HASCLASSVISIBILITY
96 #  endif
97 #endif
98
99 #ifndef SWIGEXPORT
100 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
101 #   if defined(STATIC_LINKED)
102 #     define SWIGEXPORT
103 #   else
104 #     define SWIGEXPORT __declspec(dllexport)
105 #   endif
106 # else
107 #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
108 #     define SWIGEXPORT __attribute__ ((visibility("default")))
109 #   else
110 #     define SWIGEXPORT
111 #   endif
112 # endif
113 #endif
114
115 /* calling conventions for Windows */
116 #ifndef SWIGSTDCALL
117 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
118 #   define SWIGSTDCALL __stdcall
119 # else
120 #   define SWIGSTDCALL
121 # endif 
122 #endif
123
124 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
125 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
126 # define _CRT_SECURE_NO_DEPRECATE
127 #endif
128
129 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
130 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
131 # define _SCL_SECURE_NO_DEPRECATE
132 #endif
133
134
135
136 #include <stdlib.h>
137 #include <string.h>
138 #include <stdio.h>
139 #if defined(_WIN32) || defined(__CYGWIN32__)
140 #  define DllExport   __declspec( dllexport )
141 #  define SWIGSTDCALL __stdcall
142 #else
143 #  define DllExport  
144 #  define SWIGSTDCALL
145 #endif 
146
147
148 #ifdef __cplusplus
149 #  include <new>
150 #endif
151
152
153
154
155 /* Support for throwing Ada exceptions from C/C++ */
156
157 typedef enum 
158 {
159   SWIG_AdaException,
160   SWIG_AdaOutOfMemoryException,
161   SWIG_AdaIndexOutOfRangeException,
162   SWIG_AdaDivideByZeroException,
163   SWIG_AdaArgumentOutOfRangeException,
164   SWIG_AdaNullReferenceException
165 } SWIG_AdaExceptionCodes;
166
167
168 typedef void (SWIGSTDCALL* SWIG_AdaExceptionCallback_t)(const char *);
169
170
171 typedef struct 
172 {
173   SWIG_AdaExceptionCodes code;
174   SWIG_AdaExceptionCallback_t callback;
175
176   SWIG_AdaExceptions_t;
177
178
179 static 
180 SWIG_AdaExceptions_t 
181 SWIG_ada_exceptions[] = 
182 {
183   { SWIG_AdaException, NULL },
184   { SWIG_AdaOutOfMemoryException, NULL },
185   { SWIG_AdaIndexOutOfRangeException, NULL },
186   { SWIG_AdaDivideByZeroException, NULL },
187   { SWIG_AdaArgumentOutOfRangeException, NULL },
188   { SWIG_AdaNullReferenceException, NULL } 
189 };
190
191
192 static 
193 void 
194 SWIG_AdaThrowException (SWIG_AdaExceptionCodes code, const char *msg) 
195 {
196   SWIG_AdaExceptionCallback_t callback = SWIG_ada_exceptions[SWIG_AdaException].callback;
197   if (code >=0 && (size_t)code < sizeof(SWIG_ada_exceptions)/sizeof(SWIG_AdaExceptions_t)) {
198     callback = SWIG_ada_exceptions[code].callback;
199   }
200   callback(msg);
201 }
202
203
204
205 #ifdef __cplusplus
206 extern "C" 
207 #endif
208
209 DllExport void SWIGSTDCALL SWIGRegisterExceptionCallbacks_LLVM_bit_Writer (SWIG_AdaExceptionCallback_t systemException,
210                                                                    SWIG_AdaExceptionCallback_t outOfMemory, 
211                                                                    SWIG_AdaExceptionCallback_t indexOutOfRange, 
212                                                                    SWIG_AdaExceptionCallback_t divideByZero, 
213                                                                    SWIG_AdaExceptionCallback_t argumentOutOfRange,
214                                                                    SWIG_AdaExceptionCallback_t nullReference) 
215 {
216   SWIG_ada_exceptions [SWIG_AdaException].callback                   = systemException;
217   SWIG_ada_exceptions [SWIG_AdaOutOfMemoryException].callback        = outOfMemory;
218   SWIG_ada_exceptions [SWIG_AdaIndexOutOfRangeException].callback    = indexOutOfRange;
219   SWIG_ada_exceptions [SWIG_AdaDivideByZeroException].callback       = divideByZero;
220   SWIG_ada_exceptions [SWIG_AdaArgumentOutOfRangeException].callback = argumentOutOfRange;
221   SWIG_ada_exceptions [SWIG_AdaNullReferenceException].callback      = nullReference;
222 }
223
224
225 /* Callback for returning strings to Ada without leaking memory */
226
227 typedef char * (SWIGSTDCALL* SWIG_AdaStringHelperCallback)(const char *);
228 static SWIG_AdaStringHelperCallback SWIG_ada_string_callback = NULL;
229
230
231
232 /* probably obsolete ...
233 #ifdef __cplusplus
234 extern "C" 
235 #endif
236 DllExport void SWIGSTDCALL SWIGRegisterStringCallback_LLVM_bit_Writer(SWIG_AdaStringHelperCallback callback) {
237   SWIG_ada_string_callback = callback;
238 }
239 */
240
241
242
243 /* Contract support */
244
245 #define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_AdaThrowException(SWIG_AdaArgumentOutOfRangeException, msg); return nullreturn; } else
246
247
248 #define protected public
249 #define private   public
250
251 #include "llvm-c/Analysis.h"
252 #include "llvm-c/BitReader.h"
253 #include "llvm-c/BitWriter.h"
254 #include "llvm-c/Core.h"
255 #include "llvm-c/ExecutionEngine.h"
256 #include "llvm-c/LinkTimeOptimizer.h"
257 #include "llvm-c/lto.h"
258 #include "llvm-c/Target.h"
259
260
261
262 //  struct LLVMCtxt;
263
264
265 #undef protected
266 #undef private
267 #ifdef __cplusplus 
268 extern "C" {
269 #endif
270 DllExport int SWIGSTDCALL Ada_LLVMWriteBitcodeToFileHandle (
271   void * jarg1
272   ,
273   
274   int jarg2
275   )
276 {
277   int jresult ;
278   LLVMModuleRef arg1 = (LLVMModuleRef) 0 ;
279   int arg2 ;
280   int result;
281   
282   arg1 = (LLVMModuleRef)jarg1; 
283   
284   
285   arg2 = (int) jarg2; 
286   
287   
288   result = (int)LLVMWriteBitcodeToFileHandle(arg1,arg2);
289   jresult = result; 
290   
291   
292   
293   return jresult;
294   
295 }
296
297
298
299 DllExport int SWIGSTDCALL Ada_LLVMWriteBitcodeToFile (
300   void * jarg1
301   ,
302   
303   char * jarg2
304   )
305 {
306   int jresult ;
307   LLVMModuleRef arg1 = (LLVMModuleRef) 0 ;
308   char *arg2 = (char *) 0 ;
309   int result;
310   
311   arg1 = (LLVMModuleRef)jarg1; 
312   
313   arg2 = jarg2; 
314   
315   result = (int)LLVMWriteBitcodeToFile(arg1,(char const *)arg2);
316   jresult = result; 
317   
318   
319   
320   return jresult;
321   
322 }
323
324
325
326 #ifdef __cplusplus
327 }
328 #endif
329 #ifdef __cplusplus
330 extern "C" {
331 #endif
332 #ifdef __cplusplus
333 }
334 #endif
335