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,start X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.skynet.be!195.238.0.222.MISMATCH!newsspl501.isp.belgacom.be!tjb!not-for-mail Date: Fri, 03 Apr 2009 14:01:15 +0200 From: Olivier Scalbert User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Load an object from a file Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <49d5fa88$0$2862$ba620e4c@news.skynet.be> Organization: -= Belgacom Usenet Service =- NNTP-Posting-Host: 483e4316.news.skynet.be X-Trace: 1238760072 news.skynet.be 2862 87.65.207.60:56284 X-Complaints-To: usenet-abuse@skynet.be Xref: g2news1.google.com comp.lang.ada:4415 Date: 2009-04-03T14:01:15+02:00 List-Id: Hello everybody ! In my Ada self-study context, I was asking myself how can I create and fill objects or records from a file. As an example, I have tried to represent a java class file format structure and fill it with a .class java file. The ClassFile structure is something like: ClassFile { u4 magic; u2 minor_version; u2 major_version; u2 constant_pool_count; cp_info constant_pool[constant_pool_count-1]; u2 access_flags; u2 this_class; u2 super_class; u2 interfaces_count; u2 interfaces[interfaces_count]; u2 fields_count; field_info fields[fields_count]; u2 methods_count; method_info methods[methods_count]; u2 attributes_count; attribute_info attributes[attributes_count]; } JVM Specs can be found there: http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html I have no problem to represent and to fill from file, the first four fields. But I do not know what is the best (Ada) way of representing the array of info constant_pool as the size is only known at run time.(= constant_pool_cout). Also how can I fill this array ? Thanks to help me and have a nice day. Olivier