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

Michael Van Canneyt michael at freepascal.org
Mon Apr 17 15:44:51 CEST 2006



On Mon, 17 Apr 2006, Daniel Franke wrote:

> 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) --
> reset
>     Pascal supports an optional second argument to the reset procedure.
>     This argument gives an operating system file name.
> Syntax
>     reset(file, filename)
>
> Arguments
>     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?!

> 6065:  reset(ipedfile,'ipedfile.dat');
> 6066:  reset(datafile,'datafile.dat');

Would become:

Assign(ipedfile,'ipedfile.dat')
Reset(ipedfile);

Assign(datafile,'datafile.dat');
Reset(datafile);

Michael.




More information about the fpc-pascal mailing list