🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.misc
Article #83

Re: Output formatting Question

#83
From: CBFalconer
Date: Sat, 15 Dec 2001 17:43
46 lines
3017 bytes
Dr John Stockton wrote:
> 
> JRS:  In article <3C1A4B5C.40DD76DE@yahoo.com>, seen in news:borland.pub
> lic.turbopascal, CBFalconer <cbfalconer@yahoo.com> wrote at Fri, 14 Dec
  ^^^^^^^^^^^^^^^
Nope. comp.lang.pascal.misc :-)

> >  PROCEDURE write2digs(VAR f : text; n : integer)
> >
> >     BEGIN
> >     n := abs(n);  /* just in case */
> >     IF (n < 10) THEN write(f, '0', n : 1)
> >     ELSE             write(f, n : 2);
> >     END;
> 
> IMHO, a routine which can write a wrong value (because of abs) is most
> undesirable.  Just make "n" a word.

If you want to define "word = 0..maxint:" allright.  Else it is
not portable.

I prefer to have a routine usable for many purposes.  For signed,
we could call it with:

   IF (n < 0) THEN write(f, '-');
   write2digs(f, n);

but maybe the name could be improved :-)

> 
> >  PROCEDURE writedate(VAR f : text; dd, mm, yy, field: integer);
> >  (* in ISO form yyyy-mm-dd with leading zeroes *)
> <G>.  Alas, will not give leading year zeroes in the First Millennium -
> though I doubt whether ISO-8601 requires that!
> 
> IMHO, a string function is more widely useful than a write procedure.

If you have a system with such extensions.  Ok, writedate has a (Y
< 1k) bug.  We shall restrict its usage to post-Norman-Conquest. 
I think it also has problems on or after 10,000 AD.

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@XXXXworldnet.att.net)
   Available for consulting/temporary embedded and systems.
   (Remove "XXXX" from reply address. yahoo works unmodified)
   mailto:uce@ftc.gov  (for spambots to harvest)
Technical Details
Message-ID: <3C1B85FC.8BEC978@yahoo.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn4feed!worldnet.att.net!135.173.83.72!wnfilter2!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail
References: <3C1A3235.5B88630E@marine.usf.edu> <3C1A4B5C.40DD76DE@yahoo.com> <Ssv4nFEOj0G8EwZV@merlyn.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10261c,4d112d056daac5d7
X-Google-Attributes: gid10261c,public
X-Google-Thread: 111659,4d112d056daac5d7
X-Google-Attributes: gid111659,public
X-Google-Thread: 108ebd,4d112d056daac5d7
X-Google-Attributes: gid108ebd,public
X-Google-ArrivalTime: 2001-12-15 09:43:44 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn4feed!worldnet.att.net!135.173.83.72!wnfilter2!worldnet-localpost!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail
Message-ID: <3C1B85FC.8BEC978@yahoo.com>
From: CBFalconer <cbfalconer@yahoo.com>
Reply-To: cbfalconer@worldnet.att.net
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.lang.pascal.misc,borland.public.turbopascal,comp.lang.pascal.borland
Subject: Re: Output formatting Question
References: <3C1A3235.5B88630E@marine.usf.edu> <3C1A4B5C.40DD76DE@yahoo.com> <Ssv4nFEOj0G8EwZV@merlyn.demon.co.uk>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 47
Date: Sat, 15 Dec 2001 17:43:43 GMT
NNTP-Posting-Host: 12.90.168.142
X-Complaints-To: abuse@worldnet.att.net
X-Trace: bgtnsc05-news.ops.worldnet.att.net 1008438223 12.90.168.142 (Sat, 15 Dec 2001 17:43:43 GMT)
NNTP-Posting-Date: Sat, 15 Dec 2001 17:43:43 GMT