🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #3407

Re: SIZE function for FST (DOS) compiler?

#3407
From: Graham Perkins
Date: Thu, 21 Mar 1996 15:32
41 lines
2437 bytes
Jeffrey E Stoner wrote:
> Ronald Snelgrove (ronald@newton.physics.BrockU.CA) wrote:
> : To anyone using the Fitted Software Modula-2 compiler for DOS:
> : of bytes required to store that type, ie SIZE(INTEGER) would return 2.  This
> 
> Well, in the manual, pages 21-22 lists the amount of storage for each data
> type.  Simply count 'em up.
> 

No, no!  That won't help!  He is trying to write software that does
some stuff regardless of what size the data item is.  OK so he could
count up and use a numeric literal, but then the software would need
changing in lots of places if the data item ever changed.  And the
compiler won't check you've made all those changes.  And the runtime
might not show any obvious faults for a while.

I needed that SIZE function for my file handling modules I just
wrote.  The definition module contains 

  TYPE Item = INTEGER; (* or any other transparent type *)
       Key  = INTEGER; (* or any other transparent type *)

so clients can make their own copies of the module, putting whatever
record and key structures they like.  They don't need to touch the
rest of the def. module or any of the imp. module.  Buried away in
the imp. module are a load of SIZE(Item) calls needed to cope with
all that low level "ReadNBytes" stuff.  

I can make this (and sequential and relative files) work for Topspees,
Gardens Point, and Logitech.  But it looks like it wouldn't be possible
for Fitted Software.

Ronald might like to try writing his own SIZE function, but I think
the only way would be via a paremeter of type ARRAY OF BYTE and I'm
not sure if Fitted Software M2 supports that.

-- 
person: Graham Perkins         paper: School of Computing
voice:  +44 (0)1908 834936            De Montfort University
dots:   +44 (0)1908 834948            Milton Keynes MK7 6HP
bits:   grp@dmu.ac.uk                 United Kingdom
Technical Details
Message-ID: <31517683.793C@dmu.ac.uk>
Path: arc1-ca.pugleaf.net!yama.mcc.ac.uk!dmu!usenet
References: <1996Mar17.041332.11054@spartan.ac.BrockU.CA> <4iitag$ai7@usenet.srv.cis.pitt.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!yama.mcc.ac.uk!dmu!usenet
From: Graham Perkins <grp@dmu.ac.uk>
Newsgroups: comp.lang.modula2
Subject: Re: SIZE function for FST (DOS) compiler?
Date: Thu, 21 Mar 1996 15:32:19 +0000
Organization: De Montfort University
Message-ID: <31517683.793C@dmu.ac.uk>
References: <1996Mar17.041332.11054@spartan.ac.BrockU.CA> <4iitag$ai7@usenet.srv.cis.pitt.edu>
NNTP-Posting-Host: mkcsst22.mk.dmu.ac.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0 (Win16; I)