Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.acorn.programmer > #608
| From | Martin Bazley <martin.bazley@blueyonder.co.uk> |
|---|---|
| Newsgroups | comp.sys.acorn.programmer |
| Subject | Re: Can anyone spot why this menu doesn't change anything please. |
| Message-ID | <3f49350252.martin@blueyonder.co.uk> (permalink) |
| References | <f6e2409c-426d-4f95-acff-5120b244411b@e7g2000vbw.googlegroups.com> |
| Organization | virginmedia.com |
| Date | 2011-08-13 18:00 +0100 |
The following bytes were arranged on 13 Aug 2011 by Gazza :
> REPEAT
> CLS:PRINT:PRINT
> PROCrec_stats(rec_mod%,rec_add%,rec_ptr%,rec_sval%)
> PRINT:PRINT
> PRINT" Options Menu"
> PRINT:PRINT
> PRINT" (A)utosave feature. Currently
> "+FNdev_iifs(FNdev_tstbit(0,rec_opt%),"ON","OFF")
> PRINT" (C)onfigure Autosave. Currently set at : "+STR$(asnum%)
> PRINT" (S)tatistics display. Currently
> "+FNdev_iifs(FNdev_tstbit(1,rec_opt%),"ON","OFF")
> PRINT:PRINT
> PRINT" Enter Selection or (B)ack to main menu."
> PRINT:PRINT
> REPEAT:l$=GET$:UNTIL INSTR("AaCcSsBb",l$)<>0
> CASE l$ OF
> WHEN "A","a" : PROCdev_togglebit(0,rec_opt%) :REM
> Autosave feature On/Off.
> WHEN "C","c" : REM Set auto-save activation threshold.
> INPUT" Enter autosave activation threshold. ENTER to go
> back.";m$
> IF FNdev_validnum(m$) THEN rec_asnum%=FNdev_iif(m$<>"",VAL(m
> $),rec_asnum%)
> WHEN "S","s" : PROCdev_togglebit(1,rec_opt%) :REM
> Statistics display On/Off.
> OTHERWISE : REM Save changes to file and return to main menu.
> PROCfile_opts_io(FALSE,rec_opt%,junk%,rec_asnum%):done%=TRUE
> ENDCASE
> UNTIL done%
>
>
> DEFPROCrec_stats() :
> Displays some statistics.
> DEFPROCfile_opts_io(<read>,<opt>,<null>,<opt2>) : Reads/Writes
> options file. If <read> TRUE reads.
> DEFFNdev_tstbit(<pos>,<mask>) : Returns
> TRUE if bit at <pos> in <mask> set.
> DEFPROCdev_togglebit(<pos>,RETURN <mask>) : Toggle bit at <pos>
> position in bitmask <mask>
> DEFFNdev_iif(<cond>,<true>,<false>) : C/C++
> inline if (returns one of two ints)
> DEFFNdev_iifs(<cond>,<true>,<false>) : C/C++ inline
> if (returns one of two strings)
> DEFFNdev_validnum(<num>) : Check
> validity.
Your less than verbose program listing didn't help, but considering that
problems only arise when PROCdev_togglebit is involved, I'd be very
inclined to suspect that.
The other possible culprits are FNdev_tstbit and FNdev_iifs. Have you
actually checked the saved configuration? It may well be that rec_opt%
is changing as scheduled, but your TRUE/FALSE display mechanism is
malfunctioning, so it seems to be incorrect when it isn't.
Personally, I don't see any real reason for FNdev_tstbit or
PROCdev_togglebit to exist at all, since the tasks they perform are so
trivial. FNdev_iif[s] is borderline - I think I'd probably just use
inline IFs. I don't know if it would work, but I'd probably write
tighter code, like this:
REPEAT
CLS:PRINT'
PROCrec_stats(rec_mod%,rec_add%,rec_ptr%,rec_sval%)
PRINT''" Options Menu"''
PRINT" (A)utosave feature. Currently ";
PRINT FNdev_iifs((rec_opt% AND 1)<>0,"ON","OFF")
PRINT" (C)onfigure Autosave. Currently set at : "+STR$(asnum%)
PRINT" (S)tatistics display. Currently ";
PRINT FNdev_iifs((rec_opt% AND 2)<>0,"ON","OFF")
PRINT''" Enter Selection or (B)ack to main menu."''
REPEAT:l$=GET$:UNTIL INSTR("AaCcSsBb",l$)<>0
CASE l$ OF
WHEN "A","a":rec_opt%=(rec_opt% EOR 1)
WHEN "C","c":
INPUT" Enter autosave activation threshold. ENTER to go back.";m$
IF FNdev_validnum(m$) rec_asnum%=FNdev_iif(m$<>"",VAL(m$),rec_asnum%)
WHEN "S","s":rec_opt%=(rec_opt% EOR 2)
OTHERWISE
PROCfile_opts_io(FALSE,rec_opt%,junk%,rec_asnum%):done%=TRUE
ENDCASE
UNTIL done%
...
DEF PROCrec_stats()...ENDPROC
DEF PROCfile_opts_io()...ENDPROC
DEF FNdev_validnum()...=...
DEF FNdev_iif(bool%,trueval%,falseval%)
IF bool% =trueval% ELSE =falseval%
DEF FNdev_iifs(bool%,trueval$,falseval$)
IF bool% =trueval$ ELSE =falseval$
In grandest Usenet tradition, all entirely untested.
--
__<^>__
/ _ _ \ You always find something in the last place you look.
( ( |_| ) )
\_> <_/ ======================= Martin Bazley ==========================
Back to comp.sys.acorn.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread
Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-13 07:01 -0700
Re: Can anyone spot why this menu doesn't change anything please. Martin <News03@avisoft.f9.co.uk> - 2011-08-13 16:18 +0100
Re: Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-13 09:47 -0700
Re: Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-13 11:41 -0700
Re: Can anyone spot why this menu doesn't change anything please. Martin <News03@avisoft.f9.co.uk> - 2011-08-13 23:35 +0100
Re: Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-13 15:45 -0700
Re: Can anyone spot why this menu doesn't change anything please. Martin <News03@avisoft.f9.co.uk> - 2011-08-14 10:54 +0100
Re: Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-14 04:27 -0700
Re: Can anyone spot why this menu doesn't change anything please. Martin <News03@avisoft.f9.co.uk> - 2011-08-14 12:43 +0100
Re: Can anyone spot why this menu doesn't change anything please. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-08-14 14:18 +0100
Re: Can anyone spot why this menu doesn't change anything please. Martin <News03@avisoft.f9.co.uk> - 2011-08-14 15:24 +0100
Re: Can anyone spot why this menu doesn't change anything please. "Barry Allen (news)" <evanallen@onetel.net.uk.invalid> - 2011-08-14 15:48 +0100
Re: Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-14 08:46 -0700
Re: Can anyone spot why this menu doesn't change anything please. Alan Wrigley <spamhater@keepyourfilthyspamtoyourself.co.uk> - 2011-08-14 18:36 +0100
Re: Can anyone spot why this menu doesn't change anything please. Gazza <usenet@garethlock.com> - 2011-08-21 02:50 -0700
Re: Can anyone spot why this menu doesn't change anything please. Martin Bazley <martin.bazley@blueyonder.co.uk> - 2011-08-13 18:00 +0100
csiph-web