Contents | Prev | Next | Index
Canterbury Pascal for JVM can be easily called from a simple command prompt. For example, in order to compile and execute the Slides.pas sample on a Windows system, just open a DOS-prompt and enter the following commands (shown here in red color):
C:\com.mhccorp\mhc\pas\samples\slides>java mhc.compiler.pas Slides -m -r Pascal 3.0.xx (c) 1999-2004 J.Neuhoff (www.mhccorp.com) Unlicenced time-limited evaluation version Compiling interface: C:\com.mhccorp\mhc\compiler\runtime\pas\SYSTEM.pas Importing Java class: java.lang.RuntimeException Importing Java class: java.io.InputStreamReader Importing Java class: java.io.OutputStreamWriter Importing Java class: java.lang.Exception Importing Java class: java.applet.Applet Importing Java class: java.lang.Runnable Importing Java class: java.lang.Thread Importing Java class: java.awt.Image Importing Java class: java.awt.Graphics Importing Java class: java.awt.Event Importing Java class: java.lang.RuntimeException Compiling interface: Slides.pas Importing Java class: java.lang.String Compiling implementation: Slides.pas Compilation done: Slides.pas C:\com.mhccorp\mhc\pas\samples\slides>appletviewer Slides.html C:\com.mhccorp\mhc\pas\samples\slides>
As can be seen, the command
java mhc.compiler.pas Slides -m -r
causes the file Slides.pas to be compiled into various *.class files:
Slides.class
Slides_ClickAnimation_init_Frame.class
Slides_ClickAnimation.class
SYSTEM.class
SYSTEM_*.class
The -m switch tells the compiler also to recompile other imported Pascal unit files if they are updated. This is like a Make-utility for Pascal files integrated into the Pascal compiler.
The -r switch causes the compiler to write the SYSTEM*.class runtime classes into the current working directory, this switch should be used when compiling Java applets, otherwise the runtime classes will go into the "mhc\compiler\runtime\pas" directory. The latter may be unaccessable from a Web browser environment.
Unit Slides.pas has a Pascal class type called ClickAnimation extending the imported class java.applet.Applet. It also overrides some inherited methods. In order to run ClickAnimation, an applet-tag has to be declared in a HTML-document. In this case, file Slides.html has an applet-tag (highlighted in green) as follows:
Slides.html <HTML> <HEAD> <TITLE>A simple click animation applet</TITLE> </HEAD> <BODY> <P> <APPLET CODE="Slides_ClickAnimation.class" CODEBASE=. NAME="A simple click animation applet" WIDTH="170" HEIGHT="170"> </APPLET> </BODY> </HTML>
Calling this file using the JDK or Java-2 SDK appletviewer utility:
appletviewer Slides.html
will launch the Slides_ClickAnimation.class.
Contents | Prev | Next | Index
Canterbury Pascal for JVM (Last documentation update
Sep 02, 2004)
Copyright © 1999-2004 J.Neuhoff - mhccorp.com
. All rights reserved.
Please send any comments or corrections to
neuhoff@mhccorp.com