Hughes Technologies Pty Ltd.
Fast Access Network Pty Ltd.
Since the acceptance of HTML by the Internet community, the main focus of people's attention has been the use of HTML in conjunction with HTTP as a document delivery mechanism. That is not such a great surprise when the origins of the WWW project are taken into account. Much less focus, however, has been given to a facet of HTML and the WWW in general that has the potential to revolutionise large scale application delivery. With a bit of imagination, HTML can easily be viewed as a platform independent, distributed, GUI language available to millions of users around the globe.
This paper looks at HTML in this light and focuses on a package called W3-mSQL, the WWW to Mini SQL interface package. The design and implementation of W3-mSQL will be covered in detail. Examples of the use of this package to provide platform independent applications in a commercial environment will also be given.
Delivery of locally developed applications to the desktop has been a problematic task since the invention of the GUI. The mere fact that people have a personal preference about the type of machine they use can be seen as the root of this problem. In virtually any network environment there will be a mixture of various types of machines, from multiple vendors, providing GUIs (but not the same GUI), to the end user. The simple scenario of one department using Windows based PCs while another uses Macintoshes instantly causes a problem for delivery of custom applications.
A time-honoured approach to this problem has been to create text based applications running on a central machine. Each user on the network has access to the machine via a direct connection or via telnet and as such has access to the application. Although this approach works, any advantage of having GUI capable machines on the desktop has been lost. It also gets a little hard to justify the purchase of those 50 Windows 95 machines you just bought when ASCII terminals would have done the job!
Wouldn't it be nice if there was a standard way of defining and presenting graphical interfaces? Many companies have tried to ease our collective pain by offering GUI translation libraries. Packages are available that provide Motif API calls to Windows, Windows API calls to Macs, and Mac API calls to X. At the end of the day you certainly can provide a multi-platform GUI application using these tools but it's not a simple task and your software ends up being a little schizophrenic.
Surely someone could design a simple, platform independent layout system that would allow you to provide GUI applications to all your clients over the network....... Enter HTML.
If viewed at its most basic level, GUI design and implementation is the art of placing GUI elements at predetermined locations on the screen and letting the user interact with them. Once the interaction is complete, the application can gather the information contained in the GUI elements (e.g. text entry widgets) and manipulate the data in some way. Surely we can do that with HTML.
It becomes obvious very quickly that HTML doesn't provide you with the power or flexibility of a GUI environment such as Motif, but by simply using HTML tables and the standard HTML forms elements you can achieve great results. CGI scripts can then be used to extract and manipulate the user's data.
As we all know, this approach has been in use for a long time and although it can be effective it does have its drawbacks.
A major concern with the CGI script approach is that every data entry page must be accompanied by a CGI script that knows how to handle the user's data. Frequent use of this approach can result in hundreds of tiny CGI scripts being written and installed in the cgi-bin directory of your web server. It is apparent that virtually every script performs the same tasks: acquire the user's data from the form elements, process the data, generate an HTML response page. It became obvious that this entire process could be stream-lined if it was viewed from another angle.
The Other Angle...
W3-mSQL was originally designed to provide an easy to use interface between WWW pages and Mini SQL databases. The original concept was to develop a single CGI program that understood a set of new HTML tags embedded within an HTML page that provided some level of programmatic control. The main function of these new tags was to provide simple access to external data and to allow manipulation of the data once it had been acquired. The W3-mSQL CGI code would parse and execute the extensions contained within the HTML file and replace them with valid HTML generated by the operations.
W3-mSQL 1.0 was released in September 1995 and several small applications were developed using the system. It is fair to say that the software was very limited in its functionality and as such version 1.1 was never released. Development of the second generation W3-mSQL package started not long after the release of 1.0. The goal for W3-mSQL 2.0 was to provide a complete scripting language, with access to the entire mSQL API, within an HTML tag. That development has been completed and Beta versions of W3-mSQL 2.0 are now available and in use.
The language implemented by the new W3-mSQL is based on the ESL scripting language. ESL is an embedded language originally developed for the Minerva network management environment. The syntax and functionality offered by the W3-mSQL language is a completely new implementation of a cut-down version of ESL. The syntax mimics that of C in many ways but it also offers many shell-like conveniences such as automatic memory management and simplified type handling.
The parser has been designed to look for fragments of the script enclosed between
tags within an HTML page. Any text found within these special tags is parsed and interpreted as script code. Any text outside the tags, and any output generated by the script code, is passed to the client browser.
A simple W3-mSQL enhanced page is shown below in figure 2.
Figure 2 - "Hello World" W3-mSQL style
Scripts can contain a mixture of the programmatic controls we expect from programming languages including conditionals, looping, arithmetic, and access to external function libraries (called modules). There are currently two modules delivered with W3-mSQL: the standard library module and the mSQL module. The standard module includes access to roughly 50 functions providing file IO, string manipulation and various other features. The mSQL module provides access to the complete mSQL API.
The module interface allows any C library to be made available to W3-mSQL scripts. It is the responsibility of the module code to accept a W3-mSQL parameter list, extract the parameters, call the target function, and return the result. Figure 3 below illustrates the ease with which a module function can be written.
path = expandText(params->sym->val)
res = unlink(path);
if (res < 0)
externReturn = createIntSymbol(res);
Figure 3 - W3-mSQL's unlink() function
As the need arises, further modules will be added to W3-mSQL. An SNMP module (originally written for ESL) could easily be adapted for W3-mSQL if there's a need for SNMP polling directly from a WWW page. In a future release of W3-mSQL, dynamic modules will be supported so that end-users can add locally written modules to the language.
An interesting feature of the language is the way in which data types are handled. The language is semi-typed; that is, a variable is assigned a type based on the first value assigned to it. However, the typ