(lookup, symbol): Rename. Rename members to match selectors and

better reflect their purpose.  Users changed.
(lookup_ca, symbol_ca): Rename.
This commit is contained in:
Markus Armbruster 2005-10-29 07:46:42 +00:00
parent 747d1333cc
commit 02ec5df820
4 changed files with 30 additions and 30 deletions

View file

@ -170,11 +170,11 @@ struct nstr_item {
};
/*
* Symbol table definition
* Symbol binding: associate NAME with VALUE.
*/
struct lookup {
int key;
s_char *value;
struct symbol {
int value;
char *name;
};
/*
@ -215,14 +215,14 @@ extern struct castr nat_ca[];
extern struct castr intrchr_ca[];
extern struct castr rpt_ca[];
extern struct castr empfile_ca[];
extern struct castr lookup_ca[];
extern struct lookup ship_chr_flags[];
extern struct lookup plane_chr_flags[];
extern struct lookup land_chr_flags[];
extern struct lookup nuke_chr_flags[];
extern struct castr symbol_ca[];
extern struct symbol ship_chr_flags[];
extern struct symbol plane_chr_flags[];
extern struct symbol land_chr_flags[];
extern struct symbol nuke_chr_flags[];
extern struct castr mdchr_ca[];
extern struct lookup meta_type[];
extern struct lookup meta_flags[];
extern struct symbol meta_type[];
extern struct symbol meta_flags[];
/* src/lib/subs/nstr.c */
extern int nstr_comp(struct nscstr *np, int len, int type, char *str);

View file

@ -139,25 +139,25 @@ struct empfile empfile[] = {
-1, -1, 0, 0, (char *)empfile, 0, empfile_ca},
{EF_SHIP_CHR_FLAGS, "ship chr flags", NULL, EFF_CFG,
sizeof(ship_chr_flags[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)ship_chr_flags, 0, lookup_ca},
-1, -1, 0, 0, (char *)ship_chr_flags, 0, symbol_ca},
{EF_PLANE_CHR_FLAGS, "plane chr flags", NULL, EFF_CFG,
sizeof(plane_chr_flags[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)plane_chr_flags, 0, lookup_ca},
-1, -1, 0, 0, (char *)plane_chr_flags, 0, symbol_ca},
{EF_LAND_CHR_FLAGS, "land chr flags", NULL, EFF_CFG,
sizeof(land_chr_flags[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)land_chr_flags, 0, lookup_ca},
-1, -1, 0, 0, (char *)land_chr_flags, 0, symbol_ca},
{EF_NUKE_CHR_FLAGS, "nuke chr flags", NULL, EFF_CFG,
sizeof(nuke_chr_flags[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)nuke_chr_flags, 0, lookup_ca},
-1, -1, 0, 0, (char *)nuke_chr_flags, 0, symbol_ca},
{EF_META, "meta", NULL, EFF_CFG,
sizeof(mdchr_ca[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)mdchr_ca, 0, mdchr_ca},
{EF_META_TYPE, "meta type", NULL, EFF_CFG,
sizeof(meta_type[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)meta_type, 0, lookup_ca},
-1, -1, 0, 0, (char *)meta_type, 0, symbol_ca},
{EF_META_FLAGS, "meta flags", NULL, EFF_CFG,
sizeof(meta_flags[0]), NULL, NULL, NULL,
-1, -1, 0, 0, (char *)meta_flags, 0, lookup_ca},
-1, -1, 0, 0, (char *)meta_flags, 0, symbol_ca},
/* Sentinel */
{EF_BAD, NULL, NULL, 0,

View file

@ -504,13 +504,13 @@ struct castr empfile_ca[] = {
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
struct castr lookup_ca[] = {
{NSC_STRING, 0, 0, offsetof(struct lookup, value), "name", EF_BAD},
{NSC_INT, 0, 0, offsetof(struct lookup, key), "value", EF_BAD},
struct castr symbol_ca[] = {
{NSC_STRING, 0, 0, offsetof(struct symbol, name), "name", EF_BAD},
{NSC_INT, 0, 0, offsetof(struct symbol, value), "value", EF_BAD},
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
struct lookup ship_chr_flags[] = {
struct symbol ship_chr_flags[] = {
{M_FOOD, "fish"},
{M_TORP, "torp"},
{M_DCH, "dchrg"},
@ -532,7 +532,7 @@ struct lookup ship_chr_flags[] = {
{0, 0}
};
struct lookup land_chr_flags[] = {
struct symbol land_chr_flags[] = {
{L_XLIGHT, "xlight"},
{L_ENGINEER, "engineer"},
{L_SUPPLY, "supply"},
@ -549,7 +549,7 @@ struct lookup land_chr_flags[] = {
{0, 0}
};
struct lookup plane_chr_flags[] = {
struct symbol plane_chr_flags[] = {
{P_T, "tactical"},
{P_B, "bomber"},
{P_F, "intercept"},
@ -574,7 +574,7 @@ struct lookup plane_chr_flags[] = {
{0, 0}
};
struct lookup nuke_chr_flags[] = {
struct symbol nuke_chr_flags[] = {
{N_NEUT, "neutron"},
{0, 0}
};
@ -588,14 +588,14 @@ struct castr mdchr_ca[] = {
{NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
};
struct lookup meta_flags[] = {
struct symbol meta_flags[] = {
{NSC_DEITY, "DEITY"},
{NSC_EXTRA, "EXTRA"},
{NSC_CONST, "CONST"},
{0, ""}
};
struct lookup meta_type[] = {
struct symbol meta_type[] = {
{NSC_LONG, "d"},
{NSC_DOUBLE, "g"},
{NSC_STRING, "s"},

View file

@ -133,13 +133,13 @@ make_new_list(int tlev, int type)
}
static char *
lookup(int key, struct lookup *table)
lookup(int key, struct symbol *table)
{
int i;
for (i = 0; table[i].value; i++)
if (key == table[i].key)
return table[i].value;
for (i = 0; table[i].name; i++)
if (key == table[i].value)
return table[i].name;
return NULL;
}