static int xubody(FILE *);
static int xutail(FILE *, struct castr *);
+/*
+ * Does the code hardcode indexes for table TYPE?
+ */
+static int
+have_hardcoded_indexes(int type)
+{
+ return type == EF_ITEM || type == EF_SECTOR_CHR
+ || type == EF_INFRASTRUCTURE;
+}
+
/*
* Gripe about the current line to stderr, return -1.
*/
if (CANT_HAPPEN(!ca))
return -1;
+ if (have_hardcoded_indexes(type)) {
+ may_omit_id = may_trunc = 0;
+ } else {
+ may_omit_id = 1;
+ may_trunc = empfile[type].nent < 0;
+ }
+
nca = nf = 0;
- may_omit_id = 1;
- may_trunc = empfile[type].nent < 0;
for (i = 0; ca[i].ca_name; i++) {
nca++;
- if (!(ca[i].ca_flags & NSC_EXTRA)) {
+ if (!(ca[i].ca_flags & NSC_EXTRA))
nf += MAX(1, CA_ARRAY_LEN(&ca[i]));
- if (ca[i].ca_flags & NSC_CONST)
- may_omit_id = may_trunc = 0;
- }
}
fldca = malloc(nf * sizeof(*fldca));
fldidx = malloc(nf * sizeof(*fldidx));
tests/empdump/xundump-errors/fld-unexpid1:7: Value for field 1 must be 2
tests/empdump/xundump-errors/fld-unksym:2: Unknown level symbol `xxx' in field 11
tests/empdump/xundump-errors/fld-unparen:2: Unmatched '(' in field 19
-tests/empdump/xundump-errors/ftr-fewrows:2: Expected 1024 more rows
+tests/empdump/xundump-errors/ftr-fewrows:2: Expected 34 more rows
tests/empdump/xundump-errors/ftr-fewrows2:4: Expected 13 more rows
tests/empdump/xundump-errors/ftr-fewrows3:4: Expected 1 more rows
tests/empdump/xundump-errors/ftr-fewrows4:7: Expected row with 2 in field 1, like in table's first part