From: jsuarezrivaya@yahoo.es (Jorge Suarez-Solis Rivaya)
Subject: adaflorist
Date: 2 Jul 2004 01:28:45 -0700
Date: 2004-07-02T01:28:45-07:00 [thread overview]
Message-ID: <61f665c0.0407020028.39bca9d2@posting.google.com> (raw)
I have a problem with the adaflorist posix binding,
I have a program witch code is this:
------------------------------------------------------------------------------
with Ada.Text_IO;
with POSIX, POSIX_IO;
with Interfaces.C;
--with Tareas;
procedure pruebaflorist is
-- TIPOS
type fildes_pair is array (1 .. 2) of POSIX_IO.File_Descriptor;
--task type A (fdr: POSIX_IO.File_Descriptor, fdw:
POSIX_IO.File_Descriptor, Buffer : POSIX_IO.IO_Buffer(1..4096));
-- DECLARACIONES
Audio_Fd : POSIX_IO.File_Descriptor;
mp3 : POSIX_IO.File_Descriptor;
fin : Interfaces.C.Int;
Buffer1 : POSIX_IO.IO_Buffer(1..4096);
Buffer2 : POSIX_IO.IO_Buffer(1..4096);
Last : POSIX.IO_Count;
fildes : fildes_pair;
-- IMPORTACIONES
function Open_Driver (start: in POSIX_IO.File_Descriptor)
return Interfaces.C.Int;
pragma import(C,Open_Driver,"open_sound_device");
begin
-- abrimos ficheros
mp3 := POSIX_IO.open("c.raw",POSIX_IO.Read_Only);
Audio_Fd := POSIX_IO.open("/dev/dsp",POSIX_IO.Write_Only);
fin := Open_Driver(Audio_Fd);
-- abrimos pipe
POSIX_IO.Create_Pipe(fildes(1),fildes(2));
declare
task A;
task B;
task body A is
begin
loop
POSIX_IO.read(mp3,Buffer1,Last);
POSIX_IO.write(fildes(2),Buffer1,Last);
Ada.Text_IO.Put_Line("Tarea A");
end loop;
end A;
task body B is
begin
loop
POSIX_IO.read(fildes(1),Buffer2,Last);
POSIX_IO.write(Audio_Fd,Buffer2,Last);
Ada.Text_IO.Put("Tarea B");
end loop;
end B;
begin
Ada.Text_IO.Put_Line("Programa principal, esperando
...");
-- exception
-- when Ada.Text_IO.End_Error =>
Ada.Text_IO.Put_Line("Terminamos");
end; -- bloque declare
POSIX_IO.close(mp3);
POSIX_IO.close(Audio_Fd);
--exception
-- when Ada.Text_IO.End_Error =>
Ada.Text_IO.Put_Line("Terminamos");
end pruebaflorist;
--------------------------------------------------------------------------
It compiles perfectly, but I cant link it, I did it months ago but
dont remember how, if someone could help ...
I think is because some flag but I'm not sure.
thanks
Jorge Suarez-Solis Rivaya
reply other threads:[~2004-07-02 8:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox