Virtual selectors

Where ordinary selectors specify a value stored in some object,
virtual selectors specify a function to call to compute a value
associated with some object.

Use them to replace the special case xdump ver by new table
EF_VERSION.

Move configkeys[] to lib/common because nsc_init() needs it to
initialize empfile[EF_VERSION].cadef.
This commit is contained in:
Markus Armbruster 2008-03-04 21:02:00 +01:00
parent 38047a62f7
commit da8a1daeef
12 changed files with 541 additions and 482 deletions

View file

@ -53,6 +53,7 @@
#include "server.h"
#include "trade.h"
#include "treaty.h"
#include "version.h"
#include "xy.h"
/* Number of elements in ARRAY. */
@ -102,7 +103,8 @@ struct empfile empfile[] = {
* that can be changed by users.
*
* Whatever of the above can't be done here must be done in
* empfile_init() or empfile_fixup().
* empfile_init() or empfile_fixup(). Except cadef may be set in
* nsc_init() instead.
*/
/*
@ -187,10 +189,13 @@ struct empfile empfile[] = {
ARRAY_TABLE(update_time, EFF_CFG)},
/*
* Special tables. EF_META gets bogus size, cids and fids here.
* Fixed up by empfile_init().
* Fixed up by empfile_init(). EF_VERSION's cadef is set by
* nsc_init().
*/
{EF_TABLE, "table", NULL, empfile_ca,
ARRAY_TABLE(empfile, EFF_CFG)},
{EF_VERSION, "version", NULL, NULL,
sizeof(PACKAGE_STRING), 0, version, 0, 0, 1, 1, -1, NULL, NULL},
{EF_META, "meta", NULL, mdchr_ca,
PTR_CACHE(mdchr_ca, EFF_CFG)},