David Bradley wrote:
I got the code of xpidl_java.c and libIDL, but feel very hard to read and understand all those C++ pointers, only the StateTree has made me quit. Also, I have only experience of debugging C/C++ program in VC++, so without a VC++ project file, I even can't start.jml wrote:I found the code, but that is not generating the java code I needed. I also try to read the source code to see whether I can change it, then soon I got lost -- seemed I need to understand libIDL, then I need to understand glib ... Is there any document for this part?
libIDL is a CORBA IDL yacc based parser. It's supported outside of Mozilla. Search for libidl using a search engine and you should be able to find some info. The library provides hooks, as the parse tree is traversed. The callbacks Mozilla implements and then digs into the parse tree information.
I seem to recall someone had been maintaining a separate copy of the xpidl_java.c and was looking into merging that back into the tree. Doesn't look like it's been done, and don't remember the details of who, when, where, why.
My latest approach is using "xpidl -m java" to generate java code from IDL. Then compile all the java codes into class files, then using the java reflect API to load those classes and reading method and fields from them, and then generate the code I needed from that. Paintful, isn't it? So now I am waiting for someone to write a xpidl_xml.c file to generate xml from IDL, then programmer from any language may benefit.
As moving between C and Java, I believe for those hardcore C/C++ programers who only use emacs and gcc/gdb, maybe yes. But for a java guy like me who depend on an IDE so much, forget it.
David Bradley
jml
