From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!caesar.cs.montana.edu!ogicse!emory!hubcap!billwolf%hazel.cs.clemson.edu From: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 ) Newsgroups: comp.lang.ada Subject: Re: Re: "limitations" of conditional compilation Message-ID: <7448@hubcap.clemson.edu> Date: 14 Dec 89 20:56:29 GMT References: <920015@hpcladb.HP.COM> Sender: news@hubcap.clemson.edu Reply-To: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu List-Id: >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