comp.lang.ada
 help / color / mirror / Atom feed
* adaflorist
@ 2004-07-02  8:28 Jorge Suarez-Solis Rivaya
  0 siblings, 0 replies; only message in thread
From: Jorge Suarez-Solis Rivaya @ 2004-07-02  8:28 UTC (permalink / 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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-07-02  8:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-02  8:28 adaflorist Jorge Suarez-Solis Rivaya

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