Commit graph

52 commits

Author SHA1 Message Date
86a0a43960 (xuheader1): New, factored out of xundump(). 2006-02-12 15:52:10 +00:00
10096cbf98 (xundump): Rev. 1.44 broke ef_load(). Fix. 2006-02-09 18:34:57 +00:00
66669be655 (xundump, xundump1): Fix treatment of empty lines. 2006-02-09 07:10:18 +00:00
Ron Koenderink
f76a128f5c (mtsymset, xutrailer, xundump1): Remove unused variables. 2006-02-09 00:28:28 +00:00
f5621c5a49 Accept fields out of order in human-readable syntax (indexes must
still be in order), support abbreviated field names:
(nxt_sel, nxt_idx, nxtfld, ca4fld): Remove.
(nflds, fldca, fldidx, caflds, getfld): New.
(xundump): Initialize and finalize them.
(xundump1): New, factored out of xundump().
(deffld): Match names, record field order in fldca[], fldidx[] for
getfld().  Use caflds[] to detect duplicates.
(xufldname): Catch negative index.  Used to pass it to deffld(), which
now interprets it as no index.
(setnum, setstr, setsym, mtsymset, add2symset): Use getfld().

(xufld): Improve error message.

(setstr): Fix for NULL strings.

(xuheader): Catch null ef_cadef().

(xuheader): Don't oops when an unexpected table can't be undumped.
2006-02-08 23:23:48 +00:00
28787caa95 Improve error messages. 2006-02-08 22:44:22 +00:00
b11aa718ce The separation between parsing and semantic actions is awkward and
leaks memory; rework it:
(deffld): New; semantic action for field headers.
(xufldname): Use it instead of storing a value for xucolumnheader().
(xucolumnheader): Remove, use xuflds() directly instead.
(setnum, setstr, setsym): New; semantic actions for field values.
(xufld): Use it instead of storing a value for xuloadrow().
(xuloadrow): Remove.  Was incomplete.
(xufldname, xufld, xuflds): Remove parameter values.  Callers
changed.
(cur_type, cur_obj, nxt_sel, nxt_idx, nxtfld, ca4fld, getsymtab): New
helpers.
(xundump): Initialize them.
(enum_value, value, freeflds, xunsymbol): Remove.

(mtsymset, add2symset): New.
(xufld): Use them to build a symbol set along the parse.

(xufldname, xufld, xuheader, xutrailer, xundump): Increment lineno
when and only when a linefeed is consumed, to make sure it is correct.
Move some semantic checks so that errors get reported for the correct
line.

(xundump): Use compare filenames as pointers, not strings, when
checking whether to reset lineno.

(xundump): Keep empfile[type] consistent during parse, to make
ef_ptr() usable.

(xundump): Don't call ep->init() on sentinels.
(xuinitrow): Unused, remove.
2006-02-08 22:32:53 +00:00
054d59b323 (xundump): Precise value for need_sentinel. 2006-02-08 22:02:13 +00:00
d329c4f8e6 (xutrailer): Fix parsing of /config. Change human-readable syntax not
to accept number of records.  Don't skip empty lines after trailer.
2006-02-08 21:53:04 +00:00
72127c838f (xuheader): Check for unexpected table before oopsing on !EFF_MEM. 2006-02-08 21:41:48 +00:00
8a6438b4e0 (xufldname, xufld): New, factored out of xuflds and specialized for
headers and for body lines, respectively.
(xflds): Call them through new parameter parse.  Callers changed.
2006-02-08 20:56:39 +00:00
361e33d70f (xucolumnheader): Don't gripe when xuflds() fails, because that one
already griped.
2006-02-08 20:49:47 +00:00
Ron Koenderink
426eece569 Properly parse and validate column headers:
(enum_value, value, xuflds, freeflds): Parse additional syntax:
numeric and symbolic index.
(xucolumnheader): Use it to parse column header line.  Check names
and indexes match meta-data.  Symbolic indexes not yet implemented.
(xuloadrow): Reject the additional syntax.
2006-01-30 22:23:43 +00:00
Ron Koenderink
79f672969b (xuheader): Remove values[], not used. 2006-01-29 19:12:52 +00:00
Ron Koenderink
8900dfaa3d (xuflds): Terminated the value list when a bad separator is found. 2006-01-22 17:37:05 +00:00
4515b84c59 COPYING duplicates information from README. Remove. Move GPL from
LICENSE to COPYING, because that's where it usually is.  Update all
the references to these files.
2006-01-21 19:48:41 +00:00
Ron Koenderink
036a623a40 (xunsymbol): Ensure the table is a symbol table before searching it. 2006-01-21 17:33:02 +00:00
Ron Koenderink
cf384676e8 (xuloadrow): Add support for NSC_SHORT. 2006-01-08 04:11:15 +00:00
3e400c018c Update copyright notice. 2006-01-05 13:36:57 +00:00
Ron Koenderink
4871a10a9b (xundump): Add the ability to support the parsing of the human
readable form.

(xucolumnheader): New function.
2006-01-01 03:44:41 +00:00
Ron Koenderink
15e40c55cd (xundump): Move the header parsing into a separate function xuheader().
Move the trailer parsing into a separate function xutrailer().

