[AD] Allegro 5 new config routines, alpha 1

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


I've coded a first version of the new config routines for Allegro 5,
following Shawn's original suggestions on the topic.
I've used a simple hash code based system to retrieve proper entries
from the tables; each "directory" has a dedicated table (default size =
4096 entries). When a variable is referenced, it is broken up into its
subparts. For example, if we refer to gfx/driver/width, the thing is
broken into "gfx", "driver" and "width". "gfx" belongs to the root
directory, so it is looked for onto it. If found, and it's really a
directory, it contains another 4096 entries table, onto which "driver"
is looked for.
If two names collide onto the same entry, a linked list of names is used
onto the same entry, and the proper real entry is searched using normal
strcmp(). Look in the code!

The system seems to work fine, but I need more testing. So far I've
implemented al_set_bool, al_set_int, al_set_hex, al_set_string and the
al_get_* counterparts. Loading/saving of subtrees will be trivial, but
first I'd like to assure the system really works. Please let me know if
you find any problems with it, and do more tests!

--
Angelo Mottola
a.mottola@xxxxxxxxxx
http://www.ecplusplus.com

Attachment: config.c
Description: Binary data



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