/* 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 : */