1 /***********************************************************HeaderBegin*******
2 *
3 * File: code.h
4 *
5 * Author: K.S.
6 * Created: 5-Nov-97
7 *
8 * Description: Definition of routines for codes
9 *
10 * Modified:
11 *
12 ***********************************************************HeaderEnd*********/
13
14 #ifndef _CODE_H
15 #define _CODE_H
16
17
18 #define MAX_CODEWORD_LENGTH 32
19 #define MAX_SYMS 16380
20
21 /***********************************************************CommentBegin******
22 *****************************************************************************
23 *
24 * -- Codeword -- Codeword Type
25 *
26 * Author: M.F.
27 *
28 * Created: 23-July-96
29 *
30 * Description: int size : length of codeword
31 * int cw : codeword register
32 *
33 * Example: size = 3
34 * ------------------
35 * ..| x | 0 | 1 | 1 |
36 * ------------------
37 * significance 8 4 2 1
38 *
39 * codeword: "011"
40 *
41 *
42 * Note: maximum codeword length is 32 bits:
43 * #define MAX_CODEWORD_LENGTH 32
44 *
45 * See also: -
46 *
47 * Modified: T.W., 15-Nov-1996, Adapted towards CIDS library
48 *
49 *****************************************************************************/
50 typedef struct{
51 int size;
52 int bits;
53 } Codeword;
54 /***********************************************************CommentEnd********/
55
56
57 /***********************************************************CommentBegin******
58 *****************************************************************************
59 *
60 * -- Element -- Element
61 *
62 * Author: M.F., T.W.
63 *
64 * Created: 17-July-96
65 *
66 * Description: generic element which contains the basic types
67 * int i;
68 * unsigned int ui;
69 * float f;
70 * void *p;
71 *
72 * Note: -
73 *
74 * See also: -
75 *
76 * Modified: -
77 *
78 *****************************************************************************/
79 typedef union {
80 int i;
81 unsigned int ui;
82 float f;
83 void *p;
84 } Element;
85 /***********************************************************CommentEnd********/
86
87
88 /***********************************************************CommentBegin******
89 *
90 * -- BinTreeNode -- Binary Tree Node Type
91 *
92 * Author: M.F., T.W.
93 *
94 * Created: 17-July-96
95 *
96 * Description: e: node data
97 * ndType: type of node
98 *
99 * ndType[branch] = 0/1
100 *
101 * example: branch
102 * 0 1
103 * --- ---
104 * | 1 | 0 |
105 * --- ---
106 * meaning:
107 * 0 : NO subtree for the one (right) branch
108 * 1 : subtree for the zero (left) branch
109 * (root node is referenced by btn[0])
110 * btn[0/1]: points to the child node connected by the zero/one
111 * branch.
112 *
113 * Note: Use recursive algorithms! (e.g. BinTreeFunctional)
114 *
115 * See also: -
116 *
117 * Modified:
118 *
119 ***********************************************************CommentEnd********/
120 typedef struct btn_struct {
121 Element e;
122 unsigned char ndType[2];
123 struct btn_struct *btn[2];
124 } BinTreeNode;
125
126
127 /***********************************************************CommentBegin******
128 *****************************************************************************
129 *
130 * -- Code -- Code struct type definition
131 *
132 * Author: M.F.
133 *
134 * Created: 23-July-96
135 *
136 * Description: int size : number of codewords
137 * Codeword *cwTable : table of codewords
138 * Int eventDim : size of event array
139 * Int **event : event array associated with each
140 * codeword
141 * BintTreeNode *codeTree : code tree with codeword
142 * indexes at the leaf nodes
143 *
144 * The code tree consists of 'BinTreeNode's.
145 * 'e.i' holds the index of each leaf node (codeword)
146 * If the node is not a leaf, 'e.i' is set to -1.
147 * If the node is unused, 'e.i' is set to -2.
148 * btn[0/1] points to the child node connected by the zero/one
149 * branch.
150 *
151 * Note: -
152 *
153 * See also: Codeword, BinTreeNode
154 *
155 * Modified: T.W., 15-Nov-1996, Adapted towards CIDS library
156 *
157 *****************************************************************************/
158 typedef struct{
159 int size;
160 char *title;
161 Codeword *cwTable;
162 int eventDim;
163 int **event;
164 /* private */
165 BinTreeNode *codeTree;
166 } Code;
167 /***********************************************************CommentEnd********/
168
169
170 #endif /* _CODE_H */
171
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.