On Thu, 26 Jul 2012 14:12:50 +0200 Markus Armbruster <arm...@redhat.com> wrote:
> Luiz Capitulino <lcapitul...@redhat.com> writes: > > > This script generates two files from qapi-schema-errors.json: > > > > o qapi-errors.h: contains error macro definitions, eg. QERR_BASE_NOT_FOUND, > > corresponds to most of today's qerror.h > > > > o qapi-errors.c: contains the error table that currently exists in qerror.c > [...] > > diff --git a/scripts/qapi-errors.py b/scripts/qapi-errors.py > > new file mode 100644 > > index 0000000..59cf426 > > --- /dev/null > > +++ b/scripts/qapi-errors.py > [...] > > +def gen_error_def_table(exprs): > > + ret = mcgen(''' > > +static const QErrorStringTable qerror_table[] = { > > +''') > > + > > + for err in exprs: > > + macro = gen_error_macro(err['error']) > > + desc = err['description'] > > + ret += mcgen(''' > > + { > > + .error_fmt = %(error_macro)s, > > + .desc = "%(error_desc)s", > > + }, > > +''', > > Trailing whitespace. Fixed for v3.