Hi,
I need (want!) to initialize variant records. I have created a small
example - doesn't compile of course because I can't find how to do it. I
guess GPC can do it since VS_Pascal (IBM/MVS), VAXPascal and SPARCPascal all
allow me to do it (all in different ways of course!).
Anyone?
Cheers, Martin.
program varaint_test( input , output ) ;
type
variant_record =
record
case boolean of
false : (
compare : integer( 32 )
) ;
…
[View More] true : (
case boolean of
false : (
page ,
offset : integer( 16 )
) ;
true : (
len ,
disp : integer( 16 )
) ;
) ;
end ;
var
mgcd : variant_record := ( compare : 12345 ) ; (* How can I do this? *)
begin
writeln( 'ok' ) ;
end.
[View Less]
Having got 20011123 to compile, I found three differences in the
compiler from our previous gpc version 20010604. It objected in two
different units to code using a GOTO with the error message:
" Label '1' used before containing binding contour'.
The code looks correct and compiles and executes properly with the
previous version. Is this a known problem as it looks as though it
should be fairly easy to produce a test case if required. However the
problem is easily worked around.
Secondly …
[View More]it picked up a number of occurrences of incorrect code of the
form St[9]:=Chr(65)+Random(26) that had been accepted by the previous
version; so that is progress.
My main problem is that the packing of records appears to have changed.
For instance a record of the form
TCompR=Packed Record
AName:String(49);
AClass:1..40;
Awel:Set of 1..120;
RLate,RTime:Integer;
End;
has the same size as previously (as reported by sizeof) but when using
this record to read from a file written by code compiled with our
previous version of the compiler gives nonsense values for AClass and
Awel. I can work around this particular problem by changing the
definition of AClass to Byte but sadly our code has a great many packed
records (because it was originally written a long time ago when storage
was more precious) but making all the files backwards compatible is not
going to be trivial. So two questions:
Is there any switch that will restore the previous packing behaviour?
Assuming there is not, could someone explain in more detail what has
changed and what are the rules governing packing so that I can work out
how to redefine each of the affected records.
--
Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
Cramlington, Northumberland, England, NE23 6EW.
Phone: 01670-712624. Fax: 01670-717324.
Web site: <http://www.tynecomp.co.uk>.
[View Less]
I've created a 68k cross gpc (from gpc20010623). I fairly quickly found that
I needed RTS set functions such as_p_set_equal and haven't found them
anywhere. Can anybody point me to them, or check over the stubs that I've
come up with (which appear to work for sets with fewer than 32 members)?
I'm paricularly unhappy with the p_set_equal which seems to get called with
one pointer being NULL if one is testing against the empty set.
/* $Id$ */
#include <assert.h>
/*--------------------…
[View More]----------------------------------------------------
*
*-------------------------------------------------------------------------
*/
typedef int SET_WORD;
_p_set_equal(SET_WORD *s1, int s1z, int s1Size,
SET_WORD *s2, int s2z, int s2Size)
{
if (s2 == (SET_WORD*)0)
return *s1 == 0;
if (s1 == (SET_WORD*)0)
return *s2 == 0;
return *s1 == *s2;
}
_p_set_copy(SET_WORD *s, int sz, int sSize,
SET_WORD *d, int dz, int dSize)
{
assert(d && s);
*d = *s;
}
_p_set_union(SET_WORD *s1, int s1z, int s1Size,
SET_WORD *s2, int s2z, int s2Size,
SET_WORD *d, int dz, int dSize) // [A] + [B]
{
*d = *s1 | *s2;
}
_p_set_intersection(SET_WORD *s1, int s1z, int s1Size,
SET_WORD *s2, int s2z, int s2Size,
SET_WORD *d, int dz, int dSize) // [A] * [B]
{
assert(d && s1 && s2);
*d = *s1 & *s2;
}
_p_set_diff(SET_WORD *s1, int s1z, int s1Size,
SET_WORD *s2, int s2z, int s2Size,
SET_WORD *d, int dz, int dSize) // [s1] - [s2]
{
assert(d && s1 && s2);
*d = *s1 & ~*s2;
}
_p_set_in(SET_WORD *s, int sz, int sSize, int bit)
{
return ((1<<bit) & *s) != 0;
}
__setbits(SET_WORD* out, unsigned long bitlength, long startbit, long endbit)
{
assert(startbit == endbit);
*out = 1 << startbit;
}
/*
$Log$
*/
[View Less]
I am trying to build gpc-20011123 based on gcc-2.95.2 under Red Hat
Linux 7.2. I have done this before with earlier versions of gpc but on
this occasion configure is stopping when applying the patch to gcc with
the message:
"Missing header for unified diff at line 449 of patch.
The text leading up to this was
|--- expr.c.orig Sun Nov 18 00:05:40 2001
Any clues as what the problem is ?
--
Martin Liddle, Tynemouth Computer Services, 27 Garforth Close,
Cramlington, Northumberland, England, …
[View More]NE23 6EW.
Phone: 01670-712624. Fax: 01670-717324.
Web site: <http://www.tynecomp.co.uk>.
[View Less]
Pls advise if there is a way to make GPC accept a field name in a RECORD or
variable name and that field name or variable name is a reserved or key word
in GPC. I am porting software from SPARC SunOS (using SUN PASCAL compiler)
to INTEL Solaris 7 (using GPC). For example :
EXAMPLE A:
PROCEDURE Blkkut;
VAR
Trow, Tline_nbr, Tcnt :INTEGER;
Tptr :Parm_ptr;
Tmp_erlin :Er_typ;
View :BOOLEAN;
Repos :INTEGER;
BEGIN (* Blkkut *)
IF Slct_flg THEN
BEGIN
View := FALSE;
…
[View More]Blkcopy(View); <<< this is line 349; View is a GPC
reserved word.
IF NOT Spare_buffer_used THEN
I get the following errors during compile:
Shared_tpl/Mprocsrc/blockcmd.p: In procedure `Blkkut':
Shared_tpl/Mprocsrc/blockcmd.p:349: parse error before `View'
Shared_tpl/Mprocsrc/blockcmd.p:349: missing `)'
Shared_tpl/Mprocsrc/blockcmd.p:349: too few arguments to function `Blkcopy'
Shared_tpl/Mprocsrc/blockcmd.p:349: parse error before `)'
EXAMPLE B:
Sortmask_rec = PACKED RECORD
Bin_nbr :Int8;
Class :Class_typ; <<< line
226 Class is a GPC reserve word.
Any :BOOLEAN;
Display_ch :Displ_char;
Socket_quality_delta :INT16;
Test_Sum :INT16;
Test_List :PACKED ARRAY[1..Maximum_tests] of INT16;
END;
Error messages during compile.
In file included from Shared_tpl/Inc/tplmain.typ:38,
from Shared_tpl/Mprocsrc/blockcmd.p:67:
Dependent/Inc/misc.typ:226: parse error before `Class'
Dependent/Inc/misc.typ:226: extra semicolon
I am using gpc version 20010623, based on 2.95.2 19991024 (release) and I
use only -O and --no-mixed-comments options when calling gpc.
Thanks in advance for any assistance.
Jing Gloria
Texas Instruments
[View Less]