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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8a34575d5eb275cb X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!news.astraweb.com!border2.a.newsrouter.astraweb.com!transit4.hitnews.eu!feeder8.cambrium.nl!feed.tweaknews.nl!195.238.0.231.MISMATCH!news.skynet.be!195.238.0.222.MISMATCH!newsspl501.isp.belgacom.be!tjb!not-for-mail Date: Fri, 03 Apr 2009 18:41:57 +0200 From: Olivier Scalbert User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Load an object from a file References: <49d5fa88$0$2862$ba620e4c@news.skynet.be> <443d72ca-5bbd-46a3-84c6-e8bd984e5b80@k41g2000yqh.googlegroups.com> <49d628f5$0$2865$ba620e4c@news.skynet.be> <49d6346e$0$32681$9b4e6d93@newsspool2.arcor-online.net> <643e14cf-6605-4316-ae3f-e1787c8255ef@q16g2000yqg.googlegroups.com> In-Reply-To: <643e14cf-6605-4316-ae3f-e1787c8255ef@q16g2000yqg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <49d63c51$0$2865$ba620e4c@news.skynet.be> Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 9f7c9bd4.news.skynet.be X-Trace: 1238776913 news.skynet.be 2865 87.65.207.60:51342 X-Complaints-To: usenet-abuse@skynet.be Xref: g2news2.google.com comp.lang.ada:5396 Date: 2009-04-03T18:41:57+02:00 List-Id: Ludovic Brenta wrote: > Georg Bauhaus wrote on comp.lang.ada: >> Olivier Scalbert schrieb: >> >>> Thanks Ludovic, >>> One more question: >>> with: >>> type u2 is new Integer; >>> type cp_info is new Integer; >>> type Constant_Pool_Array is array (Positive range <>) of cp_info; >>> type Interfaces_Array is array (Positive range <>) of u2; >> Make the index type the same as the type in the disciminant, >> that is, u2. >> >> type Constant_Pool_Array is array (u2 range <>) of cp_info; >> type Interfaces_Array is array (u2 range <>) of u2; >> >> since U2 is the type of the discriminants used in providing >> the array bounds. >> >> In fact, very likely the type U2 is range 0 .. Something, with >> Java's integer type semantics regarding overflow and wrap >> around. Perhaps it is a good idea to express this in Ada >> for U2 as well. > > Right; in fact, Java's u2 probably corresponds to > > type u2 is mod 2 ** 32; -- or perhaps 64? > > -- > Ludovic Brenta.A class file consists of a stream of 8-bit bytes. All 16-bit, 32-bit, and 64-bit quantities are constructed by reading in two, four, and eight consecutive 8-bit bytes, respectively. Multibyte data items are always stored in big-endian order, where the high bytes come first. In the Java and Java 2 platforms, this format is supported by interfaces java.io.DataInput and java.io.DataOutput and classes such as java.io.DataInputStream and java.io.DataOutputStream. Yes it works ! I should focus on the domain problem. I should focus on the domain problem. I should focus on the domain problem. I should focus on the domain problem. I should focus on the domain problem. For your info: ... A class file consists of a stream of 8-bit bytes. All 16-bit, 32-bit, and 64-bit quantities are constructed by reading in two, four, and eight consecutive 8-bit bytes, respectively. Multibyte data items are always stored in big-endian order, where the high bytes come first. ... This chapter defines its own set of data types representing class file data: The types u1, u2, and u4 represent an unsigned one-, two-, or four-byte quantity, respectively. ... The firt 4 bytes that composed the magic field are: 0xCAFEBABE ;-) Olivier