OK then, what I suggested might be suitable. All you would need is to redefine some of your type and record definitions, a bit. You wouldn't need to touch the "code proper", and the same source code could run on your older platforms too.
Eg. perhaps as follows :
type INT0_255 = packed 0..255;
BITS = (BIT0,BIT1,BIT2,BIT3, BIT4,BIT5,BIT6,BIT7, BIT8,BIT9,BIT10,BIT11, BIT12,BIT13,BIT14,BIT15, BIT16,BIT17,BIT18,BIT19, BIT20,BIT21,BIT22,BIT23, BIT24,BIT25,BIT26,BIT27, BIT28,BIT29,BIT30,BIT31);
var VARIABLE1 : record case shortint of 0: (DUMMY0, AWORD: shortint); 1: (DUMMY1: shortint; MSB, LSB: INT0_255); 2: (BT : BITS); end;
Of course, DUMMY0/DUMMY1/BIT16..BIT31 would be just wasted memory, but you say that's not an issue ... You could even have some "conditional defines" to exclude them on other platforms, if required. :-)
BTW, I have no idea which way the (set) bits and (16 bit) words are aligned within 32 bit words, for your intended platform(s), but I'm sure you can figure that out anyway.
Joe.
-----Original Message----- From: Sven Jauring [SMTP:sven.jauring@hiq.se] Sent: Monday, August 06, 2001 10:02 PM To: da Silva, Joe Subject: Re: [Fwd: 16 bit sets?]
Hi Joe
Memory waste is no issue, but original code stability is. That is, I need to keep the original code as unmodified as possible.
We are actually looking at how much work it would be to add the "set size" functionality in GPC! I would appretiate any thoghts/advice on this subject from anyone!
/sven
"da Silva, Joe" wrote:
Just an idea ... if memory (waste) isn't an issue, and if you can't (currently) get 16 bits sets with GPC, how about making everything 32 bit instead?
Joe.
-----Original Message----- From: Sven Jauring [SMTP:sven.jauring@hiq.se] Sent: Friday, August 03, 2001 9:22 PM To: Russell Whitaker Cc: gpc@gnu.de Subject: Re: [Fwd: 16 bit sets?]
Hi Russel Thanks for your help, but unfortunatly the pascal code that I'm trying
to
compile actually deals specifically with sets. (E.g. Variable1.BT := Variable1.BT - [BIT4] + [BIT2]; and so forth...)
Best Regards Sven Jauring
Russell Whitaker wrote:
On Fri, 3 Aug 2001, Sven Jauring wrote:
Hi again!
I need to be able to specify not only 16 bit sizes but also 8 bit
and
4
bit sizes as well. Is there anyone out there that could give me a hint of HOW to
implement
the functionality in GPC
Patched your program a little. It *might* be what you're looking
for.
type INT0_255 = packed 0..255;
{ BITS = (BIT0,BIT1,BIT2,BIT3, BIT4,BIT5,BIT6,BIT7, BIT8,BIT9,BIT10,BIT11, BIT12,BIT13,BIT14,BIT15); }
bitarray = packed array [ 0..15 ] of integer ( 1 );
var VARIABLE1 : record case shortint of 0: (AWORD: shortint); 1: (MSB: INT0_255; LSB: INT0_255); 2: (BT : bitarray ); end;
begin writeln( sizeof (VARIABLE1)); end.
prints 2 (bytes)
Hopes this helps Russ << File: Card for Sven Jauring >> << File: Card for Sven
Jauring >>