Bringing Ada to Eclipse Developers - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Bringing Ada to Eclipse Developers

Description:

www.adacore.com. Bringing Ada to Eclipse Developers. Quentin Ochem ... GNAT Development Environment. Eclipse environment. JNI. Slide 3. Example : formatting ... – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 10
Provided by: quenti7
Category:

less

Transcript and Presenter's Notes

Title: Bringing Ada to Eclipse Developers


1
Bringing Ada to Eclipse Developers
  • Quentin Ochem
  • Software Engineer

2
The initial situation
GNAT Development Environment
Eclipse environment
Formatting Quick Fixes Code assist Browsing
Framework ResourcesWidgets Plugins
Subprograms OOP Exceptions Callbacks
Eclipse Plugin
JNI
3
Example formatting
Ada
Java
JNI
Computes format
Updates the buffer
4
Plugin architecture
Ada Code
Java Code
Native shared Library
Java Library
5
Overview of the Tool
Wrappers to Ada to JNI
Ada specs
Javahigh level Interface (Wrappers JNI to Java)
6
Original Ada API
package Test is function Addition (A, B
Integer) return Integer end Test
7
Generated code (1 / 3)
pragma Warnings (Off) pragma Style_Checks
("NM32766") with Interfaces.Java.JNI with
AJIS with AJIS.Internal with AJIS.Java with
AJIS.Internal.Java with Ada.Characters.Conversion
s with Ada.Finalization with Test use
Test package JNI_Binding.Test_JNI.Test_Package_J
NI is pragma Elaborate_Body function
Id_JNI_5 (A Standard.Integer B
Standard.Integer) return Standard.Integer
function Addition_Id_JNI_4 (Id_JNI_1
Interfaces.Java.JNI.JNI_Env_Access Id_JNI_3
Interfaces.Java.JNI.J_Class A
Interfaces.Java.JNI.J_Int B Interfaces.Java.JNI
.J_Int) return Interfaces.Java.JNI.J_Int
pragma Export (C, Addition_Id_JNI_4,
"Java_com_adacore_test01_Test_Test_1Package_Additi
on_1Id_1JNI_14__II") end JNI_Binding.Test_JNI.Te
st_Package_JNI
8
Generated code (2 / 3)
pragma Warnings (Off) pragma Style_Checks
("NM32766") with Ada.Unchecked_Deallocation wit
h System.Address_To_Access_Conversions with
Ada.Unchecked_Conversion with Ada.Tags with
Ada.Exceptions with Interfaces.C with
Interfaces.C.Strings with Test use
Test package body JNI_Binding.Test_JNI.Test_Pack
age_JNI is function Id_JNI_5 (A
Standard.Integer B Standard.Integer) return
Standard.Integer is Id_JNI_7
Standard.Integer renames Test.Addition (A, B)
begin return Id_JNI_7 end Id_JNI_5
function Addition_Id_JNI_4 (Id_JNI_1
Interfaces.Java.JNI.JNI_Env_Access Id_JNI_3
Interfaces.Java.JNI.J_Class A
Interfaces.Java.JNI.J_Int B Interfaces.Java.JNI
.J_Int) return Interfaces.Java.JNI.J_Int is
begin declare Id_JNI_8
Interfaces.Java.JNI.J_Int Interfaces.Java.JNI.J
_Int (Id_JNI_5 (Standard.Integer (A),
Standard.Integer (B))) begin
return Id_JNI_8 end exception
when J AJIS.Java.Java_Exception gt
declare Result Interfaces.Java.JNI.J
_Int begin Result
Interfaces.Java.JNI.Throw (Id_JNI_1,
AJIS.Internal.Java.Throwable_Value
(Ada.Exceptions.Exception_Message (J)))
return 0 end when E others
gt declare Result
Interfaces.Java.JNI.J_Int begin
Result Interfaces.Java.JNI.Throw_New
(Id_JNI_1, Interfaces.Java.JNI.Find_Class
(Id_JNI_1, String'("Lcom/adacore/ajis/NativeExcept
ion")), Interfaces.C.To_C (Ada.Exceptions.Excepti
on_Information (E))) return 0
end end Addition_Id_JNI_4 begin
null end JNI_Binding.Test_JNI.Test_Package_JNI
9
Generated code (3 / 3)
package com.adacore.test01.Test import
com.adacore.test01.Ada2Java.Library _at_SuppressWar
nings("unused") public final class Test_Package
static public int Addition (int A, int B)
com.adacore.test01.Ada2Java.Library.lock.lock
() try int Id_JNI_9
Addition_Id_JNI_4 (A, B) return
Id_JNI_9 finally
com.adacore.test01.Ada2Java.Library.lock.unlock
() // Addition static
com.adacore.test01.Ada2Java.Library.load ()
native static private int Addition_Id_JNI_4
(int A, int B) // Test_Package
package com.adacore.test01.Test public
final class Test_Package static public int
Addition (int A, int B)
//
Addition //
Test_Package
10
Semantic match
package Test public class Rec public Rec
() // Creates a Rec object on the //
native heap. public int Func ()
// Code
package Test is type Rec is tagged private
function Func (P Rec) return
Integer private -- some code end Test
11
Features (entities bound from Ada to Java)
  • Scalars, strings, structures (records), pointers
    (access types)
  • Global constants variables
  • Procedures Functions
  • Exceptions, raised from Ada to Java, and from
    Java to Ada in the callback case
  • Callbacks (access to functions)
  • Classes (tagged types), derivable from Java, with
    cross language dispatching either from Ada or
    from Java
Write a Comment
User Comments (0)
About PowerShow.com