Re: [AD] Allegro 5 new config routines, alpha 1

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Angelo Mottola writes:
> so that you know the current state of 
> "/keyboard/state/AL_KEY_SPACE" for example, as to access AL_KEY_SPACE 
> the system first scans the /state/ dir, finds it has an hook and calls 
> it. Having an unique table with each entry being a full path would make 
> this harder to manage. Unless hooks are stored into a separated table, 
> with which the entry is compared once it has been found.

Perhaps it could work backwards through the search string? ie. start
by doing a hash lookup for "keyboard/state/AL_KEY_SPACE", then if
it can't find any matching entry, chop off the last term in the 
string and try another hash lookup to see if anyone has hooked the
"keyboard/state/" dir, if that fails, try "keyboard/", etc. This
would never require more than a few (usually only 1 or 2) lookups,
and would also allow the possibility of hooking a whole directory,
but then still overriding individual variables inside it with more
specialised hooks.

> Now that I think of it, having an hooks list separated from the hash
> table also saves much space, as each hash table entry will 
> have 8 bytes less to take care of. :)

But then how do you find the hooks? Surely they need to be in the hash
table in order to be located efficiently?


-- 
Shawn



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/