(xuheader, xutrailer): New functions.
2006-01-01 03:37:36 +00:00
3aebb68ee7 Include config.h. 2005-12-27 18:04:19 +00:00
3dc35a77f7 (xundump): Eat whitespace after table, so that caller can check for
trailing junk more easily.  This fixes that check in ef_load().
2005-12-17 15:09:43 +00:00
965bf6dbe4 (xundump): Fix table row counting, broken by rev. 1.23. 2005-12-17 08:25:57 +00:00
2ebc947969 (xundump): Fix rev. 1.19. 2005-12-03 16:15:16 +00:00
86a59e4de4 (xuflds, xunsymbol, xuloadrow): Symbol sets.
(VAL_SYMBOL_SET, getid, xunsymbol1): New.

(xunsymbol): New argument n for more useful diagnostics.

(xuloadrow): Remove redundant semantic check.
2005-12-03 14:14:44 +00:00
739f346584 (xunsymbol): Fix design flaw: negative symbol values were interpreted
as failure.
2005-12-03 13:38:52 +00:00
b7eb39ebef (xuflds): Allow unescaped space and tab in strings. Also fix the
previous revision, which broke '#' in strings.
2005-12-03 11:36:55 +00:00
1eb7d1795c (xuloadrow): Fix crash. 2005-12-03 11:19:20 +00:00
0a7291eb37 Less rigid field separators, support comments:
(skipfs): New.
(xuflds, xundump): Use it.  Update field scanf stop-sets accordingly.
(xuflds): Update test for good field separator.

(xundump): Fail silently if nothing can be read and no specific table
is expected.
2005-12-03 11:04:44 +00:00
8ca219819c (xuloadrow): Obey NSC_EXTRA.
(xuloadrow): Remove redundant `not supported' check.
2005-12-03 10:15:57 +00:00
29c83d1511 (ef_init_srv): Call ef_init() before ef_load().
(xundump): Set empfile member cids in addition to fids.

(xundump): Clarify shortcomings: requires EFF_MEM, appends sentinel
always, can't grow dynamic cache.

(xundump): Return table type on success.
2005-12-03 10:09:53 +00:00
b8befab521 (xuloadrow): Fix rev. 1.11. 2005-12-03 09:17:30 +00:00
e1420d2a14 (xundump): Fix parsing of XDUMP header (really!) and footer. 2005-12-02 19:22:27 +00:00
b2e18c5125 (xuflds): The way field separators were parsed lead to confusing
diagnostics on EOF.  Fix.  Also simplify treatment of newline.

(xuflds): Require identifiers to start with a letter.
2005-12-02 18:57:55 +00:00
1e4ecda185 (xundump): Fix parsing of XDUMP header. 2005-12-02 17:27:19 +00:00
aa63e64107 (xuflds): Test for no fields was off by one. Remove it; let caller
deal with missing fields.
2005-12-02 17:08:36 +00:00
f6bec2c3f7 (xuflds): Simplify test for space in values[]. 2005-12-02 17:05:25 +00:00
8d0ec9db08 (xundump): Improve diagnostics. Remove superflous check for
unexpected EOF.
2005-12-02 16:06:24 +00:00
8e6baf0bcb (xundump): Table names no longer contain whitespace. Simplify. 2005-12-01 20:00:15 +00:00
95a2523b9f (xuflds): Fix confusing diagnostics on unexpected EOF. 2005-12-01 19:28:31 +00:00
656b726a24 Plug memory leaks:
(freeflds): New.
(xundump): Call it.
(xuloadrow): Leave freeing storage to freeflds().
(xuflds): Ensure values[] is terminated with a VAL_NOTUSED element
even on error.
2005-12-01 19:12:54 +00:00
33912952bb Roll back to rev. 1.3 in preparation of a re-engineering of the
changes since then.
2005-12-01 18:56:41 +00:00
Ron Koenderink
ea1e3b6090 (xuflds): Allow multiple spaces to separate fields or symbols in symbol set. 2005-11-30 17:16:02 +00:00
Ron Koenderink
e9ddf6a80b (xunsymbol): Fix formating. 2005-11-30 00:36:35 +00:00
Ron Koenderink
d223865d2b (xuloadrow): Add missing case for VAL_SYMBOL_SET for trailing
junk row check.

(xuskipcommentlines): Make the function static.
2005-11-30 00:33:37 +00:00
Ron Koenderink
bf94174f88 (xuflds, xunsymbol, xuloadrow): Split VAL_SYMBOL into
VAL_SYMBOL and VAL_SYMBOL_SET.  Identify SYMBOL_SET
by the '(' and ')'.  Switch SYMBOL_SET separator from '|' to a space.
2005-11-29 23:55:17 +00:00
Ron Koenderink
125af4b338 (xuskipcommentlines): Include the lines skipped in the line count. 2005-11-29 23:38:32 +00:00
Ron Koenderink
03121d44aa (xundump): Skip lines beginning with '#'.
These lines are considered comments.

(xuskipcommentlines): New.
2005-11-29 21:50:31 +00:00
Ron Koenderink
50e4ef3e39 (xunsymbol): Fix xunsymbol() to parse multiple symbols for a
symbol_set (NSC_BITS).
2005-11-13 01:45:39 +00:00