🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2219

Re: Generic stack implementation

#2219
From: Dominique Willems
Date: Tue, 15 Dec 1992 01:35
36 lines
1705 bytes
Hello HON,

In a msg of <12 Dec 92>, HON (EDWIN writes to All:

 >> location: ADDRESS;

 >> BEGIN
 >>   IF empty(s) THEN
 >>     stackunderflow
 >>   ELSE
 >>     size := s^.size;
 >>     oldnode := s^.next;
 >>     location := oldnode^.contents;
 >>     FOR wordcount := 0 TO size DIV TSIZE(WORD) - 1 DO
 >>       item[wordcount] := location^;
 >>       INC(location, TSIZE(WORD));

 H(>           ^^^^^^
 H(>        parameter not correct type ??

 H(>         Is this some problem ...???
 H(>         I am using TopSpeed Modular-2.

 H(>         Can anybody help ??

"location" is of TYPE "ADDRESS". Addresses in the large models are composed of a segment and an offset part, at least if you're using an Intel processor compiler, like the TopSpeed one. Since INC only works on ordinal types in general, it won't work on a structured type like ADDRESS, which is a record composed of the two CARDINALs "Segment" and "Offset". The TopSpeed library provides you with the necessary procedures to do all the address arithmetic you need, though.

Simply use Lib.IncAddr(location,TSIZE(WORD)).

Glad to help,
Domus


--  
uucp: uunet!m2xenix!puddle!2!291!702.10!Dominique.Willems
Internet: Dominique.Willems@p10.f702.n291.z2.fidonet.org
Technical Details
Message-ID: <31320.2B32D8B7@puddle.fidonet.org>
Path: arc1-ca.pugleaf.net!sparky!uunet!psgrain!puddle!p10.f702.n291.z2.fidonet.org!Dominique.Willems

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!psgrain!puddle!p10.f702.n291.z2.fidonet.org!Dominique.Willems
From: Dominique.Willems@p10.f702.n291.z2.fidonet.org (Dominique Willems)
Sender: ufgate@puddle.fidonet.org (newsout1.26)
Newsgroups: comp.lang.modula2
Subject: Re: Generic stack implementation
Message-ID: <31320.2B32D8B7@puddle.fidonet.org>
Date: Mon, 14 Dec 92 18:35:00 PDT
Organization: FidoNet node 2:291/702.10 - In Limbo, Lennik B
Lines: 36