From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- support/dktools/testlzw.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 support/dktools/testlzw.c (limited to 'support/dktools/testlzw.c') diff --git a/support/dktools/testlzw.c b/support/dktools/testlzw.c new file mode 100644 index 0000000000..7d28b3b913 --- /dev/null +++ b/support/dktools/testlzw.c @@ -0,0 +1,109 @@ +/* + WARNING: This file was generated by dkct. + Changes you make here will be lost if dkct is run again! + You should modify the original source and run dkct on it. + Original source: testlzw.ctr +*/ + +/** @file testlzw.c The testlzw module. +*/ + + +#line 1 "testlzw.ctr" + +#include + +#include +#include "dk4lzwe.h" +#include + + + +#line 9 "testlzw.ctr" + + +static const unsigned char teststr[] = { + 45, 45, 45, 45, 45, 65, 45, 45, 45, 66 +}; + + + +static +void +show_bytes(dk4_lzwe_t *lzwe) +{ + const unsigned char *cptr = NULL; + size_t nbt = 0; + size_t i; + + + +#line 26 "testlzw.ctr" + if (0 != dk4lzwe_output(&cptr, &nbt, lzwe, NULL)) { + if ((NULL != cptr) && (0 < nbt)) { + for (i = 0; i < nbt; i++) { + printf("%2x\n", (unsigned)(cptr[i])); + } + } + else { + +#line 33 "testlzw.ctr" + } + } + else { + +#line 36 "testlzw.ctr" + } + + +#line 38 "testlzw.ctr" +} + + + +int main(int argc, char *argv[]) +{ + dk4_lzwe_t lzwe; + size_t i; + + + +#line 48 "testlzw.ctr" + + +#line 49 "testlzw.ctr" + if (0 != dk4lzwe_init(&lzwe, NULL)) { + for (i = 0; i < sizeof(teststr); i++) { + switch (dk4lzwe_add(&lzwe, teststr[i], NULL)) { + case DK4_EDSTM_FINISHED : { + show_bytes(&lzwe); + } break; + case DK4_EDSTM_ERROR : { + +#line 56 "testlzw.ctr" + } break; + } + } + switch (dk4lzwe_finish(&lzwe, NULL)) { + case DK4_EDSTM_FINISHED : { + show_bytes(&lzwe); + } break; + case DK4_EDSTM_ERROR : { + +#line 64 "testlzw.ctr" + } break; + } + } + else { + } + + +#line 70 "testlzw.ctr" + + +#line 71 "testlzw.ctr" + return 0; +} + +/* vim: set ai sw=4 ts=4 : */ + -- cgit v1.2.3