* in the context object. I.e. the value is at sym.off + sym.idx *
* SZ, where SZ is the size of the value.
* If sym.get is not null, you obtain the value by calling get() like
- * VAL->get(VAL, CNUM, CTXO), where CNUM is the country to use for
- * coordinate translation and access control, and CTXO is the context
- * object. get() either returns a null pointer and sets VAL->val_as
- * to the value, as appropriate for the type. Or it returns another
- * context object and sets VAL->val_as.sym for it.
+ * VAL->get(VAL, NP, CTXO), where NP points to the country to use for
+ * coordinate translation and access control (null for none), and CTXO
+ * is the context object. get() either returns a null pointer and
+ * sets VAL->val_as to the value, as appropriate for the type. Or it
+ * returns another context object and sets VAL->val_as.sym for it.
*/
struct valstr {
enum nsc_type val_type; /* type of value */
ptrdiff_t off;
int len;
int idx;
- void *(*get)(struct valstr *, natid, void *);
+ void *(*get)(struct valstr *, struct natstr *, void *);
} sym;
double dbl; /* cat NSC_VAL, type NSC_DOUBLE */
struct { /* cat NSC_VAL, type NSC_STRING, cat NSC_ID */
* A datum of any other type is either a scalar of that type (if
* ca_len is zero), or an array of ca_len elements of that type.
* If ca_get is not null, the selector is virtual. Values can be
- * obtained by calling ca_get(VAL, CNUM, CTXO), where VAL has been
+ * obtained by calling ca_get(VAL, NP, CTXO), where VAL has been
* initialized my from the selector and an index by nstr_mksymval(),
- * CNUM is the country to use for coordinate translation and access
- * control, and CTXO is the context object. See struct valstr for
- * details.
+ * NP points to the country to use for coordinate translation and
+ * access control (null for none), and CTXO is the context object.
+ * See struct valstr for details.
* If flag NSC_DEITY is set, only to deities can use this selector.
* If flag NSC_EXTRA is set, xdump ignores this selector.
* If flag NSC_CONST is set, the datum can't be changed from its
ptrdiff_t ca_off;
enum nsc_type ca_type;
unsigned short ca_len;
- void *(*ca_get)(struct valstr *, natid, void *);
+ void *(*ca_get)(struct valstr *, struct natstr *, void *);
int ca_table;
int ca_flags;
};
#include "nsc.h"
#include "product.h"
-static void *nsc_ver(struct valstr *, natid, void *);
-static void *nsc_pln_att(struct valstr *, natid, void *);
-static void *nsc_pln_def(struct valstr *, natid, void *);
-static void *nsc_lnd_att(struct valstr *, natid, void *);
-static void *nsc_lnd_def(struct valstr *, natid, void *);
-static void *nsc_lnd_vul(struct valstr *, natid, void *);
-static void *nsc_lnd_spd(struct valstr *, natid, void *);
-static void *nsc_lnd_vis(struct valstr *, natid, void *);
-static void *nsc_lnd_frg(struct valstr *, natid, void *);
-static void *nsc_lnd_acc(struct valstr *, natid, void *);
-static void *nsc_lnd_dam(struct valstr *, natid, void *);
-static void *nsc_lnd_aaf(struct valstr *, natid, void *);
-static void *nsc_lchr(struct valstr *, natid, void *);
+static void *nsc_ver(struct valstr *, struct natstr *, void *);
+static void *nsc_pln_att(struct valstr *, struct natstr *, void *);
+static void *nsc_pln_def(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_att(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_def(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_vul(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_spd(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_vis(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_frg(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_acc(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_dam(struct valstr *, struct natstr *, void *);
+static void *nsc_lnd_aaf(struct valstr *, struct natstr *, void *);
+static void *nsc_lchr(struct valstr *, struct natstr *, void *);
/* Ugly hack to improve legibility by avoid long lines */
#define fldoff(fld) offsetof(CURSTR, fld)
*/
static void *
-nsc_ver(struct valstr *val, natid cnum, void *ptr)
+nsc_ver(struct valstr *val, struct natstr *np, void *ptr)
{
struct keymatch *kp = &configkeys[val->val_as.sym.off];
val->val_as.sym.off = 0;
}
static void *
-nsc_pln_def(struct valstr *val, natid cnum, void *ptr)
+nsc_pln_def(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = pln_def(ptr);;
return NULL;
}
static void *
-nsc_pln_att(struct valstr *val, natid cnum, void *ptr)
+nsc_pln_att(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = pln_att(ptr);
return NULL;
}
static void *
-nsc_lnd_att(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_att(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.dbl = lnd_att(ptr);
return NULL;
}
static void *
-nsc_lnd_def(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_def(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.dbl = lnd_def(ptr);
return NULL;
}
static void *
-nsc_lnd_vul(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_vul(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_vul(ptr);
return NULL;
}
static void *
-nsc_lnd_spd(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_spd(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_spd(ptr);
return NULL;
}
static void *
-nsc_lnd_vis(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_vis(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_vis(ptr);
return NULL;
}
static void *
-nsc_lnd_frg(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_frg(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_frg(ptr);
return NULL;
}
static void *
-nsc_lnd_acc(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_acc(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_acc(ptr);
return NULL;
}
static void *
-nsc_lnd_dam(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_dam(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_dam(ptr);
return NULL;
}
static void *
-nsc_lnd_aaf(struct valstr *val, natid cnum, void *ptr)
+nsc_lnd_aaf(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.lng = lnd_aaf(ptr);
return NULL;
}
static void *
-nsc_lchr(struct valstr *val, natid cnum, void *ptr)
+nsc_lchr(struct valstr *val, struct natstr *np, void *ptr)
{
val->val_as.sym.get = NULL;
return lchr + ((struct lndstr *)ptr)->lnd_type;