🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.simula
Article #531

Re: Simula's GetInt function

#531
From: Ron Kerr
Date: Fri, 29 Jul 1994 13:44
51 lines
2345 bytes
Albert Burger writes:
>
> I am trying to use the GetInt function in Simula, but seem to have some
> problems understanding its correct use. When running below program:
>
> begin
>  text line;
>  line :- Copy("1 2 3 4");
>  OutInt(line.GetInt,4);
>  OutImage;
>  OutInt(line.GetInt,4);
>  OutImage;
>  OutInt(line.GetInt,4);
>  OutImage;
>  OutInt(line.GetInt,4);
>  OutImage;
> end;
>
> I would expect to get
>
>    1
>    2
>    3
>    4
>
> as output, but get
>
>    1
>    1
>    1
>    1
>
> instead!
>
> Any ideas where I go wrong?
>

 You are making the mistake (which I think is also made in Rob Pooley's
 book!) of thinking that successive calls of getint progress through
 the text. Getint (and all the other "gets" except getchar), unlike
 inint, ALWAYS starts its scan from the leftmost character position. If
 you want to read several numbers from a text you need to define the
 remainder of the text as a subtext and do a "get" on that.

 This looks like a stupid form of behaviour for getting things out of
 texts. However, the reason for this is that formatted I/O is done in
 SIMULA by "getting" data from subtexts of image and to process
 successive images would be very clumsy and slow if the "get" routines
 did not always start at the beginning.

 Cheers....Ron
Technical Details
Message-ID: <199407291344.OAA27074@eata.ncl.ac.uk>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.onramp.net!convex!news.duke.edu!news-feed-1.peachnet.edu!gatech!howland.reston.ans.net!news.cac.psu.edu!psuvm!auvm!NEWCASTLE.AC.UK!R.Kerr

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113dd9,22a819fc6f7d493e
X-Google-Attributes: gid113dd9,public
X-Google-ArrivalTime: 1994-07-29 12:48:36 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!news.onramp.net!convex!news.duke.edu!news-feed-1.peachnet.edu!gatech!howland.reston.ans.net!news.cac.psu.edu!psuvm!auvm!NEWCASTLE.AC.UK!R.Kerr
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
Newsgroups: bit.listserv.simula
Via: uk.ac.ncl; Fri, 29 Jul 1994 14:42:46 +0100
X-Mailer: ELM [version 2.4 PL23]
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1300
Message-ID: <199407291344.OAA27074@eata.ncl.ac.uk>
Date: Fri, 29 Jul 1994 14:44:55 +0100
Sender: The SIMULA Language List <SIMULA@UGA.BITNET>
From: Ron Kerr <R.Kerr@NEWCASTLE.AC.UK>
Subject: Re: Simula's GetInt function
Comments: cc: ab@dcs.ed.ac.uk
In-Reply-To: <199407291321.AA20428@cheviot.ncl.ac.uk> from "Albert Burger" at
              Jul 29, 94 12:16:08 pm
Lines: 50