Browse Prior Art Database

Design Methodology for Common Gateway Interface Applications

IP.com Disclosure Number: IPCOM000117892D
Original Publication Date: 1996-Jul-01
Included in the Prior Art Database: 2005-Mar-31
Document File: 4 page(s) / 115K

Publishing Venue

IBM

Related People

Alvarez, AE: AUTHOR

Abstract

Disclosed is a methodology for building Common Gateway Interface (CGI) applications. This complete construction methodology will allow for simple management and expansion of arbitrarily complex "forms" programs, including the use of menus and sub-menus. This methodology also naturally lends itself to implementation in a CGI CASE tool product.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 47% of the total text.

Design Methodology for Common Gateway Interface Applications

      Disclosed is a methodology for building Common Gateway
Interface (CGI) applications.  This complete construction methodology
will allow for simple management and expansion of arbitrarily complex
"forms" programs, including the use of menus and sub-menus.  This
methodology also naturally lends itself to implementation in a CGI
CASE tool product.

      As a precursor to describing the overall control flow, a
convenient structure is described which can be used as a template for
all "forms" used in a program:
    typedef struct {
    char        *title;
    const       myformnumber;
    int         error;
    int         (*func)(); } FORM, *pFORM;
  and a second structure which can be used in overall control flow:
    typedef struct {
    char *title;
    int currentform;
    int nextform;
    int debuglevel; } STATE, *pSTATE;

Finally, a user data structure is also defined, and modified
according to the needs of each application:
    typedef struct {
    char *string;
    char *name;
    char *building;
    int value; } DATA, *pDATA;

      The FORM structure contains an essential element - a pointer to
a function which actually prints the form on the screen.  By using a
standard set of parameters for all functions which do that, for
example:
  int func1(pFORM, pSTATE, pDATA); int func2(pFORM, pSTATE, pDATA);
   int func3(pFORM, pSTATE, pDATA);
  the stage is set for using a control loop, described below, which
though very simple, still allows an arbitrarily complex series of
forms to be presented to the user.

The typical function in this scheme is laid out as:
  int func1(pFORM f, pSTATE s, pDATA d) {
    if(s->currentform != f->myformnumber)
         return(FALSE);  // only execute if it's your turn
    s->nextform = 20;
  /*
  code here
  */
    if(error condition){
         f->error = 110;
         nextform = 10;
         return(TRUE);
         }
  /*
  more code here
  */
  return(TRUE); }

      Probably the most convenient aspect of this design for a
"forms" application is the control loop which can be used if all
functions which describe a form have a uniform parameter interface.
The following control loop would, with the previous function
definitions, allow for arbitrarily complex sequences of forms.
Recall that this is a re-entrant program, and that CGI data will be
passed to the program on startup taken from the program when it exits
as "hidden" data on each execution.  Data handling will be discussed
a bit below, but note here that on a pass through the program, the
execution of a single function/form will provide data on which
function/form will be executed on the next pass.  The following is a
diagram of an initialized "Form" table and the overall control loop.
  #define SZ(a)           ((sizeof(a))...