I am currently converting an OpenVMS DEC-PASCAL model into GPC (v.19991030 based on 2.95.2 19991024) on a LINUX PC.
Part of this task is to, where ever possible, maintain a common source between the two systems. The model initialises many variables using the DEC-PASCAL function "ZERO", is there an equivalent within GPC that works with any variable, or record, type.
VAR i : INTEGER; r : REAL; d : ARRAY[1..5] OF DOUBLE;
BEGIN i := zero; r := zero; d := zero; END.
I've searched the documentation but cannot find anything, the closest I've come is to pass an untyped parameter and its size to a function, then use pointers to set the memory to zero (0x00). This works OK for GPC, but DEC-PASCAL doesn't seem to like untyped parameters.
Any help would be appreciated, as would any comments from people who have undertaken a similar task.
Thanks, in advance
Lee.
Wren Lee wrote:
i := zero; r := zero; d := zero;
GPC does not have such an "untyped zero". You have to use instead:
i := 0; r := 0; (* or: r := 0.0 *) d := '';
In principle, it would be possible to implement such a thing, but we are not going to assign a high priority to it right now. In fact we are close to a "feature freeze" for gpc-2.1.
And in fact it should not be that difficult to implement such a thing. If you want to try yourself on it, be welcome. :)
I've searched the documentation but cannot find anything, the closest I've come is to pass an untyped parameter and its size to a function, then use pointers to set the memory to zero (0x00). This works OK for GPC, but DEC-PASCAL doesn't seem to like untyped parameters.
It does not work okay for GPC since zeroing the memory of a string or schema or file will spoil its data integrity.
Hope this helps,
Peter