System.pas module_(re)
Sun, 20 Oct 1996 14:40:57 +0100 (MET)
Hello Berend, hello everybody!
The system.pas module triggers one bug in GPC concerning
String schemas as parameters:
> procedure GetDir(D: byte; var s: string);
declares a string schema without specified length as a formal
parameter. When trying to use it with an actual parameter
which must have a specified length, the compiler crashes.
To work around, always specify string length, e.g.
procedure GetDir(D: byte; var s: string255);
According to Berend de Boer:
> This program is free software; you can redistribute it and/or modify
> it under the terms of the GNU General Public License as published by
> the Free Software Foundation; either version 2 of the License, or
> (at your option) any later version.
Berend, you know that the normal GNU GPL implies that a program
linked with your module automatically becomes free software?
If you want to enable commercial use of your module, either state
explicitely that the above does *not* hold, or use the GNU LGPL
(GNU Library General Public License) instead of the normal GPL.
> type
> shortint = __byte__ integer;
> byte = __byte__ integer;
That's incompatible with Borland's definition of "byte".
They have
byte = __unsigned__ shortint;
Same holds for "word".
> TChar = array[0..MaxInt] of char;
> PChar = TChar;
> pointer = void;
It must be
PChar = ^TChar;
pointer = ^void;
with adaptions below when "PChar" is used.
On my machine, your module compiled (?!;), but "GetDir"
always returned empty strings for this reason.
> string255= string(255);
>
> var
> {?ExitProc: Pointer; { Exit procedure }
Can be implemented using "to end do" and GPC's pointers to procedures.
> export
> System = (shortint, byte, word, longint, PChar, pointer, string255,
> HeapError, ExitCode, PrefixSeg,
> Assign, BPChDir => ChDir, Close, Copy, Dec, Delete, Erase,
> GetDir, GetMem,
> Inc, IOResult,
> MaxAvail, MemAvail, BPMkDir => MkDir,
> ParamCount, ParamStr,
> BPRename => Rename, BPRmDir => RmDir,
> UpCase);
"Inc", "dec", "GetMem" are in GPC (and couldn't be implemented in a
module anyway) - and there is no implementation of them in the body.
Yours,
Peter
e-mail: peter.gerwinski@uni-essen.de
home address: D\"usseldorfer Str. 35, 45145 Essen, Germany
WWW: http://agnes.dida.physik.uni-essen.de/~peter/
Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es