comp.lang.ada
 help / color / mirror / Atom feed
* Ada-kernel calls / IF & ELSE...
@ 2002-03-11 19:42 Karl Ran
  2002-03-11 20:41 ` Bj�rn Lundin
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Karl Ran @ 2002-03-11 19:42 UTC (permalink / raw)


Hi,
I'm just starting to understand how to make Ada-kernel calls...

Has anyone compiled the Kernel Calls demo on
http://www.vaxxine.com/pegasoft/homes/13.html#13.5.4 
?

Here is a much simpler version:

-----------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;

procedure audiocd is 

  DevCDROM : constant string := "/dev/cdrom";

  type aFileID is new integer;

  procedure open( id : out aFileID;
                  path : string;
                  flags : integer );

  pragma import( C, open, "open");
  pragma import_valued_procedure( open );

  procedure perror( prefixstr : string );
  pragma import( C, perror, "perror");

  cd : aFileID;

begin

  Put_Line( "Openning " & DevCDROM & "..." );
  Open( cd, DevCDROM, 0 );

  if cd < 0 then
     perror( "IF: Error openning CDROM drive " );
  else
     Put_Line( "ELSE: opened CDROM drive successfully " );
  end if;

end audiocd; 
-----------------------------------------------------

>gnatmake -gnatwa audiocd.adb
gcc -c -gnatwa audiocd.adb
gnatbind -x audiocd.ali
gnatlink audiocd.ali

>./audiocd
Openning /dev/cdrom...
IF: Error openning CDROM drive ELSE: opened CDROM drive successfully :
No such file or directory


Would someone please explain whats going on here?

Is this just because of my bleeding-edge-suse71-gnat3.14p-unsupported
system or is normal?


Karl



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2002-03-12 20:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-11 19:42 Ada-kernel calls / IF & ELSE Karl Ran
2002-03-11 20:41 ` Bj�rn Lundin
2002-03-12 15:09   ` Karl Ran
2002-03-12 20:16     ` Vadim Godunko
2002-03-11 21:06 ` Vadim Godunko
2002-03-11 21:06 ` Vadim Godunko
2002-03-11 21:07 ` Vadim Godunko
2002-03-11 21:09 ` Vadim Godunko
2002-03-11 21:09 ` Vadim Godunko
2002-03-11 21:17   ` Sorry for repeat " Vadim Godunko
2002-03-12 15:01   ` Karl Ran
2002-03-12  0:34 ` Adrian Knoth

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