[fpc-pascal] pc -> fpc porting question: reset()

Daniel Franke daniel.franke at imbs.uni-luebeck.de
Mon Apr 17 15:24:03 CEST 2006

Hi all.

I'm a pascal noob who was given the task to compile a couple of ancient pascal 
files, originally written for "Sun Pascal pc compiler". 

Since I don't know anything about pascal, fpc's error messages gave me sort of 
a headache. Nevertheless, I'm almost there - but not quite. i still get loads 
of these:

-- fpc error messages (begin) --
ilink51.p(6065,32) Error: Incompatible type for arg no. 2: Got "ShortString", 
expected "LongInt"
ilink51.p(6066,32) Error: Incompatible type for arg no. 2: Got "ShortString", 
expected "LongInt"
-- fpc error messages (end) --

These messages are always related to calls to reset:
-- ilink51.p (begin) --
6065:  reset(ipedfile,'ipedfile.dat');
6066:  reset(datafile,'datafile.dat');
-- ilink51.p (end) --
[ipedfile/datafile are of type "text"]

The fpc language manual (sec 28.9.442, p. 1109) describes reset as: 
-- rtl.pdf (begin) --
Synopsis: Open file for reading
Declaration: procedure    Reset(var f: File;l: LongInt)
             procedure    Reset(var  f: File)
             procedure    Reset(var  f: TypedFile)
             procedure    Reset(var  t: Text)
-- rtl.pdf (end) --

whereas the SUN pascal reference has:
-- docs.sun.com [1] (begin) --
    Pascal supports an optional second argument to the reset procedure. 
    This argument gives an operating system file name. 
    reset(file, filename)

    file is a variable having the text or file data type. 
    filename is a fixed- or variable-length string, or a string constant.
-- docs.sun.com [1] (end) --

My assumption: to compile these files using fpc, I have to change any call to 
reset, most likely by adding another function call afterwards.
My question: which function would that be? How to accomplish with fpc what is 
done by Sun's compiler/libraries?!

With kind regards

[1] http://docs.sun.com/app/docs/doc/801-5055/6hvhckkgl?l=fr&a=view

More information about the fpc-pascal mailing list