##// END OF EJS Templates
xdiff: add comments for fields in xdfile_t...
Jun Wu -
r36839:0c735065 default
parent child Browse files
Show More
@@ -1,71 +1,105
1 1 /*
2 2 * LibXDiff by Davide Libenzi ( File Differential Library )
3 3 * Copyright (C) 2003 Davide Libenzi
4 4 *
5 5 * This library is free software; you can redistribute it and/or
6 6 * modify it under the terms of the GNU Lesser General Public
7 7 * License as published by the Free Software Foundation; either
8 8 * version 2.1 of the License, or (at your option) any later version.
9 9 *
10 10 * This library is distributed in the hope that it will be useful,
11 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 13 * Lesser General Public License for more details.
14 14 *
15 15 * You should have received a copy of the GNU Lesser General Public
16 16 * License along with this library; if not, see
17 17 * <http://www.gnu.org/licenses/>.
18 18 *
19 19 * Davide Libenzi <davidel@xmailserver.org>
20 20 *
21 21 */
22 22
23 23 #if !defined(XTYPES_H)
24 24 #define XTYPES_H
25 25
26 26
27 27
28 28 typedef struct s_chanode {
29 29 struct s_chanode *next;
30 30 long icurr;
31 31 } chanode_t;
32 32
33 33 typedef struct s_chastore {
34 34 chanode_t *head, *tail;
35 35 long isize, nsize;
36 36 chanode_t *ancur;
37 37 chanode_t *sncur;
38 38 long scurr;
39 39 } chastore_t;
40 40
41 41 typedef struct s_xrecord {
42 42 struct s_xrecord *next;
43 43 char const *ptr;
44 44 long size;
45 45 unsigned long ha;
46 46 } xrecord_t;
47 47
48 48 typedef struct s_xdfile {
49 /* manual memory management */
49 50 chastore_t rcha;
51
52 /* number of records (lines) */
50 53 long nrec;
54
55 /* hash table size
56 * the maximum hash value in the table is (1 << hbits) */
51 57 unsigned int hbits;
58
59 /* hash table, hash value => xrecord_t
60 * note: xrecord_t is a linked list. */
52 61 xrecord_t **rhash;
62
63 /* range excluding common prefix and suffix
64 * [recs[i] for i in range(0, dstart)] are common prefix.
65 * [recs[i] for i in range(dstart, dend + 1 - dstart)] are interesting
66 * lines */
53 67 long dstart, dend;
68
69 /* pointer to records (lines) */
54 70 xrecord_t **recs;
71
72 /* record changed, use original "recs" index
73 * rchag[i] can be either 0 or 1. 1 means recs[i] (line i) is marked
74 * "changed". */
55 75 char *rchg;
76
77 /* cleaned-up record index => original "recs" index
78 * clean-up means:
79 * rule 1. remove common prefix and suffix
80 * rule 2. remove records that are only on one side, since they can
81 * not match the other side
82 * rindex[0] is likely dstart, if not removed up by rule 2.
83 * rindex[nreff - 1] is likely dend, if not removed by rule 2.
84 */
56 85 long *rindex;
86
87 /* rindex size */
57 88 long nreff;
89
90 /* cleaned-up record index => hash value
91 * ha[i] = recs[rindex[i]]->ha */
58 92 unsigned long *ha;
59 93 } xdfile_t;
60 94
61 95 typedef struct s_xdfenv {
62 96 xdfile_t xdf1, xdf2;
63 97
64 98 /* number of lines for common prefix and suffix that are removed
65 99 * from xdf1 and xdf2 as a preprocessing step */
66 100 long nprefix, nsuffix;
67 101 } xdfenv_t;
68 102
69 103
70 104
71 105 #endif /* #if !defined(XTYPES_H) */
General Comments 0
You need to be logged in to leave comments. Login now