Context algorithm
Semi-predictive context algorithm implementation
 All Data Structures Files Functions Variables Typedefs Macros Pages
decoderTree.h
Go to the documentation of this file.
1 /* Copyright 2013 Jorge Merlino
2 
3  This file is part of Context.
4 
5  Context is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Context is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with Context. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef DECODER_TREE_H
20 #define DECODER_TREE_H
21 
22 #include "types.h"
23 
25 typedef struct decoderTree {
27  right,
28  *count,
29  totalSyms,
30  totalCount; /*suma de counts*/
31 
32  struct decoderTree *tail,
33  *origin,
34  *parent,
35  **children,
36  **transitions;
39  used,
40  internal,
41  internalFSM;
43  Uchar **text;
44  Uchar *symbols; /* simbolo en cada posicion */
45 } *decoderTree_t;
46 
48 
51 
54 
57 
60 
63 
65 void verifyDecoder(const decoderTree_t root, decoderTree_t node);
66 
67 #ifdef DEBUG
68 
70 void printDecoderTree(decoderTree_t);
71 
72 #endif
73 
74 #endif
struct decoderTree ** children
List of pointers to all the children of this node.
Definition: decoderTree.h:32
Uint totalCount
&lt; Total number of symbols occuring at this state.
Definition: decoderTree.h:26
struct decoderTree * decoderTree_t
Decoder context tree structure.
Uchar ** text
&lt; Flag that indicates if this node is an internal node of the FSM closure of T(x) ...
Definition: decoderTree.h:43
void freeDecoderTree(decoderTree_t tree, BOOL deleteText)
Deletes a decoder tree structure instance.
Definition: decoderTree.c:648
BOOL * traversed
List of flags indicating an attempt was made to traverse each child edge.
Definition: decoderTree.h:38
struct decoderTree * tail
Pointer to the node whose label is the tail of this one.
Definition: decoderTree.h:32
struct decoderTree * parent
Pointer to the parent of this node.
Definition: decoderTree.h:32
unsigned char Uchar
Unsigned char type.
Definition: types.h:48
Uint right
Index of the rightmost character of the label of this node.
Definition: decoderTree.h:26
BOOL internalFSM
&lt; Flag that indicates if this node is an internal node of T(x)
Definition: decoderTree.h:38
struct decoderTree * origin
Pointer to the original node this one descends from.
Definition: decoderTree.h:32
Uint left
Index of the leftmost character of the label of this node.
Definition: decoderTree.h:26
BOOL isRootDecoderTree(decoderTree_t tree)
Indicates if the parameter node is the root of the tree.
Definition: decoderTree.c:717
Uint totalSyms
Definition: decoderTree.h:26
unsigned long Uint
Unsigned int type.
Definition: types.h:54
#define BOOL
Boolean data type.
Definition: types.h:92
void verifyDecoder(const decoderTree_t root, decoderTree_t node)
Verify*, only called by the decoder routine.
Definition: decoderTree.c:418
BOOL used
Flag that indicates if this node has been used to decode eny symbols.
Definition: decoderTree.h:38
void makeDecoderFsm(decoderTree_t tree)
Calculates the FSM closure of this tree.
Definition: decoderTree.c:665
struct decoderTree ** transitions
List of FSM transitions from this state.
Definition: decoderTree.h:32
void initDecoderTreeStack()
Definition: decoderTree.c:584
decoderTree_t initDecoderTree(BOOL useMalloc)
Creates and initializes a new decoder tree structure instance.
Definition: decoderTree.c:597
Uint * count
Counts of the number of occurrences of each symbol in this state.
Definition: decoderTree.h:26
Decoder context tree structure.
Definition: decoderTree.h:25
Uchar * symbols
Definition: decoderTree.h:44
decoderTree_t readDecoderTree(FILE *file)
Creates a new decoder tree reading it from a file.
Definition: decoderTree.c:683