• Gem #55: Introduction to Ada / Java Interfacing

    Interfacing Ada and Java is a very tricky problem. As opposed to C, C++, or Fortran, the two languages execute on two different environments, Java on the JVM and Ada directly on the underlying OS. For this reason, it is not possible to directly bind Java functions to natively compiled Ada through a pragma Import. Two solutions are offered to the developer: either compiling the code directly to Java bytecode, using GNAT for the JVM, or using the Java Native Interface (JNI), allowing communication between the native and JVM environments. In this Gem we will take a look at the latter.

    Using this JNI layer manually is very error-prone and tedious. Fortunately, AdaCore provides a set of tools for automating the interface generation, through GNAT-AJIS. This Gem is the first of a series showing how this toolset can be used to create a mixed Ada / Java application. Continue Reading »

    Quentin Ochem
    AdaCore
  • Gem #54: Scripting Capabilities in GNAT (Part 2)

    Ada Gem #54 — In Gem #52, we saw various facilities that GNAT provides to make Ada a scripting language (sort of). We discussed GNAT.Command_Line, GNATCOLL.Mmap, GNAT.Regpat and GNAT.AWK. This Gem continues the discussion of scripting capabilities, and focuses on interaction with external processes. Continue Reading »

    Emmanuel Briot
    AdaCore
  • Gem #52: Scripting Capabilities in GNAT (Part 1)

    Ada Gem #52 — Programming languages are, at least in the mind of most programmers, divided into two categories: scripting languages and others. The dividing line is not always obvious, and generally has to do with the size of the application, whether the language is interpreted or compiled, and whether doing operations such as manipulating external processes is easy.

    It's safe to say, though, that Ada is almost never classified as a scripting language. This Gem demonstrates a few of the packages that are part of the GNAT distribution and that provide helpful scripting features to accomplish tasks that would often be thought to be in the domain of languages specialized for scripting. Portability is of course a major advantage of choosing Ada!

    Continue Reading »

    Emmanuel Briot
    AdaCore
  • Gem #46: Incompatibilities between Ada 83 and Ada 95

    Ada Gem #46 — Part 1, Unconstrained arrays in generics Continue Reading »

    Robert Dewar
    AdaCore
  • Gem #37: Bounded Buffer package in GNAT Hierarchy (Part 2)

    Ada Gem #37 — Part 1 of this Gem briefly introduced bounded buffers, protected types, and the declaration of the generic package GNAT.Bounded_Buffers, exporting protected type Bounded_Buffer. In Part 2 of the Gem we examine the private part of Bounded_Buffer and the implementations of the protected entries and functions. Continue Reading »

    Pat Rogers
    AdaCore
  • Gem #35: Bounded buffer package in GNAT hierarchy (Part 1)

    Ada Gem #35 — Ada 95 introduced “protected types” as a fundamental building block for efficient concurrent programming and interrupt handling. In this Gem we examine the use of protected types in the implementation of the classic asynchronous bounded buffer abstraction provided by the GNAT hierarchy of library units. This Gem assumes the reader is somewhat familiar with protected types and will, therefore, explain some, but by no means all, of their semantics. Continue Reading »

    Pat Rogers
    AdaCore
  • Gem #31: Preconditions/postconditions

    Ada Gem #31 — The notion of preconditions and postconditions is an old one. A precondition is a condition that must be true before a section of code is executed, and a postcondition is a condition that must be true after the section of code is executed. Continue Reading »

    Robert Dewar
    AdaCore
  • Gem #28: Changing Data Representation (Part 2)

    Ada Gem #28 — Part 2, Efficiency Considerations Continue Reading »

    Robert Dewar
    AdaCore
  • Gem #25: How to Search Text

    Ada Gem #25 — The Ada standard defines several subprograms related to searching text in a string. In addition, GNAT provides additional packages to search. This gem will cover the various possibilities. Continue Reading »

    Emmanuel Briot
    AdaCore
  • Gem #24: Null Considered Harmful (Part 2—Efficiency)

    Ada Gem #24 — The "not null" syntax can make programs more efficient by removing the need for implicit run-time checks. Continue Reading »

    Bob Duff
    AdaCore
  • Gem #21: How to parse an XML text

    Ada Gem #21 — The World Wide Web Consortium (W3C) develops various specifications around the XML file format. In particular, it specifies various APIs to load, process and write an XML file. Although these APIs are not specified for Ada, XML/Ada tries to conform as closely as possible to them.

    This gem describes how to use XML/Ada to parse an XML file. Continue Reading »

    Emmanuel Briot
    AdaCore
  • Gem #19: XML streaming of Ada objects

    Ada Gem #19 — XML streaming of Ada objects Continue Reading »

    Pascal Obry
    EDF R&D
  • Gem #18: Warnings in GNAT

    Ada Gem #18 — This "gem" is not about the Ada language, but about a set of GNAT-specific features related to warnings. We discuss how to make the best use of GNAT's warnings. Continue Reading »

    Bob Duff
    AdaCore
  • Gem #17: Pragma No_Return, Part 2 (functions)

    Ada Gem #17 — GNAT warns about functions that might reach their "end", and sometimes these warnings are false alarms. Pragma No_Return can be used to suppress such false alarms. Continue Reading »

    Bob Duff
    AdaCore
  • Gem #16: Pragma No_Return

    Ada Gem #16 — Pragma No_Return may be used to mark procedures that cannot return normally. Continue Reading »

    Bob Duff
    AdaCore
  • Gem #8: Factory Functions

    Ada Gem #8 — A factory function is a technique for constructing an object from one class given only an object in some other class. The technique is used to implement assignment for objects having a class-wide type, such that tag-mismatch exceptions cannot occur. Continue Reading »

    Matthew Heaney
    On2 Technologies
« Previous    1  2  3