comp.lang.ada
 help / color / mirror / Atom feed
From: Juergen.Pfeifer@t-online.de (Juergen Pfeifer)
Subject: Re: RFD: comp.windows.curses (Ada)
Date: 1997/06/12
Date: 1997-06-12T00:00:00+00:00	[thread overview]
Message-ID: <5npao2$op5$1@news02.btx.dtag.de> (raw)
In-Reply-To: 866127932.6765@dejanews.com


dg@poboxes.com wrote:

> My understanding is that ncurses is a C library.
>
> My understanding is that what Russ Allbery is referring to is
> an "Ada binding", and that this is a set of headers and interface
> routines to allow the use of ncurses FROM an Ada application, but that
>
> ncurses is still a C library.
>
> 1) Could someone verify, clarify, or correct what an Ada binding is,
> by a posting to "news.groups" or "comp.lang.c"?  I have not personally
>
> used the Ada binding, just read about it.
>
> 2) If ncurses is not just a C library, what would Russ think about
> "comp.programming.libraries.curses"?

Ada has a standardized mechanism how to talk to routines that are
written
in another language. This mechanism allows you to formulate a prototype
of a function or a datastrcuture in Ada systax, but then you tell the
Ada
compiler that the function is implemented in another language. Let me
give an example:

function Sleep_A_Little_Bit( How_Long : Integer) returns Integer;
pragma Import (C, Sleep_A_Little_Bit, "sleep");

This little (not quite correct) sequence shows you how you write a
Ada prototype for the function Sleep_A_Little_Bit and how you
tell the compiler, that it is actually written in C and its real name is

"sleep".

In theory an Ada binding to a C library is nothing else than a set
of Ada "headers" that defines such prototypes and mappings. In
practice there exist tools that read C header files and generate
corresponding Ada "headers" for it. Thats what the Ada community
calls "thin bindings".

The ncurses binding is not quite thin in the sense that it implements
small wrapper routines around the C routines to do exception handling.
In addition it provides Ada like mechanisms to deal with constructs in
(n)curses that are to "C-ish", i.e. have constructs like vararg
functions
that are not easily portable across different language runtime models.

So there is some Ada code involved in the binding, but this code doesn't

implement any real ncurses functionality, it is only there to make the
interface more Ada friendly.

ncurses itself is of course implemented in C. But that doesn't mean that

it is only of use for C programmers (that would be a bad idea for a good

library).

Cheers
Juergen





      reply	other threads:[~1997-06-12  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <864986194.12186@isc.org>
     [not found] ` <5mn26e$nfg$1@henson.cc.kzoo.edu>
     [not found]   ` <xonoh9smzs7.fsf@leo.mrc.uidaho.edu>
     [not found]     ` <m3wwog4o7s.fsf@windlord.Stanford.EDU>
     [not found]       ` <kmuom5.bcs.ln@pug1.sprocketshop.com>
     [not found]         ` <5nlui1$f97$1@narses.hrz.tu-chemnitz.de>
     [not found]           ` <m3vi3lo03y.fsf@windlord.Stanford.EDU>
1997-06-12  0:00             ` RFD: comp.windows.curses (Ada) dg
1997-06-12  0:00               ` Juergen Pfeifer [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox