comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Efficiently setting up large quantities of constant data
Date: 14 Dec 2004 12:18:54 +0000
Date: 2004-12-14T12:18:54+00:00	[thread overview]
Message-ID: <x7v7jnlyswh.fsf@smaug.pushface.org> (raw)
In-Reply-To: fa59671.0412131348.2677f5ec@posting.google.com


In a spec ...

   type String_P is access constant String;

   type Stream_Element_Array_P is
     access constant Ada.Streams.Stream_Element_Array;

   type Format is
     (HTML,
      Plain,
      JPEG,
      GIF,
      PNG,
      OCTET_STREAM);

   type URL_Info is record
      URL : String_P;
      Doc : Stream_Element_Array_P;
      Form : Format;
   end record;

   type URL_Info_Array is array (Positive range <>) of URL_Info;
   type URL_Info_Array_P is access constant URL_Info_Array;

in a body ...

   Url_1 : aliased constant String := "/index.html";
   Doc_1 : aliased constant Stream_Element_Array :=
     (
      60, 33, 45, 45, 32, 36, 73, 100, 58, 32, 105, 110,
      100, 101, 120, 46, 104, 116, 109, 108, 44, 118, 32, 49,
.......
      108, 62
     );
   Documents : aliased constant Url_Info_Array :=
     (
      1 => (Url => Url_1'Access, Doc => Doc_1'Access, Form => HTML)
     );
   function Static_Urls return Url_Info_Array_P is
   begin
      return Documents'Access;
   end Static_Urls;


(on looking at this, I'm a bit surprised that I didn't need to say
'all' ..)

-- 
Simon Wright                               100% Ada, no bugs.



  parent reply	other threads:[~2004-12-14 12:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-13 21:48 Efficiently setting up large quantities of constant data Michael Mounteney
2004-12-13 22:09 ` Stephen Leake
2004-12-13 22:15 ` Luke A. Guest
2004-12-14  0:20 ` Jeffrey Carter
2004-12-14  8:43 ` Martin Krischik
2004-12-14 12:18 ` Simon Wright [this message]
2004-12-15 21:10   ` Brian May
2004-12-16 23:18     ` Nick Roberts
2004-12-16 12:36 ` Dr. Adrian Wrigley
2004-12-16 13:50   ` Marc A. Criley
2004-12-17  2:32     ` John B. Matthews
2004-12-16 14:06   ` rien
2004-12-16 14:24   ` Vinzent 'Gadget' Hoefler
2004-12-16 18:12     ` Dr. Adrian Wrigley
2004-12-16 23:25       ` Nick Roberts
2004-12-17  5:20     ` tmoran
2004-12-17  8:38       ` Vinzent 'Gadget' Hoefler
2004-12-17 13:53     ` Dr. Adrian Wrigley
2004-12-17 14:16       ` Alex R. Mosteo
2004-12-16 17:11   ` Andre
2004-12-16 21:52     ` Larry Kilgallen
2004-12-16 23:23       ` Nick Roberts
2004-12-16 23:47       ` Dr. Adrian Wrigley
2004-12-19 14:34         ` Simon Wright
2004-12-16 18:29 ` Alex R. Mosteo
replies disabled

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