home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Vectronix 2
/
VECTRONIX2.iso
/
FILES_01
/
HISPEED2.LZH
/
UNITS
/
STPASCAL.DOC
< prev
next >
Wrap
Text File
|
1991-03-26
|
6KB
|
194 lines
HighSpeed Pascal
----------------
STPASCAL.DOC - information about the usage of the ST Pascal unit
1. Introduction
---------------
The ST Pascal unit (STPASCAL.UNI) implements a large set of constants,
variables, types, functions and procedures found in the ST Pascal
libraries PASLIB, PASGEM and PASTRIX. They are included in the HighSpeed
Pascal package for your benefit, so that you won't have to waste too
much time rewriting your ST Pascal applications for the HighSpeed Pascal.
We shall in the following show what a typical ST Pascal program rewrite
implies. For a complete listing of the unit's interface section, please
consult the on-line help.
NOTE : Although the greatest possible effort has been made to ensure
that the unit operates exactly as the original ST Pascal libraries, we
can not guarantee that all converted programs will behave exactly as
they do with the ST Pascal. If you are experiencing trouble, please
send us a note describing the problem - if possible with a listing too
- so that we can update the unit.
2. How to rewrite an ST Pascal program
--------------------------------------
In order to rewrite an ST Pascal program two steps have to be
performed:
1. Correcting strictly compiler related issues
2. Removing the $I files and incorporate the STPASCAL unit
2.1. Compiler related changes
-----------------------------
The steps are :
1. Rewrite Shl and Shr expressions :
An ST Pascal statement like this :
i := Shl(2,4)
must be rewritten like this :
i := 2 Shl 4
or into :
i := ST_Shl(2,4)
2. Rewrite all LOOP..END statements
3. Change compiler options where required; modules require quite a lot
of rewriting (splitting 'em up into INTERFACEs and IMPLEMENTATIONs
etc.)
4. See what you can do with the special directives BIOS, XBIOS, GEMDOS
etc... Quite a few of 'em can be found in other HighSpeed Pascal units
such as the DOS unit.
5. Change calls to IO_Check to the corresponding {$I+} and {$I-}
directives
6. The ST Pascal implements a file system based on the original Wirth
philosophy of PUTting and GETting - from a system programmer's view
a quite logical way, but a bit more tricky to deal with when it
comes to formatted output etc. Therefore, HighSpeed Pascal implements
the nowadays most commonly used method of READing and WRITEing. The
actual code rewrite to perform isn't very difficult; it merely
involves this : All references to a file pointer (say, f^) will have
to be changed into a variable holding the file pointer's value.
After that, all PUTs must be changed into WRITEs of the previously
mentioned variable and all GETs will have to be changed into the
corresponding READs :
ST Pascal : HighSpeed Pascal :
---------------------------------------------------
VAR f : FILE OF Integer; VAR f : FILE OF Integer;
i : Integer;
... ...
Rewrite(f, 'JUNK.TMP'); Rewrite(f, 'JUNK.TMP');
f^ := 1234; i := 1234;
Put(f); { write 1234 to file } Write(f, i { or 1234 } );
Reset(f); Reset(f);
WriteLn(f^); Read(f, i);
Get(f); WriteLn(i);
Close(f); Close(f);
Erase(f); { <-- note this --> } Erase('JUNK.TMP');
7. The ST Pascal ReadV and WriteV procedures do not exist as the Turbo
Pascal procedures Str and Val were inherited, so they require
rewriting too - but that's a really simple one :
ST Pascal : HighSpeed Pascal :
---------------------------------------------------
VAR s : String; VAR s : String;
r : Real; r : Real;
dummy : Integer;
BEGIN BEGIN
s := '123.45'; s := '123.45';
ReadV(s, r); Val(s, r, dummy);
r := 54.321; r := 54.321;
WriteV(s, r); Str(r, s);
To sum it up : Changing ReadV into Val and adding a dummy parameter
and changing WriteV into Str and swapping parameters.
6. Try to compile and fix whatever else you come across (shouldn't be
much, though)
2.2. Incorporating the STPASCAL unit
------------------------------------
First of all, you have to remove the following $Include directives (if
they exist) :
{$I GEMCONST}
{$I GEMTYPE}
{$I GEMSUBS}
{$I TRIXCONS}
{$I TRIXTYPE}
{$I TRIXSUBS}
Then, after the PROGRAM heading, you include the following line :
USES STPascal;
A final warning is in order : Not everything in PASTRIX is implemented,
so you'll perhaps need to declare a bit of things on your own.
As a final example, we give the "before" and "after" header of a
program :
Before :
--------
PROGRAM MyProg;
CONST
{$I GEMCONST}
MyConst = 0;
TYPE
{$I GEMTYPE}
MyType = (hello, good_bye);
{$I GEMSUBS}
PROCEDURE MyProc;
...
After :
-------
PROGRAM MyProg;
USES STPascal;
CONST
MyConst = 0;
TYPE
MyType = (hello, good_bye);
PROCEDURE MyProc;
...
3. Implementation notes
-------------------------
The following restrictions exist in the current implementation :
* IO_Result return codes don't correspond to those documented in the ST
Pascal manual as the original function, together with IO_Check, are
tightly interfaced with the ST Pascal runtime section. Instead,
IO_Result returns exactly the same error codes as the HighSpeed Pascal
IOResult.
* There is a limitation on the number of menus a program can have. In
total, 20 menus with 20 titles each are available. If you create more
of either, the program will abort.
3.1. New since version 1.0
--------------------------
Put_Screen, Get_Screen, Read_Screen, Write_Screen, ST_Shl, ST_Shr and
associated types, constants etc.