
| the COMAL Servlet |
Software components |
How to get the software |
Getting started |
the Sample Programs |
Students' COMAL |
This is one of the most exciting COMAL projects we have seen, and we are delighted to be able to offer it free to all UniCOMAL users, thanks to the generosity of the authors, P&D Software of Rotterdam. You can find out more about P&D in Dick Klingens' article on the Comalites Forum. This project will be updated from time to time as new facilities are developed and added.
Want to write programs to run in a Web Browser, but don't want the slavery of learning Perl or CGI or Java? Well, thanks to Pim and Dick Klingens (P&D Software) in Rotterdam, you can now write your scripts in UniCOMAL and have them executed by your browser!
Pim and Dick have developed a Java "Servlet" which accepts the output from a COMAL program and presents it as a Web page. Along with the servlet comes an UniCOMAL module, called "internet.mod", which provides facilities to allow the COMAL program to exchange data with the browser via the servlet. So you can export HTML commands, tags and so on from COMAL to a browser, and have the browser treat them as if they were HTML documents - in other words, you can run a COMAL program on the Web! Furthermore, you can set up a Web page to call a COMAL program and supply it with parameters so as to control what it does, from a FORM tag on the webpage. Best of all, the software needed is all in the public domain, so if you are already an UniCOMAL user, you can set themselves up to do it at minimal cost.
We have now tested the WebCOMAL package on various PCs ranging from 90MHz Pentium Classics up to 400MHz Celeron processors, and across two small Local Area Networks. The package runs very smoothly and responds quickly on them all, with only normal delays of a few seconds between posting data in the browser and the results being delivered back to it. During tests on an Intel P166 machine connected to 19 others on a school 10 Mbit network, there was a longish delay between clicking on the HTML link and the results from the COMAL program appearing. We don't yet know why the performance suffered so much on this network, and we will investigate this further. If you are running UniCOMAL V3.11 from inside MS-Windows 95 or 98, it is likely that you have most of the software components already available on your system. Here is a complete list:
First, you need to install the Java Development Kit JDK 1.2.2. The rest of this project assumes a default Java Installation, that is, the Java Runtime Environment (JRE) is installed to the folder C:\Program Files\Javasoft\jre\1.2\. We strongly recommend that you install JDK in this way, because, if your JAVA installation is different, you will have to change all the paths in the WebCOMAL package to point to where the JAVA components are, and this is tricky to do and prone to error.
Next, you need to unzip the WebCOMAL files to a WebCOMAL folder inside your C:\COMAL or C:\STCOMAL folder on your hard drive. Once again, the setup assumes a default UniCOMAL Developers' installation, so if you are using UniCOMAL Students', you will need to change some details in the startup file. More about that later. Full details on which files need to be copied to which folders on your system, are contained in the README.TXT file in the WebCOMAL03 distribution.
Third, you need to make sure that the MS-Windows Network components are installed on your PC, and that the TCP/IP network protocol is available. This is done by clicking Start > Settings > Control Panel > Network > Add > Protocol > Microsoft > TCP/IP. You will be asked to insert your MS-Windows distribution media.
Next, you need to run the file startcs.bat (from the WebCOMAL folder) so as to activate the Java Servlet which sets up the link between your browser and the UniCOMAL interpreter. After running this file, you should have a DOS window with the Servlet messages displayed in it, like this:
This Servlet runs, in the background, during the interaction of the Browser with COMAL. Messages relating to the running program, including any error messages, are displayed in this Servlet window.
Now you are ready to launch your browser by double-clicking on one of the example HTML files supplied with the system, such as WebCOMAL.HTML for example. When launched, each example HTML file contains a link which launches a UniCOMAL program from the browser. WebCOMAL03 comes with a small collection of sample programs illustrating some of the possibilities of the new system. Each COMAL program is called from an HTML script allowing the program to be launched from the browser. This table shows what they each do: The 'startcs.bat' file starts up the COMAL servlet. To do this it first assigns values for the path names to locate the Java Runtime Environment. Here is an example, for a standard JAVA system:
Once the proper paths to the JAVA side of the system are set up, the HTML files which call the COMAL programs must also point to the correct locations for the COMAL environment. For Students' COMAL, this will normally be C:\STCOMAL\. So, for example, in the test.html file, the proper code for use on a Students' COMAL system should be:
Suitable hardware platforms
What software components do you need?
How do you get hold of the components?
How to get started
C>SET JRE=C:\Progra~1\javasoft\jre\1.2
C>SET LIB=C:\Progra~1\javasoft\jre\1.2\lib
C>
C>SET CLASSPATH=.\java\classes;.\java\lib\jsdk.jar;C:\Progra~1\javasoft\jre\1.2\
lib\rt.jar;C:\Progra~1\javasoft\jre\1.2\lib\jaws.jar;C:\Progra~1\javasoft\jre\1.
2\lib\i18n.jar
C>
C>
C>C:\Progra~1\javasoft\jre\1.2\bin\java.exe -cp .\java\classes;.\java\lib\jsdk.j
ar;C:\Progra~1\javasoft\jre\1.2\lib\rt.jar;C:\Progra~1\javasoft\jre\1.2\lib\jaws
.jar;C:\Progra~1\javasoft\jre\1.2\lib\i18n.jar comal.ServletServer -d .\java\cla
sses -p 8080
servletrunner starting with settings:
port = 8080
backlog = 50
max handlers = 100
timeout = 5000
servlet dir = .\java\classes
document dir = .\examples
servlet propfile = .\java\classes\servlet.properties
The sample programs
HTML launcher
COMAL program
Comments
test.html
samplet.cml
Displays Servlet Host Details
webchain.html
sample.cml
sample2.cml
sample3.cml
sample4.cml
Displays Servlet details
Demonstrates CHAINing of COMAL programs
Shows loading of GIF images from COMAL
Text colour triangle from COMAL
webinput.html
sample5.cml
Multiplication Tables Program
Path names and Students' COMAL
SET JRE=C:\Progra~1\javasoft\jre\1.2
SET LIB=%JRE%\lib
SET CLASSPATH
=.\java\classes;.\java\lib\jsdk.jar;%LIB%\rt.jar;%LIB%\jaws.jar;
%LIB%\i18n.jar
rem # Run the Servlet
%JRE%\bin\java.exe -cp %CLASSPATH% comal.ServletServer -d .\java\classes -p 8080
a HREF =http://localhost:8080/servlet/comal.ComalServlet?COMAL_EXE=
c:\stcomal\comal.exe&COMAL_PRG=c:\stcomal\samplet.cml
Updated 27 March 2000