comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 )
Subject: Re: Re: "limitations" of conditional compilation
Date: 14 Dec 89 20:56:29 GMT	[thread overview]
Message-ID: <7448@hubcap.clemson.edu> (raw)
In-Reply-To: 920015@hpcladb.HP.COM

From article <920015@hpcladb.HP.COM>, by defaria@hpcladb.HP.COM (Andy DeFaria):
> I'm developing such a binding as we speak.  One problem that I have, and
> haven't been able to workaround, is that of different representation clauses.
> This OS binding is designed to be portable to multiple architectures.  The
> data alignment of the different machines are different so I need to:
> 
%          Machine 1                                Machine 2
% ----------------------------------   ----------------------------------------
% for RECORD_1 use                     for RECORD_1 use
%    record                               record
%       FIELD_1 at 0 range 0 .. 15;          FIELD_1 at 0 range 0 .. 15;
%       FIELD_2 at 2 range 0 .. 15;          FIELD_2 at 4 range 0 .. 15;
%       ...                                  ...
%    end record;                          end record;
> 
> As you can see Machine 2 need to be aligned at the 4 byte boundary.  Since the
> interface code I am going to is C (Unix system calls) I'm stuck the these
> record layouts and alignments.  I have thought using some sort of constant to
> determine where the next alignment would be but it would make the coding of
> the for clause exceeding difficult.  

   Hmmm... how about:

      ALIGNMENT_LENGTH : constant := 2;   -- or 4, or whatever...

      for RECORD_1 use
         record
            FIELD_1 at 0 * ALIGNMENT_LENGTH range 0..15;
            FIELD_2 at 1 * ALIGNMENT_LENGTH range 0..15;
            ...
         end record;

   The general form of the "at" expression seems to qualify as a
   static_simple_expression (by 4.9.7 & 4.4.2, plus a similar 
   example is given in 13.4.9), and the coding of the for clause 
   would seem to be relatively straightforward.


   Bill Wolfe, wtwolfe@hubcap.clemson.edu
 

  reply	other threads:[~1989-12-14 20:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-12-11  2:02 limitations on optimizers for conditional compilation Emery
1989-12-11 15:58 ` "limitations" of " William Thomas Wolfe, 2847 
1989-12-12 21:10   `  Sun Visualization Products
1989-12-13 17:33   ` Andy DeFaria
1989-12-14 20:56     ` William Thomas Wolfe, 2847  [this message]
1989-12-15 20:05   ` Andy DeFaria
1989-12-11 20:10 ` limitations on optimizers for " Robert Munck
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox