NEURON
nrnjava.cpp
Go to the documentation of this file.
1 /** Neuron/Java Interface code
2  *
3  * @author Fred Howell
4  * @date March 2001
5  *
6  * Modified by Michael Hines
7  * The Java to Neuron JNIEXPORT functions for Neuron.java
8  * have been collected in nrnjni.cpp. This file now mostly supports the
9  * Neuron to Java direction
10  */
11 
12 #include <../../nrnconf.h>
13 #include <stdio.h>
14 #include <errno.h>
15 #include <stdlib.h>
16 #include <string.h>
17 #include <ctype.h>
18 #include <jni.h>
19 #include <time.h>
20 #include <OS/list.h>
21 #include "ivoc.h"
22 #include "classreg.h"
23 
24 #include "nrnoc2iv.h"
25 #include "parse.hpp"
26 
27 #include "njvm.h"
28 
30 
31 extern "C" {
32 
33 // Hooks in nrn-5.0.0/src/oc/hoc_oop.cpp for filling in cTemplate structure
34 extern void* (*p_java2nrn_cons)(Object*); /* returns pointer to java object */
35 extern void (*p_java2nrn_destruct)(void* opaque_java_object);
36 extern double (*p_java2nrn_dmeth)(Object* ho, Symbol* method);
37 extern char** (*p_java2nrn_smeth)(Object* ho, Symbol* method);
38 extern Object** (*p_java2nrn_ometh)(Object* ho, Symbol* method);
39 extern const char* (*p_java2nrn_classname)(Object* ho);
40 extern bool (*p_java2nrn_identity)(Object* o1, Object* o2);
41 }
42 // and others
43 extern void (*nrnjava_pwm_setwin)(void*, int, int, int);
44 
45 // actual functions in this file that fill in the above hooks
46 static void* java2nrn_cons(Object* o);
47 static void java2nrn_destruct(void* opaque_java_object);
48 static double java2nrn_dmeth(Object* ho, Symbol* method);
49 static char** java2nrn_smeth(Object* ho, Symbol* method);
50 static Object** java2nrn_ometh(Object* ho, Symbol* method);
51 static const char* java2nrn_classname(Object* ho);
52 static bool java2nrn_identity(Object* o1, Object* o2);
53 static void pwm_setwin(void*, int, int, int);
54 static char** js2charpool(jstring js);
55 
56 // see nrnjni.cpp
57 extern void nrnjni_registration(jclass nrnCls);
58 extern void nrnjni_redirreg(jclass nrnCls);
59 
60 // Java Method & class IDs
61 static jclass nrnclsldr;
62 static jclass neuronCls;
63 static jmethodID nrnclsldID;
64 static jmethodID constructNoArgID;
65 static jmethodID constructWithArgID;
66 static jmethodID makeHocClassID;
67 static jmethodID invokeDoubleMethodID;
68 static jmethodID invokeCharsMethodID;
69 static jmethodID invokeObjectMethodID;
70 static jmethodID encapsulateID;
71 static jmethodID getObjectTypeID;
72 static jmethodID setwinID;
73 static jmethodID identityID;
74 static jmethodID jclassnameID;
75 static jfieldID hocObjectCastID;
76 
77 declarePtrList(NJSymList, Symbol)
78 implementPtrList(NJSymList, Symbol)
79 // list of cTemplate of java registered classes in id order.
80 // this parallels the classList in Neuron.Java
81 NJSymList* nrn_jclass_symlist;
82 
83 declarePtrList(NJStrList, String)
84 implementPtrList(NJStrList, String)
85 // list of the full java classnames for use in session save
86 static NJStrList* njclassnames;
87 
88 Symbol* nrn_jobj_sym; // for a JavaObject
89 Symbol* nrn_vec_sym; // for deciding if Vector
90 
91 static void* joconstruct(Object*) {
92  hoc_execerror("JavaObject for internal use only.", "Do not construct");
93  return nil;
94 }
95 static void jodestruct(void* v) {
96  if (v) {
97  nrnjava_env->DeleteGlobalRef((jobject)v);
98  }
99 }
100 
101 static double joequals(void* v) {
102  jobject jo1 = (jobject)v;
103  Object* o2 = *hoc_objgetarg(1);
104  jobject jo2;
105  if (o2 == nil) {return 0.;}
106  if (o2->ctemplate->constructor == joconstruct // a JavaObject
107  || o2->ctemplate->sym->type == JAVAOBJECT) { // registerd java Object
108  jobject jo2 = (jobject)o2->u.this_pointer;
109  return (nrnjava_env->CallStaticIntMethod(neuronCls, identityID,
110  jo1,jo2 ) != 0 ) ? 1. : 0.;
111 
112  }
113  return 0.;
114 }
115 
116 static const char** joname(void* v) {
117  jstring js = (jstring)nrnjava_env->CallStaticObjectMethod(
118  neuronCls, jclassnameID, (jobject)v);
119  return (const char**)js2charpool(js);
120 }
121 
123  "equals", joequals,
124  0,0
125 };
127  "name", joname,
128  0,0
129 };
130 
131 // called from njvm.cpp when the first NrnJava hoc object is consstructed
132 void nrnjava_init () {
133 // printf("nrnjava_init\n");
134 
135  nrn_jclass_symlist = new NJSymList(20);
136  class2oc("JavaObject", joconstruct, jodestruct, jo_members,
137  nil, nil, jo_retstr_members);
138  nrn_jobj_sym = hoc_lookup("JavaObject");
139  nrn_vec_sym = hoc_lookup("Vector");
140 
141 #if defined(_MSWIN) || (defined(MAC) && !defined(DARWIN))
142  neuronCls = nrnjava_env->FindClass("neuron/Redirect");
143  if (neuronCls == 0) {
144  printf("ERROR in nrnjava_init : neuron/Redirect class not loaded\n");
145 printf("Look in the Redirect.out file of the current working directory for the reason for failure\n");
146  return;
147  }
149 #endif
150 
151  nrnclsldr = nrnjava_env->FindClass("neuron/NrnClassLoader");
152  if (nrnclsldr == 0) {
153  printf("ERROR in nrnjava_init : neuron/NrnClassLoader not found\n");
154  }
155  nrnclsldID = nrnjava_env->GetStaticMethodID(nrnclsldr,
156  "load", "(Ljava/lang/String;)Ljava/lang/Class;" );
157 
158  jstring js;
159  js = nrnjava_env->NewStringUTF("neuron.Neuron");
160  neuronCls = (jclass)nrnjava_env->CallStaticObjectMethod(nrnclsldr, nrnclsldID,js);
161  if (neuronCls == 0) {
162  printf("ERROR in nrnjava_init : neuron.Neuron class not found\n");
163  return;
164  }
165  js = nrnjava_env->NewStringUTF("neuron.HocObject");
166  jclass hoCls = (jclass)nrnjava_env->CallStaticObjectMethod(nrnclsldr, nrnclsldID,js);
167  if (hoCls == 0) {
168  printf("ERROR in nrnjava_init : neuron.HocObject class not found\n");
169  return;
170  }
171 
179 
181 
183 
184  /*** Lookup method ids of Java Neuron class ***/
185  constructNoArgID = nrnjava_env->GetStaticMethodID( neuronCls,
186  "constructNoArg",
187  "(I)Ljava/lang/Object;" );
188  constructWithArgID = nrnjava_env->GetStaticMethodID( neuronCls,
189  "constructWithArg",
190  "(I)Ljava/lang/Object;" );
191  makeHocClassID = nrnjava_env->GetStaticMethodID( neuronCls,
192  "makeHocClass",
193  "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I" );
194  invokeDoubleMethodID = nrnjava_env->GetStaticMethodID( neuronCls,
195  "invokeDoubleMethod",
196  "(Ljava/lang/Object;III)D" );
197  invokeCharsMethodID = nrnjava_env->GetStaticMethodID( neuronCls,
198  "invokeCharsMethod",
199  "(Ljava/lang/Object;III)Ljava/lang/String;" );
200  invokeObjectMethodID = nrnjava_env->GetStaticMethodID( neuronCls,
201  "invokeObjectMethod",
202  "(Ljava/lang/Object;III)Ljava/lang/Object;" );
203  encapsulateID = nrnjava_env->GetStaticMethodID( neuronCls,
204  "encapsulateHocObject",
205  "(JI)Ljava/lang/Object;" );
206  getObjectTypeID = nrnjava_env->GetStaticMethodID( neuronCls,
207  "getObjectType",
208  "(Ljava/lang/Object;)I" );
209  setwinID = nrnjava_env->GetStaticMethodID( neuronCls,
210  "setwin",
211  "(JIII)I");
212  identityID = nrnjava_env->GetStaticMethodID( neuronCls,
213  "identity",
214  "(Ljava/lang/Object;Ljava/lang/Object;)I" );
215  jclassnameID = nrnjava_env->GetStaticMethodID( neuronCls,
216  "javaClassName",
217  "(Ljava/lang/Object;)Ljava/lang/String;" );
218  hocObjectCastID = nrnjava_env->GetFieldID( hoCls,
219  "hocObjectCast", "J");
220 
221 // printf("neuronCls=%ld mids %ld %ld %ld\n",
222 // neuronCls, constructNoArgID,
223 // makeHocClassID, invokeDoubleMethodID);
224 
225 }
226 
227 // don't forget to delete [] after use
228 char* nrn_underbar2dot(const char* s) {
229  char *mangledstr = new char[strlen(s) + 1];
230  strcpy(mangledstr, s);
231  for (char* cp = mangledstr; *cp; ++cp) {
232  if (*cp == '_') {
233  *cp = '.';
234  }
235  }
236  return mangledstr;
237 }
238 
239 //don't forget to delete []
240 char* nrn_dot2underbar(const char* s) {
241  char *mangledstr = new char[strlen(s) + 1];
242  strcpy(mangledstr, s);
243  for (char* cp = mangledstr; *cp; ++cp) {
244  if (*cp == '.') {
245  *cp = '_';
246  }
247  }
248  return mangledstr;
249 }
250 
251 /** equality in the sense of ==
252 */
253 static bool java2nrn_identity(Object* o1, Object* o2) {
254  if (o1 == o2) return true;
255  if (o1 == 0 || o2 == 0) return false;
256  return (nrnjava_env->CallStaticIntMethod(neuronCls, identityID,
257  (jobject)o1->u.this_pointer, (jobject)o2->u.this_pointer
258  ) != 0 ) ? true : false;
259 }
260 
261 /** Construct a new instance of a java class
262  * @param o Empty hoc object which will contain this object
263  */
264 static void* java2nrn_cons(Object* o) {
265 // printf("java2nrn_cons %s\n",o->ctemplate->sym->name );
266 
267  jint cid = -(o->ctemplate->id) - 1;
268 
269  jobject newo;
270  if (!ifarg(1)) {
271  newo = nrnjava_env->CallStaticObjectMethod( neuronCls,
272  constructNoArgID, cid );
273  }else{
274  newo = nrnjava_env->CallStaticObjectMethod( neuronCls,
275  constructWithArgID, cid);
276  }
277  jobject ret = 0;
278  if (newo) { // otherwise it is pure static like java.lang.Math
279 // printf("java2nrn_cons got jobject %ld\n", newo );
280  ret = nrnjava_env->NewGlobalRef( newo );
281 // printf("java2nrn_cons got global jobject %ld\n", ret );
282  }
283  return (void*)ret;
284 }
285 
286 /** Destroy java reference
287  */
288 static void java2nrn_destruct(void* opaque_java_object) {
289  // printf("java2nrn_destruct\n");
290  if (opaque_java_object) {
291  nrnjava_env->DeleteGlobalRef( (jobject) opaque_java_object );
292  }
293 }
294 
295 /** Make a hoc equivalent to Java class (jname) calling it hname in hoc.
296  Done from NrnJava.load("name")
297  after the class is loaded with FindClass.
298  */
299 int convertJavaClassToHoc( JNIEnv *env, const char* jname, const char* hname, const char* path ) {
300  //only if classname not already in use.
301  if (!njclassnames) {
302  njclassnames = new NJStrList();
303  }
304  char* hn = nrn_dot2underbar(hname);
305 // printf("loading %s --- calling it %s\n", jname, hn);
306  Symbol* s = hoc_table_lookup(hn, hoc_top_level_symlist);
307  if (s) {
308  delete [] hn;
309  if (s->type == TEMPLATE && s->u.ctemplate->id < 0) {
310  return 2;
311  }
312  return 0;
313  }
314  jstring js = env->NewStringUTF( jname );
315 if (env->ExceptionOccurred()) { env->ExceptionDescribe();}
316  jstring hs = env->NewStringUTF( hn );
317  jstring jp = env->NewStringUTF(path);
318 
319  int i = env->CallStaticIntMethod(neuronCls, makeHocClassID, js, hs, jp);
320  if (i == 1) {
321  njclassnames->append(new CopyString(jname));
322  }
323  errno = 0; // have seen this set to 2 by linux
324  delete [] hn;
325  return i;
326 }
327 
328 
329 static const char* java2nrn_classname(Object* ho) {
330  jint cid = -(ho->ctemplate->id) - 1;
331  return njclassnames->item(cid)->string();
332 }
333 
334 static void overloaded(Object* ho, Symbol* method) {
335  int n = strlen(method->name);
336  printf("%s.%s Overloaded. Use one of:\n", hoc_object_name(ho), method->name);
337  for (Symbol* s = ho->ctemplate->symtable->first; s; s = s->next) {
338  if (s != method && strncmp(s->name, method->name, n) == 0
339  && isdigit(s->name[n])
340  ) {
341  printf(" %s\n", s->name);
342  }
343  }
344  hoc_execerror(method->name, "Overloaded. Disambiguate using a more specific method.");
345 }
346 
347 /** invoke java method returning double
348  */
349 static double java2nrn_dmeth(Object* ho, Symbol* method) {
350 // printf("java2nrn_dmeth invoking %s.%s\n", hoc_object_name(ho), method->name);
351  if (method->s_varn) {overloaded(ho, method);}
352  double d = (double) nrnjava_env->CallStaticDoubleMethod(
354  (jobject)ho->u.this_pointer,
355  -(jint)ho->ctemplate->id - 1,
356  (jint)method->u.u_auto, (jint)method->s_varn);
357  errno = 0;
358  if (d == -1e98) {
359  hoc_execerror("Java Exception for", method->name);
360  }
361  return d;
362 }
363 
364 static char** js2charpool(jstring js) {
365 #define imax 5
366  static char** cs;
367  static int i;
368  // allow up to 5 calls before freeing
369  // the problem is that several of these can be put on the
370  // hoc stack before an early one is copied into strdef
371  // and until then the early one must stay in existence
372  if (!cs) {
373  cs = new char*[imax];
374  for (i=0; i < imax; ++i) {
375  cs[i] = nil;
376  }
377  i = 0;
378  }
379  const char* jc = nrnjava_env->GetStringUTFChars(js, 0);
380  if (cs[i]) {
381  delete [] cs[i];
382  cs[i] = nil;
383  }
384  i = (i+1)%imax;
385  cs[i] = new char[strlen(jc) + 1];
386  strcpy(cs[i], jc);
387  nrnjava_env->ReleaseStringUTFChars(js, jc);
388  return cs + i;
389 }
390 
391 /** invoke java method returning String
392  */
393 static char** java2nrn_smeth(Object* ho, Symbol* method) {
394 // printf("java2nrn_smeth invoking %s.%s\n", hoc_object_name(ho), method->name);
395  if (method->s_varn) {overloaded(ho, method);}
396  jstring js = (jstring)nrnjava_env->CallStaticObjectMethod(
398  (jobject)ho->u.this_pointer,
399  -(jint)ho->ctemplate->id - 1,
400  (jint)method->u.u_auto, (jint)method->s_varn);
401  errno = 0;
402  if (js == nil) {
403  hoc_execerror("Java Exception for", method->name);
404  }
405  return js2charpool(js);
406 }
407 
408 Object** nj_j2hObject(jobject jo, int type) {
409  Object** po = nil;
410  if (jo == 0) { //null
411  po = hoc_temp_objptr(0);
412  return po;
413  }
414  if (type >= 0) {
415  void* v = nrnjava_env->NewGlobalRef(jo);
416  Symbol* tsym = nrn_jclass_symlist->item(type);
417  po = hoc_temp_objvar(tsym, v);
418  return po;
419  }else{
420  void* v;
421  Object* o;
422  switch (type) {
423  case -1: //Unregistered java object
424  // put it in a JavaObject
425  v = nrnjava_env->NewGlobalRef(jo);
426  po = hoc_temp_objvar(nrn_jobj_sym, v);
427  return po;
428  case -2: //encapsulated hoc object
429  case -3: //encapsulated Vector object
430  o = (Object*)nrnjava_env->GetLongField(jo, hocObjectCastID);
431  po = hoc_temp_objptr(o);
432  return po;
433  default:
434  break;
435  }
436  }
437  return 0;
438 }
439 
440 /** invoke java method returning a Java Object
441  */
442 static Object** java2nrn_ometh(Object* ho, Symbol* method) {
443 // printf("java2nrn_ometh invoking %s.%s\n", hoc_object_name(ho), method->name);
444  // I don't know how to return two things at once so we call two
445  // methods. The first returns a java object and the second tells
446  // the type.
447  //type 0+ is a registered java object and is the template id.
448  //type -1 is an unregistered java object -- enclose in JavaObject
449  //type -2 is a HocObject and the jobject has a field called
450  // long hocObjectCast which we can cast to the correct object.
451  // other types are for Java objects that extend HocObject
452  // but all have a field called "long hocObjectCast"
453  Object** po = nil;
454  if (method->s_varn) {overloaded(ho, method);}
455 
456  jobject jo = nrnjava_env->CallStaticObjectMethod(
458  (jobject)ho->u.this_pointer,
459  -(jint)ho->ctemplate->id - 1,
460  (jint)method->u.u_auto, (jint)method->s_varn);
461  if (nrnjava_env->ExceptionOccurred()) {
462  nrnjava_env->ExceptionDescribe();
463  hoc_execerror("Java Exception for", method->name);
464  }
465  jint type = 0;
466  if (jo) {
467  type = nrnjava_env->CallStaticIntMethod(
469  }
470 //printf("java2nrn_ometh type = %d\n", type);
471  po = nj_j2hObject(jo, type);
472  if (!po) {
473  printf("%s.%s : do not recognize the return object type %d\n", hoc_object_name(ho), method->name, type);
474  }
475  errno = 0;
476  return po;
477 }
478 
479 /** a hoc object must be encapsulated in a java object for use in
480 java. The generic case for hoc objects opaque to java is HocObject
481 and it's java id for this purpose is 0.
482 Other kinds of hoc object which java should be able to do something
483 with, eg. Vector all have a corresponding java class that extends
484 HocObject and an id known here and in Neuron.java.
485 */
486 jobject nj_encapsulate(Object* ho) {
487  jobject jo;
488  int type = 0;
489  if ( ho->ctemplate->sym == nrn_vec_sym) {
490  type = 1;
491  }
492 //printf("nj_encapsulate %s %ld\n", hoc_object_name(ho), (long)ho);
493  jo = nrnjava_env->CallStaticObjectMethod(neuronCls,
494  encapsulateID, (jlong)ho, type);
495  // refcount incremented already by h2jObject(Object*)
496  return jo;
497 }
498 
499 static void pwm_setwin(void* win, int type, int left, int top) {
500 // printf("pwm_setwin %p %ld %d %d %d\n", win, type, left, top);
501  if (nrnjava_root_env == nrnjava_env) {
502  nrnjava_env->CallStaticIntMethod(neuronCls,
503  setwinID, (jlong)win, type, left, top);
504  }else{
505  printf("nrnjava_env = %ld nrnjava_root_env = %ld\n", (long)nrnjava_env, (long)nrnjava_root_env);
506  }
507 }
o
Definition: seclist.cpp:180
const char *(* p_java2nrn_classname)(Object *ho)
Definition: hocdec.h:84
static jclass neuronCls
Definition: nrnjava.cpp:62
static jmethodID invokeDoubleMethodID
Definition: nrnjava.cpp:67
short type
Definition: cabvars.h:10
char * nrn_underbar2dot(const char *s)
Definition: nrnjava.cpp:228
static void java2nrn_destruct(void *opaque_java_object)
Destroy java reference.
Definition: nrnjava.cpp:288
#define JAVAOBJECT
Definition: hocdec.h:105
void nrnjava_init()
Definition: nrnjava.cpp:132
static jmethodID nrnclsldID
Definition: nrnjava.cpp:63
static jmethodID encapsulateID
Definition: nrnjava.cpp:70
short type
Definition: model.h:58
static const char ** joname(void *v)
Definition: nrnjava.cpp:116
static jmethodID jclassnameID
Definition: nrnjava.cpp:74
static char ** java2nrn_smeth(Object *ho, Symbol *method)
invoke java method returning String
Definition: nrnjava.cpp:393
Object ** nj_j2hObject(jobject jo, int type)
Definition: nrnjava.cpp:408
Symbol * hoc_lookup(const char *)
static Object ** java2nrn_ometh(Object *ho, Symbol *method)
invoke java method returning a Java Object
Definition: nrnjava.cpp:442
void
void * this_pointer
Definition: hocdec.h:231
char * hoc_object_name(Object *ob)
Definition: hoc_oop.cpp:84
Object **(* p_java2nrn_ometh)(Object *ho, Symbol *method)
Definition: hoc_oop.cpp:26
void(* nrnjava_pwm_setwin)(void *, int, int, int)
char * name
Definition: model.h:72
#define v
Definition: md1redef.h:4
static bool java2nrn_identity(Object *o1, Object *o2)
equality in the sense of ==
Definition: nrnjava.cpp:253
JNIEnv * nrnjava_env
Definition: njvm.cpp:59
static void * joconstruct(Object *)
Definition: nrnjava.cpp:91
const char * string() const
Definition: string.h:139
#define implementPtrList(PtrList, T)
unsigned s_varn
Definition: hocdec.h:157
JNIEnv * nrnjava_root_env
Definition: njvm.cpp:60
static double java2nrn_dmeth(Object *ho, Symbol *method)
invoke java method returning double
Definition: nrnjava.cpp:349
Object ** hoc_temp_objvar(Symbol *symtemp, void *v)
Definition: hoc_oop.cpp:503
static jmethodID constructNoArgID
Definition: nrnjava.cpp:64
int const size_t const size_t n
Definition: nrngsl.h:12
_CONST char * s
Definition: system.cpp:74
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
Definition: hoc_oop.cpp:1581
Symlist * hoc_top_level_symlist
Neuron/Java Interface code.
Definition: symbol.cpp:41
static void jodestruct(void *v)
Definition: nrnjava.cpp:95
static String NJStrList * njclassnames
Definition: nrnjava.cpp:86
#define printf
Definition: mwprefix.h:26
static jmethodID invokeCharsMethodID
Definition: nrnjava.cpp:68
#define ret
Definition: redef.h:123
int
Definition: nrnmusic.cpp:71
#define CopyString
Definition: _defines.h:2
void nrnjni_registration(jclass nrnCls)
Definition: nrnjni.cpp:65
static jmethodID constructWithArgID
Definition: nrnjava.cpp:65
static Member_ret_str_func jo_retstr_members[]
Definition: nrnjava.cpp:126
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:741
errno
Definition: system.cpp:98
Definition: model.h:57
static jmethodID makeHocClassID
Definition: nrnjava.cpp:66
static char * env[]
Definition: inithoc.cpp:228
#define nil
Definition: enter-scope.h:36
static void pwm_setwin(void *, int, int, int)
Definition: nrnjava.cpp:499
#define left
Definition: rbtqueue.cpp:45
static jfieldID hocObjectCastID
Definition: nrnjava.cpp:75
int ifarg(int)
Definition: code.cpp:1562
void nrnjni_redirreg(jclass nrnCls)
Definition: nrnjni.cpp:71
Symbol NJSymList * nrn_jclass_symlist
Definition: nrnjava.cpp:81
int id
Definition: hocdec.h:204
static char ** js2charpool(jstring js)
Definition: nrnjava.cpp:364
static void overloaded(Object *ho, Symbol *method)
Definition: nrnjava.cpp:334
static jmethodID identityID
Definition: nrnjava.cpp:73
int u_auto
Definition: hocdec.h:142
char * nrn_dot2underbar(const char *s)
JNI code for Neuron.java C implementations of Java native methods.
Definition: nrnjava.cpp:240
Definition: hocdec.h:226
HocStruct cTemplate * ctemplate
Definition: hocdec.h:151
double(* p_java2nrn_dmeth)(Object *ho, Symbol *method)
Definition: hoc_oop.cpp:24
void *(* p_java2nrn_cons)(Object *)
Definition: hoc_oop.cpp:22
jobject nj_encapsulate(Object *ho)
a hoc object must be encapsulated in a java object for use in java.
Definition: nrnjava.cpp:486
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:60
int convertJavaClassToHoc(JNIEnv *env, const char *jname, const char *hname, const char *path)
Make a hoc equivalent to Java class (jname) calling it hname in hoc.
Definition: nrnjava.cpp:299
static void * java2nrn_cons(Object *o)
Construct a new instance of a java class.
Definition: nrnjava.cpp:264
static jclass nrnclsldr
Definition: nrnjava.cpp:61
#define i
Definition: md1redef.h:12
static jmethodID setwinID
Definition: nrnjava.cpp:72
Definition: string.h:34
static double joequals(void *v)
Definition: nrnjava.cpp:101
bool(* p_java2nrn_identity)(Object *o1, Object *o2)
void(* p_java2nrn_destruct)(void *opaque_java_object)
Definition: hoc_oop.cpp:23
Symbol * nrn_jobj_sym
Definition: nrnjava.cpp:88
#define imax
declarePtrList(NJSymList, Symbol) implementPtrList(NJSymList
union Symbol::@18 u
union Object::@54 u
Object ** hoc_temp_objptr(Object *)
Definition: code.cpp:209
Symbol * nrn_vec_sym
Definition: nrnjava.cpp:89
char **(* p_java2nrn_smeth)(Object *ho, Symbol *method)
Definition: hoc_oop.cpp:25
Object ** hoc_objgetarg(int)
Definition: code.cpp:1568
static jmethodID getObjectTypeID
Definition: nrnjava.cpp:71
static const char * java2nrn_classname(Object *ho)
Definition: nrnjava.cpp:329
static Member_func jo_members[]
Definition: nrnjava.cpp:122
static jmethodID invokeObjectMethodID
Definition: nrnjava.cpp:69