OpenAmiga (601/964)

From:Jim Peters
Date:20 Sep 2000 at 10:37:31
Subject:Re: AMIOPEN: Hotkey Config/Need suggestions

On Tue, Sep 19, 2000 at 11:03:33PM -0700, Jesse McClusky wrote:
> > Both formats can have comments that start with '#'. What do you guys think?
>
> I'd stick with the first one, since the whole point is to make the config
> file human-readable. Suggest to the programmer that they make an
> enum for their key indexes. Besides, the description gives a GUI
> mapper something to present to the user.

Just one problem with the first one - is that it would be very
fragile. If someone stuck an extra 0x03=XXX at the top of the file,
all the helpful labels lower down would be completely useless, if I
understand this correctly, because they would then be pointing at the
wrong slots. Also, the config file would have to be completely in
sync with the source, always, including having dummy values for things
no longer required in version 2.0, etc.

I prefer the second one - comments surrounding the line itself could
give more details, or you could allow a slot specifically for a
GUI-presentable string. Question better "Alt-X = ExecuteMacro" or
"ExecuteMacro = Alt-X" ? All these names take more space in the
binary, as you say, but it's going to survive a few version changes
much better.

For minimalists, you could still use the second version, but using
numbers for the names:

000 = Alt-X # Execute macro
002 = Alt-O # Other function
001 = Alt-Z # Go to sleep
003 = Alt-S # Show status bar

No wasted space in your program for the labels - just loop, generating
"%03d" names and load them up into an array - and the file format is
not so fragile either. Everyone else can have the benefits of labels
in their code for greater readability and stability.

Thoughts, anyone ?

Jim



Jim Peters / __ | \ Aguazul
/ /| /| )| /| / )|| \
jim@aguazul. \ (_|(_|(_|(_| )(_|I / www.aguazul.
demon.co.uk \ ._) _/ / demon.co.uk
Subscribe/Unsubscribe: open-request@amiga.com
Amiga FAQ: http://www.amiga.com/faq.html