comp.lang.ada
 help / color / mirror / Atom feed
From: "Vladimir Olensky" <vladimir_olensky@yahoo.com>
Subject: Re: Project: Free OS and Other Projects Continued
Date: 2000/01/16
Date: 2000-01-16T00:00:00+00:00	[thread overview]
Message-ID: <s843k8kveh6122@corp.supernews.com> (raw)
In-Reply-To: Pine.A41.3.96-heb-2.07.1000115195033.159474A-100000@pluto.mscc.huji.ac.il

Ehud Lamm wrote in message ...
>On Sat, 15 Jan 2000, Michael Garrett wrote:
>|What about an application like the Visual Basic IDE or Symantec's Visual
>|Cafe
>
>As a general direction this seems to me like a very worthy goal.
>
>I also like some of the speicifc ideas (like patterns, and componoent
>lib).



Many interesting ideas are implemented in the Oberon BlackBox
RAD environment. And their implementation is very well described
in the documentation.
Have a look at at http://www.oberon.ch/prod/BlackBox/

As far as component lib is concerned I think that a general purpose
communication class library (IO subsystem) which include all available
means of communications ( IPC, COMMs, sockets, set of available for
use protocols )  and which is very easy to use could be very
useful especially for control applications that consist of several
parts running separately.

I just finished such library for Named Pipes under Windows NT (now
only Sync Blocking Pipes) and going to implements mailslots,
memory mapped files, overlapped operations  ( depending on the
available time). There exists also nice serial IO package
that was posted here some time ago by someone (I do not
remember the author name and it was not mentioned in the
package info).

Below  is a small example of how simple could  be  use of
WinNT Named Pipes with such class library:

------------------------
-- Simple  Echo Server:
----------------------
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO;
use Ada.Strings.Unbounded.Text_IO;

procedure tst_Serv_Pipe is

   sPipe : Server_Sync_Pipe_Type;
   str : Unbounded_String;
begin
    Main_Server_Loop:
    loop
       Put_Line(To_Unbounded_String("Waiting for client connection...") );
       Open_Pipe(pipe =>sPipe);
       loop
         begin
            Read_Pipe(sPipe,str);
            Put(To_Unbounded_String("Client command > "));
            Put_Line(str);
            if (str="exit") or (str="exit1") or (str="exit2") then
               Write_Pipe(sPipe, str );
               exit Main_Server_Loop;
            end if;
            Write_Pipe(sPipe, str );
         exception
            when Pipe_Disconnected_Exception =>
                  Put_Line(Null_Unbounded_String);
                  Put_Line(To_Unbounded_String(" --
Pipe_Is_Broken_Exception --"));
                  exit;
           when others    => exit Main_Server_Loop;
         end;
       end loop;
    end loop Main_Server_Loop;
    Close_Pipe(sPipe);

end tst_Serv_Pipe;

-------------------------------------------------
-- Simple Client example:
--------------------------------------
with Win_IPC.Simple_Named_Pipes;
use Win_IPC.Simple_Named_Pipes;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO;
use Ada.Strings.Unbounded.Text_IO;

procedure tst_Client_Pipe is

sPipe : Client_Sync_Pipe_Type;
str : Unbounded_String;

begin

    Put(To_Unbounded_String("type server name -> "));
    str:=Get_Line;

    if str = "" then
       Open_Pipe(pipe => sPipe);
    else
       Open_Pipe(pipe => sPipe, Server_Name => To_String(str));
    end if;

   loop

        Put(To_Unbounded_String("Input_line  > "));
        str:=Get_Line;

       if str="quit" then
          exit;
        end if;

        Write_Pipe(sPipe,str);
        Read_Pipe(sPipe,str);
        Put_Line("Server echo : " & str);

        if    str="exit1" then
           Read_Pipe(sPipe,str);

        elsif  str="exit2" then
           Put(To_Unbounded_String("Type something  > "));
           str:=Get_Line;

           Write_Pipe(sPipe,str);

        elsif
           str="exit" then exit;

        end if;

    end loop;

    Close_Pipe(sPipe);

end tst_Client_Pipe;

---------------------------------------------
-- Another Pipe Client example
----------------------------------------------
 with Win_IPC.Simple_Named_Pipes;
use Win_IPC.Simple_Named_Pipes;
with Ada.Strings.Unbounded;
use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Text_IO;
use Ada.Strings.Unbounded.Text_IO;

procedure tst_Call_Pipe is

  In_Msg,
  Out_Msg : Unbounded_String;

  Server_Name : Unbounded_String;

begin
    Put(To_Unbounded_String("type server name -> "));
    Server_Name := Get_Line;

    if Server_Name = "" then
       Server_Name := To_Unbounded_String(".");
    end if;

    loop
        Put(To_Unbounded_String("Input_line      > "));
        In_Msg:=Get_Line;

        if In_Msg="quit" then
           exit;
        end if;

        Call_Pipe (
            Server_Name => To_String ( Server_Name ),
            In_Msg      => In_Msg,
            Out_Msg     => Out_Msg);

       Put_Line (To_Unbounded_String("Server Response : ") & Out_Msg );

    end loop;

end tst_Call_Pipe;


---------------------------------------------


Regards,
Vladimir Olensky








  reply	other threads:[~2000-01-16  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-15  0:00 Project: Free OS and Other Projects Continued Michael Garrett
2000-01-15  0:00 ` Ehud Lamm
2000-01-16  0:00   ` Vladimir Olensky [this message]
2000-01-18  0:00     ` Juergen Pfeifer
replies disabled

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