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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.109.57.221.228.mobile.3.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: A little trouble with very large arrays. Date: Fri, 05 Oct 2018 08:17:46 +0200 Organization: JSA Research & Innovation Message-ID: <875zygudbp.fsf@jacob-sparre.dk> References: <3f2828df-d54a-4427-bc3c-dc5ef0dc8069@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: franka.jacob-sparre.dk; posting-host="109.57.221.228.mobile.3.dk:109.57.221.228"; logging-data="3637"; mail-complaints-to="news@jacob-sparre.dk" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:6DvgEzlDVx7jFIve2AqRUQ14LBk= Xref: reader02.eternal-september.org comp.lang.ada:54480 Date: 2018-10-05T08:17:46+02:00 List-Id: Shark8 writes: > The main-problem right now is the "Primary Data Array" which can have > a dimensionality in 1..999, each itself with some non-zero range. (In > the files these are specified by keywords in the file like NAXIS = n, > NAXIS1 = n_1, NAXIS2 = n_2, and so on until the NAXISn = n_n > keyword/value pair is encountered.) Ouch. :-( Something like this will work, but it doesn't look nice: package Variable_Dimensionality is type Raw is array (Positive range <>, Positive range <>, Positive range <>) of Boolean; type Nice (Dim_1, Dim_2, Dim_3 : Positive) is record Data : Raw (1 .. Dim_1, 1 .. Dim_2, 1 .. Dim_3); end record; end Variable_Dimensionality; > (As another interesting constraint, the file-format mandates a sort of > block-structure of 2880 bytes [23040 bits], and while I don't > anticipate this being an issue, something that might be relevant.) Ada.Sequential_IO and Ada.Direct_IO can both be instantiated with types of any size, so you could simply use a 2880 character String, or a 2880 element Storage_Element_Array (remember to assert that Storage_Element'Size = 8). Greetings, Jacob -- »Verbing weirds language.« -- Calvin