1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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 <stdio.h>
#include <dk4conf.h>
#include "dk4lzwe.h"
#include <dk4edstm.h>
#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 : */
|