From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fdb77,9923b1c3be80099b,start X-Google-Attributes: gidfdb77,public X-Google-Thread: 103376,9923b1c3be80099b,start X-Google-Attributes: gid103376,public From: Mike Stark Subject: Ada to byte-code compiler works as advertised Date: 1996/09/27 Message-ID: <324BF60E.4DEF@gsfc.nasa.gov>#1/1 X-Deja-AN: 185755530 content-type: text/plain; charset=us-ascii organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA mime-version: 1.0 newsgroups: comp.lang.java.advocacy,comp.lang.ada x-mailer: Mozilla 3.0 (Macintosh; I; 68K) Date: 1996-09-27T00:00:00+00:00 List-Id: I have been playing with the Intermetrics AppletMagic tool, which compiles Ada source into Java byte code, and I have successfully met all the objectives of my experimentation except for ones that I haven't gotten around to but that I expect no problems with. The main purpose of this post is to let people know that this tool works as advertised and to thank Tucker Taft of Intermetrics for his help in figuring out the undocumented capabilities of the beta versions I've been using. Intermetrics has also developed browsable documentation for the Ada interface to the Java APIs that is similar in concept to the Java API documentation, as well as a software development environment that is also Java byte code. I haven't had a chance to play with (evaluate, I mean ;) these features, but they look nice when you scan the Intermetrics Web page (http://www.inmet.com:80/javadir/download/). For those who are more interested in details, I wrote up a summary of what I've done below the line. For those who just want to know if AppletMagic is a good tool -- I'd say it's a great one, and am looking forward to seeing non-beta versions. Mike ----------------------------------------------------------------- My objectives were 1. Have a Java applet call Ada code. The application we have been working with is to draw a satellite ground track over a world map. The graphics is coded in Java, and the computation of latitude and longitude are computed in Ada. This applet has been tested with the flight dynamics state as package body variables. The interface to Ada and the .class files compiled from Ada work fine, but we are still debugging the graphics that are written in Java. When this is done, the applet will be available from the Goddard Space Flight Center Flight Dynamics Division WWW page (http://fdd.gsfc.nasa.gov/). I will post an announcement when this is done. 2. Write a Java class that is called from Ada. This was easy to do based on the AppletMagic documentation. This is done using the "java2ada" tool on the compiled .class file. The only undocumented step is that you need to run the "adareg" tool to register the output from java2ada with the compilation library, so that the calling routines can import the resulting package. 3. Write a class in Ada that is callable from Java. This was done by replacing the package implementation discussed above which generated a Java class with static functions) with an implementation that extended java.lang.Object with a tagged private record. Unlike the package implementation, to get a correct record type implementation requires the use of pragma Export for all your functions. Once that little undocumented issue was resolved it was easy to compile a package containing the tagged record type, and to run javap on the resulting class to verify that the interface was correct. I then wrote a Java application to create an object of this class and use it to generate the longitudes and latitudes for the ground track. The only minor problem here (which I attribute entirely to the fact that the product is a beta version) is that my private record components in Ada become public instance variables in the corres- ponding Java class. This does not have any impact on how the system runs, but to have consistent semantics between the languages the private record components should IMO become protected instance variables. 4. (the part I haven't done) Write a Java class that extends the Ada class. I have no real doubts that this will work, but I won't get to it until next week. Similarly, I could write an Ada extension to the Java class being called from Ada. Examining the generated code leaves me no doubt that both can be done -- I just have run out of time before the expiration of the AM1.5 beta license. The source code for all this work will be forwarded to Intermetrics to include in their applet writer's guide. I will probably finish up my work by mid-October and send it then.