Home/Compilers/WebAda

WebAda Scripts

Overview | Scripts | Templates | Macros

  • file
  • lovelace
  • surfada
  • save_gnat_prefs

    <hr>
    Each WebAda script recognizes certain parameters to determine which action to take and then responds by macro expanding the appropriate HTML Template file. The scripts, their parameters, and logic cannot be altered by the WebAda user. However, the templates can be modified to significantly change the look and feel of WebAda.

    Of course, you have to know what parameters make sense to which scripts. Then you can begin to build your own templates, which call each other to form your own Graphical User Interface (GUI) to an Ada Development Environment (ADE).

    You can also use CGI parameters to change which HTML Template file is expanded. If there are several outcomes to an operation (such as saving a file), each outcome will have a different parameter name (such as Missing_Filename) which gives the name of the template to expand. See Template for details.

    <hr>
    There are some CGI-parameters which control the logic of WebAda scripts and provide parameters for WebAda operations. Examples of how these parameters are used can be found throughout WebAda template files and include forms, hidden-parameters, and macro-generated parameters.

    Warning: Some of these links show files that modify your WebAda interface when saved. Delete the file to revert back to the predefined interface:

    <hr>
    file?[action=(surf|compile|edit|ftp|save|delete)]{&file=filename}[&code=text] -- templates

    case is
      when None           =>;
      when action=Surf    => Surfada;
      when action=Compile => WebAda.Source_Code.Save; -- file=filename&code=text
        case WebAda.Source_Code.Save_Result is
          when NA | No_Code | File_Saved | File_Created =>
            WebAda.Source_Code.GNAT.Compile;
          when No_Filename           =>;
          when Unable_to_Open_File   =>;
          when Unable_to_Create_File =>;
          when Unable_to_Save_File   =>;
        end case;
      when action=Edit    => ;
      when action=FTP     => FTP; -- {file=filename}
      when action=Save    => WebAda.Source_Code.Save; -- file=filename&code=text
      when action=Delete  => WebAda.Source_Code.Delete; -- file=filename
    end case;
     
    -- new_file.html expands a file of Ada code and illustrates one way to
    --   use the file script. Expand the template and use your browser's
    --   View Source to see the expanded HTML.

    <hr>
    lovelace?file=filename[&code=text][&verbose=on][&krunch=nnn][&configure=on][&save_prefs][&option=(SAVE|COMPILE|EDIT|SURF|CONFIGURE)] -- templates

    convert verbose=on to option=l;
    convert krunch=nnn to option=knnn;
     
    if configure then  WebAda.Source_Code.Save; -- file=filename[&code=text]
    else
      if save_prefs then
        WebAda.Lovelace.Save_Preferences; -- option=(SAVE|COMPILE|EDIT|SURF|CONFIGURE)
      end if;
      if file then
        case is
          when NA        => ;
          when Save      => File&action=save;
          when Compile   => File&action=compile;
          when Edit      => File&action=edit;
          when Surf      => File&action=surf;
          when Configure => WebAda.Source_Code.Save; -- file=filename[&code=text]
        end case;
      end if;
    end if;
    -- Lovelace uses this script to interface to WebAda. The first example
    --   is Lesson 1's simple program. View source to see how Lovelace uses
    --   WebAda's lovelace script.
    -- lovelace_options.html illustrates how lovelace options can be presented
    --   in a form. View source of the expanded page to see the results.

    <hr>
    surfada?file=(filename)[&code=text] -- templates

    WebAda.Source_Code.Save;
    -- surfada.html expands a file of Ada code and illustrates one way to
    --   use surfada. Notice how many of the links on this page use surfada
    --   to display Ada source code for the CGI scripts. View source to see
    --   how surfada adds links to the Ada source code.

    <hr>
    save_gnat_prefs[?gnat_option=option{&gnat_option=name}] -- templates

    WebAda.Source_Code.GNAT.Save_Preferences;
    -- gnat_options.html expands the options and illustrates one way
    --   to submit options to save_gnat_prefs.
    -- http://sw-eng.falls-church.va.us/cgi-bin/webada/file?template=gnat_options.html
    --   will expand the template. View source to see how the macros expanded.
    -- Note: calling save_gnat_prefs without gnat_option parameters deselects
    --       all preferences.