Subversion Repositories Kolibri OS

Rev

Rev 9903 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9903 Rev 9907
Line 24... Line 24...
24
 
24
 
25
CONST
25
CONST
Line 26... Line 26...
26
	itemSize = 64;
26
	itemSize = 64;
27
 
27
 
Line 28... Line 28...
28
TYPE
28
TYPE
Line 29... Line 29...
29
	tBuffer* = CB.tBuffer;
29
	tBuffer = CB.tBuffer;
30
 
30
 
Line 113... Line 113...
113
	END
113
	END
114
	RETURN res
114
	RETURN res
115
END next;
115
END next;
Line 116... Line 116...
116
 
116
 
117
 
117
 
118
PROCEDURE find* (text: tBuffer; s: ARRAY OF WCHAR; whole: BOOLEAN; list: List.tList);
118
PROCEDURE find* (text: tBuffer; s: ARRAY OF WCHAR; whole: BOOLEAN; list: List.tList; offset: INTEGER);
119
VAR
119
VAR
120
	k, pos, n, x, prev_item_pos: INTEGER;
120
	k, pos, n, i, x, prev_item_pos: INTEGER;
121
	item: tPos;
121
	item: tPos;
122
	c1, c2: WCHAR;
122
	c1, c2: WCHAR;
123
	flag: BOOLEAN;
123
	flag: BOOLEAN;
124
BEGIN
124
BEGIN
-
 
125
	ASSERT(table # NIL);
-
 
126
	n := LENGTH(s);
-
 
127
	i := 0;
-
 
128
	WHILE (i < n) & whole DO
-
 
129
		whole := Utils.isWordChar(s[i]);
125
	ASSERT(table # NIL);
130
		INC(i)
126
	n := LENGTH(s);
131
	END;
127
	k := table.data[ORD(s[0]), 1];
132
	k := table.data[ORD(s[0]), 1];
128
	pos := table.data[ORD(s[0]), 0];
133
	pos := table.data[ORD(s[0]), 0];
129
	prev_item_pos := 0;
134
	prev_item_pos := 0;
Line 136... Line 141...
136
					SYSTEM.GET(text.dataPtr + (x - 1)*SYSTEM.SIZE(WCHAR), c1);
141
					SYSTEM.GET(text.dataPtr + (x - 1)*SYSTEM.SIZE(WCHAR), c1);
137
				ELSE
142
				ELSE
138
					c1 := 0X
143
					c1 := 0X
139
				END;
144
				END;
140
				SYSTEM.GET(text.dataPtr + (x + n)*SYSTEM.SIZE(WCHAR), c2);
145
				SYSTEM.GET(text.dataPtr + (x + n)*SYSTEM.SIZE(WCHAR), c2);
141
				flag := Utils.isLetter(c1) OR Utils.isLetter(c2) OR Utils.isDigit(c1) OR Utils.isDigit(c2) OR
146
				flag := Utils.isWordChar(c1) OR Utils.isWordChar(c2)
142
					(c1 = "_") OR (c2 = "_")
-
 
143
			END;
147
			END;
144
			IF ~flag & (x >= prev_item_pos) THEN
148
			IF ~flag & (x >= prev_item_pos) THEN
145
				prev_item_pos := x + n;
149
				prev_item_pos := x + n;
146
				item := list.last(tPos);
150
				item := list.last(tPos);
147
				IF (item = NIL) OR (item.cnt = itemSize) THEN
151
				IF (item = NIL) OR (item.cnt = itemSize) THEN
148
					NEW(item);
152
					NEW(item);
149
					item.cnt := 0;
153
					item.cnt := 0;
150
					List.append(list, item)
154
					List.append(list, item)
151
				END;
155
				END;
152
				item.pos[item.cnt] := x;
156
				item.pos[item.cnt] := x + offset;
153
				INC(item.cnt)
157
				INC(item.cnt)
154
			END
158
			END
155
		END;
159
		END;
156
		INC(pos, SYSTEM.SIZE(INTEGER));
160
		INC(pos, SYSTEM.SIZE(INTEGER));
157
		DEC(k)
161
		DEC(k)