home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / modula2 / 1594 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.6 KB

  1. Path: sparky!uunet!psgrain!puddle!p10.f702.n291.z2.fidonet.org!Dominique.Willems
  2. From: Dominique.Willems@p10.f702.n291.z2.fidonet.org (Dominique Willems)
  3. Sender: ufgate@puddle.fidonet.org (newsout1.26)
  4. Newsgroups: comp.lang.modula2
  5. Subject: Re: Generic stack implementation
  6. Message-ID: <31320.2B32D8B7@puddle.fidonet.org>
  7. Date: Mon, 14 Dec 92 18:35:00 PDT
  8. Organization: FidoNet node 2:291/702.10 - In Limbo, Lennik B
  9. Lines: 36
  10.  
  11. Hello HON,
  12.  
  13. In a msg of <12 Dec 92>, HON (EDWIN writes to All:
  14.  
  15.  >> location: ADDRESS;
  16.  
  17.  >> BEGIN
  18.  >>   IF empty(s) THEN
  19.  >>     stackunderflow
  20.  >>   ELSE
  21.  >>     size := s^.size;
  22.  >>     oldnode := s^.next;
  23.  >>     location := oldnode^.contents;
  24.  >>     FOR wordcount := 0 TO size DIV TSIZE(WORD) - 1 DO
  25.  >>       item[wordcount] := location^;
  26.  >>       INC(location, TSIZE(WORD));
  27.  
  28.  H(>           ^^^^^^
  29.  H(>        parameter not correct type ??
  30.  
  31.  H(>         Is this some problem ...???
  32.  H(>         I am using TopSpeed Modular-2.
  33.  
  34.  H(>         Can anybody help ??
  35.  
  36. "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.
  37.  
  38. Simply use Lib.IncAddr(location,TSIZE(WORD)).
  39.  
  40. Glad to help,
  41. Domus
  42.  
  43.  
  44. --  
  45. uucp: uunet!m2xenix!puddle!2!291!702.10!Dominique.Willems
  46. Internet: Dominique.Willems@p10.f702.n291.z2.fidonet.org
  47.