Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1195 lines
41 KiB

  1. /* -----------------------------------------------------------------------------
  2. * See the LICENSE file for information on copyright, usage and redistribution
  3. * of SWIG, and the README file for authors - http://www.swig.org/release.html.
  4. *
  5. * java.swg
  6. *
  7. * Java typemaps
  8. * ----------------------------------------------------------------------------- */
  9. %include <javahead.swg>
  10. /* The jni, jtype and jstype typemaps work together and so there should be one of each.
  11. * The jni typemap contains the JNI type used in the JNI (C/C++) code.
  12. * The jtype typemap contains the Java type used in the JNI intermediary class.
  13. * The jstype typemap contains the Java type used in the Java proxy classes, type wrapper classes and module class. */
  14. /* Primitive types */
  15. %typemap(jni) bool, const bool & "jboolean"
  16. %typemap(jni) char, const char & "jchar"
  17. %typemap(jni) signed char, const signed char & "jbyte"
  18. %typemap(jni) unsigned char, const unsigned char & "jshort"
  19. %typemap(jni) short, const short & "jshort"
  20. %typemap(jni) unsigned short, const unsigned short & "jint"
  21. %typemap(jni) int, const int & "jint"
  22. %typemap(jni) unsigned int, const unsigned int & "jlong"
  23. %typemap(jni) long, const long & "jint"
  24. %typemap(jni) unsigned long, const unsigned long & "jlong"
  25. %typemap(jni) long long, const long long & "jlong"
  26. %typemap(jni) unsigned long long, const unsigned long long & "jobject"
  27. %typemap(jni) float, const float & "jfloat"
  28. %typemap(jni) double, const double & "jdouble"
  29. %typemap(jni) void "void"
  30. %typemap(jtype) bool, const bool & "boolean"
  31. %typemap(jtype) char, const char & "char"
  32. %typemap(jtype) signed char, const signed char & "byte"
  33. %typemap(jtype) unsigned char, const unsigned char & "short"
  34. %typemap(jtype) short, const short & "short"
  35. %typemap(jtype) unsigned short, const unsigned short & "int"
  36. %typemap(jtype) int, const int & "int"
  37. %typemap(jtype) unsigned int, const unsigned int & "long"
  38. %typemap(jtype) long, const long & "int"
  39. %typemap(jtype) unsigned long, const unsigned long & "long"
  40. %typemap(jtype) long long, const long long & "long"
  41. %typemap(jtype) unsigned long long, const unsigned long long & "java.math.BigInteger"
  42. %typemap(jtype) float, const float & "float"
  43. %typemap(jtype) double, const double & "double"
  44. %typemap(jtype) void "void"
  45. %typemap(jstype) bool, const bool & "boolean"
  46. %typemap(jstype) char, const char & "char"
  47. %typemap(jstype) signed char, const signed char & "byte"
  48. %typemap(jstype) unsigned char, const unsigned char & "short"
  49. %typemap(jstype) short, const short & "short"
  50. %typemap(jstype) unsigned short, const unsigned short & "int"
  51. %typemap(jstype) int, const int & "int"
  52. %typemap(jstype) unsigned int, const unsigned int & "long"
  53. %typemap(jstype) long, const long & "int"
  54. %typemap(jstype) unsigned long, const unsigned long & "long"
  55. %typemap(jstype) long long, const long long & "long"
  56. %typemap(jstype) unsigned long long, const unsigned long long & "java.math.BigInteger"
  57. %typemap(jstype) float, const float & "float"
  58. %typemap(jstype) double, const double & "double"
  59. %typemap(jstype) void "void"
  60. %typemap(jni) char *, char[ANY], char[] "jstring"
  61. %typemap(jtype) char *, char[ANY], char[] "String"
  62. %typemap(jstype) char *, char[ANY], char[] "String"
  63. /* JNI types */
  64. %typemap(jni) jboolean "jboolean"
  65. %typemap(jni) jchar "jchar"
  66. %typemap(jni) jbyte "jbyte"
  67. %typemap(jni) jshort "jshort"
  68. %typemap(jni) jint "jint"
  69. %typemap(jni) jlong "jlong"
  70. %typemap(jni) jfloat "jfloat"
  71. %typemap(jni) jdouble "jdouble"
  72. %typemap(jni) jstring "jstring"
  73. %typemap(jni) jobject "jobject"
  74. %typemap(jni) jbooleanArray "jbooleanArray"
  75. %typemap(jni) jcharArray "jcharArray"
  76. %typemap(jni) jbyteArray "jbyteArray"
  77. %typemap(jni) jshortArray "jshortArray"
  78. %typemap(jni) jintArray "jintArray"
  79. %typemap(jni) jlongArray "jlongArray"
  80. %typemap(jni) jfloatArray "jfloatArray"
  81. %typemap(jni) jdoubleArray "jdoubleArray"
  82. %typemap(jni) jobjectArray "jobjectArray"
  83. %typemap(jtype) jboolean "boolean"
  84. %typemap(jtype) jchar "char"
  85. %typemap(jtype) jbyte "byte"
  86. %typemap(jtype) jshort "short"
  87. %typemap(jtype) jint "int"
  88. %typemap(jtype) jlong "long"
  89. %typemap(jtype) jfloat "float"
  90. %typemap(jtype) jdouble "double"
  91. %typemap(jtype) jstring "String"
  92. %typemap(jtype) jobject "Object"
  93. %typemap(jtype) jbooleanArray "boolean[]"
  94. %typemap(jtype) jcharArray "char[]"
  95. %typemap(jtype) jbyteArray "byte[]"
  96. %typemap(jtype) jshortArray "short[]"
  97. %typemap(jtype) jintArray "int[]"
  98. %typemap(jtype) jlongArray "long[]"
  99. %typemap(jtype) jfloatArray "float[]"
  100. %typemap(jtype) jdoubleArray "double[]"
  101. %typemap(jtype) jobjectArray "Object[]"
  102. %typemap(jstype) jboolean "boolean"
  103. %typemap(jstype) jchar "char"
  104. %typemap(jstype) jbyte "byte"
  105. %typemap(jstype) jshort "short"
  106. %typemap(jstype) jint "int"
  107. %typemap(jstype) jlong "long"
  108. %typemap(jstype) jfloat "float"
  109. %typemap(jstype) jdouble "double"
  110. %typemap(jstype) jstring "String"
  111. %typemap(jstype) jobject "Object"
  112. %typemap(jstype) jbooleanArray "boolean[]"
  113. %typemap(jstype) jcharArray "char[]"
  114. %typemap(jstype) jbyteArray "byte[]"
  115. %typemap(jstype) jshortArray "short[]"
  116. %typemap(jstype) jintArray "int[]"
  117. %typemap(jstype) jlongArray "long[]"
  118. %typemap(jstype) jfloatArray "float[]"
  119. %typemap(jstype) jdoubleArray "double[]"
  120. %typemap(jstype) jobjectArray "Object[]"
  121. /* Non primitive types */
  122. %typemap(jni) SWIGTYPE "jlong"
  123. %typemap(jtype) SWIGTYPE "long"
  124. %typemap(jstype) SWIGTYPE "$&javaclassname"
  125. %typemap(jni) SWIGTYPE [] "jlong"
  126. %typemap(jtype) SWIGTYPE [] "long"
  127. %typemap(jstype) SWIGTYPE [] "$javaclassname"
  128. %typemap(jni) SWIGTYPE * "jlong"
  129. %typemap(jtype) SWIGTYPE * "long"
  130. %typemap(jstype) SWIGTYPE * "$javaclassname"
  131. %typemap(jni) SWIGTYPE & "jlong"
  132. %typemap(jtype) SWIGTYPE & "long"
  133. %typemap(jstype) SWIGTYPE & "$javaclassname"
  134. /* pointer to a class member */
  135. %typemap(jni) SWIGTYPE (CLASS::*) "jlong"
  136. %typemap(jtype) SWIGTYPE (CLASS::*) "long"
  137. %typemap(jstype) SWIGTYPE (CLASS::*) "$javaclassname"
  138. /* The following are the in, out, freearg, argout typemaps. These are the JNI code generating typemaps for converting from Java to C and visa versa. */
  139. /* primitive types */
  140. %typemap(in) bool
  141. %{ $1 = $input ? true : false; %}
  142. %typemap(directorout) bool
  143. %{ $result = $input ? true : false; %}
  144. %typemap(javadirectorin) bool "$jniinput"
  145. %typemap(javadirectorout) bool "$javacall"
  146. %typemap(in) char,
  147. signed char,
  148. unsigned char,
  149. short,
  150. unsigned short,
  151. int,
  152. unsigned int,
  153. long,
  154. unsigned long,
  155. long long,
  156. float,
  157. double
  158. %{ $1 = ($1_ltype)$input; %}
  159. %typemap(directorout) char,
  160. signed char,
  161. unsigned char,
  162. short,
  163. unsigned short,
  164. int,
  165. unsigned int,
  166. long,
  167. unsigned long,
  168. long long,
  169. float,
  170. double
  171. %{ $result = ($1_ltype)$input; %}
  172. %typemap(directorin, descriptor="Z") bool "$input = (jboolean) $1;"
  173. %typemap(directorin, descriptor="C") char "$input = (jint) $1;"
  174. %typemap(directorin, descriptor="B") signed char "$input = (jbyte) $1;"
  175. %typemap(directorin, descriptor="S") unsigned char "$input = (jshort) $1;"
  176. %typemap(directorin, descriptor="S") short "$input = (jshort) $1;"
  177. %typemap(directorin, descriptor="I") unsigned short "$input = (jint) $1;"
  178. %typemap(directorin, descriptor="I") int "$input = (jint) $1;"
  179. %typemap(directorin, descriptor="J") unsigned int "$input = (jlong) $1;"
  180. %typemap(directorin, descriptor="I") long "$input = (jint) $1;"
  181. %typemap(directorin, descriptor="J") unsigned long "$input = (jlong) $1;"
  182. %typemap(directorin, descriptor="J") long long "$input = (jlong) $1;"
  183. %typemap(directorin, descriptor="F") float "$input = (jfloat) $1;"
  184. %typemap(directorin, descriptor="D") double "$input = (jdouble) $1;"
  185. %typemap(javadirectorin) char,
  186. signed char,
  187. unsigned char,
  188. short,
  189. unsigned short,
  190. int,
  191. unsigned int,
  192. long,
  193. unsigned long,
  194. long long,
  195. float,
  196. double
  197. "$jniinput"
  198. %typemap(javadirectorout) char,
  199. signed char,
  200. unsigned char,
  201. short,
  202. unsigned short,
  203. int,
  204. unsigned int,
  205. long,
  206. unsigned long,
  207. long long,
  208. float,
  209. double
  210. "$javacall"
  211. %typemap(out) bool %{ $result = (jboolean)$1; %}
  212. %typemap(out) char %{ $result = (jchar)$1; %}
  213. %typemap(out) signed char %{ $result = (jbyte)$1; %}
  214. %typemap(out) unsigned char %{ $result = (jshort)$1; %}
  215. %typemap(out) short %{ $result = (jshort)$1; %}
  216. %typemap(out) unsigned short %{ $result = (jint)$1; %}
  217. %typemap(out) int %{ $result = (jint)$1; %}
  218. %typemap(out) unsigned int %{ $result = (jlong)$1; %}
  219. %typemap(out) long %{ $result = (jint)$1; %}
  220. %typemap(out) unsigned long %{ $result = (jlong)$1; %}
  221. %typemap(out) long long %{ $result = (jlong)$1; %}
  222. %typemap(out) float %{ $result = (jfloat)$1; %}
  223. %typemap(out) double %{ $result = (jdouble)$1; %}
  224. /* unsigned long long */
  225. /* Convert from BigInteger using the toByteArray member function */
  226. %typemap(in) unsigned long long {
  227. jclass clazz;
  228. jmethodID mid;
  229. jbyteArray ba;
  230. jbyte* bae;
  231. jsize sz;
  232. int i;
  233. if (!$input) {
  234. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
  235. return $null;
  236. }
  237. clazz = JCALL1(GetObjectClass, jenv, $input);
  238. mid = JCALL3(GetMethodID, jenv, clazz, "toByteArray", "()[B");
  239. ba = (jbyteArray)JCALL2(CallObjectMethod, jenv, $input, mid);
  240. bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  241. sz = JCALL1(GetArrayLength, jenv, ba);
  242. $1 = 0;
  243. for(i=0; i<sz; i++) {
  244. $1 = ($1 << 8) | ($1_type)(unsigned char)bae[i];
  245. }
  246. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  247. }
  248. %typemap(directorout) unsigned long long {
  249. jclass clazz;
  250. jmethodID mid;
  251. jbyteArray ba;
  252. jbyte* bae;
  253. jsize sz;
  254. int i;
  255. if (!$input) {
  256. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
  257. return $null;
  258. }
  259. clazz = JCALL1(GetObjectClass, jenv, $input);
  260. mid = JCALL3(GetMethodID, jenv, clazz, "toByteArray", "()[B");
  261. ba = (jbyteArray)JCALL2(CallObjectMethod, jenv, $input, mid);
  262. bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  263. sz = JCALL1(GetArrayLength, jenv, ba);
  264. $result = 0;
  265. for(i=0; i<sz; i++) {
  266. $result = ($result << 8) | ($1_type)(unsigned char)bae[i];
  267. }
  268. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  269. }
  270. /* Convert to BigInteger - byte array holds number in 2's complement big endian format */
  271. %typemap(out) unsigned long long {
  272. jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
  273. jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  274. jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger");
  275. jmethodID mid = JCALL3(GetMethodID, jenv, clazz, "<init>", "([B)V");
  276. jobject bigint;
  277. int i;
  278. bae[0] = 0;
  279. for(i=1; i<9; i++ ) {
  280. bae[i] = (jbyte)($1>>8*(8-i));
  281. }
  282. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  283. bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
  284. $result = bigint;
  285. }
  286. /* Convert to BigInteger (see out typemap) */
  287. %typemap(directorin, descriptor="Ljava/math/BigInteger;") unsigned long long, const unsigned long long & {
  288. jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
  289. jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  290. jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger");
  291. jmethodID mid = JCALL3(GetMethodID, jenv, clazz, "<init>", "([B)V");
  292. jobject bigint;
  293. int swig_i;
  294. bae[0] = 0;
  295. for(swig_i=1; swig_i<9; swig_i++ ) {
  296. bae[swig_i] = (jbyte)($1>>8*(8-swig_i));
  297. }
  298. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  299. bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
  300. $input = bigint;
  301. }
  302. %typemap(javadirectorin) unsigned long long "$jniinput"
  303. %typemap(javadirectorout) unsigned long long "$javacall"
  304. /* char * - treat as String */
  305. %typemap(in, noblock=1) char * {
  306. $1 = 0;
  307. if ($input) {
  308. $1 = ($1_ltype)JCALL2(GetStringUTFChars, jenv, $input, 0);
  309. if (!$1) return $null;
  310. }
  311. }
  312. %typemap(directorout, noblock=1, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) char * {
  313. $1 = 0;
  314. if ($input) {
  315. $result = ($1_ltype)JCALL2(GetStringUTFChars, jenv, $input, 0);
  316. if (!$result) return $null;
  317. }
  318. }
  319. %typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) char * {
  320. $input = 0;
  321. if ($1) {
  322. $input = JCALL1(NewStringUTF, jenv, (const char *)$1);
  323. if (!$input) return $null;
  324. }
  325. }
  326. %typemap(freearg, noblock=1) char * { if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, (const char *)$1); }
  327. %typemap(out, noblock=1) char * { if($1) $result = JCALL1(NewStringUTF, jenv, (const char *)$1); }
  328. %typemap(javadirectorin) char * "$jniinput"
  329. %typemap(javadirectorout) char * "$javacall"
  330. %typemap(out) void ""
  331. %typemap(javadirectorin) void "$jniinput"
  332. %typemap(javadirectorout) void "$javacall"
  333. %typemap(directorin, descriptor="V") void ""
  334. /* primitive types by reference */
  335. %typemap(in) const bool & ($*1_ltype temp)
  336. %{ temp = $input ? true : false;
  337. $1 = &temp; %}
  338. %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const bool &
  339. %{ static $*1_ltype temp;
  340. temp = $input ? true : false;
  341. $result = &temp; %}
  342. %typemap(javadirectorin) const bool & "$jniinput"
  343. %typemap(javadirectorout) const bool & "$javacall"
  344. %typemap(in) const char & ($*1_ltype temp),
  345. const signed char & ($*1_ltype temp),
  346. const unsigned char & ($*1_ltype temp),
  347. const short & ($*1_ltype temp),
  348. const unsigned short & ($*1_ltype temp),
  349. const int & ($*1_ltype temp),
  350. const unsigned int & ($*1_ltype temp),
  351. const long & ($*1_ltype temp),
  352. const unsigned long & ($*1_ltype temp),
  353. const long long & ($*1_ltype temp),
  354. const float & ($*1_ltype temp),
  355. const double & ($*1_ltype temp)
  356. %{ temp = ($*1_ltype)$input;
  357. $1 = &temp; %}
  358. %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const char &,
  359. const signed char &,
  360. const unsigned char &,
  361. const short &,
  362. const unsigned short &,
  363. const int &,
  364. const unsigned int &,
  365. const long &,
  366. const unsigned long &,
  367. const long long &,
  368. const float &,
  369. const double &
  370. %{ static $*1_ltype temp;
  371. temp = ($*1_ltype)$input;
  372. $result = &temp; %}
  373. %typemap(directorin, descriptor="Z") const bool & "$input = (jboolean)$1_name;"
  374. %typemap(directorin, descriptor="C") const char & "$input = (jchar)$1_name;"
  375. %typemap(directorin, descriptor="B") const signed char & "$input = (jbyte)$1_name;"
  376. %typemap(directorin, descriptor="S") const unsigned char & "$input = (jshort)$1_name;"
  377. %typemap(directorin, descriptor="S") const short & "$input = (jshort)$1_name;"
  378. %typemap(directorin, descriptor="I") const unsigned short & "$input = (jint)$1_name;"
  379. %typemap(directorin, descriptor="I") const int & "$input = (jint)$1_name;"
  380. %typemap(directorin, descriptor="J") const unsigned int & "$input = (jlong)$1_name;"
  381. %typemap(directorin, descriptor="I") const long & "$input = (jint)$1_name;"
  382. %typemap(directorin, descriptor="J") const unsigned long & "$input = (jlong)$1_name;"
  383. %typemap(directorin, descriptor="J") const long long & "$input = (jlong)$1_name;"
  384. %typemap(directorin, descriptor="F") const float & "$input = (jfloat)$1_name;"
  385. %typemap(directorin, descriptor="D") const double & "$input = (jdouble)$1_name;"
  386. %typemap(javadirectorin) const char & ($*1_ltype temp),
  387. const signed char & ($*1_ltype temp),
  388. const unsigned char & ($*1_ltype temp),
  389. const short & ($*1_ltype temp),
  390. const unsigned short & ($*1_ltype temp),
  391. const int & ($*1_ltype temp),
  392. const unsigned int & ($*1_ltype temp),
  393. const long & ($*1_ltype temp),
  394. const unsigned long & ($*1_ltype temp),
  395. const long long & ($*1_ltype temp),
  396. const float & ($*1_ltype temp),
  397. const double & ($*1_ltype temp)
  398. "$jniinput"
  399. %typemap(javadirectorout) const char & ($*1_ltype temp),
  400. const signed char & ($*1_ltype temp),
  401. const unsigned char & ($*1_ltype temp),
  402. const short & ($*1_ltype temp),
  403. const unsigned short & ($*1_ltype temp),
  404. const int & ($*1_ltype temp),
  405. const unsigned int & ($*1_ltype temp),
  406. const long & ($*1_ltype temp),
  407. const unsigned long & ($*1_ltype temp),
  408. const long long & ($*1_ltype temp),
  409. const float & ($*1_ltype temp),
  410. const double & ($*1_ltype temp)
  411. "$javacall"
  412. %typemap(out) const bool & %{ $result = (jboolean)*$1; %}
  413. %typemap(out) const char & %{ $result = (jchar)*$1; %}
  414. %typemap(out) const signed char & %{ $result = (jbyte)*$1; %}
  415. %typemap(out) const unsigned char & %{ $result = (jshort)*$1; %}
  416. %typemap(out) const short & %{ $result = (jshort)*$1; %}
  417. %typemap(out) const unsigned short & %{ $result = (jint)*$1; %}
  418. %typemap(out) const int & %{ $result = (jint)*$1; %}
  419. %typemap(out) const unsigned int & %{ $result = (jlong)*$1; %}
  420. %typemap(out) const long & %{ $result = (jint)*$1; %}
  421. %typemap(out) const unsigned long & %{ $result = (jlong)*$1; %}
  422. %typemap(out) const long long & %{ $result = (jlong)*$1; %}
  423. %typemap(out) const float & %{ $result = (jfloat)*$1; %}
  424. %typemap(out) const double & %{ $result = (jdouble)*$1; %}
  425. /* const unsigned long long & */
  426. /* Similar to unsigned long long */
  427. %typemap(in) const unsigned long long & ($*1_ltype temp) {
  428. jclass clazz;
  429. jmethodID mid;
  430. jbyteArray ba;
  431. jbyte* bae;
  432. jsize sz;
  433. int i;
  434. if (!$input) {
  435. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
  436. return $null;
  437. }
  438. clazz = JCALL1(GetObjectClass, jenv, $input);
  439. mid = JCALL3(GetMethodID, jenv, clazz, "toByteArray", "()[B");
  440. ba = (jbyteArray)JCALL2(CallObjectMethod, jenv, $input, mid);
  441. bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  442. sz = JCALL1(GetArrayLength, jenv, ba);
  443. $1 = &temp;
  444. temp = 0;
  445. for(i=0; i<sz; i++) {
  446. temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i];
  447. }
  448. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  449. }
  450. %typemap(directorout,warning=SWIGWARN_TYPEMAP_THREAD_UNSAFE_MSG) const unsigned long long & {
  451. static $*1_ltype temp;
  452. jclass clazz;
  453. jmethodID mid;
  454. jbyteArray ba;
  455. jbyte* bae;
  456. jsize sz;
  457. int i;
  458. if (!$input) {
  459. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "BigInteger null");
  460. return $null;
  461. }
  462. clazz = JCALL1(GetObjectClass, jenv, $input);
  463. mid = JCALL3(GetMethodID, jenv, clazz, "toByteArray", "()[B");
  464. ba = (jbyteArray)JCALL2(CallObjectMethod, jenv, $input, mid);
  465. bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  466. sz = JCALL1(GetArrayLength, jenv, ba);
  467. $result = &temp;
  468. temp = 0;
  469. for(i=0; i<sz; i++) {
  470. temp = (temp << 8) | ($*1_ltype)(unsigned char)bae[i];
  471. }
  472. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  473. }
  474. %typemap(out) const unsigned long long & {
  475. jbyteArray ba = JCALL1(NewByteArray, jenv, 9);
  476. jbyte* bae = JCALL2(GetByteArrayElements, jenv, ba, 0);
  477. jclass clazz = JCALL1(FindClass, jenv, "java/math/BigInteger");
  478. jmethodID mid = JCALL3(GetMethodID, jenv, clazz, "<init>", "([B)V");
  479. jobject bigint;
  480. int i;
  481. bae[0] = 0;
  482. for(i=1; i<9; i++ ) {
  483. bae[i] = (jbyte)(*$1>>8*(8-i));
  484. }
  485. JCALL3(ReleaseByteArrayElements, jenv, ba, bae, 0);
  486. bigint = JCALL3(NewObject, jenv, clazz, mid, ba);
  487. $result = bigint;
  488. }
  489. %typemap(javadirectorin) const unsigned long long & "$jniinput"
  490. %typemap(javadirectorout) const unsigned long long & "$javacall"
  491. /* Default handling. Object passed by value. Convert to a pointer */
  492. %typemap(in) SWIGTYPE ($&1_type argp)
  493. %{ argp = *($&1_ltype*)&$input;
  494. if (!argp) {
  495. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null $1_type");
  496. return $null;
  497. }
  498. $1 = *argp; %}
  499. %typemap(directorout) SWIGTYPE ($&1_type argp)
  500. %{ argp = *($&1_ltype*)&$input;
  501. if (!argp) {
  502. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type");
  503. return $null;
  504. }
  505. $result = *argp; %}
  506. %typemap(out) SWIGTYPE
  507. #ifdef __cplusplus
  508. %{ *($&1_ltype*)&$result = new $1_ltype(($1_ltype &)$1); %}
  509. #else
  510. {
  511. $&1_ltype $1ptr = ($&1_ltype) malloc(sizeof($1_ltype));
  512. memmove($1ptr, &$1, sizeof($1_type));
  513. *($&1_ltype*)&$result = $1ptr;
  514. }
  515. #endif
  516. %typemap(directorin,descriptor="L$packagepath/$&javaclassname;") SWIGTYPE
  517. %{ $input = 0;
  518. *(($&1_ltype*)&$input) = &$1; %}
  519. %typemap(javadirectorin) SWIGTYPE "new $&javaclassname($jniinput, false)"
  520. %typemap(javadirectorout) SWIGTYPE "$&javaclassname.getCPtr($javacall)"
  521. /* Generic pointers and references */
  522. %typemap(in) SWIGTYPE *, SWIGTYPE (CLASS::*) %{ $1 = *($&1_ltype)&$input; %}
  523. %typemap(in) SWIGTYPE & %{ $1 = *($&1_ltype)&$input;
  524. if(!$1) {
  525. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "$1_type reference is null");
  526. return $null;
  527. } %}
  528. %typemap(out) SWIGTYPE *, SWIGTYPE (CLASS::*)
  529. %{ *($&1_ltype)&$result = $1; %}
  530. %typemap(out) SWIGTYPE &
  531. %{ *($&1_ltype)&$result = $1; %}
  532. %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE *, SWIGTYPE (CLASS::*)
  533. %{ $result = *($&1_ltype)&$input; %}
  534. %typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE *, SWIGTYPE (CLASS::*)
  535. %{ *(($&1_ltype)&$input) = ($1_ltype) $1; %}
  536. %typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &
  537. %{ if (!$input) {
  538. SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Unexpected null return for type $1_type");
  539. return $null;
  540. }
  541. $result = *($&1_ltype)&$input; %}
  542. %typemap(directorin,descriptor="L$packagepath/$javaclassname;") SWIGTYPE &
  543. %{ *($&1_ltype)&$input = ($1_ltype) &$1; %}
  544. %typemap(javadirectorin) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "new $javaclassname($jniinput, false)"
  545. %typemap(javadirectorout) SWIGTYPE *, SWIGTYPE (CLASS::*), SWIGTYPE & "$javaclassname.getCPtr($javacall)"
  546. /* Default array handling */
  547. %typemap(in) SWIGTYPE [] %{ $1 = *($&1_ltype)&$input; %}
  548. %typemap(out) SWIGTYPE [] %{ *($&1_ltype)&$result = $1; %}
  549. %typemap(freearg) SWIGTYPE [ANY], SWIGTYPE [] ""
  550. /* char arrays - treat as String */
  551. %typemap(in, noblock=1) char[ANY], char[] {
  552. $1 = 0;
  553. if ($input) {
  554. $1 = ($1_ltype)JCALL2(GetStringUTFChars, jenv, $input, 0);
  555. if (!$1) return $null;
  556. }
  557. }
  558. %typemap(directorout, noblock=1) char[ANY], char[] {
  559. $1 = 0;
  560. if ($input) {
  561. $result = ($1_ltype)JCALL2(GetStringUTFChars, jenv, $input, 0);
  562. if (!$result) return $null;
  563. }
  564. }
  565. %typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) char[ANY], char[] {
  566. $input = 0;
  567. if ($1) {
  568. $input = JCALL1(NewStringUTF, jenv, (const char *)$1);
  569. if (!$input) return $null;
  570. }
  571. }
  572. %typemap(argout) char[ANY], char[] ""
  573. %typemap(freearg, noblock=1) char[ANY], char[] { if ($1) JCALL2(ReleaseStringUTFChars, jenv, $input, (const char *)$1); }
  574. %typemap(out, noblock=1) char[ANY], char[] { if($1) $result = JCALL1(NewStringUTF, jenv, (const char *)$1); }
  575. %typemap(javadirectorin) char[ANY], char[] "$jniinput"
  576. %typemap(javadirectorout) char[ANY], char[] "$javacall"
  577. /* JNI types */
  578. %typemap(in) jboolean,
  579. jchar,
  580. jbyte,
  581. jshort,
  582. jint,
  583. jlong,
  584. jfloat,
  585. jdouble,
  586. jstring,
  587. jobject,
  588. jbooleanArray,
  589. jcharArray,
  590. jbyteArray,
  591. jshortArray,
  592. jintArray,
  593. jlongArray,
  594. jfloatArray,
  595. jdoubleArray,
  596. jobjectArray
  597. %{ $1 = $input; %}
  598. %typemap(directorout) jboolean,
  599. jchar,
  600. jbyte,
  601. jshort,
  602. jint,
  603. jlong,
  604. jfloat,
  605. jdouble,
  606. jstring,
  607. jobject,
  608. jbooleanArray,
  609. jcharArray,
  610. jbyteArray,
  611. jshortArray,
  612. jintArray,
  613. jlongArray,
  614. jfloatArray,
  615. jdoubleArray,
  616. jobjectArray
  617. %{ $result = $input; %}
  618. %typemap(out) jboolean,
  619. jchar,
  620. jbyte,
  621. jshort,
  622. jint,
  623. jlong,
  624. jfloat,
  625. jdouble,
  626. jstring,
  627. jobject,
  628. jbooleanArray,
  629. jcharArray,
  630. jbyteArray,
  631. jshortArray,
  632. jintArray,
  633. jlongArray,
  634. jfloatArray,
  635. jdoubleArray,
  636. jobjectArray
  637. %{ $result = $1; %}
  638. %typemap(directorin,descriptor="Z") jboolean "$input = $1;"
  639. %typemap(directorin,descriptor="C") jchar "$input = $1;"
  640. %typemap(directorin,descriptor="B") jbyte "$input = $1;"
  641. %typemap(directorin,descriptor="S") jshort "$input = $1;"
  642. %typemap(directorin,descriptor="I") jint "$input = $1;"
  643. %typemap(directorin,descriptor="J") jlong "$input = $1;"
  644. %typemap(directorin,descriptor="F") jfloat "$input = $1;"
  645. %typemap(directorin,descriptor="D") jdouble "$input = $1;"
  646. %typemap(directorin,descriptor="Ljava/lang/String;") jstring "$input = $1;"
  647. %typemap(directorin,descriptor="Ljava/lang/Object;",nouse="1") jobject "$input = $1;"
  648. %typemap(directorin,descriptor="[Z") jbooleanArray "$input = $1;"
  649. %typemap(directorin,descriptor="[C") jcharArray "$input = $1;"
  650. %typemap(directorin,descriptor="[B") jbyteArray "$input = $1;"
  651. %typemap(directorin,descriptor="[S") jshortArray "$input = $1;"
  652. %typemap(directorin,descriptor="[I") jintArray "$input = $1;"
  653. %typemap(directorin,descriptor="[J") jlongArray "$input = $1;"
  654. %typemap(directorin,descriptor="[F") jfloatArray "$input = $1;"
  655. %typemap(directorin,descriptor="[D") jdoubleArray "$input = $1;"
  656. %typemap(directorin,descriptor="[Ljava/lang/Object;",nouse="1") jobjectArray "$input = $1;"
  657. %typemap(javadirectorin) jboolean,
  658. jchar,
  659. jbyte,
  660. jshort,
  661. jint,
  662. jlong,
  663. jfloat,
  664. jdouble,
  665. jstring,
  666. jobject,
  667. jbooleanArray,
  668. jcharArray,
  669. jbyteArray,
  670. jshortArray,
  671. jintArray,
  672. jlongArray,
  673. jfloatArray,
  674. jdoubleArray,
  675. jobjectArray
  676. "$jniinput"
  677. %typemap(javadirectorout) jboolean,
  678. jchar,
  679. jbyte,
  680. jshort,
  681. jint,
  682. jlong,
  683. jfloat,
  684. jdouble,
  685. jstring,
  686. jobject,
  687. jbooleanArray,
  688. jcharArray,
  689. jbyteArray,
  690. jshortArray,
  691. jintArray,
  692. jlongArray,
  693. jfloatArray,
  694. jdoubleArray,
  695. jobjectArray
  696. "$javacall"
  697. /* Typecheck typemaps - The purpose of these is merely to issue a warning for overloaded C++ functions
  698. * that cannot be overloaded in Java as more than one C++ type maps to a single Java type */
  699. %typecheck(SWIG_TYPECHECK_BOOL) /* Java boolean */
  700. jboolean,
  701. bool,
  702. const bool &
  703. ""
  704. %typecheck(SWIG_TYPECHECK_CHAR) /* Java char */
  705. jchar,
  706. char,
  707. const char &
  708. ""
  709. %typecheck(SWIG_TYPECHECK_INT8) /* Java byte */
  710. jbyte,
  711. signed char,
  712. const signed char &
  713. ""
  714. %typecheck(SWIG_TYPECHECK_INT16) /* Java short */
  715. jshort,
  716. unsigned char,
  717. short,
  718. const unsigned char &,
  719. const short &
  720. ""
  721. %typecheck(SWIG_TYPECHECK_INT32) /* Java int */
  722. jint,
  723. unsigned short,
  724. int,
  725. long,
  726. const unsigned short &,
  727. const int &,
  728. const long &
  729. ""
  730. %typecheck(SWIG_TYPECHECK_INT64) /* Java long */
  731. jlong,
  732. unsigned int,
  733. unsigned long,
  734. long long,
  735. const unsigned int &,
  736. const unsigned long &,
  737. const long long &
  738. ""
  739. %typecheck(SWIG_TYPECHECK_INT128) /* Java BigInteger */
  740. unsigned long long,
  741. const unsigned long long &
  742. ""
  743. %typecheck(SWIG_TYPECHECK_FLOAT) /* Java float */
  744. jfloat,
  745. float,
  746. const float &
  747. ""
  748. %typecheck(SWIG_TYPECHECK_DOUBLE) /* Java double */
  749. jdouble,
  750. double,
  751. const double &
  752. ""
  753. %typecheck(SWIG_TYPECHECK_STRING) /* Java String */
  754. jstring,
  755. char *,
  756. char[ANY],
  757. char []
  758. ""
  759. %typecheck(SWIG_TYPECHECK_BOOL_ARRAY) /* Java boolean[] */
  760. jbooleanArray
  761. ""
  762. %typecheck(SWIG_TYPECHECK_CHAR_ARRAY) /* Java char[] */
  763. jcharArray
  764. ""
  765. %typecheck(SWIG_TYPECHECK_INT8_ARRAY) /* Java byte[] */
  766. jbyteArray
  767. ""
  768. %typecheck(SWIG_TYPECHECK_INT16_ARRAY) /* Java short[] */
  769. jshortArray
  770. ""
  771. %typecheck(SWIG_TYPECHECK_INT32_ARRAY) /* Java int[] */
  772. jintArray
  773. ""
  774. %typecheck(SWIG_TYPECHECK_INT64_ARRAY) /* Java long[] */
  775. jlongArray
  776. ""
  777. %typecheck(SWIG_TYPECHECK_FLOAT_ARRAY) /* Java float[] */
  778. jfloatArray
  779. ""
  780. %typecheck(SWIG_TYPECHECK_DOUBLE_ARRAY) /* Java double[] */
  781. jdoubleArray
  782. ""
  783. %typecheck(SWIG_TYPECHECK_OBJECT_ARRAY) /* Java jobject[] */
  784. jobjectArray
  785. ""
  786. %typecheck(SWIG_TYPECHECK_POINTER) /* Default */
  787. SWIGTYPE,
  788. SWIGTYPE *,
  789. SWIGTYPE &,
  790. SWIGTYPE [],
  791. SWIGTYPE (CLASS::*)
  792. ""
  793. /* Exception handling */
  794. %typemap(throws) int,
  795. long,
  796. short,
  797. unsigned int,
  798. unsigned long,
  799. unsigned short
  800. %{ char error_msg[256];
  801. sprintf(error_msg, "C++ $1_type exception thrown, value: %d", $1);
  802. SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, error_msg);
  803. return $null; %}
  804. %typemap(throws) SWIGTYPE, SWIGTYPE &, SWIGTYPE *, SWIGTYPE [], SWIGTYPE [ANY]
  805. %{ (void)$1;
  806. SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, "C++ $1_type exception thrown");
  807. return $null; %}
  808. %typemap(throws) char *
  809. %{ SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1);
  810. return $null; %}
  811. /* Typemaps for code generation in proxy classes and Java type wrapper classes */
  812. /* The javain typemap is used for converting function parameter types from the type
  813. * used in the proxy, module or type wrapper class to the type used in the JNI class. */
  814. %typemap(javain) bool, const bool &,
  815. char, const char &,
  816. signed char, const signed char &,
  817. unsigned char, const unsigned char &,
  818. short, const short &,
  819. unsigned short, const unsigned short &,
  820. int, const int &,
  821. unsigned int, const unsigned int &,
  822. long, const long &,
  823. unsigned long, const unsigned long &,
  824. long long, const long long &,
  825. unsigned long long, const unsigned long long &,
  826. float, const float &,
  827. double, const double &
  828. "$javainput"
  829. %typemap(javain) char *, char[ANY], char[] "$javainput"
  830. %typemap(javain) jboolean,
  831. jchar,
  832. jbyte,
  833. jshort,
  834. jint,
  835. jlong,
  836. jfloat,
  837. jdouble,
  838. jstring,
  839. jobject,
  840. jbooleanArray,
  841. jcharArray,
  842. jbyteArray,
  843. jshortArray,
  844. jintArray,
  845. jlongArray,
  846. jfloatArray,
  847. jdoubleArray,
  848. jobjectArray
  849. "$javainput"
  850. %typemap(javain) SWIGTYPE "$&javaclassname.getCPtr($javainput)"
  851. %typemap(javain) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "$javaclassname.getCPtr($javainput)"
  852. /* The javaout typemap is used for converting function return types from the return type
  853. * used in the JNI class to the type returned by the proxy, module or type wrapper class. */
  854. %typemap(javaout) bool, const bool &,
  855. char, const char &,
  856. signed char, const signed char &,
  857. unsigned char, const unsigned char &,
  858. short, const short &,
  859. unsigned short, const unsigned short &,
  860. int, const int &,
  861. unsigned int, const unsigned int &,
  862. long, const long &,
  863. unsigned long, const unsigned long &,
  864. long long, const long long &,
  865. unsigned long long, const unsigned long long &,
  866. float, const float &,
  867. double, const double & {
  868. return $jnicall;
  869. }
  870. %typemap(javaout) char *, char[ANY], char[] {
  871. return $jnicall;
  872. }
  873. %typemap(javaout) jboolean,
  874. jchar,
  875. jbyte,
  876. jshort,
  877. jint,
  878. jlong,
  879. jfloat,
  880. jdouble,
  881. jstring,
  882. jobject,
  883. jbooleanArray,
  884. jcharArray,
  885. jbyteArray,
  886. jshortArray,
  887. jintArray,
  888. jlongArray,
  889. jfloatArray,
  890. jdoubleArray,
  891. jobjectArray {
  892. return $jnicall;
  893. }
  894. %typemap(javaout) void {
  895. $jnicall;
  896. }
  897. %typemap(javaout) SWIGTYPE {
  898. return new $&javaclassname($jnicall, true);
  899. }
  900. %typemap(javaout) SWIGTYPE & {
  901. return new $javaclassname($jnicall, $owner);
  902. }
  903. %typemap(javaout) SWIGTYPE *, SWIGTYPE [], SWIGTYPE (CLASS::*) {
  904. long cPtr = $jnicall;
  905. return (cPtr == 0) ? null : new $javaclassname(cPtr, $owner);
  906. }
  907. /* Pointer reference typemaps */
  908. %typemap(jni) SWIGTYPE *& "jlong"
  909. %typemap(jtype) SWIGTYPE *& "long"
  910. %typemap(jstype) SWIGTYPE *& "$*javaclassname"
  911. %typemap(javain) SWIGTYPE *& "$*javaclassname.getCPtr($javainput)"
  912. %typemap(javaout) SWIGTYPE *& {
  913. long cPtr = $jnicall;
  914. return (cPtr == 0) ? null : new $*javaclassname(cPtr, $owner);
  915. }
  916. %typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
  917. %{ temp = *($1_ltype)&$input;
  918. $1 = &temp; %}
  919. %typemap(out) SWIGTYPE *&
  920. %{ *($1_ltype)&$result = *$1; %}
  921. /* Array reference typemaps */
  922. %apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
  923. /* Typemaps used for the generation of proxy and type wrapper class code */
  924. %typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
  925. %typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
  926. %typemap(javacode) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
  927. %typemap(javaimports) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
  928. %typemap(javainterfaces) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
  929. /* javabody typemaps */
  930. %define SWIG_JAVABODY_METHODS(PTRCTOR_VISIBILITY, CPTR_VISIBILITY, TYPENAME...)
  931. // Base proxy classes
  932. %typemap(javabody) TYPENAME %{
  933. private long swigCPtr;
  934. protected boolean swigCMemOwn;
  935. PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
  936. swigCMemOwn = cMemoryOwn;
  937. swigCPtr = cPtr;
  938. }
  939. CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
  940. return (obj == null) ? 0 : obj.swigCPtr;
  941. }
  942. %}
  943. // Derived proxy classes
  944. %typemap(javabody_derived) TYPENAME %{
  945. private long swigCPtr;
  946. PTRCTOR_VISIBILITY $javaclassname(long cPtr, boolean cMemoryOwn) {
  947. super($imclassname.SWIG$javaclassnameUpcast(cPtr), cMemoryOwn);
  948. swigCPtr = cPtr;
  949. }
  950. CPTR_VISIBILITY static long getCPtr($javaclassname obj) {
  951. return (obj == null) ? 0 : obj.swigCPtr;
  952. }
  953. %}
  954. %enddef
  955. /* Set the default for SWIGTYPE: pointer constructor is protected,
  956. getCPtr is protected. Season to your own taste! */
  957. SWIG_JAVABODY_METHODS(protected, protected, SWIGTYPE)
  958. // Typewrapper classes
  959. %typemap(javabody) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) %{
  960. private long swigCPtr;
  961. protected $javaclassname(long cPtr, boolean futureUse) {
  962. swigCPtr = cPtr;
  963. }
  964. protected $javaclassname() {
  965. swigCPtr = 0;
  966. }
  967. protected static long getCPtr($javaclassname obj) {
  968. return (obj == null) ? 0 : obj.swigCPtr;
  969. }
  970. %}
  971. %typemap(javafinalize) SWIGTYPE %{
  972. protected void finalize() {
  973. delete();
  974. }
  975. %}
  976. /*
  977. * Java constructor typemaps:
  978. *
  979. * The javaconstruct typemap is inserted when a proxy class's constructor is generated.
  980. * This typemap allows control over what code is executed in the constructor as
  981. * well as specifying who owns the underlying C/C++ object. Normally, Java has
  982. * ownership and the underlying C/C++ object is deallocated when the Java object
  983. * is finalized (swigCMemOwn is true.) If swigCMemOwn is false, C/C++ is
  984. * ultimately responsible for deallocating the underlying object's memory.
  985. *
  986. * The SWIG_PROXY_CONSTRUCTOR macro defines the javaconstruct typemap for a proxy
  987. * class for a particular TYPENAME. OWNERSHIP is passed as the value of
  988. * swigCMemOwn to the pointer constructor method. WEAKREF determines which kind
  989. * of Java object reference will be used by the C++ director class (WeakGlobalRef
  990. * vs. GlobalRef.)
  991. *
  992. * The SWIG_DIRECTOR_OWNED macro sets the ownership of director-based proxy
  993. * classes and the weak reference flag to false, meaning that the underlying C++
  994. * object will be reclaimed by C++.
  995. */
  996. %define SWIG_PROXY_CONSTRUCTOR(OWNERSHIP, WEAKREF, TYPENAME...)
  997. %typemap(javaconstruct,directorconnect="\n $imclassname.$javaclassname_director_connect(this, swigCPtr, swigCMemOwn, WEAKREF);") TYPENAME {
  998. this($imcall, OWNERSHIP);$directorconnect
  999. }
  1000. %enddef
  1001. %define SWIG_DIRECTOR_OWNED(TYPENAME...)
  1002. SWIG_PROXY_CONSTRUCTOR(true, false, TYPENAME)
  1003. %enddef
  1004. // Set the default for SWIGTYPE: Java owns the C/C++ object.
  1005. SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
  1006. %typemap(javadestruct, methodname="delete", methodmodifiers="public synchronized") SWIGTYPE {
  1007. if(swigCPtr != 0 && swigCMemOwn) {
  1008. swigCMemOwn = false;
  1009. $jnicall;
  1010. }
  1011. swigCPtr = 0;
  1012. }
  1013. %typemap(javadestruct_derived, methodname="delete", methodmodifiers="public synchronized") SWIGTYPE {
  1014. if(swigCPtr != 0 && swigCMemOwn) {
  1015. swigCMemOwn = false;
  1016. $jnicall;
  1017. }
  1018. swigCPtr = 0;
  1019. super.delete();
  1020. }
  1021. %typemap(directordisconnect, methodname="swigDirectorDisconnect") SWIGTYPE %{
  1022. protected void $methodname() {
  1023. swigCMemOwn = false;
  1024. $jnicall;
  1025. }
  1026. %}
  1027. %typemap(directorowner_release, methodname="swigReleaseOwnership") SWIGTYPE %{
  1028. public void $methodname() {
  1029. swigCMemOwn = false;
  1030. $jnicall;
  1031. }
  1032. %}
  1033. %typemap(directorowner_take, methodname="swigTakeOwnership") SWIGTYPE %{
  1034. public void $methodname() {
  1035. swigCMemOwn = true;
  1036. $jnicall;
  1037. }
  1038. %}
  1039. /* Java specific directives */
  1040. #define %javaconst(flag) %feature("java:const","flag")
  1041. #define %javaconstvalue(value) %feature("java:constvalue",value)
  1042. #define %javaenum(wrapapproach) %feature("java:enum","wrapapproach")
  1043. #define %javamethodmodifiers %feature("java:methodmodifiers")
  1044. #define %javaexception(exceptionclasses) %feature("except",throws=exceptionclasses)
  1045. #define %nojavaexception %feature("except","",throws="")
  1046. %pragma(java) jniclassclassmodifiers="class"
  1047. %pragma(java) moduleclassmodifiers="public class"
  1048. /* Some ANSI C typemaps */
  1049. %apply unsigned long { size_t };
  1050. %apply const unsigned long & { const size_t & };
  1051. /* java keywords */
  1052. %include <javakw.swg>
  1053. // Default enum handling
  1054. %include <enumtypesafe.swg>