simon-git: agedu (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Mar 28 20:15:28 BST 2018


TL;DR:
  33f55e0 Factor out dump-file handling. (NFC)
  bbaa734 Convert to and from a new 'sortable' dump format.
  af641e6 Give a sensible error message about misordered dumps.

Repository:     https://git.tartarus.org/simon/agedu.git
On the web:     https://git.tartarus.org/?p=simon/agedu.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2018-03-28 20:15:28

commit 33f55e0bce39d9f867c1cd317cba8304ba3988bf
web diff https://git.tartarus.org/?p=simon/agedu.git;a=commitdiff;h=33f55e0bce39d9f867c1cd317cba8304ba3988bf;hp=9421c00aa49b5da0ff8073db1fbf3b77c73394d7
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Mar 27 20:43:07 2018 +0100

    Factor out dump-file handling. (NFC)
    
    All the code that knows about the format of the -S / -L / -D textual
    dump file - how to read it and how to write it - now lives in
    dumpfile.c, and the handling of it in agedu.c is replaced with calls
    to functions in that new file.

 Makefile.am |   2 +-
 agedu.c     | 117 +++++++++++++-------------------------------
 agedu.h     |   2 -
 dumpfile.c  | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 dumpfile.h  |  21 ++++++++
 5 files changed, 212 insertions(+), 87 deletions(-)

commit bbaa734941858799ccc49b6341232a37529f6bc5
web diff https://git.tartarus.org/?p=simon/agedu.git;a=commitdiff;h=bbaa734941858799ccc49b6341232a37529f6bc5;hp=33f55e0bce39d9f867c1cd317cba8304ba3988bf
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Mar 27 21:00:15 2018 +0100

    Convert to and from a new 'sortable' dump format.
    
    A user pointed out that if you're constructing agedu dump input from
    some source agedu itself doesn't know how to scan, it's surprisingly
    hard to get the sorting order right - and if you don't, then trie.c
    fails an assertion.
    
    The sorting order is too complicated for sort(1), and even for tr |
    sort | tr, so instead I've written a pair of conversion modes to help people in this situation.
    
    'agedu --presort' transforms the existing reasonably clear dump file
    format into a form where sort(1) without arguments will do the right
    thing. Having done that, you can then either run 'agedu --postsort' to
    turn the sorted output back into the normal dump format, or
    alternatively feed the sorted transformed text directly into agedu -L,
    which wil recognise it by the different header line and consume it as
    willingly as the original dump format.

 agedu.but  |  38 +++++++++++++++
 agedu.c    |  50 +++++++++++++++++++-
 dumpfile.c | 155 +++++++++++++++++++++++++++++++++++++++++++++----------------
 dumpfile.h |   1 +
 4 files changed, 202 insertions(+), 42 deletions(-)

commit af641e6fbcb9cef9a7d624c28712e1ba48806f04
web diff https://git.tartarus.org/?p=simon/agedu.git;a=commitdiff;h=af641e6fbcb9cef9a7d624c28712e1ba48806f04;hp=bbaa734941858799ccc49b6341232a37529f6bc5
Author: Simon Tatham <anakin at pobox.com>
Date:   Tue Mar 27 21:13:10 2018 +0100

    Give a sensible error message about misordered dumps.
    
    Since creataing dump files is not agedu's sole privilege - users can
    construct their own, and may get it wrong - it's not polite to respond
    with an assertion failure to a dump file in the wrong sorting order.
    Now we give a proper error message citing the ilne of the file where
    the problem occurred.

 agedu.c    |  4 ++--
 dumpfile.c | 11 ++++++++++-
 dumpfile.h |  2 +-
 trie.c     | 18 +++++++++---------
 trie.h     |  6 ++++++
 5 files changed, 28 insertions(+), 13 deletions(-)



More information about the tartarus-commits mailing list