/[eiffelstudio]/trunk/Src/library/Eiffel2Java/jni_environment.e
ViewVC logotype

Contents of /trunk/Src/library/Eiffel2Java/jni_environment.e

Parent Directory Parent Directory | Revision Log Revision Log


Revision 34906 - (show annotations)
Fri Nov 22 22:45:32 2002 UTC (17 years, 3 months ago) by manus
File size: 53144 byte(s)
Better comments for class name specification.

1 indexing
2 description: "Holds information abouy JNI environment. %
3 %Potentially many JNI environments can exists at once,%
4 % but more than one was never tested"
5 date: "$Date$"
6 revision: "$Revision$"
7
8 class
9 JNI_ENVIRONMENT
10
11 create {JAVA_VM}
12 make
13
14 feature {NONE} -- Initialization
15
16 make (vm: JAVA_VM) is
17 -- Create new JNI environment
18 require
19 vm_not_void: vm /= Void
20 do
21 jvm := vm
22 create java_class_table.make (200)
23 create java_object_table.make (200)
24 end
25
26 feature -- Disposal
27
28 destroy_vm is
29 -- Destroy the JVM and reclaim its ressources
30 -- It can only be used in the main thread when it is the
31 -- last remaining thread
32 do
33 jvm.destroy_vm
34 end
35
36 feature -- Exception mechanism
37
38 check_for_exceptions is
39 -- Check if a Java exception occurred, raise Java exception occurred
40 local
41 p, null: POINTER
42 l_exception: EXCEPTIONS
43 do
44 p := c_exception_occurred (jvm.envp)
45 if p /= null then
46 c_exception_describe (jvm.envp)
47 c_exception_clear (jvm.envp)
48 create l_exception
49 l_exception.raise ("Java Exception occurred")
50 end
51 end
52
53 throw_java_exception (jthrowable: JAVA_OBJECT) is
54 -- throw the exception 'jthrowable' (must be a java.lang.Throwable object)
55 do
56 c_throw_java_exception (jvm.envp, jthrowable.java_object_id)
57 end
58
59 throw_custom_exception (jclass: JAVA_CLASS; msg: STRING) is
60 -- Constructs an exception object from the specified class 'jclass'
61 -- with the message specified by 'msg' and causes that exception
62 -- to be thrown.
63 local
64 l_msg_to_c: C_STRING
65 do
66 create l_msg_to_c.make (msg)
67 c_throw_custom_exception (jvm.envp, jclass.java_class_id, l_msg_to_c.item)
68 end
69
70 feature -- Thread Mechanism
71
72 attach_current_thread is
73 -- Attach `jvm' to current thread.
74 do
75 jvm.attach_current_thread
76 end
77
78 detach_current_thread is
79 -- Detach `jvm' from current thread.
80 do
81 jvm.detach_current_thread
82 end
83
84 feature {JAVA_CLASS, JAVA_OBJECT, JAVA_ARGS, JAVA_ARRAY}
85
86 java_object_table: HASH_TABLE [JAVA_OBJECT, POINTER]
87 -- Table of Eiffel objects representing Java objects
88
89 feature {NONE} -- Access
90
91 jvm: JAVA_VM
92 -- JVM that goes with the JNI enviroment
93
94 java_class_table: HASH_TABLE [JAVA_CLASS, POINTER]
95 -- Table of classes we have loaded - keyed by java_class_id
96
97 feature -- Reflection
98
99 find_class (name: STRING): JAVA_CLASS is
100 -- Load in the Java class with the given name.
101 -- Namespace if any are delimited by `/'
102 require
103 name_valid: name /= Void
104 local
105 clsp: POINTER
106 l_name_to_c: C_STRING
107 do
108 create l_name_to_c.make (name)
109 clsp := c_jni_find_class (jvm.envp, l_name_to_c.item);
110 debug ("jni")
111 check_for_exceptions
112 end
113 Result := find_class_by_pointer (clsp)
114 end
115
116 find_class_by_pointer (classp: POINTER): JAVA_CLASS is
117 -- Get a Java class Eiffel proxy given pointer to the
118 -- Java class. Create a new one if needed
119 require
120 classp_not_null: classp /= default_pointer
121 do
122 Result := java_class_table.item (classp)
123 if Result = Void then
124 if classp /= default_pointer then
125 create Result.make (classp)
126 java_class_table.put (Result, classp)
127 end
128 end
129 end
130
131 find_class_pointer (name: STRING): POINTER is
132 -- Find class pointer only (used during creation in descendants).
133 -- Namespace if any are delimited by `/'
134 local
135 l_name_to_c: C_STRING
136 do
137 create l_name_to_c.make (name)
138 Result := c_jni_find_class (jvm.envp, l_name_to_c.item);
139 debug ("jni")
140 check_for_exceptions
141 end
142 end
143
144 get_class (an_obj: POINTER): POINTER is
145 -- Get associated class of `an_obj'.
146 require
147 an_obj_not_null: an_obj /= default_pointer
148 do
149 Result := c_get_class (jvm.envp, an_obj)
150 debug ("jni")
151 check_for_exceptions
152 end
153 end
154
155 get_method_id (cls: POINTER; mname: POINTER; sig: POINTER): POINTER is
156 -- Find feature `mname' in class `cls' with signature `sig'.
157 do
158 Result := c_get_method_id (jvm.envp, cls, mname, sig)
159 debug ("jni")
160 check_for_exceptions
161 end
162 end
163
164 get_static_method_id (cls: POINTER; mname: POINTER; sig: POINTER): POINTER is
165 -- Find static feature `mname' in class `cls' with signature `sig'.
166 do
167 Result := c_get_static_method_id (jvm.envp, cls, mname, sig)
168 debug ("jni")
169 check_for_exceptions
170 end
171 end
172
173 get_field_id (cls: POINTER; fname, sig: POINTER): POINTER is
174 -- Find attribute `mname' in class `cls' with signature `sig'.
175 do
176 Result := c_get_field_id (jvm.envp, cls, fname, sig)
177 debug ("jni")
178 check_for_exceptions
179 end
180 end
181
182 get_static_field_id (cls: POINTER; fname, sig: POINTER): POINTER is
183 -- Find static attribute `mname' in class `cls' with signature `sig'.
184 do
185 Result := c_get_static_field_id (jvm.envp, cls, fname, sig)
186 debug ("jni")
187 check_for_exceptions
188 end
189 end
190
191 feature -- Object creation
192
193 new_object (cls: POINTER; constructor: POINTER; args: POINTER): POINTER is
194 -- Create a new instance of `cls' using feature `constructor' and
195 -- arguments `args'.
196 do
197 Result := c_new_object (jvm.envp, cls, constructor, args)
198 debug ("jni")
199 check_for_exceptions
200 end
201 end
202
203 new_string (v: STRING): POINTER is
204 -- Create a new java string from `v'.
205 local
206 l_str: C_STRING
207 do
208 if v /= Void then
209 create l_str.make (v)
210 Result := c_new_string_utf (jvm.envp, l_str.item)
211 debug ("jni")
212 check_for_exceptions
213 end
214 end
215 end
216
217 new_boolean_array (a_size: INTEGER): POINTER is
218 -- Create a new array of boolean.
219 require
220 a_size_positive: a_size >= 0
221 do
222 Result := c_new_boolean_array (jvm.envp, a_size)
223 debug ("jni")
224 check_for_exceptions
225 end
226 end
227
228 new_char_array (a_size: INTEGER): POINTER is
229 -- Create a new array of char.
230 require
231 a_size_positive: a_size >= 0
232 do
233 Result := c_new_char_array (jvm.envp, a_size)
234 debug ("jni")
235 check_for_exceptions
236 end
237 end
238
239 new_int_array (a_size: INTEGER): POINTER is
240 -- Create a new array of int.
241 require
242 a_size_positive: a_size >= 0
243 do
244 Result := c_new_int_array (jvm.envp, a_size)
245 debug ("jni")
246 check_for_exceptions
247 end
248 end
249
250 new_long_array (a_size: INTEGER): POINTER is
251 -- Create a new array of long.
252 require
253 a_size_positive: a_size >= 0
254 do
255 Result := c_new_long_array (jvm.envp, a_size)
256 debug ("jni")
257 check_for_exceptions
258 end
259 end
260
261 new_double_array (a_size: INTEGER): POINTER is
262 -- Create a new array of double.
263 require
264 a_size_positive: a_size >= 0
265 do
266 Result := c_new_double_array (jvm.envp, a_size)
267 debug ("jni")
268 check_for_exceptions
269 end
270 end
271
272 new_float_array (a_size: INTEGER): POINTER is
273 -- Create a new array of float.
274 require
275 a_size_positive: a_size >= 0
276 do
277 Result := c_new_float_array (jvm.envp, a_size)
278 debug ("jni")
279 check_for_exceptions
280 end
281 end
282
283 new_short_array (a_size: INTEGER): POINTER is
284 -- Create a new array of short.
285 require
286 a_size_positive: a_size >= 0
287 do
288 Result := c_new_short_array (jvm.envp, a_size)
289 debug ("jni")
290 check_for_exceptions
291 end
292 end
293
294 new_byte_array (a_size: INTEGER): POINTER is
295 -- Create a new array of byte.
296 require
297 a_size_positive: a_size >= 0
298 do
299 Result := c_new_byte_array (jvm.envp, a_size)
300 debug ("jni")
301 check_for_exceptions
302 end
303 end
304
305 new_object_array (a_size: INTEGER; element_class: POINTER; init_elt: POINTER): POINTER is
306 -- Create a new array of reference of type `element_class'.
307 require
308 a_size_positive: a_size >= 0
309 element_class_not_null: element_class /= default_pointer
310 do
311 Result := c_new_object_array (jvm.envp, a_size, element_class, init_elt)
312 debug ("jni")
313 check_for_exceptions
314 end
315 end
316
317 feature -- Calls
318
319 call_void_method (oid: POINTER; mid: POINTER; args: POINTER) is
320 -- Call function `mid' with argument `args' on object `oid'.
321 do
322 c_call_void_method (jvm.envp, oid, mid, args)
323 debug ("jni")
324 check_for_exceptions
325 end
326 end
327
328 call_boolean_method (oid: POINTER; mid: POINTER; args: POINTER): BOOLEAN is
329 -- Call function `mid' with argument `args' on object `oid'.
330 do
331 Result := c_call_boolean_method (jvm.envp, oid, mid, args)
332 debug ("jni")
333 check_for_exceptions
334 end
335 end
336
337 call_byte_method (oid: POINTER; mid: POINTER; args: POINTER): INTEGER_8 is
338 -- Call function `mid' with argument `args' on object `oid'.
339 do
340 Result := c_call_byte_method (jvm.envp, oid, mid, args)
341 debug ("jni")
342 check_for_exceptions
343 end
344 end
345
346 call_char_method (oid: POINTER; mid: POINTER; args: POINTER): CHARACTER is
347 -- Call function `mid' with argument `args' on object `oid'.
348 do
349 Result := c_call_char_method (jvm.envp, oid, mid, args)
350 debug ("jni")
351 check_for_exceptions
352 end
353 end
354
355 call_short_method (oid: POINTER; mid: POINTER; args: POINTER): INTEGER_16 is
356 -- Call function `mid' with argument `args' on object `oid'.
357 do
358 Result := c_call_short_method (jvm.envp, oid, mid, args)
359 debug ("jni")
360 check_for_exceptions
361 end
362 end
363
364 call_int_method (oid: POINTER; mid: POINTER; args: POINTER): INTEGER is
365 -- Call function `mid' with argument `args' on object `oid'.
366 do
367 Result := c_call_int_method (jvm.envp, oid, mid, args)
368 debug ("jni")
369 check_for_exceptions
370 end
371 end
372
373 call_long_method (oid: POINTER; mid: POINTER; args: POINTER): INTEGER_64 is
374 -- Call function `mid' with argument `args' on object `oid'.
375 do
376 Result := c_call_long_method (jvm.envp, oid, mid, args)
377 debug ("jni")
378 check_for_exceptions
379 end
380 end
381
382 call_float_method (oid: POINTER; mid: POINTER; args: POINTER): REAL is
383 -- Call function `mid' with argument `args' on object `oid'.
384 do
385 Result := c_call_float_method (jvm.envp, oid, mid, args)
386 debug ("jni")
387 check_for_exceptions
388 end
389 end
390
391 call_double_method (oid: POINTER; mid: POINTER; args: POINTER): DOUBLE is
392 -- Call function `mid' with argument `args' on object `oid'.
393 do
394 Result := c_call_double_method (jvm.envp, oid, mid, args)
395 debug ("jni")
396 check_for_exceptions
397 end
398 end
399
400 call_object_method (oid: POINTER; mid: POINTER; argsp: POINTER): POINTER is
401 -- Call function `mid' with argument `args' on object `oid'.
402 do
403 Result := c_call_object_method (jvm.envp, oid, mid, argsp)
404 debug ("jni")
405 check_for_exceptions
406 end
407 end
408
409 call_string_method (oid: POINTER; mid: POINTER; args: POINTER): STRING is
410 -- Call function `mid' with argument `args' on object `oid'.
411 local
412 p, null: POINTER
413 do
414 p := c_call_object_method (jvm.envp, oid, mid, args)
415 debug ("jni")
416 check_for_exceptions
417 end
418 if p /= null then
419 Result := get_string (p)
420 end
421 end
422
423 feature -- Static calls
424
425 call_static_void_method (cls: POINTER; mid: POINTER; argp: POINTER) is
426 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
427 do
428 c_call_static_void_method (jvm.envp, cls, mid, argp)
429 debug ("jni")
430 check_for_exceptions
431 end
432 end
433
434 call_static_byte_method (cls: POINTER; mid: POINTER; argp: POINTER): INTEGER_8 is
435 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
436 do
437 Result := c_call_static_byte_method (jvm.envp, cls, mid, argp)
438 debug ("jni")
439 check_for_exceptions
440 end
441 end
442
443 call_static_boolean_method (cls: POINTER; mid: POINTER; argp: POINTER): BOOLEAN is
444 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
445 do
446 Result := c_call_static_boolean_method (jvm.envp, cls, mid, argp)
447 debug ("jni")
448 check_for_exceptions
449 end
450 end
451
452 call_static_char_method (cls: POINTER; mid: POINTER; argp: POINTER): CHARACTER is
453 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
454 do
455 Result := c_call_static_char_method (jvm.envp, cls, mid, argp)
456 debug ("jni")
457 check_for_exceptions
458 end
459 end
460
461 call_static_short_method (cls: POINTER; mid: POINTER; argp: POINTER): INTEGER_16 is
462 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
463 do
464 Result := c_call_static_short_method (jvm.envp, cls, mid, argp)
465 debug ("jni")
466 check_for_exceptions
467 end
468 end
469
470 call_static_int_method (cls: POINTER; mid: POINTER; argp: POINTER): INTEGER is
471 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
472 do
473 Result := c_call_static_int_method (jvm.envp, cls, mid, argp)
474 debug ("jni")
475 check_for_exceptions
476 end
477 end
478
479 call_static_long_method (cls: POINTER; mid: POINTER; argp: POINTER): INTEGER_64 is
480 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
481 do
482 Result := c_call_static_long_method (jvm.envp, cls, mid, argp)
483 debug ("jni")
484 check_for_exceptions
485 end
486 end
487
488 call_static_float_method (cls: POINTER; mid: POINTER; argp: POINTER): REAL is
489 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
490 do
491 Result := c_call_static_float_method (jvm.envp, cls, mid, argp)
492 debug ("jni")
493 check_for_exceptions
494 end
495 end
496
497 call_static_double_method (cls: POINTER; mid: POINTER; argp: POINTER): DOUBLE is
498 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
499 do
500 Result := c_call_static_double_method (jvm.envp, cls, mid, argp)
501 debug ("jni")
502 check_for_exceptions
503 end
504 end
505
506 call_static_object_method (cls: POINTER; mid: POINTER; argp: POINTER): POINTER is
507 -- Call static feature `mid' defined in class `cls' with arguments `argp'.
508 do
509 Result := c_call_static_object_method (jvm.envp, cls, mid, argp)
510 debug ("jni")
511 check_for_exceptions
512 end
513 end
514
515 call_static_string_method (cls: POINTER; mid: POINTER; argsp: POINTER): STRING is
516 require
517 cls_not_null: cls /= default_pointer
518 mid_not_null: mid /= default_pointer
519 argsp_not_null: argsp /= default_pointer
520 local
521 l_str, null: POINTER
522 do
523 l_str := c_call_static_object_method (jvm.envp, cls, mid, argsp)
524 debug ("jni")
525 check_for_exceptions
526 end
527 if l_str /= null then
528 Result := get_string (l_str)
529 end
530 end
531
532 feature -- Field Access
533
534 get_integer_field (oid: POINTER; fid: POINTER): INTEGER is
535 -- Value of attribute `fid' in object `oid'.
536 do
537 Result := c_get_integer_field (jvm.envp, oid, fid)
538 debug ("jni")
539 check_for_exceptions
540 end
541 end
542
543 get_long_field (oid: POINTER; fid: POINTER): INTEGER_64 is
544 -- Value of attribute `fid' in object `oid'.
545 do
546 Result := c_get_long_field (jvm.envp, oid, fid)
547 debug ("jni")
548 check_for_exceptions
549 end
550 end
551
552 get_boolean_field (oid: POINTER; fid: POINTER): BOOLEAN is
553 -- Value of attribute `fid' in object `oid'.
554 do
555 Result := c_get_boolean_field (jvm.envp, oid, fid)
556 debug ("jni")
557 check_for_exceptions
558 end
559 end
560
561 get_char_field (oid: POINTER; fid: POINTER): CHARACTER is
562 -- Value of attribute `fid' in object `oid'.
563 do
564 Result := c_get_char_field (jvm.envp, oid, fid)
565 debug ("jni")
566 check_for_exceptions
567 end
568 end
569
570 get_float_field (oid: POINTER; fid: POINTER): REAL is
571 -- Value of attribute `fid' in object `oid'.
572 do
573 Result := c_get_float_field (jvm.envp, oid, fid)
574 debug ("jni")
575 check_for_exceptions
576 end
577 end
578
579 get_double_field (oid: POINTER; fid: POINTER): DOUBLE is
580 -- Value of attribute `fid' in object `oid'.
581 do
582 Result := c_get_double_field (jvm.envp, oid, fid)
583 debug ("jni")
584 check_for_exceptions
585 end
586 end
587
588 get_byte_field (oid: POINTER; fid: POINTER): INTEGER_8 is
589 -- Value of attribute `fid' in object `oid'.
590 do
591 Result := c_get_byte_field (jvm.envp, oid, fid)
592 debug ("jni")
593 check_for_exceptions
594 end
595 end
596
597 get_short_field (oid: POINTER; fid: POINTER): INTEGER_16 is
598 -- Value of attribute `fid' in object `oid'.
599 do
600 Result := c_get_short_field (jvm.envp, oid, fid)
601 debug ("jni")
602 check_for_exceptions
603 end
604 end
605
606 get_object_field (oid: POINTER; fid: POINTER): POINTER is
607 -- Value of attribute `fid' in object `oid'.
608 do
609 Result := c_get_object_field (jvm.envp, oid, fid)
610 debug ("jni")
611 check_for_exceptions
612 end
613 end
614
615 get_string_field (oid: POINTER; fid: POINTER): STRING is
616 require
617 oid_not_null: oid /= default_pointer
618 fid_not_null: fid /= default_pointer
619 local
620 l_str, null: POINTER
621 do
622 l_str := c_get_object_field (jvm.envp, oid, fid)
623 debug ("jni")
624 check_for_exceptions
625 end
626 if l_str /= null then
627 Result := get_string (l_str)
628 end
629 end
630
631 feature -- Static Field access
632
633 get_static_integer_field (cls: POINTER; fid: POINTER): INTEGER is
634 -- Value of attribute `fid' in static `cls'.
635 do
636 Result := c_get_static_integer_field (jvm.envp, cls, fid)
637 debug ("jni")
638 check_for_exceptions
639 end
640 end
641
642 get_static_long_field (cls: POINTER; fid: POINTER): INTEGER_64 is
643 -- Value of attribute `fid' in static `cls'.
644 do
645 Result := c_get_static_long_field (jvm.envp, cls, fid)
646 debug ("jni")
647 check_for_exceptions
648 end
649 end
650
651 get_static_boolean_field (cls: POINTER; fid: POINTER): BOOLEAN is
652 -- Value of attribute `fid' in static `cls'.
653 do
654 Result := c_get_static_boolean_field (jvm.envp, cls, fid)
655 debug ("jni")
656 check_for_exceptions
657 end
658 end
659
660 get_static_char_field (cls: POINTER; fid: POINTER): CHARACTER is
661 -- Value of attribute `fid' in static `cls'.
662 do
663 Result := c_get_static_char_field (jvm.envp, cls, fid)
664 debug ("jni")
665 check_for_exceptions
666 end
667 end
668
669 get_static_float_field (cls: POINTER; fid: POINTER): REAL is
670 -- Value of attribute `fid' in static `cls'.
671 do
672 Result := c_get_static_float_field (jvm.envp, cls, fid)
673 debug ("jni")
674 check_for_exceptions
675 end
676 end
677
678 get_static_double_field (cls: POINTER; fid: POINTER): DOUBLE is
679 -- Value of attribute `fid' in static `cls'.
680 do
681 Result := c_get_static_double_field (jvm.envp, cls, fid)
682 debug ("jni")
683 check_for_exceptions
684 end
685 end
686
687 get_static_byte_field (cls: POINTER; fid: POINTER): INTEGER_8 is
688 -- Value of attribute `fid' in static `cls'.
689 do
690 Result := c_get_static_byte_field (jvm.envp, cls, fid)
691 debug ("jni")
692 check_for_exceptions
693 end
694 end
695
696 get_static_short_field (cls: POINTER; fid: POINTER): INTEGER_16 is
697 -- Value of attribute `fid' in static `cls'.
698 do
699 Result := c_get_static_short_field (jvm.envp, cls, fid)
700 debug ("jni")
701 check_for_exceptions
702 end
703 end
704
705 get_static_object_field (cls: POINTER; fid: POINTER): POINTER is
706 -- Value of attribute `fid' in static `cls'.
707 do
708 Result := c_get_static_object_field (jvm.envp, cls, fid)
709 debug ("jni")
710 check_for_exceptions
711 end
712 end
713
714 get_static_string_field (cls: POINTER; fid: POINTER): STRING is
715 require
716 cls_not_null: cls /= default_pointer
717 fid_not_null: fid /= default_pointer
718 local
719 l_str, null: POINTER
720 do
721 l_str := c_get_static_object_field (jvm.envp, cls, fid)
722 debug ("jni")
723 check_for_exceptions
724 end
725 if l_str /= null then
726 Result := get_string (l_str)
727 end
728 end
729
730 feature -- Field setting
731
732 set_integer_field (oid: POINTER; fid: POINTER; v: INTEGER) is
733 -- Set attribute `fid' with value `v' in object `oid'.
734 do
735 c_set_integer_field (jvm.envp, oid, fid, v)
736 debug ("jni")
737 check_for_exceptions
738 end
739 end
740
741 set_long_field (oid: POINTER; fid: POINTER; v: INTEGER_64) is
742 -- Set attribute `fid' with value `v' in object `oid'.
743 do
744 c_set_long_field (jvm.envp, oid, fid, v)
745 debug ("jni")
746 check_for_exceptions
747 end
748 end
749
750 set_object_field (oid: POINTER; fid: POINTER; v: POINTER) is
751 -- Set attribute `fid' with value `v' in object `oid'.
752 do
753 c_set_object_field (jvm.envp, oid, fid, v)
754 debug ("jni")
755 check_for_exceptions
756 end
757 end
758
759 set_boolean_field (oid: POINTER; fid: POINTER; v: BOOLEAN) is
760 -- Set attribute `fid' with value `v' in object `oid'.
761 do
762 c_set_boolean_field (jvm.envp, oid, fid, v)
763 debug ("jni")
764 check_for_exceptions
765 end
766 end
767
768 set_char_field (oid: POINTER; fid: POINTER; v: CHARACTER) is
769 -- Set attribute `fid' with value `v' in object `oid'.
770 do
771 c_set_char_field (jvm.envp, oid, fid, v)
772 debug ("jni")
773 check_for_exceptions
774 end
775 end
776
777 set_float_field (oid: POINTER; fid: POINTER; v: REAL) is
778 -- Set attribute `fid' with value `v' in object `oid'.
779 do
780 c_set_float_field (jvm.envp, oid, fid, v)
781 debug ("jni")
782 check_for_exceptions
783 end
784 end
785
786 set_double_field (oid: POINTER; fid: POINTER; v: DOUBLE) is
787 -- Set attribute `fid' with value `v' in object `oid'.
788 do
789 c_set_double_field (jvm.envp, oid, fid, v)
790 debug ("jni")
791 check_for_exceptions
792 end
793 end
794
795 set_byte_field (oid: POINTER; fid: POINTER; v: INTEGER_8) is
796 -- Set attribute `fid' with value `v' in object `oid'.
797 do
798 c_set_byte_field (jvm.envp, oid, fid, v)
799 debug ("jni")
800 check_for_exceptions
801 end
802 end
803
804 set_short_field (oid: POINTER; fid: POINTER; v: INTEGER_16) is
805 -- Set attribute `fid' with value `v' in object `oid'.
806 do
807 c_set_short_field (jvm.envp, oid, fid, v)
808 debug ("jni")
809 check_for_exceptions
810 end
811 end
812
813 set_string_field (oid: POINTER; fid: POINTER; v: STRING) is
814 require
815 oid_not_null: oid /= default_pointer
816 fid_not_null: fid /= default_pointer
817 v_not_void: v /= Void
818 local
819 p: POINTER
820 l_str: C_STRING
821 do
822 create l_str.make (v)
823 p := c_new_string_utf (jvm.envp, l_str.item)
824 c_set_object_field (jvm.envp, oid, fid, p)
825 ensure
826 string_field_set: v.is_equal (get_string_field (oid, fid))
827 end
828
829 feature -- Static field setting
830
831 set_static_integer_field (cls: POINTER; fid: POINTER; v: INTEGER) is
832 -- Set attribute `fid' with value `v' in class `cls'.
833 do
834 c_set_static_integer_field (jvm.envp, cls, fid, v)
835 debug ("jni")
836 check_for_exceptions
837 end
838 end
839
840 set_static_long_field (cls: POINTER; fid: POINTER; v: INTEGER_64) is
841 -- Set attribute `fid' with value `v' in class `cls'.
842 do
843 c_set_static_long_field (jvm.envp, cls, fid, v)
844 debug ("jni")
845 check_for_exceptions
846 end
847 end
848
849 set_static_object_field (cls: POINTER; fid: POINTER; v: POINTER) is
850 -- Set attribute `fid' with value `v' in class `cls'.
851 do
852 c_set_static_object_field (jvm.envp, cls, fid, v)
853 debug ("jni")
854 check_for_exceptions
855 end
856 end
857
858 set_static_boolean_field (cls: POINTER; fid: POINTER; v: BOOLEAN) is
859 -- Set attribute `fid' with value `v' in class `cls'.
860 do
861 c_set_static_boolean_field (jvm.envp, cls, fid, v)
862 debug ("jni")
863 check_for_exceptions
864 end
865 end
866
867 set_static_char_field (cls: POINTER; fid: POINTER; v: CHARACTER) is
868 -- Set attribute `fid' with value `v' in class `cls'.
869 do
870 c_set_static_char_field (jvm.envp, cls, fid, v)
871 debug ("jni")
872 check_for_exceptions
873 end
874 end
875
876 set_static_float_field (cls: POINTER; fid: POINTER; v: REAL) is
877 -- Set attribute `fid' with value `v' in class `cls'.
878 do
879 c_set_static_float_field (jvm.envp, cls, fid, v)
880 debug ("jni")
881 check_for_exceptions
882 end
883 end
884
885 set_static_double_field (cls: POINTER; fid: POINTER; v: DOUBLE) is
886 -- Set attribute `fid' with value `v' in class `cls'.
887 do
888 c_set_static_double_field (jvm.envp, cls, fid, v)
889 debug ("jni")
890 check_for_exceptions
891 end
892 end
893
894 set_static_byte_field (cls: POINTER; fid: POINTER; v: INTEGER_8) is
895 -- Set attribute `fid' with value `v' in class `cls'.
896 do
897 c_set_static_byte_field (jvm.envp, cls, fid, v)
898 debug ("jni")
899 check_for_exceptions
900 end
901 end
902
903 set_static_short_field (cls: POINTER; fid: POINTER; v: INTEGER_16) is
904 -- Set attribute `fid' with value `v' in class `cls'.
905 do
906 c_set_static_short_field (jvm.envp, cls, fid, v)
907 debug ("jni")
908 check_for_exceptions
909 end
910 end
911
912 set_static_string_field (cls: POINTER; fid: POINTER; value: STRING) is
913 require
914 cls_not_null: cls /= default_pointer
915 fid_not_null: fid /= default_pointer
916 value_not_void: value /= Void
917 local
918 p: POINTER
919 l_str: C_STRING
920 do
921 create l_str.make (value)
922 p := c_new_string_utf (jvm.envp, l_str.item)
923 c_set_static_object_field (jvm.envp, cls, fid, p)
924 debug ("jni")
925 check_for_exceptions
926 end
927 ensure
928 static_string_field_set: value.is_equal (get_static_string_field (cls, fid))
929 end
930
931 feature -- Array manipulation
932
933 get_array_length (jarray: POINTER): INTEGER is
934 -- Number of elements in `jarray'.
935 require
936 jarray_not_null: jarray /= default_pointer
937 do
938 Result := c_get_array_length (jvm.envp, jarray)
939 debug ("jni")
940 check_for_exceptions
941 end
942 end
943
944 get_object_array_element (jarray: POINTER; indx: INTEGER): POINTER is
945 -- Item at index `indx' in `jarray'.
946 require
947 jarray_not_null: jarray /= default_pointer
948 do
949 Result := c_get_object_array_element (jvm.envp, jarray, indx)
950 debug ("jni")
951 check_for_exceptions
952 end
953 end
954
955 set_object_array_element (jarray: POINTER; indx: INTEGER; v: POINTER) is
956 -- Put `v' at index `indx' in `jarray'.
957 require
958 jarray_not_null: jarray /= default_pointer
959 do
960 c_set_object_array_element (jvm.envp, jarray, indx, v)
961 debug ("jni")
962 check_for_exceptions
963 end
964 end
965
966 get_char_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
967 -- Acquire area of `jarray'.
968 require
969 jarray_not_null: jarray /= default_pointer
970 do
971 Result := c_get_char_array_elements (jvm.envp, jarray, is_copy)
972 debug ("jni")
973 check_for_exceptions
974 end
975 end
976
977 release_char_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
978 -- Release area of `jarray' pointed by `elts'.
979 require
980 jarray_not_null: jarray /= default_pointer
981 elts_not_null: elts /= default_pointer
982 do
983 c_release_char_array_elements (jvm.envp, jarray, elts, mode)
984 debug ("jni")
985 check_for_exceptions
986 end
987 end
988
989 get_int_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
990 -- Acquire area of `jarray'.
991 require
992 jarray_not_null: jarray /= default_pointer
993 do
994 Result := c_get_int_array_elements (jvm.envp, jarray, is_copy)
995 debug ("jni")
996 check_for_exceptions
997 end
998 end
999
1000 release_int_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1001 -- Release area of `jarray' pointed by `elts'.
1002 require
1003 jarray_not_null: jarray /= default_pointer
1004 elts_not_null: elts /= default_pointer
1005 do
1006 c_release_int_array_elements (jvm.envp, jarray, elts, mode)
1007 debug ("jni")
1008 check_for_exceptions
1009 end
1010 end
1011
1012 get_long_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
1013 -- Acquire area of `jarray'.
1014 require
1015 jarray_not_null: jarray /= default_pointer
1016 do
1017 Result := c_get_long_array_elements (jvm.envp, jarray, is_copy)
1018 debug ("jni")
1019 check_for_exceptions
1020 end
1021 end
1022
1023 release_long_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1024 -- Release area of `jarray' pointed by `elts'.
1025 require
1026 jarray_not_null: jarray /= default_pointer
1027 elts_not_null: elts /= default_pointer
1028 do
1029 c_release_long_array_elements (jvm.envp, jarray, elts, mode)
1030 debug ("jni")
1031 check_for_exceptions
1032 end
1033 end
1034
1035 get_boolean_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
1036 -- Acquire area of `jarray'.
1037 require
1038 jarray_not_null: jarray /= default_pointer
1039 do
1040 Result := c_get_boolean_array_elements (jvm.envp, jarray, is_copy)
1041 debug ("jni")
1042 check_for_exceptions
1043 end
1044 end
1045
1046 release_boolean_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1047 -- Release area of `jarray' pointed by `elts'.
1048 require
1049 jarray_not_null: jarray /= default_pointer
1050 elts_not_null: elts /= default_pointer
1051 do
1052 c_release_boolean_array_elements (jvm.envp, jarray, elts, mode)
1053 debug ("jni")
1054 check_for_exceptions
1055 end
1056 end
1057
1058 get_short_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
1059 -- Acquire area of `jarray'.
1060 require
1061 jarray_not_null: jarray /= default_pointer
1062 do
1063 Result := c_get_short_array_elements (jvm.envp, jarray, is_copy)
1064 debug ("jni")
1065 check_for_exceptions
1066 end
1067 end
1068
1069 release_short_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1070 -- Release area of `jarray' pointed by `elts'.
1071 require
1072 jarray_not_null: jarray /= default_pointer
1073 elts_not_null: elts /= default_pointer
1074 do
1075 c_release_short_array_elements (jvm.envp, jarray, elts, mode)
1076 debug ("jni")
1077 check_for_exceptions
1078 end
1079 end
1080
1081 get_byte_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
1082 -- Acquire area of `jarray'.
1083 require
1084 jarray_not_null: jarray /= default_pointer
1085 do
1086 Result := c_get_byte_array_elements (jvm.envp, jarray, is_copy)
1087 debug ("jni")
1088 check_for_exceptions
1089 end
1090 end
1091
1092 release_byte_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1093 -- Release area of `jarray' pointed by `elts'.
1094 require
1095 jarray_not_null: jarray /= default_pointer
1096 elts_not_null: elts /= default_pointer
1097 do
1098 c_release_byte_array_elements (jvm.envp, jarray, elts, mode)
1099 debug ("jni")
1100 check_for_exceptions
1101 end
1102 end
1103
1104 get_float_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
1105 -- Acquire area of `jarray'.
1106 require
1107 jarray_not_null: jarray /= default_pointer
1108 do
1109 Result := c_get_float_array_elements (jvm.envp, jarray, is_copy)
1110 debug ("jni")
1111 check_for_exceptions
1112 end
1113 end
1114
1115 release_float_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1116 -- Release area of `jarray' pointed by `elts'.
1117 require
1118 jarray_not_null: jarray /= default_pointer
1119 elts_not_null: elts /= default_pointer
1120 do
1121 c_release_float_array_elements (jvm.envp, jarray, elts, mode)
1122 debug ("jni")
1123 check_for_exceptions
1124 end
1125 end
1126
1127 get_double_array_elements (jarray: POINTER; is_copy: POINTER): POINTER is
1128 -- Acquire area of `jarray'.
1129 require
1130 jarray_not_null: jarray /= default_pointer
1131 do
1132 Result := c_get_double_array_elements (jvm.envp, jarray, is_copy)
1133 debug ("jni")
1134 check_for_exceptions
1135 end
1136 end
1137
1138 release_double_array_elements (jarray: POINTER; elts: POINTER; mode: INTEGER) is
1139 -- Release area of `jarray' pointed by `elts'.
1140 require
1141 jarray_not_null: jarray /= default_pointer
1142 elts_not_null: elts /= default_pointer
1143 do
1144 c_release_double_array_elements (jvm.envp, jarray, elts, mode)
1145 debug ("jni")
1146 check_for_exceptions
1147 end
1148 end
1149
1150 feature -- Convenience
1151
1152 get_string (a_str: POINTER): STRING is
1153 -- Create new instance of STRING using `a_str'.
1154 require
1155 a_str_not_null: a_str /= default_pointer
1156 local
1157 l_str: C_STRING
1158 null: POINTER
1159 do
1160 create l_str.make_by_pointer (c_get_string_utf_chars (jvm.envp, a_str, null))
1161 debug ("jni")
1162 check_for_exceptions
1163 end
1164 Result := l_str.string
1165 c_release_string_utf_chars (jvm.envp, a_str, l_str.item)
1166 debug ("jni")
1167 check_for_exceptions
1168 end
1169 end
1170
1171 feature {NONE} -- String manipulation
1172
1173 c_get_string_utf_chars (env: POINTER; js, is_copy: POINTER): POINTER is
1174 external
1175 "C++ JNIEnv signature (jstring, jboolean *): EIF_POINTER use %"jni.h%""
1176 alias
1177 "GetStringUTFChars"
1178 end
1179
1180 c_release_string_utf_chars (env: POINTER; js, chars: POINTER) is
1181 external
1182 "C++ JNIEnv signature (jstring, char *) use %"jni.h%""
1183 alias
1184 "ReleaseStringUTFChars"
1185 end
1186
1187 c_new_string_utf (env: POINTER; chars: POINTER): POINTER is
1188 external
1189 "C++ JNIEnv signature (char *): EIF_POINTER use %"jni.h%""
1190 alias
1191 "NewStringUTF"
1192 end
1193
1194 feature {NONE} -- Exceptions checking
1195
1196 c_exception_occurred (env: POINTER): POINTER is
1197 external
1198 "C++ JNIEnv use %"jni.h%""
1199 alias
1200 "ExceptionOccurred"
1201 end
1202
1203 c_exception_describe (env: POINTER) is
1204 external
1205 "C++ JNIEnv use %"jni.h%""
1206 alias
1207 "ExceptionDescribe"
1208 end
1209
1210 c_exception_clear (env: POINTER) is
1211 external
1212 "C++ JNIEnv use %"jni.h%""
1213 alias
1214 "ExceptionClear"
1215 end
1216
1217 feature {NONE} -- object creation
1218
1219 c_new_object (env: POINTER; cls: POINTER; constructor: POINTER; args: POINTER): POINTER is
1220 external
1221 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_POINTER use %"jni.h%""
1222 alias
1223 "NewObjectA"
1224 end
1225
1226 feature {NONE} -- dynamic method calls
1227
1228 c_get_method_id (env: POINTER; cls: POINTER; mname: POINTER; sig: POINTER): POINTER is
1229 external
1230 "C++ JNIEnv signature (jclass, char *, char *): EIF_POINTER use %"jni.h%""
1231 alias
1232 "GetMethodID"
1233 end
1234
1235 c_call_void_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER) is
1236 external
1237 "C++ JNIEnv signature (jobject, jmethodID, jvalue *) use %"jni.h%""
1238 alias
1239 "CallVoidMethodA"
1240 end
1241
1242 c_call_boolean_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): BOOLEAN is
1243 external
1244 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_BOOLEAN use %"jni.h%""
1245 alias
1246 "CallBooleanMethodA"
1247 end
1248
1249 c_call_byte_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): INTEGER_8 is
1250 external
1251 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER_8 use %"jni.h%""
1252 alias
1253 "CallByteMethodA"
1254 end
1255
1256 c_call_char_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): CHARACTER is
1257 external
1258 "C++ JNIEnv signature (jclass, jmethodID, jvalue *):EIF_CHARACTER use %"jni.h%""
1259 alias
1260 "CallCharMethodA"
1261 end
1262
1263 c_call_short_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): INTEGER_16 is
1264 external
1265 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER_16 use %"jni.h%""
1266 alias
1267 "CallShortMethodA"
1268 end
1269
1270 c_call_int_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): INTEGER is
1271 external
1272 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER use %"jni.h%""
1273 alias
1274 "CallIntMethodA"
1275 end
1276
1277 c_call_long_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): INTEGER_64 is
1278 external
1279 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER_64 use %"jni.h%""
1280 alias
1281 "CallLongMethodA"
1282 end
1283
1284 c_call_float_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): REAL is
1285 external
1286 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_REAL use %"jni.h%""
1287 alias
1288 "CallFloatMethodA"
1289 end
1290
1291 c_call_double_method (env: POINTER; oid: POINTER; mid: POINTER; args: POINTER): DOUBLE is
1292 external
1293 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_DOUBLE use %"jni.h%""
1294 alias
1295 "CallDoubleMethodA"
1296 end
1297
1298 c_call_object_method (lenv: POINTER; cls: POINTER; mid: POINTER; argsp: POINTER): POINTER is
1299 external
1300 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_POINTER use %"jni.h%""
1301 alias
1302 "CallObjectMethodA"
1303 end
1304
1305 feature {NONE} -- dynamic attribute access
1306
1307 c_get_field_id (env: POINTER; cls: POINTER; fname, sig: POINTER): POINTER is
1308 external
1309 "C++ JNIEnv signature (jclass, char *, char *): EIF_POINTER use %"jni.h%""
1310 alias
1311 "GetFieldID"
1312 end
1313
1314 c_get_static_field_id (env: POINTER; cls: POINTER; fname, sig: POINTER): POINTER is
1315 external
1316 "C++ JNIEnv signature (jclass, char *, char *): EIF_POINTER use %"jni.h%""
1317 alias
1318 "GetStaticFieldID"
1319 end
1320
1321 c_get_integer_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER is
1322 external
1323 "C++ JNIEnv signature (jobject, jfieldID): EIF_INTEGER use %"jni.h%""
1324 alias
1325 "GetIntField"
1326 end
1327
1328 c_get_static_integer_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER is
1329 external
1330 "C++ JNIEnv signature (jclass, jfieldID): EIF_INTEGER use %"jni.h%""
1331 alias
1332 "GetStaticIntField"
1333 end
1334
1335 c_get_long_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER_64 is
1336 external
1337 "C++ JNIEnv signature (jobject, jfieldID): EIF_INTEGER_64 use %"jni.h%""
1338 alias
1339 "GetLongField"
1340 end
1341
1342 c_get_static_long_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER_64 is
1343 external
1344 "C++ JNIEnv signature (jclass, jfieldID): EIF_INTEGER_64 use %"jni.h%""
1345 alias
1346 "GetStaticLongField"
1347 end
1348
1349
1350 c_get_boolean_field (env: POINTER; oid: POINTER; fid: POINTER): BOOLEAN is
1351 external
1352 "C++ JNIEnv signature (jobject, jfieldID): EIF_BOOLEAN use %"jni.h%""
1353 alias
1354 "GetBooleanField"
1355 end
1356
1357 c_get_static_boolean_field (env: POINTER; oid: POINTER; fid: POINTER): BOOLEAN is
1358 external
1359 "C++ JNIEnv signature (jclass, jfieldID): EIF_BOOLEAN use %"jni.h%""
1360 alias
1361 "GetStaticBooleanField"
1362 end
1363
1364 c_get_char_field (env: POINTER; oid: POINTER; fid: POINTER): CHARACTER is
1365 external
1366 "C++ JNIEnv signature (jobject, jfieldID): EIF_CHARACTER use %"jni.h%""
1367 alias
1368 "GetCharField"
1369 end
1370
1371 c_get_static_char_field (env: POINTER; oid: POINTER; fid: POINTER): CHARACTER is
1372 external
1373 "C++ JNIEnv signature (jclass, jfieldID): EIF_CHARACTER use %"jni.h%""
1374 alias
1375 "GetStaticCharField"
1376 end
1377
1378 c_get_float_field (env: POINTER; oid: POINTER; fid: POINTER): REAL is
1379 external
1380 "C++ JNIEnv signature (jobject, jfieldID): EIF_REAL use %"jni.h%""
1381 alias
1382 "GetFloatField"
1383 end
1384
1385 c_get_static_float_field (env: POINTER; oid: POINTER; fid: POINTER): REAL is
1386 external
1387 "C++ JNIEnv signature (jclass, jfieldID): EIF_REAL use %"jni.h%""
1388 alias
1389 "GetStaticFloatField"
1390 end
1391
1392 c_get_double_field (env: POINTER; oid: POINTER; fid: POINTER): DOUBLE is
1393 external
1394 "C++ JNIEnv signature (jobject, jfieldID): EIF_DOUBLE use %"jni.h%""
1395 alias
1396 "GetDoubleField"
1397 end
1398
1399 c_get_static_double_field (env: POINTER; oid: POINTER; fid: POINTER): DOUBLE is
1400 external
1401 "C++ JNIEnv signature (jclass, jfieldID): EIF_DOUBLE use %"jni.h%""
1402 alias
1403 "GetStaticDoubleField"
1404 end
1405
1406 c_get_byte_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER_8 is
1407 external
1408 "C++ JNIEnv signature (jobject, jfieldID): EIF_INTEGER_8 use %"jni.h%""
1409 alias
1410 "GetByteField"
1411 end
1412
1413 c_get_static_byte_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER_8 is
1414 external
1415 "C++ JNIEnv signature (jclass, jfieldID): EIF_INTEGER_8 use %"jni.h%""
1416 alias
1417 "GetStaticByteField"
1418 end
1419
1420 c_get_short_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER_16 is
1421 external
1422 "C++ JNIEnv signature (jobject, jfieldID): EIF_INTEGER_16 use %"jni.h%""
1423 alias
1424 "GetShortField"
1425 end
1426
1427 c_get_static_short_field (env: POINTER; oid: POINTER; fid: POINTER): INTEGER_16 is
1428 external
1429 "C++ JNIEnv signature (jclass, jfieldID): EIF_INTEGER_16 use %"jni.h%""
1430 alias
1431 "GetStaticShortField"
1432 end
1433
1434 c_get_object_field (env: POINTER; oid: POINTER; fid: POINTER): POINTER is
1435 external
1436 "C++ JNIEnv signature (jobject, jfieldID): EIF_POINTER use %"jni.h%""
1437 alias
1438 "GetObjectField"
1439 end
1440
1441 c_get_static_object_field (env: POINTER; oid: POINTER; fid: POINTER): POINTER is
1442 external
1443 "C++ JNIEnv signature (jclass, jfieldID): EIF_POINTER use %"jni.h%""
1444 alias
1445 "GetStaticObjectField"
1446 end
1447
1448 feature {NONE} -- dynamic attribute setting
1449
1450 c_set_integer_field ( env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER) is
1451 external
1452 "C++ JNIEnv signature (jobject, jfieldID, jint) use %"jni.h%""
1453 alias
1454 "SetIntField"
1455 end
1456
1457 c_set_static_integer_field (env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER) is
1458 external
1459 "C++ JNIEnv signature (jclass, jfieldID, jint) use %"jni.h%""
1460 alias
1461 "SetStaticIntField"
1462 end
1463
1464 c_set_long_field ( env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER_64) is
1465 external
1466 "C++ JNIEnv signature (jobject, jfieldID, jlong) use %"jni.h%""
1467 alias
1468 "SetLongField"
1469 end
1470
1471 c_set_static_long_field (env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER_64) is
1472 external
1473 "C++ JNIEnv signature (jclass, jfieldID, jlong) use %"jni.h%""
1474 alias
1475 "SetStaticLongField"
1476 end
1477
1478 c_set_object_field (env: POINTER; oid: POINTER; fid: POINTER; value: POINTER) is
1479 external
1480 "C++ JNIEnv signature (jobject, jfieldID, jobject) use %"jni.h%""
1481 alias
1482 "SetObjectField"
1483 end
1484
1485 c_set_static_object_field (env: POINTER; oid: POINTER; fid: POINTER; value: POINTER) is
1486 external
1487 "C++ JNIEnv signature (jclass, jfieldID, jobject) use %"jni.h%""
1488 alias
1489 "SetStaticObjectField"
1490 end
1491
1492 c_set_boolean_field (env: POINTER; oid: POINTER; fid: POINTER; value: BOOLEAN) is
1493 external
1494 "C++ JNIEnv signature (jobject, jfieldID, jboolean) use %"jni.h%""
1495 alias
1496 "SetBooleanField"
1497 end
1498
1499 c_set_static_boolean_field (env: POINTER; oid: POINTER; fid: POINTER; value: BOOLEAN) is
1500 external
1501 "C++ JNIEnv signature (jclass, jfieldID, jboolean) use %"jni.h%""
1502 alias
1503 "SetStaticBooleanField"
1504 end
1505
1506 c_set_char_field (env: POINTER; oid: POINTER; fid: POINTER; value: CHARACTER) is
1507 external
1508 "C++ JNIEnv signature (jobject, jfieldID, jchar) use %"jni.h%""
1509 alias
1510 "SetCharField"
1511 end
1512
1513 c_set_static_char_field (env: POINTER; oid: POINTER; fid: POINTER; value: CHARACTER) is
1514 external
1515 "C++ JNIEnv signature (jclass, jfieldID, jchar) use %"jni.h%""
1516 alias
1517 "SetStaticCharField"
1518 end
1519
1520 c_set_float_field (env: POINTER; oid: POINTER; fid: POINTER; value: REAL) is
1521 external
1522 "C++ JNIEnv signature (jobject, jfieldID, jfloat) use %"jni.h%""
1523 alias
1524 "SetFloatField"
1525 end
1526
1527 c_set_static_float_field (env: POINTER; oid: POINTER; fid: POINTER; value: REAL) is
1528 external
1529 "C++ JNIEnv signature (jclass, jfieldID, jfloat) use %"jni.h%""
1530 alias
1531 "SetStaticFloatField"
1532 end
1533
1534 c_set_double_field (env: POINTER; oid: POINTER; fid: POINTER; value: DOUBLE) is
1535 external
1536 "C++ JNIEnv signature (jobject, jfieldID, jdouble) use %"jni.h%""
1537 alias
1538 "SetDoubleField"
1539 end
1540
1541 c_set_static_double_field (env: POINTER; oid: POINTER; fid: POINTER; value: DOUBLE) is
1542 external
1543 "C++ JNIEnv signature (jclass, jfieldID, jdouble) use %"jni.h%""
1544 alias
1545 "SetStaticDoubleField"
1546 end
1547
1548 c_set_byte_field (env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER_8) is
1549 external
1550 "C++ JNIEnv signature (jobject, jfieldID, jbyte) use %"jni.h%""
1551 alias
1552 "SetByteField"
1553 end
1554
1555 c_set_static_byte_field (env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER_8) is
1556 external
1557 "C++ JNIEnv signature (jclass, jfieldID, jbyte) use %"jni.h%""
1558 alias
1559 "SetStaticByteField"
1560 end
1561
1562 c_set_short_field (env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER_16) is
1563 external
1564 "C++ JNIEnv signature (jobject, jfieldID, jshort) use %"jni.h%""
1565 alias
1566 "SetShortField"
1567 end
1568
1569 c_set_static_short_field (env: POINTER; oid: POINTER; fid: POINTER; value: INTEGER_16) is
1570 external
1571 "C++ JNIEnv signature (jclass, jfieldID, jshort) use %"jni.h%""
1572 alias
1573 "SetStaticShortField"
1574 end
1575
1576 feature {NONE} -- static method calls
1577
1578 c_get_static_method_id (lenv: POINTER; cls: POINTER; mname: POINTER; sig: POINTER): POINTER is
1579 external
1580 "C++ JNIEnv signature (jclass, char *, char *): EIF_POINTER use %"jni.h%""
1581 alias
1582 "GetStaticMethodID"
1583 end
1584
1585 c_call_static_void_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER) is
1586 external
1587 "C++ JNIEnv signature (jclass, jmethodID, jvalue *) use %"jni.h%""
1588 alias
1589 "CallStaticVoidMethodA"
1590 end
1591
1592 c_call_static_byte_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): INTEGER_8 is
1593 external
1594 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER_8 use %"jni.h%""
1595 alias
1596 "CallStaticByteMethodA"
1597 end
1598
1599 c_call_static_boolean_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): BOOLEAN is
1600 external
1601 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_BOOLEAN use %"jni.h%""
1602 alias
1603 "CallStaticBooleanMethodA"
1604 end
1605
1606 c_call_static_char_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): CHARACTER is
1607 external
1608 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_CHARACTER use %"jni.h%""
1609 alias
1610 "CallStaticCharMethodA"
1611 end
1612
1613 c_call_static_short_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): INTEGER_16 is
1614 external
1615 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER_16 use %"jni.h%""
1616 alias
1617 "CallStaticShortMethodA"
1618 end
1619
1620 c_call_static_int_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): INTEGER is
1621 external
1622 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER use %"jni.h%""
1623 alias
1624 "CallStaticIntMethodA"
1625 end
1626
1627 c_call_static_long_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): INTEGER_64 is
1628 external
1629 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_INTEGER_64 use %"jni.h%""
1630 alias
1631 "CallStaticLongMethodA"
1632 end
1633
1634 c_call_static_float_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): REAL is
1635 external
1636 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_REAL use %"jni.h%""
1637 alias
1638 "CallStaticFloatMethodA"
1639 end
1640
1641 c_call_static_double_method (lenv: POINTER; cls: POINTER; mid: POINTER; argp: POINTER): DOUBLE is
1642 external
1643 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_DOUBLE use %"jni.h%""
1644 alias
1645 "CallStaticDoubleMethodA"
1646 end
1647
1648
1649 c_call_static_object_method (lenv: POINTER; cls: POINTER; mid: POINTER; argsp: POINTER): POINTER is
1650 external
1651 "C++ JNIEnv signature (jclass, jmethodID, jvalue *): EIF_POINTER use %"jni.h%""
1652 alias
1653 "CallStaticObjectMethodA"
1654 end
1655
1656 feature {NONE} -- array operations
1657
1658 c_get_array_length (lenv: POINTER; ljarray: POINTER): INTEGER is
1659 external
1660 "C++ JNIEnv signature (jarray): EIF_INTEGER use %"jni.h%""
1661 alias
1662 "GetArrayLength"
1663 end
1664
1665 c_new_object_array (lenv: POINTER; lsize: INTEGER; element_jclass: POINTER;
1666 initial_element: POINTER): POINTER is
1667 external
1668 "C++ JNIEnv signature (jsize, jclass, jobject): EIF_POINTER use %"jni.h%""
1669 alias
1670 "NewObjectArray"
1671 end
1672
1673 c_get_object_array_element (lenv: POINTER; ljarray: POINTER; indx: INTEGER): POINTER is
1674 external
1675 "C++ JNIEnv signature (jobjectArray, jsize): EIF_POINTER use %"jni.h%""
1676 alias
1677 "GetObjectArrayElement"
1678 end
1679
1680 c_set_object_array_element (lenv: POINTER; ljarray: POINTER; indx: INTEGER; lvalue: POINTER) is
1681 external
1682 "C++ JNIEnv signature (jobjectArray, jsize, jobject) use %"jni.h%""
1683 alias
1684 "SetObjectArrayElement"
1685 end
1686
1687 c_new_char_array (lenv: POINTER; lsize: INTEGER): POINTER is
1688 external
1689 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1690 alias
1691 "NewCharArray"
1692 end
1693
1694 c_get_char_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1695 external
1696 "C++ JNIEnv signature (jcharArray, jboolean *): EIF_POINTER use %"jni.h%""
1697 alias
1698 "GetCharArrayElements"
1699 end
1700
1701 c_release_char_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1702 external
1703 "C++ JNIEnv signature (jcharArray, jchar *, jint) use %"jni.h%""
1704 alias
1705 "ReleaseCharArrayElements"
1706 end
1707
1708 c_new_int_array (lenv: POINTER; lsize: INTEGER): POINTER is
1709 external
1710 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1711 alias
1712 "NewIntArray"
1713 end
1714
1715 c_get_int_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1716 external
1717 "C++ JNIEnv signature (jintArray, jboolean *): EIF_POINTER use %"jni.h%""
1718 alias
1719 "GetIntArrayElements"
1720 end
1721
1722 c_release_int_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1723 external
1724 "C++ JNIEnv signature (jintArray, jint *, jint) use %"jni.h%""
1725 alias
1726 "ReleaseIntArrayElements"
1727 end
1728
1729 c_new_long_array (lenv: POINTER; lsize: INTEGER): POINTER is
1730 external
1731 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1732 alias
1733 "NewLongArray"
1734 end
1735
1736 c_get_long_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1737 external
1738 "C++ JNIEnv signature (jlongArray, jboolean *): EIF_POINTER use %"jni.h%""
1739 alias
1740 "GetLongArrayElements"
1741 end
1742
1743 c_release_long_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1744 external
1745 "C++ JNIEnv signature (jlongArray, jlong *, jint) use %"jni.h%""
1746 alias
1747 "ReleaseLongArrayElements"
1748 end
1749
1750 c_new_boolean_array (lenv: POINTER; lsize: INTEGER): POINTER is
1751 external
1752 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1753 alias
1754 "NewBooleanArray"
1755 end
1756
1757 c_get_boolean_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1758 external
1759 "C++ JNIEnv signature (jbooleanArray, jboolean *): EIF_POINTER use %"jni.h%""
1760 alias
1761 "GetBooleanArrayElements"
1762 end
1763
1764 c_release_boolean_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1765 external
1766 "C++ JNIEnv signature (jbooleanArray, jboolean *, jint) use %"jni.h%""
1767 alias
1768 "ReleaseBooleanArrayElements"
1769 end
1770
1771 c_new_short_array (lenv: POINTER; lsize: INTEGER): POINTER is
1772 external
1773 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1774 alias
1775 "NewShortArray"
1776 end
1777
1778 c_get_short_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1779 external
1780 "C++ JNIEnv signature (jshortArray, jboolean *): EIF_POINTER use %"jni.h%""
1781 alias
1782 "GetShortArrayElements"
1783 end
1784
1785 c_release_short_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1786 external
1787 "C++ JNIEnv signature (jshortArray, jshort *, jint) use %"jni.h%""
1788 alias
1789 "ReleaseShortArrayElements"
1790 end
1791
1792 c_new_byte_array (lenv: POINTER; lsize: INTEGER): POINTER is
1793 external
1794 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1795 alias
1796 "NewByteArray"
1797 end
1798
1799 c_get_byte_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1800 external
1801 "C++ JNIEnv signature (jbyteArray, jboolean *): EIF_POINTER use %"jni.h%""
1802 alias
1803 "GetByteArrayElements"
1804 end
1805
1806 c_release_byte_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1807 external
1808 "C++ JNIEnv signature (jbyteArray, jbyte *, jint) use %"jni.h%""
1809 alias
1810 "ReleaseByteArrayElements"
1811 end
1812
1813 c_new_float_array (lenv: POINTER; lsize: INTEGER): POINTER is
1814 external
1815 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1816 alias
1817 "NewFloatArray"
1818 end
1819
1820 c_get_float_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1821 external
1822 "C++ JNIEnv signature (jfloatArray, jboolean *): EIF_POINTER use %"jni.h%""
1823 alias
1824 "GetFloatArrayElements"
1825 end
1826
1827 c_release_float_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1828 external
1829 "C++ JNIEnv signature (jfloatArray, jfloat *, jint) use %"jni.h%""
1830 alias
1831 "ReleaseFloatArrayElements"
1832 end
1833
1834 c_new_double_array (lenv: POINTER; lsize: INTEGER): POINTER is
1835 external
1836 "C++ JNIEnv signature (jsize): EIF_POINTER use %"jni.h%""
1837 alias
1838 "NewDoubleArray"
1839 end
1840
1841 c_get_double_array_elements (lenv: POINTER; ljarray: POINTER; is_copy: POINTER): POINTER is
1842 external
1843 "C++ JNIEnv signature (jdoubleArray, jboolean *): EIF_POINTER use %"jni.h%""
1844 alias
1845 "GetDoubleArrayElements"
1846 end
1847
1848 c_release_double_array_elements (lenv: POINTER; ljarray: POINTER; elts: POINTER; mode: INTEGER) is
1849 external
1850 "C++ JNIEnv signature (jdoubleArray, jdouble *, jint) use %"jni.h%""
1851 alias
1852 "ReleaseDoubleArrayElements"
1853 end
1854
1855 feature -- Java exception mechanism
1856
1857 c_throw_java_exception (lenv: POINTER; jthrowable: POINTER) is
1858 external
1859 "C++ JNIEnv signature (jthrowable) use %"jni.h%""
1860 alias
1861 "Throw"
1862 end
1863
1864 c_throw_custom_exception (lenv: POINTER; jclass_id: POINTER; msg: POINTER) is
1865 external
1866 "C++ JNIEnv signature (jclass, char *) use %"jni.h%""
1867 alias
1868 "ThrowNew"
1869 end
1870
1871 feature {NONE} -- class information
1872
1873 c_get_class (lenv: POINTER; lobj: POINTER): POINTER is
1874 external
1875 "C++ JNIEnv signature (jobject): EIF_POINTER use %"jni.h%""
1876 alias
1877 "GetObjectClass"
1878 end
1879
1880 c_jni_find_class (env: POINTER; name: POINTER): POINTER is
1881 external
1882 "C++ JNIEnv signature (char *): EIF_POINTER use %"jni.h%""
1883 alias
1884 "FindClass"
1885 end
1886
1887 feature {NONE} -- Structure size
1888
1889 sizeof_jboolean: INTEGER is
1890 -- Size of `jboolean' structure.
1891 external
1892 "C macro use %"jni.h%""
1893 alias
1894 "sizeof(jboolean)"
1895 end
1896
1897 sizeof_jchar: INTEGER is
1898 -- Size of `jchar' structure.
1899 external
1900 "C macro use %"jni.h%""
1901 alias
1902 "sizeof(jchar)"
1903 end
1904
1905 sizeof_jbyte: INTEGER is
1906 -- Size of `jbyte' structure.
1907 external
1908 "C macro use %"jni.h%""
1909 alias
1910 "sizeof(jbyte)"
1911 end
1912
1913 sizeof_jshort: INTEGER is
1914 -- Size of `jshort' structure.
1915 external
1916 "C macro use %"jni.h%""
1917 alias
1918 "sizeof(jshort)"
1919 end
1920
1921 sizeof_jint: INTEGER is
1922 -- Size of `jint' structure.
1923 external
1924 "C macro use %"jni.h%""
1925 alias
1926 "sizeof(jint)"
1927 end
1928
1929 sizeof_jlong: INTEGER is
1930 -- Size of `jlong' structure.
1931 external
1932 "C macro use %"jni.h%""
1933 alias
1934 "sizeof(jlong)"
1935 end
1936
1937 sizeof_jfloat: INTEGER is
1938 -- Size of `jfloat' structure.
1939 external
1940 "C macro use %"jni.h%""
1941 alias
1942 "sizeof(jfloat)"
1943 end
1944
1945 sizeof_jdouble: INTEGER is
1946 -- Size of `jdouble' structure.
1947 external
1948 "C macro use %"jni.h%""
1949 alias
1950 "sizeof(jdouble)"
1951 end
1952
1953 invariant
1954 jvm_not_void: jvm /= Void
1955 java_class_table_not_void: java_class_table /= Void
1956 java_object_table_not_void: java_object_table /= Void
1957
1958 end
1959
1960
1961 --|----------------------------------------------------------------
1962 --| Eiffel2Java: library of reusable components for ISE Eiffel.
1963 --| Copyright (C) 1986-2001 Interactive Software Engineering Inc.
1964 --| All rights reserved. Duplication and distribution prohibited.
1965 --| May be used only with ISE Eiffel, under terms of user license.
1966 --| Contact ISE for any other use.
1967 --|
1968 --| Interactive Software Engineering Inc.
1969 --| ISE Building
1970 --| 360 Storke Road, Goleta, CA 93117 USA
1971 --| Telephone 805-685-1006, Fax 805-685-6869
1972 --| Electronic mail <info@eiffel.com>
1973 --| Customer support: http://support.eiffel.com>
1974 --| For latest info see award-winning pages: http://www.eiffel.com
1975 --|----------------------------------------------------------------
1976

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.23