🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.simula
Article #532

Re: Simula's GetInt function

#532
From: Rob Pooley
Date: Mon, 01 Aug 1994 11:33
44 lines
2122 bytes
As I have to embarassedly repeat every time someone tries this, my book is
wrong on this point. I have the corrected version if anyone would like the
relevant chapter!

The de-editing functions in SIMULA, other than GetChar, reset the Pos value for
the text back to the start of the text before they start looking. More formally
the Standard says that the longest matching item "which includes the first
character of the text" is used to generate the value returned. You have to use
something like:

begin
 text line;
 line :- Copy("1 2 3 4");
 OutInt(line.GetInt,4);
 OutImage;
 line :- line.sub(line.pos,line.length-line.pos+1);
 OutInt(line.GetInt,4);
 OutImage;
 line :- line.sub(line.pos,line.length-line.pos+1);
 OutInt(line.GetInt,4);
 OutImage;
 line :- line.sub(line.pos,line.length-line.pos+1);
 OutInt(line.GetInt,4);
 OutImage;
end;

to achieve what you want. I would check my arithmetic to make sure those sub
calls are right, by the way! Seems I always get something wrong in this area!

Rob

-----------------

Rob Pooley
Department of Computer Science
Edinburgh University
Kings Buildings
Mayfield
Edinburgh      EH9 3JZ
Scotland

Tel. +44 31 650 5123

Fax. +44 31 667 7209
Technical Details
Message-ID: <14150.9408011133@auskerry.dcs.ed.ac.uk>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.kei.com!eff!news.duke.edu!news-feed-1.peachnet.edu!gatech!howland.reston.ans.net!EU.net!Austria.EU.net!newsfeed.ACO.net!paladin.american.edu!auvm!DCS.ED.AC.UK!rjp

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-08-01 05:06:37 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.kei.com!eff!news.duke.edu!news-feed-1.peachnet.edu!gatech!howland.reston.ans.net!EU.net!Austria.EU.net!newsfeed.ACO.net!paladin.american.edu!auvm!DCS.ED.AC.UK!rjp
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
Newsgroups: bit.listserv.simula
Via: uk.ac.ed.dcs; Mon, 1 Aug 1994 12:32:19 +0100
Message-ID: <14150.9408011133@auskerry.dcs.ed.ac.uk>
Date: Mon, 1 Aug 1994 12:33:43 BST
Sender: The SIMULA Language List <SIMULA@UGA.BITNET>
From: Rob Pooley <rjp@DCS.ED.AC.UK>
Subject: Re: Simula's GetInt function
In-Reply-To: <9407291421.aa07058@dcs.ed.ac.uk> (message from Albert Burger on
              Fri, 29 Jul 1994 12:16:08 GMT)
Lines: 43