comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <marin.condic.auntie.spam@pacemicro.com>
Subject: Re: howto make system calls (newbie question)
Date: Fri, 4 May 2001 11:49:09 -0400
Date: 2001-05-04T15:49:11+00:00	[thread overview]
Message-ID: <9cuj1n$gsu$1@nh.pace.co.uk> (raw)
In-Reply-To: 3AF28F9A.6DC3BD90@earthlink.net

While I'm basically on your side here, Marc, I think it is fair to point out
that in Kernighan & Ritchie (I don't have the ANSI C standard in front of
me) it says there is a "Standard Library" that, while "not part of the C
language proper" is considered to be part of the C environment that a
standard implementation of C will provide. In that library, we find
<stdlib.h> which contains a function "system" that one can reasonably expect
to be part of a standard C implementation.

I would consider this analogous to the Ada appendices that define things
like Unbounded_String, etc. The various string packages are not part of the
Ada language per se, but are an expected library of things available in Ada
if the implementation is conformant with the standard. I see no reason that
Ada couldn't provide similar libraries (perhaps optional for implementations
where it makes no sense to have them - e.g. embedded machines) for functions
like "system" so that calling conventions, etc., were Ada-ish and required
no understanding of anything outside Ada to use. (No pragma import stuff,
etc.) If it were legal for us mere mortal hackers to extend the package Ada,
it might have already been done. (This is how a lot of things crept into C,
after all.)

Its fair for someone to criticize Ada for not providing the sort of
reasonable and customary libraries one gets with lots of other languages.
(Where "reasonable and customary" stops is subject to debate, but I'd think
some basic OS services ought to fall within scope.) Saying "well you can get
there by binding to the C libraries" is a bit of a "me too!!!" syndrome that
keeps Ada a follower rather than a leader. Ada has to get out in front of
the issue and create its own interfaces or it will forever find itself
fighting the "well then why not just use C/C++ and be done with it?"
criticism. That's a hard one to win.

I like the idea of having Ada include lots of apendices to bind to things in
a standard way. A lot of what is in the C libraries Ada doesn't need because
it has other ways of getting there, but why not look over the C libraries
and provide an Ada standard way of getting the same services? (Not in a
slavish "me too!!!" way - do it "The Ada Way" (tm).)

A quick scan of K&R-II Appendix B, suggest the following as things Ada
provides no immediate alternative to that could be added in some way:

<stdlib.h> system
<stdlib.h> getenv
<stdlib.h> bsearch
<stdlib.h> qsort
<assert.h> (Yes, it exists, but should be part of the standard...)
<signal.h> (Yeah, you have some of it with exceptions - OS stuff is what I
have in mind here - can we have a standard exception (or other mechanism?)
for SIGINT, SIGTERM, SIGABRT?)
<time.h> clock
<time.h> asctime
<time.h> ctime
<time.h> gmtime
<time.h> localtime
<time.h> strftime

A little thought about other things commonly supplied by most OS's would
probably yield a bunch more ideas. Maybe we'd start seeing some posts in
Comp.Lang.C(++) to the effect of "I can do XYZ in Ada - how do I do the same
thing in C(++)?" and "Why doesn't C(++) provide me with a function/class to
do ABC which I can do in Ada so easily?" (Maybe we can start some shill
postings? :-)

Just an idea....

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Marc A. Criley" <mcqada@earthlink.net> wrote in message
news:3AF28F9A.6DC3BD90@earthlink.net...
>
> "system" is neither part of C, nor part of Ada, it is an OS function
> that uses a C-style calling syntax.
>
> There's a widespread belief that OS functions, string handling
> functions, and so on, are all part of C, which makes C so much more
> powerful than languages like Ada.  In reality, all those functions are
> provided in libraries for which C bindings have merely been provided by
> the vendor.  The libraries themselves can be written in any programming
> language, it is simply that a C-style calling syntax must be provided.
>
> I've worked on a shared library, completely written in Ada, that is
> invoked by C and Ada applications.  Even the Ada applications have to
> use "pragma Import(C, ...)" to gain access to its functions.  (And of
> course the library specifies pragma Export for the visible entities.)
>
> Marc A. Criley
> Senior Staff Engineer
> Quadrus Corporation
> www.quadruscorp.com





  reply	other threads:[~2001-05-04 15:49 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-04  7:51 howto make system calls (newbie question) Lars Lundgren
2001-05-04  8:16 ` L.H.Jeong
2001-05-04  8:47   ` Lars Lundgren
2001-05-04 12:12     ` Marc A. Criley
2001-05-04 15:49       ` Marin David Condic [this message]
2001-05-04 17:46         ` tmoran
2001-05-04 18:46           ` Marin David Condic
2001-05-05  7:01             ` tmoran
2001-05-04 16:35     ` Jeffrey Carter
2001-05-04 11:00 ` Noam Kloos
2001-05-04 12:01   ` Lars Lundgren
  -- strict thread matches above, loose matches on Subject: below --
2001-05-04 20:56 Beard, Frank
2001-05-07 14:42 ` Marin David Condic
2001-05-07 16:41   ` Samuel T. Harris
2001-05-07 18:25     ` Marin David Condic
2001-05-08 20:30       ` Samuel T. Harris
2001-05-08 21:13         ` Marin David Condic
2001-05-08 20:23     ` Samuel T. Harris
2001-05-08  7:34   ` Tarjei T. Jensen
2001-05-08 12:16     ` Larry Kilgallen
2001-05-08 14:12       ` Tarjei T. Jensen
2001-05-08 16:48         ` Larry Kilgallen
2001-05-08 21:40           ` Charles Hixson
2001-05-08 22:53             ` Larry Kilgallen
2001-05-09 16:00               ` Charles Hixson
2001-05-09 17:14                 ` Larry Kilgallen
2001-05-09  8:25           ` Tarjei T. Jensen
2001-05-09 12:28             ` Larry Kilgallen
2001-05-09 16:13               ` Charles Hixson
2001-05-10  7:17               ` Tarjei T. Jensen
2001-05-08 13:43     ` Marin David Condic
2001-05-12  2:58       ` Randy Brukardt
2001-05-12 13:07         ` Larry Kilgallen
2001-05-04 21:08 Beard, Frank
2001-05-04 22:45 ` Jeffrey Carter
2001-05-07 14:47 ` Marin David Condic
2001-05-09 13:41   ` Noam Kloos
2001-05-09 14:17     ` Ted Dennison
2001-05-16 12:45       ` Marc A. Criley
2001-05-16 19:50         ` Ted Dennison
2001-05-09 18:29 ` GianLuigi Piacentini
2001-05-09 19:18   ` David Starner
2001-05-07 17:04 Beard, Frank
2001-05-09 21:42 Mike Brenner
2001-05-09 22:07 Beard, Frank
2001-05-10 12:34 ` Samuel T. Harris
2001-05-09 22:19 Beard, Frank
2001-05-10  6:18 ` Pascal Obry
2001-05-10 12:40 ` Samuel T. Harris
2001-05-10 15:44   ` Stephen Leake
2001-05-09 22:28 Beard, Frank
2001-05-10 19:54 Beard, Frank
2001-05-10 20:41 ` Pascal Obry
2001-05-10 20:11 Beard, Frank
2001-05-11 16:03 ` Samuel T. Harris
2001-05-10 21:22 Beard, Frank
replies disabled

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