]> git.pond.sub.org Git - empserver/blob - src/lib/global/nsc.c
Update copyright notice.
[empserver] / src / lib / global / nsc.c
1 /*
2  *  Empire - A multi-player, client/server Internet based war game.
3  *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
4  *                           Ken Stevens, Steve McClure
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  *  ---
21  *
22  *  See files README, COPYING and CREDITS in the root of the source
23  *  tree for related information and legal notices.  It is expected
24  *  that future projects/authors will amend these files as needed.
25  *
26  *  ---
27  *
28  *  nsc.c: Empire selection global structures
29  * 
30  *  Known contributors to this file:
31  *     Markus Armbruster, 2004-2006
32  */
33
34 /*
35  * Convention: uid selector comes first.  Table TYPE has an uid
36  * selector if empfile[TYPE].cadef[0].ca_table == TYPE.
37  */
38
39 #include <config.h>
40
41 #include <stddef.h>
42 #include "empobj.h"
43 #include "file.h"
44 #include "nsc.h"
45 #include "product.h"
46
47 #define fldoff(str, fld) offsetof(struct str, fld)
48
49 #define NSC_IELT(name, pfx, sfx, base, itype)                   \
50 {NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(unsigned short)),    \
51 sizeof(sfx) == 1 ? name : pfx sfx, EF_BAD}
52
53 #define NSC_IVEC(base, sfx)             \
54 NSC_IELT("civil", "c", sfx, base, I_CIVIL),     \
55 NSC_IELT("milit", "m", sfx, base, I_MILIT),     \
56 NSC_IELT("shell", "s", sfx, base, I_SHELL),     \
57 NSC_IELT("gun", "g", sfx, base, I_GUN),         \
58 NSC_IELT("petrol", "p", sfx, base, I_PETROL),   \
59 NSC_IELT("iron", "i", sfx, base, I_IRON),       \
60 NSC_IELT("dust", "d", sfx, base, I_DUST),       \
61 NSC_IELT("bar", "b", sfx, base, I_BAR),         \
62 NSC_IELT("food", "f", sfx, base, I_FOOD),       \
63 NSC_IELT("oil", "o", sfx, base, I_OIL),         \
64 NSC_IELT("lcm", "l", sfx, base, I_LCM),         \
65 NSC_IELT("hcm", "h", sfx, base, I_HCM),         \
66 NSC_IELT("uw", "u", sfx, base, I_UW),           \
67 NSC_IELT("rad", "r", sfx, base, I_RAD)
68
69 struct castr ichr_ca[] = {
70     {NSC_SITYPE(i_type), 0, 0, offsetof(struct ichrstr, i_uid), "uid",
71      EF_ITEM},
72     {NSC_STRING, 0, 0, offsetof(struct ichrstr, i_name), "name", EF_BAD},
73     {NSC_STRINGY, NSC_CONST, 1, offsetof(struct ichrstr, i_mnem), "mnem",
74      EF_BAD},
75     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_value), "value", EF_BAD},
76     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_sell), "sell", EF_BAD},
77     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_lbs), "lbs", EF_BAD},
78     {NSC_INT, 0, NUMPKG, offsetof(struct ichrstr, i_pkg), "pkg", EF_BAD},
79     {NSC_INT, 0, 0, offsetof(struct ichrstr, i_melt_denom), "melt_denom",
80      EF_BAD},
81     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
82 };
83
84 struct castr pchr_ca[] = {
85     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_uid), "uid", EF_PRODUCT},
86     {NSC_STRING, 0, 0, offsetof(struct pchrstr, p_name), "name", EF_BAD},
87     {NSC_STRING, NSC_CONST, 0, offsetof(struct pchrstr, p_sname), "sname",
88      EF_BAD},
89     {NSC_SITYPE(i_type), 0, MAXPRCON, offsetof(struct pchrstr, p_ctype),
90      "ctype", EF_ITEM},
91     {NSC_USHORT, 0, MAXPRCON, offsetof(struct pchrstr, p_camt), "camt",
92      EF_BAD},
93     {NSC_SITYPE(i_type), 0, 0, offsetof(struct pchrstr, p_type), "type",
94      EF_ITEM},
95     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_level), "level", EF_LEVEL},
96     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_cost), "cost", EF_BAD},
97     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrndx), "nrndx", EF_RESOURCES},
98     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nrdep), "nrdep", EF_BAD},
99     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlndx), "nlndx", EF_LEVEL},
100     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nlmin), "nlmin", EF_BAD},
101     {NSC_INT, 0, 0, offsetof(struct pchrstr, p_nllag), "nllag", EF_BAD},
102     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
103 };
104
105 struct castr sect_ca[] = {
106     /* uid is encoded in x, y */
107     {NSC_NATID, 0, 0, fldoff(sctstr, sct_own), "owner", EF_NATION},
108     {NSC_XCOORD, NSC_CONST, 0, fldoff(sctstr, sct_x), "xloc", EF_BAD},
109     {NSC_YCOORD, NSC_CONST, 0, fldoff(sctstr, sct_y), "yloc", EF_BAD},
110     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_type), "des", EF_SECTOR_CHR},
111     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_effic), "effic", EF_BAD},
112     {NSC_SHORT, 0, 0, fldoff(sctstr, sct_mobil), "mobil", EF_BAD},
113     {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_loyal), "loyal", EF_BAD},
114     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr), "terr", EF_BAD},
115     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(sctstr, sct_terr), "terr0", EF_BAD},
116     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr1), "terr1", EF_BAD},
117     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr2), "terr2", EF_BAD},
118     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_terr3), "terr3", EF_BAD},
119     {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_dterr), "dterr", EF_BAD},
120     {NSC_XCOORD, 0, 0, fldoff(sctstr, sct_dist_x), "xdist", EF_BAD},
121     {NSC_YCOORD, 0, 0, fldoff(sctstr, sct_dist_y), "ydist", EF_BAD},
122     {NSC_SHORT, 0, 0, fldoff(sctstr, sct_avail), "avail", EF_BAD},
123     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_work), "work", EF_BAD},
124     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_coastal), "coastal", EF_BAD},
125     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_newtype), "newdes", EF_SECTOR_CHR},
126     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_min), "min", EF_BAD},
127     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_gmin), "gold", EF_BAD},
128     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_fertil), "fert", EF_BAD},
129     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_oil), "ocontent", EF_BAD},
130     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_uran), "uran", EF_BAD},
131     {NSC_NATID, 0, 0, fldoff(sctstr, sct_oldown), "oldown", EF_NATION},
132     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_off), "off", EF_BAD},
133     NSC_IVEC(fldoff(sctstr, sct_item), ""),
134     NSC_IVEC(fldoff(sctstr, sct_dist), "_dist"),
135     NSC_IVEC(fldoff(sctstr, sct_del), "_del"),
136     /* should let old owner access mines, but can't express that: */
137     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_mines), "mines", EF_BAD},
138     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_pstage), "pstage",
139      EF_PLAGUE_STAGES},
140     {NSC_SHORT, NSC_DEITY, 0, fldoff(sctstr, sct_ptime), "ptime", EF_BAD},
141     {NSC_UCHAR, NSC_DEITY, 0, fldoff(sctstr, sct_che), "che", EF_BAD},
142     {NSC_NATID, NSC_DEITY, 0, fldoff(sctstr, sct_che_target), "che_target",
143      EF_NATION},
144     {NSC_USHORT, 0, 0, fldoff(sctstr, sct_fallout), "fallout", EF_BAD},
145     {NSC_TIME, 0, 0, fldoff(sctstr, sct_access), "access", EF_BAD},
146     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_road), "road", EF_BAD},
147     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_rail), "rail", EF_BAD},
148     {NSC_UCHAR, 0, 0, fldoff(sctstr, sct_defense), "dfense", EF_BAD},
149     {NSC_TIME, NSC_EXTRA, 0, fldoff(sctstr, sct_timestamp), "timestamp",
150      EF_BAD},
151     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
152 };
153
154 struct castr dchr_ca[] = {
155     {NSC_UCHAR, 0, 0, offsetof(struct dchrstr, d_uid), "uid", EF_SECTOR_CHR},
156     {NSC_STRING, 0, 0, offsetof(struct dchrstr, d_name), "name", EF_BAD},
157     {NSC_STRINGY, NSC_CONST, 1, offsetof(struct dchrstr, d_mnem), "mnem",
158      EF_BAD},
159     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_prd), "prd", EF_PRODUCT},
160     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_peffic), "peffic", EF_BAD},
161     {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_mob0), "mob0", EF_BAD},
162     {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_mob1), "mob1", EF_BAD},
163     {NSC_SITYPE(d_navigation), 0, 0, offsetof(struct dchrstr, d_nav), "nav",
164      EF_SECTOR_NAVIGATION},
165     {NSC_SITYPE(i_packing), 0, 0, offsetof(struct dchrstr, d_pkg), "pkg",
166      EF_PACKING},
167     {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_ostr), "ostr", EF_BAD},
168     {NSC_FLOAT, 0, 0, offsetof(struct dchrstr, d_dstr), "dstr", EF_BAD},
169     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_value), "value", EF_BAD},
170     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_cost), "cost", EF_BAD},
171     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_build), "build", EF_BAD},
172     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_lcms), "lcms", EF_BAD},
173     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_hcms), "hcms", EF_BAD},
174     {NSC_INT, 0, 0, offsetof(struct dchrstr, d_maxpop), "maxpop", EF_BAD},
175     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
176 };
177
178 #define NSC_GENITEM(ef_type, ef_chr)                                    \
179 { NSC_SHORT, 0, 0, fldoff(empobj, uid), "uid", ef_type},                \
180 { NSC_NATID, 0, 0, fldoff(empobj, own), "owner", EF_NATION},            \
181 { NSC_XCOORD, 0, 0, fldoff(empobj, x), "xloc", EF_BAD},         \
182 { NSC_YCOORD, 0, 0, fldoff(empobj, y), "yloc", EF_BAD},         \
183 { NSC_CHAR, 0, 0, fldoff(empobj, type), "type", ef_chr},                \
184 { NSC_CHAR, 0, 0, fldoff(empobj, effic), "effic", EF_BAD},              \
185 { NSC_CHAR , 0, 0, fldoff(empobj, mobil), "mobil", EF_BAD},             \
186 { NSC_UCHAR , 0, 0, fldoff(empobj, off), "off", EF_BAD},                \
187 { NSC_SHORT, 0, 0, fldoff(empobj, tech), "tech", EF_BAD},               \
188 { NSC_STRINGY, NSC_EXTRA, 1, fldoff(empobj, group), "group", EF_BAD},   \
189 { NSC_XCOORD, 0, 0, fldoff(empobj, opx), "opx", EF_BAD},                \
190 { NSC_YCOORD, 0, 0, fldoff(empobj, opy), "opy", EF_BAD},                \
191 { NSC_SHORT, 0, 0, fldoff(empobj, mission), "mission", EF_MISSIONS},    \
192 { NSC_SHORT, 0, 0, fldoff(empobj, radius), "radius", EF_BAD}
193
194 struct castr ship_ca[] = {
195     NSC_GENITEM(EF_SHIP, EF_SHIP_CHR),
196     {NSC_STRINGY, 0, 1, fldoff(shpstr, shp_fleet), "fleet", EF_BAD},
197     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nplane), "nplane", EF_BAD},
198     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nland), "nland", EF_BAD},
199     {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[0]), "xstart", EF_BAD},
200     {NSC_XCOORD, 0, 0, fldoff(shpstr, shp_destx[1]), "xend", EF_BAD},
201     {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[0]), "ystart", EF_BAD},
202     {NSC_YCOORD, 0, 0, fldoff(shpstr, shp_desty[1]), "yend", EF_BAD},
203     {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tstart), "cargostart",
204      EF_ITEM},
205     {NSC_SITYPE(i_type), 0, TMAX, fldoff(shpstr, shp_tend), "cargoend",
206      EF_ITEM},
207     {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lstart), "amtstart", EF_BAD},
208     {NSC_SHORT, 0, TMAX, fldoff(shpstr, shp_lend), "amtend", EF_BAD},
209     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_autonav), "autonav", EF_BAD},
210     NSC_IVEC(fldoff(shpstr, shp_item), ""),
211     {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_pstage), "pstage",
212      EF_PLAGUE_STAGES},
213     {NSC_SHORT, NSC_DEITY, 0, fldoff(shpstr, shp_ptime), "ptime", EF_BAD},
214     {NSC_TIME, 0, 0, fldoff(shpstr, shp_access), "access", EF_BAD},
215     {NSC_TIME, NSC_EXTRA, 0, fldoff(shpstr, shp_timestamp), "timestamp",
216      EF_BAD},
217     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_mobquota), "mquota", EF_BAD},
218     {NSC_STRINGY, 0, MAXSHPPATH, fldoff(shpstr, shp_path), "path", EF_BAD},
219     {NSC_SHORT, 0, 0, fldoff(shpstr, shp_follow), "follow", EF_BAD},
220     {NSC_STRINGY, 0, MAXSHPNAMLEN, fldoff(shpstr, shp_name), "name", EF_BAD},
221     {NSC_UCHAR, 0, 0, fldoff(shpstr, shp_fuel), "fuel", EF_BAD},
222     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nchoppers), "nchoppers",
223      EF_BAD},
224     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(shpstr, shp_nxlight), "nxlight", EF_BAD},
225     /* should let builder access xbuilt, ybuilt, but can't express that: */
226     {NSC_XCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_x), "xbuilt", EF_BAD},
227     {NSC_YCOORD, NSC_DEITY, 0, fldoff(shpstr, shp_orig_y), "ybuilt", EF_BAD},
228     {NSC_NATID, NSC_DEITY, 0, fldoff(shpstr, shp_orig_own), "builder",
229      EF_NATION},
230     {NSC_INT, NSC_BITS, 0, fldoff(shpstr, shp_rflags), "rflags",
231      EF_RETREAT_FLAGS},
232     {NSC_STRINGY, 0, RET_LEN, fldoff(shpstr, shp_rpath), "rpath", EF_BAD},
233     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
234 };
235
236 struct castr mchr_ca[] = {
237     {NSC_CHAR, 0, 0, offsetof(struct mchrstr, m_type), "type", EF_SHIP_CHR},
238     {NSC_STRING, 0, 0, offsetof(struct mchrstr, m_name), "name", EF_BAD},
239     NSC_IVEC(offsetof(struct mchrstr, m_item), ""),
240     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_lcm), "l_build", EF_BAD},
241     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_hcm), "h_build", EF_BAD},
242     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_armor), "armor", EF_BAD},
243     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_speed), "speed", EF_BAD},
244     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_visib), "visib", EF_BAD},
245     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_vrnge), "vrnge", EF_BAD},
246     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_frnge), "frnge", EF_BAD},
247     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_glim), "glim", EF_BAD},
248     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nxlight), "nxlight", EF_BAD},
249     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nchoppers), "nchoppers",
250      EF_BAD},
251     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelc), "fuelc", EF_BAD},
252     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_fuelu), "fuelu", EF_BAD},
253     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_tech), "tech", EF_BAD},
254     {NSC_INT, 0, 0, offsetof(struct mchrstr, m_cost), "cost", EF_BAD},
255     {NSC_LONG, NSC_BITS, 0, offsetof(struct mchrstr, m_flags), "flags",
256      EF_SHIP_CHR_FLAGS},
257     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nplanes), "nplanes", EF_BAD},
258     {NSC_UCHAR, 0, 0, offsetof(struct mchrstr, m_nland), "nland", EF_BAD},
259     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
260 };
261
262 struct castr plane_ca[] = {
263     NSC_GENITEM(EF_PLANE, EF_PLANE_CHR),
264     {NSC_STRINGY, 0, 1, fldoff(plnstr, pln_wing), "wing", EF_BAD},
265     {NSC_UCHAR, 0, 0, fldoff(plnstr, pln_range), "range", EF_BAD},
266     {NSC_SHORT, 0, 0, fldoff(plnstr, pln_ship), "ship", EF_BAD},
267     {NSC_SHORT, 0, 0, fldoff(plnstr, pln_land), "land", EF_BAD},
268     {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_att), "att", EF_BAD},
269     {NSC_INT, NSC_EXTRA, 0, fldoff(plnstr, pln_def), "def", EF_BAD},
270     {NSC_CHAR, 0, 0, fldoff(plnstr, pln_harden), "harden", EF_BAD},
271     {NSC_CHAR, 0, 0, fldoff(plnstr, pln_nuketype), "nuketype", EF_BAD},
272     {NSC_CHAR, NSC_BITS, 0, fldoff(plnstr, pln_flags), "flags",
273      EF_PLANE_FLAGS},
274     {NSC_TIME, 0, 0, fldoff(plnstr, pln_access), "access", EF_BAD},
275     {NSC_TIME, NSC_EXTRA, 0, fldoff(plnstr, pln_timestamp), "timestamp",
276      EF_BAD},
277     {NSC_FLOAT, 0, 0, fldoff(plnstr, pln_theta), "theta", EF_BAD},
278     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
279 };
280
281 struct castr plchr_ca[] = {
282     {NSC_CHAR, 0, 0, offsetof(struct plchrstr, pl_type), "type", EF_PLANE_CHR},
283     {NSC_STRING, 0, 0, offsetof(struct plchrstr, pl_name), "name", EF_BAD},
284     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_lcm), "l_build", EF_BAD},
285     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_hcm), "h_build", EF_BAD},
286     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_cost), "cost", EF_BAD},
287     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_tech), "tech", EF_BAD},
288     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_acc), "acc", EF_BAD},
289     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_load), "load", EF_BAD},
290     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_att), "att", EF_BAD},
291     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_def), "def", EF_BAD},
292     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_range), "range", EF_BAD},
293     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_crew), "crew", EF_BAD},
294     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_fuel), "fuel", EF_BAD},
295     {NSC_INT, 0, 0, offsetof(struct plchrstr, pl_stealth), "stealth", EF_BAD},
296     {NSC_INT, NSC_BITS, 0, offsetof(struct plchrstr, pl_flags), "flags",
297      EF_PLANE_CHR_FLAGS},
298     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
299 };
300
301 struct castr land_ca[] = {
302     NSC_GENITEM(EF_LAND, EF_LAND_CHR),
303     {NSC_STRINGY, 0, 1, fldoff(lndstr, lnd_army), "army", EF_BAD},
304     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_ship), "ship", EF_BAD},
305     {NSC_CHAR, 0, 0, fldoff(lndstr, lnd_harden), "harden", EF_BAD},
306     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_retreat), "retreat", EF_BAD},
307     {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_fuel), "fuel", EF_BAD},
308     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nxlight), "nxlight", EF_BAD},
309     {NSC_INT, NSC_BITS, 0, fldoff(lndstr, lnd_rflags), "rflags",
310      EF_RETREAT_FLAGS},
311     {NSC_STRINGY, 0, RET_LEN, fldoff(lndstr, lnd_rpath), "rpath", EF_BAD},
312     {NSC_UCHAR, 0, 0, fldoff(lndstr, lnd_rad_max), "react", EF_BAD},
313     NSC_IVEC(fldoff(lndstr, lnd_item), ""),
314     {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_pstage), "pstage",
315      EF_PLAGUE_STAGES},
316     {NSC_SHORT, NSC_DEITY, 0, fldoff(lndstr, lnd_ptime), "ptime", EF_BAD},
317     {NSC_SHORT, 0, 0, fldoff(lndstr, lnd_land), "land", EF_BAD},
318     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_nland), "nland", EF_BAD},
319     {NSC_TIME, 0, 0, fldoff(lndstr, lnd_access), "access", EF_BAD},
320     {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_att), "att", EF_BAD},
321     {NSC_FLOAT, NSC_EXTRA, 0, fldoff(lndstr, lnd_def), "def", EF_BAD},
322     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vul), "vul", EF_BAD},
323     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spd), "spd", EF_BAD},
324     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_vis), "vis", EF_BAD},
325     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_spy), "spy", EF_BAD},
326     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_rad), "rmax", EF_BAD},
327     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_frg), "frg", EF_BAD},
328     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_acc), "acc", EF_BAD},
329     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_dam), "dam", EF_BAD},
330     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_ammo), "ammo", EF_BAD},
331     {NSC_INT, NSC_EXTRA, 0, fldoff(lndstr, lnd_aaf), "aaf", EF_BAD},
332     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelc), "fuelc", EF_BAD},
333     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_fuelu), "fuelu", EF_BAD},
334     {NSC_UCHAR, NSC_EXTRA, 0, fldoff(lndstr, lnd_maxlight), "maxlight",
335      EF_BAD},
336     {NSC_TIME, NSC_EXTRA, 0, fldoff(lndstr, lnd_timestamp), "timestamp",
337      EF_BAD},
338     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
339 };
340
341 struct castr lchr_ca[] = {
342     {NSC_CHAR, 0, 0, offsetof(struct lchrstr, l_type), "type", EF_LAND_CHR},
343     {NSC_STRING, 0, 0, offsetof(struct lchrstr, l_name), "name", EF_BAD},
344     NSC_IVEC(offsetof(struct lchrstr, l_item), ""),
345     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_lcm), "l_build", EF_BAD},
346     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_hcm), "h_build", EF_BAD},
347     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_tech), "tech", EF_BAD},
348     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_cost), "cost", EF_BAD},
349     {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_att), "att", EF_BAD},
350     {NSC_FLOAT, 0, 0, offsetof(struct lchrstr, l_def), "def", EF_BAD},
351     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vul), "vul", EF_BAD},
352     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spd), "spd", EF_BAD},
353     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_vis), "vis", EF_BAD},
354     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_spy), "spy", EF_BAD},
355     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_rad), "rmax", EF_BAD},
356     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_frg), "frg", EF_BAD},
357     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_acc), "acc", EF_BAD},
358     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_dam), "dam", EF_BAD},
359     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_ammo), "ammo", EF_BAD},
360     {NSC_INT, 0, 0, offsetof(struct lchrstr, l_aaf), "aaf", EF_BAD},
361     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelc), "fuelc", EF_BAD},
362     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_fuelu), "fuelu", EF_BAD},
363     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_nxlight), "nxlight", EF_BAD},
364     {NSC_UCHAR, 0, 0, offsetof(struct lchrstr, l_nland), "nland", EF_BAD},
365     {NSC_LONG, NSC_BITS, 0, offsetof(struct lchrstr, l_flags), "flags",
366      EF_LAND_CHR_FLAGS},
367     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
368 };
369
370 struct castr nuke_ca[] = {
371     NSC_GENITEM(EF_NUKE, EF_NUKE_CHR),
372     {NSC_SHORT, 0, 0, fldoff(nukstr, nuk_plane), "plane", EF_BAD},
373     {NSC_TIME, NSC_EXTRA, 0, fldoff(nukstr, nuk_timestamp), "timestamp",
374      EF_BAD},
375     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
376 };
377
378 struct castr nchr_ca[] = {
379     {NSC_CHAR, 0, 0, offsetof(struct nchrstr, n_type), "type", EF_NUKE_CHR},
380     {NSC_STRING, 0, 0, offsetof(struct nchrstr, n_name), "name", EF_BAD},
381     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_lcm), "l_build", EF_BAD},
382     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_hcm), "h_build", EF_BAD},
383     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_oil), "o_build", EF_BAD},
384     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_rad), "r_build", EF_BAD},
385     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_blast), "blast", EF_BAD},
386     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_dam), "dam", EF_BAD},
387     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_cost), "cost", EF_BAD},
388     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_tech), "tech", EF_BAD},
389     {NSC_INT, 0, 0, offsetof(struct nchrstr, n_weight), "weight", EF_BAD},
390     {NSC_INT, NSC_BITS, 0, offsetof(struct nchrstr, n_flags), "flags",
391      EF_NUKE_CHR_FLAGS},
392     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
393 };
394
395 struct castr treaty_ca[] = {
396     {NSC_SHORT, 0, 0, fldoff(trtstr, trt_uid), "uid", EF_TREATY},
397     {NSC_NATID, 0, 0, fldoff(trtstr, trt_cna), "cna", EF_NATION},
398     {NSC_NATID, 0, 0, fldoff(trtstr, trt_cnb), "cnb", EF_NATION},
399     {NSC_CHAR, 0, 0, fldoff(trtstr, trt_status), "status",
400      EF_AGREEMENT_STATUS},
401     {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_acond), "acond",
402      EF_TREATY_FLAGS},
403     {NSC_SHORT, NSC_BITS, 0, fldoff(trtstr, trt_bcond), "bcond",
404      EF_TREATY_FLAGS},
405     {NSC_TIME, 0, 0, fldoff(trtstr, trt_exp), "exp", EF_BAD},
406     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
407 };
408
409 struct castr loan_ca[] = {
410     {NSC_SHORT, 0, 0, fldoff(lonstr, l_uid), "uid", EF_LOAN},
411     {NSC_NATID, 0, 0, fldoff(lonstr, l_loner), "loaner", EF_NATION},
412     {NSC_NATID, 0, 0, fldoff(lonstr, l_lonee), "loanee", EF_NATION},
413     {NSC_CHAR, 0, 0, fldoff(lonstr, l_status), "status",
414      EF_AGREEMENT_STATUS},
415     {NSC_INT, 0, 0, fldoff(lonstr, l_irate), "irate", EF_BAD},
416     {NSC_INT, 0, 0, fldoff(lonstr, l_ldur), "ldur", EF_BAD},
417     {NSC_LONG, 0, 0, fldoff(lonstr, l_amtpaid), "amtpaid", EF_BAD},
418     {NSC_LONG, 0, 0, fldoff(lonstr, l_amtdue), "amtdue", EF_BAD},
419     {NSC_TIME, 0, 0, fldoff(lonstr, l_lastpay), "lastpay", EF_BAD},
420     {NSC_TIME, 0, 0, fldoff(lonstr, l_duedate), "duedate", EF_BAD},
421     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
422 };
423
424 struct castr news_ca[] = {
425     /* no need for uid as long as it's not referenced from other tables */
426     {NSC_NATID, 0, 0, fldoff(nwsstr, nws_ano), "actor", EF_NATION},
427     {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_vrb), "action", EF_NEWS_CHR},
428     {NSC_NATID, 0, 0, fldoff(nwsstr, nws_vno), "victim", EF_NATION},
429     {NSC_CHAR, 0, 0, fldoff(nwsstr, nws_ntm), "times", EF_BAD},
430     {NSC_TIME, 0, 0, fldoff(nwsstr, nws_when), "time", EF_BAD},
431     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
432 };
433
434 struct castr lost_ca[] = {
435     /* no need for uid as long as it's not referenced from other tables */
436     {NSC_NATID, 0, 0, fldoff(loststr, lost_owner), "owner", EF_NATION},
437     {NSC_CHAR, 0, 0, fldoff(loststr, lost_type), "type", EF_TABLE},
438     {NSC_SHORT, 0, 0, fldoff(loststr, lost_id), "id", EF_BAD},
439     {NSC_XCOORD, 0, 0, fldoff(loststr, lost_x), "x", EF_BAD},
440     {NSC_YCOORD, 0, 0, fldoff(loststr, lost_y), "y", EF_BAD},
441     {NSC_TIME, 0, 0, fldoff(loststr, lost_timestamp), "timestamp", EF_BAD},
442     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
443 };
444
445 struct castr commodity_ca[] = {
446     {NSC_SHORT, 0, 0, fldoff(comstr, com_uid), "uid", EF_COMM},
447     {NSC_NATID, 0, 0, fldoff(comstr, com_owner), "owner", EF_NATION},
448     {NSC_SITYPE(i_type), 0, 0, fldoff(comstr, com_type), "type", EF_ITEM},
449     {NSC_INT, 0, 0, fldoff(comstr, com_amount), "amount", EF_BAD},
450     {NSC_FLOAT, 0, 0, fldoff(comstr, com_price), "price", EF_BAD},
451     {NSC_INT, 0, 0, fldoff(comstr, com_maxbidder), "maxbidder", EF_NATION},
452     {NSC_TIME, 0, 0, fldoff(comstr, com_markettime), "markettime", EF_BAD},
453     /* should let maxbidder access xbuy, ybuy, but can't express that: */
454     {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_x), "xbuy", EF_BAD},
455     {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, com_y), "ybuy", EF_BAD},
456     /* should let owner access xsell, ysell, but can't express that: */
457     {NSC_XCOORD, NSC_DEITY, 0, fldoff(comstr, sell_x), "xsell", EF_BAD},
458     {NSC_YCOORD, NSC_DEITY, 0, fldoff(comstr, sell_y), "ysell", EF_BAD},
459     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
460 };
461
462 struct castr trade_ca[] = {
463     {NSC_SHORT, 0, 0, fldoff(trdstr, trd_uid), "uid", EF_TRADE},
464     {NSC_NATID, 0, 0, fldoff(trdstr, trd_owner), "owner", EF_NATION},
465     {NSC_CHAR, 0, 0, fldoff(trdstr, trd_type), "type", EF_TABLE},
466     {NSC_SHORT, 0, 0, fldoff(trdstr, trd_unitid), "unitid", EF_BAD},
467     {NSC_LONG, 0, 0, fldoff(trdstr, trd_price), "price", EF_BAD},
468     {NSC_INT, 0, 0, fldoff(trdstr, trd_maxbidder), "maxbidder", EF_NATION},
469     {NSC_TIME, 0, 0, fldoff(trdstr, trd_markettime), "markettime", EF_BAD},
470     /* should let maxbidder access xloc, yloc, but can't express that: */
471     {NSC_XCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_x), "xloc", EF_BAD},
472     {NSC_YCOORD, NSC_DEITY, 0, fldoff(trdstr, trd_y), "yloc", EF_BAD},
473     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
474 };
475
476 struct castr cou_ca[] = {
477     /*
478      * This is the owner's view, i.e. it applies only to the own
479      * nation.  The public view nat_ca[], which applies to all
480      * nations, has the same selectors with different flags: NSC_DEITY
481      * is set except for cnum (which must come first) and all
482      * NSC_EXTRA selectors, NSC_EXTRA is cleared.
483      * nat_ca[] should also make tech, research, education and
484      * happiness available, but we can't express the obfuscation
485      * necessary for foreign levels.
486      */
487     {NSC_NATID, 0, 0, fldoff(natstr, nat_cnum), "cnum", EF_NATION},
488     {NSC_SITYPE(nat_status), NSC_EXTRA, 0, fldoff(natstr, nat_stat),
489      "stat", EF_NATION_STATUS},
490     {NSC_STRINGY, NSC_EXTRA, 20, fldoff(natstr, nat_cnam), "cname", EF_BAD},
491     {NSC_STRINGY, NSC_DEITY | NSC_EXTRA, 20, fldoff(natstr, nat_pnam),
492      "passwd", EF_BAD},
493     {NSC_STRINGY, 0, 32, fldoff(natstr, nat_hostaddr), "ip", EF_BAD},
494     {NSC_STRINGY, 0, 512, fldoff(natstr, nat_hostname), "hostname", EF_BAD},
495     {NSC_STRINGY, 0, 32, fldoff(natstr, nat_userid), "userid", EF_BAD},
496     {NSC_XCOORD, 0, 0, fldoff(natstr, nat_xcap), "xcap", EF_BAD},
497     {NSC_YCOORD, 0, 0, fldoff(natstr, nat_ycap), "ycap", EF_BAD},
498     {NSC_XCOORD, NSC_DEITY | NSC_EXTRA, 0, fldoff(natstr, nat_xorg),
499      "xorg", EF_BAD},
500     {NSC_YCOORD, NSC_DEITY | NSC_EXTRA, 0, fldoff(natstr, nat_yorg),
501      "yorg", EF_BAD},
502     {NSC_CHAR, 0, 0, fldoff(natstr, nat_dayno), "dayno", EF_BAD},
503     {NSC_CHAR, 0, 0, fldoff(natstr, nat_update), "update", EF_BAD},
504     {NSC_UCHAR, 0, 0, fldoff(natstr, nat_missed), "missed", EF_BAD},
505     {NSC_USHORT, 0, 0, fldoff(natstr, nat_tgms), "tgms", EF_BAD},
506     {NSC_USHORT, 0, 0, fldoff(natstr, nat_ann), "ann", EF_BAD},
507     {NSC_USHORT, 0, 0, fldoff(natstr, nat_minused), "minused", EF_BAD},
508     {NSC_SHORT, 0, 0, fldoff(natstr, nat_btu), "btu", EF_BAD},
509     {NSC_LONG, 0, 0, fldoff(natstr, nat_reserve), "milreserve", EF_BAD},
510     {NSC_LONG, 0, 0, fldoff(natstr, nat_money), "money", EF_BAD},
511     {NSC_TIME, 0, 0, fldoff(natstr, nat_last_login), "login", EF_BAD},
512     {NSC_TIME, 0, 0, fldoff(natstr, nat_last_logout), "logout", EF_BAD},
513     {NSC_TIME, 0, 0, fldoff(natstr, nat_newstim), "newstim", EF_BAD},
514     {NSC_TIME, 0, 0, fldoff(natstr, nat_annotim), "annotim", EF_BAD},
515     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_TLEV]), "tech", EF_BAD},
516     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_RLEV]), "research", EF_BAD},
517     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_ELEV]), "education",
518      EF_BAD},
519     {NSC_FLOAT, 0, 0, fldoff(natstr, nat_level[NAT_HLEV]), "happiness",
520      EF_BAD},
521     {NSC_HIDDEN, NSC_EXTRA, MAXNOC, fldoff(natstr, nat_relate), "relations",
522      EF_NATION_RELATIONS},
523     /* mortals know there's contact (relations show), but not how strong */
524     {NSC_UCHAR, NSC_DEITY | NSC_EXTRA, MAXNOC, fldoff(natstr, nat_contact),
525      "contacts", EF_BAD},
526     {NSC_UCHAR, NSC_EXTRA | NSC_BITS, MAXNOC, fldoff(natstr, nat_rejects),
527      "rejects", EF_NATION_REJECTS},
528     /* FIXME nat_priorities[] */
529     {NSC_LONG, NSC_BITS, 0, fldoff(natstr, nat_flags), "flags",
530      EF_NATION_FLAGS},
531     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
532 };
533
534 struct castr nat_ca[sizeof(cou_ca) / sizeof(*cou_ca)];
535 /* initialized in ef_init_srv() */
536
537 struct castr realm_ca[] = {
538     /* uid is encoded in cnum, realm */
539     {NSC_NATID, NSC_CONST, 0, fldoff(realmstr, r_cnum), "cnum", EF_NATION},
540     {NSC_USHORT, NSC_CONST, 0, fldoff(realmstr, r_realm), "realm", EF_BAD},
541     {NSC_SHORT, 0, 0, fldoff(realmstr, r_xl), "xl", EF_BAD},
542     {NSC_SHORT, 0, 0, fldoff(realmstr, r_xh), "xh", EF_BAD},
543     {NSC_SHORT, 0, 0, fldoff(realmstr, r_yl), "yl", EF_BAD},
544     {NSC_SHORT, 0, 0, fldoff(realmstr, r_yh), "yh", EF_BAD},
545     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
546 };
547
548 struct castr intrchr_ca[] = {
549     /* no need for uid as long as it's not referenced from other tables */
550     {NSC_STRING, NSC_CONST, 0, offsetof(struct sctintrins, in_name), "name",
551      EF_BAD},
552     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_lcms), "lcms", EF_BAD},
553     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_hcms), "hcms", EF_BAD},
554     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_dcost), "dcost", EF_BAD},
555     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_mcost), "mcost", EF_BAD},
556     {NSC_UCHAR, 0, 0, offsetof(struct sctintrins, in_enable), "enable",
557      EF_BAD},
558     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
559 };
560
561 struct castr rpt_ca[] = {
562     {NSC_CHAR, 0, 0, offsetof(struct rptstr, r_uid), "uid", EF_NEWS_CHR},
563     {NSC_STRING, 0, NUM_RPTS, offsetof(struct rptstr, r_newstory), "newstory",
564      EF_BAD},
565     {NSC_INT, 0, 0, offsetof(struct rptstr, r_good_will), "good_will", EF_BAD},
566     {NSC_INT, 0, 0, offsetof(struct rptstr, r_newspage), "newspage",
567      EF_PAGE_HEADINGS},
568     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
569 };
570
571 struct castr empfile_ca[] = {
572     {NSC_INT, 0, 0, offsetof(struct empfile, uid), "uid", EF_TABLE},
573     {NSC_STRING, NSC_CONST, 0, offsetof(struct empfile, name), "name", EF_BAD},
574     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
575 };
576
577 struct castr symbol_ca[] = {
578     /*
579      * value is is const because it has to match what is compiled into
580      * the server.  name is const because clients key on it.
581      */
582     {NSC_INT, NSC_CONST, 0, offsetof(struct symbol, value), "value", EF_BAD},
583     {NSC_STRING, NSC_CONST, 0, offsetof(struct symbol, name), "name", EF_BAD},
584     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
585 };
586 struct castr mdchr_ca[] = {
587     /* no need for uid */
588     /* name must come first, clients may rely on it */
589     {NSC_STRING, NSC_CONST, 0, offsetof(struct castr, ca_name), "name",
590      EF_BAD},
591     {NSC_CHAR, NSC_CONST, 0, offsetof(struct castr, ca_type), "type",
592      EF_META_TYPE},
593     {NSC_UCHAR, NSC_CONST | NSC_BITS, 0, offsetof(struct castr, ca_flags),
594      "flags", EF_META_FLAGS},
595     {NSC_USHORT, NSC_CONST, 0, offsetof(struct castr, ca_len), "len",
596      EF_BAD},
597     {NSC_INT, NSC_CONST, 0, offsetof(struct castr, ca_table), "table",
598      EF_BAD},
599     {NSC_NOTYPE, 0, 0, 0, NULL, EF_BAD}
600 };