Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #5756
| Subject | Re: Font problem |
|---|---|
| Newsgroups | comp.sys.acorn.programmer |
| From | Alan Adams <alan@adamshome.org.uk> |
| Date | 2019-05-15 10:11 +0100 |
| Message-ID | <e9b079b457.Alan.Adams@ArmX6.adamshome.org.uk> (permalink) |
| References | <003219b257.Alan.Adams@ArmX6.adamshome.org.uk> <57b27c5a25Paul@sprie.nl> <e52928b357.Alan.Adams@ArmX6.adamshome.org.uk> <101d047b-eaea-4a5a-8955-bc6e52ad7eac@googlegroups.com> |
| Organization | Orpheus Internet Services |
In message <101d047b-eaea-4a5a-8955-bc6e52ad7eac@googlegroups.com>
jgh@mdfs.net wrote:
>> Partly because about a year I replaced all CLOSE# calls with a function
>> call which checked the handle for zero, closed it if non-zero, and set it
>> to zero.
> A function call? How do you do that?
Like this
DEF PROCclosefile(RETURN H%)
IF (DEBUG%AND(1<<21)) AND (H%=0) THEN
*REPORT \R WL: closefile: caller$ HANDLE IS ZERO H%
*REPORTSTACK
ENDIF
LOCAL ERROR
ON ERROR LOCAL ENDPROC
CLOSE#H%
RESTORE ERROR
H%=0
ENDPROC
> DEFFNclose(chn%)
> IF chn%<>0 THEN CLOSE#chn%:chn%=0
> =some_return_value
> ....won't do what you expect as it only changes the *local* value of
> chn%.
> DEFFNclose(chn%)
> IF chn%<>0 THEN CLOSE#chn%
> =0
> ...with handle%=FNclose(handle%) would do it, though I tend to code
> it inline explictly as: IF hnd%:CLOSE#hnd%:hnd%=0
> However, with the magic of passing-by-reference:
> DEFPROCclose(RETURN chn%)
> IF chn%:CLOSE#chn%:chn%=0
> ENDPROC
> would work, giving you PROCclose(handle%). I'd go further and do:
> DEFPROCclose(RETURN chn%)
> LOCAL tmp%
> IF chn%:tmp%=chn%:chn%=0:CLOSE#tmp%
> ENDPROC
> ...so if an error occurs in the CLOSE#, the handle has already been
> zeroed, so won't cause an attempt to reclose it.
--
Alan Adams, from Northamptonshire
alan@adamshome.org.uk
http://www.nckc.org.uk/
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-10 19:25 +0100
Re: Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-10 19:35 +0100
Re: Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-10 20:19 +0100
Re: Font problem Matthew Phillips <spam2011m@yahoo.co.uk> - 2019-05-10 21:21 +0100
Re: Font problem Harriet Bazley <harriet@bazleyfamily.co.uk> - 2019-05-11 01:20 +0100
Re: Font problem Paul Sprangers <Paul@sprie.nl> - 2019-05-11 14:28 +0200
Re: Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-12 20:44 +0100
Re: Font problem Martin Wuerthner <spamtrap@mw-software.com> - 2019-05-13 19:43 +0200
Re: Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-13 21:54 +0100
Re: Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-14 11:57 +0100
Re: Font problem jgh@mdfs.net - 2019-05-14 21:10 -0700
Re: Font problem Alan Adams <alan@adamshome.org.uk> - 2019-05-15 10:11 +0100
csiph-web