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

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


Title: RE: R: R: R: [AD] Allegro 5 new config routines, alpha 1

> 1) Store variables in memory using their real type. An int is
> stored as
> an int, etc.
> Pro: fast access to the variable once it's already in memory,
> as no type
> conversion is involved.
> Con: the data type is apparently (if we don't find a way to solve it)
> lost when saving the variables to disk.

I think the data type loss is a non issue, as most of the types can
be readily deduced. The only thing is that strings have to be quoted,
so they can be strings of digits. Oh yes, and signedness, but we can
say integers are signed, and hex numbers are unsigned.

[0-9]+ is an int
0x[0-9]+ and #[0-9]+ are hex numbers
[0-9+]\.[0-9]+ is a floating point number (are we allowing f suffices ?)
".*" and '.*' are strings
yes, no, true, false, on, off are booleans

add-ons then can have their own parsing routine, executed before
Allegro's own ones, to determine the type of an entry.
Conversion can then be done at runtime on demand, as they should
happen quite seldom. After all, the programmer knows the type of
a given variable (unless very advanced uses like building a new
language from that :)) so he will use the right al_get_??? and
al_set_??? routines for the right function anyway.

--
Vincent Penquerc'h



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