Hans Lunsing wrote:
I commented out iso.pas, because it gave errors:
iso.pas: In function `program_Iso': iso.pas:13: parse error before `Operator' iso.pas:13: comma missing after identifier `Uses' iso.pas:13: parse error before `Shl' iso.pas:13: comma missing after identifier `Uses' iso.pas:13: parse error before `;' iso.pas:14: comma missing after identifier `Uses' iso.pas:14: pointer domain type undefined iso.pas:14: parse error before `Uses' iso.pas:14: comma missing after identifier `Uses' iso.pas:14: parse error before `Value' iso.pas:14: comma missing after identifier `Uses' iso.pas:14: parse error before `Absolute' iso.pas:21: comma missing after identifier `Uses' iso.pas:21: parse error before `(' iso.pas:21: comma missing after identifier `Uses' iso.pas:21: parse error before `Operator' iso.pas:21: extra comma following id_list
This file seems to be in the wrong directory. It must not be compiled with --borland-pascal, but with --extended-pascal.
That was not the case in GPC for Cygwin32 b17.1. Harakiri.pas in = test\misc gave errors as well:
harakiri.pas: In function `Paramstr': harakiri.pas:40: condition must be of Boolean type
This message is correct. The test program declares some obsolete external functions (now built-in), and it even does it twice (???) and wrong (it tries to use an integer as a boolean -- wrong language ;-). If GPC didn't complain before, that was a bug. Removing all the ParamCount and ParamStr declarations (C, external and Pascal) gets rid of this error.
harakiri.pas: In function `Atoi': harakiri.pas:54: warning: cast to type of different size harakiri.pas:54: invalid lvalue in address expression
Another bug in the test file. It tries to round a real number by "casting" it into an integer which is AFAIK wrong. Replace "integer" by "round" in this line, and the program works. (Of course, one could also get rid of atoi altogether, and use ReadStr instead...) Oh yes, and getpid and kill should also be declared only once. -- Seems like this test suite really is outdated...
Well, here's the corrected program, just in case anyone cares:
(* Commit suicide with a signal of your choice *) program Harakiri(output);
(* I assume these are in your C library: * pid_t getpid(void); * int kill(pid_t pid, int sig); * and pid_t is really int *)
{$X+}
type pid_t = integer;
(* We really should get some standard libraries <sigh> *)
function getpid: pid_t; C; function kill(pid: pid_t; sig: integer): integer; C;
var signal: Integer;
begin if (ParamCount < 1) then writeln('Usage: ', ParamStr(0), ' [signal number]') else begin ReadStr (ParamStr(1), signal); kill(getpid, signal); end end.