catacomb.c, util.c: Publish negative constants correctly.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 24 Nov 2019 15:11:46 +0000 (15:11 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Wed, 27 Nov 2019 15:10:43 +0000 (15:10 +0000)
commit2ec562f15a095c23bc7c16199ea7428007b7b8ec
treedbbb6588c28c3b09b1674a8106fc000f578a39b6
parent43806eefdf9d9400425ff74ec25ec461b09dc0ef
catacomb.c, util.c: Publish negative constants correctly.

The various `KERR_...' constants and `PGEN_ABORT' are canonically
negative integers, but weren't published correctly.  Add a flags word to
`struct nameval' to identify constants which should really be signed,
and some fancy footwork to convert unsigned integers back to negative
values without upsetting C.  Adjust the `C' macro to spot negative
constants and mark them specially.

Not all is well.  In particular, the `KEXP_...' constants should /not/
be published as signed values, even if `time_t' is signed on the target
platform, because the Python bindings handle them exclusively as
`unsigned long' values.  To make this work, also introduce `CF' which
allows us to set the flags explicitly, and use it for `KEXP_...'.
catacomb-python.h
catacomb.c
util.c