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,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dbaf05888e191cb6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-01-15 19:52:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Access to array slices? References: <5ad0dd8a.0301151818.7931f6a3@posting.google.com> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1042689168 12.234.13.56 (Thu, 16 Jan 2003 03:52:48 GMT) NNTP-Posting-Date: Thu, 16 Jan 2003 03:52:48 GMT Organization: AT&T Broadband Date: Thu, 16 Jan 2003 03:52:48 GMT Xref: archiver1.google.com comp.lang.ada:33073 Date: 2003-01-16T03:52:48+00:00 List-Id: > > You could also use Ada streams. > Are they buffered or each 'Read and 'Input will result in a syscall? Each 'Read does what it needs to do to get the next value of the data type. You could define 'Reads that generate random numbers, or successive letters of the alphabet, or read from a buffer, in which case no syscalls or IO calls would be needed. You can define a 'Read that reads an entire structure with a single IO call, if that's appropriate. OTOH, if you do a 'Read on a String, and pass it a stream from Ada.Text_IO.Streams.Stream(Ada.Text_IO.Standard_Input) then it will do one read from standard input per character. The special thing a 'Read does is that if you don't overide it for My_Record'Read use ... then the compiler will automatically generate a series of 'Reads for the various components of My_Record, recursively down to the elementary types, or the pieces you have overriden, whichever comes first. > > Do_Something_With_Data( name, value ); > ... > wanted a function returning an array of access to > Name_Value_Pair_Type, where name and value would be accesses to > strings. You haven't really said that you need random access to this array, as opposed to sequential. If sequential, you can use the technique in Message-ID: If random, you can create an array of type Name_Value_Pair_Type is record Name_First, Name_Last, Value_First, Value_Last : Natural; end record; and then do calls like: Do_Something_With_Data(Buffer(Name_First(i) .. Name_Last(i)), Buffer(Value_First(i) .. Value_Last(i))); If that won't do, and you really truly need "is access all String;", you will have to do data copying.