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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,94b44ecb42c031b9 X-Google-Attributes: gid103376,public From: Ted Dennison Subject: Re: Searching for an object Date: 2000/08/21 Message-ID: <8nrh3t$ht9$1@nnrp1.deja.com>#1/1 X-Deja-AN: 660741027 References: <87og2q9yyp.fsf@moon.mteege.de> X-Http-Proxy: 1.0 x60.deja.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Aug 21 15:16:34 2000 GMT X-MyDeja-Info: XMYDJUIDtedennison Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.7 [en] (WinNT; I) Date: 2000-08-21T00:00:00+00:00 List-Id: In article <87og2q9yyp.fsf@moon.mteege.de>, Matthias Teege wrote: > I've defined the following type: > > type customer is record > aname : String( 1..25); > bname : String( 1..25); > end record; This looks shaky right from the start. How do you know how many characters in these fields are valid? Ada string handling doesn't rely on special "terminator" characters at the end of the strings. You either dynamicly size the string to hold the exact number of characters you will need for the data, you keep around a "length" variable with the string, or you use one of the types in the Ada.Strings.* packages. > Now I want to find a special object with a find procedure > like this (not authentic Ada Code :-)): > > procedure find ( Field : in String; > What : in String; > Result: out String) is > > while end_of_table is false loop > read(object); > if object.Field = What then -- field should be 'aname' > -- or 'bname' > Result := object.Field; > exit; -- We have found it > end if > end loop; > end find; > > I want to search in all Record "Fields" depend on the > procedure parameter. Is object supposed to be some global variable? Otherwise, this looks like you are familiar with "object" notation in some other "OO" languages, and are looking for the same notation in Ada. Eg: you want to call Object.Find (...) rather than Find(Object, ...) Is that your question? -- T.E.D. http://www.telepath.com/~dennison/Ted/TED.html Sent via Deja.com http://www.deja.com/ Before you buy.