Object-Oriented Software in Ada95

Additional material not in the book

  • A wysiwg text editor
  • Text archiver
  • CGI programs

  • Index A wysiwg text editor

    The following is an example of a simple wysiwyg text editor written in Ada. The editor commands are:

  • ^A :: Open file
  • ^B :: Close file
  • ^F :: Set file name
  • ^G :: Go to the next screen
  • ^H :: Delete character left
  • ^K :: Move down
  • ^L :: Move left
  • ^E :: Exit & quit the editor
  • ^R :: Move right
  • ^U :: Move up
  • ^T :: Trace info (Debug)
  • ^W :: Rack up a page
  • ^X :: Rack down a page
  • ^Y :: Refresh the display
  • Arrow keys move the current position marker
  • Characters typed are inserted at the current position
  • del :: Delete the current character
  • The text Editor


    Index A Text Archiver / De-archiver

    The format of the source text archive is:

    @@ mas1.ada @@
    +WITH Ada.Text_io;
    +USE  Ada.Text_io;
    +PROCEDURE main IS
    +BEGIN
    +  put("Hello world"); new_line;
    +END main;
    @@ mas2.ada @@
    +WITH Ada.Text_io;
    +USE  Ada.Text_io;
    +PROCEDURE main IS
    +BEGIN
    +  put("Another program"); new_line;
    +END main;
    

    Archiver

    The archive is created by the program:

    De-archiver

    The files are extracted from the archive by the program:

    The line @@ mas1.ada @@ specifies the file to which the following text is to be written to. Each line of extracted text has a + as its first character which is removed before the line is written to the file.

    The source code held in this archive format for the all the programs used in this book, is available using anonymous FTP at the URL address ftp://ftp.brighton.ac.uk/pub/mas/ada95 . Alternatively the files are accessed using the WWW URL http://www.brighton.ac.uk/ada95/programs/home.htm


    Index CGI programs

    See A quick introduction to HTML for details about writing WWW pages in HTML.

    Pages on the World Wide Web are written using the HTML markup language. The markup tags control in part the format of the displayed information that a browser of the page will see.

    Normally the web page displayed will simply contain information which the reader of the page will view. However, it is possible to let the viewer return information to a server for processing. For example, to search for information on a particular topic. The input that the viewer returns is sent to a server which invokes a CGI (Common Gateway Interface) script to process the transaction. After processing the CGI script returns a web page constructed using HTML which will be displayed to the viewer.

    On the server the environment variable QUERY_STRING contains the data sent. The CGI script can then extract this information from the environment variable and construct a suitable web page as a reply.

    A program in Ada 95 to dynamically create a web page that contains the contents of the environment variable QUERY_STRING is cgi_qs.ada.

    A program to decode the data held in the environment variable QUERY_STRING is described in CGI parse program


    © M.A.Smith University of Brighton. Created September 1995 last modified February 1997.
    Comments, suggestions, etc. M.A.Smith@brighton.ac.uk * [Home page]