summaryrefslogtreecommitdiffstats
path: root/ChangeLog
blob: 33225a616c303d6833b3a488aedd4a2de777e142 (plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
2009-09-28  Kaz Kylheku  <kkylheku@gmail.com>

	Version 012

	Semantics change of @(until) in @(collect) and @(coll).

	Minor fixes.

	* extract.y (match_line, match_files): The until clauses
	continue to be processed after the main clauses of the collect
	or coll (to see the bindings), but are processed before
	the collection occurs, so that the until will veto
	the bindings of the last iteration.  Moreover, the data
	positions stays where it is when this happens, and no
	arrangement is made to match the until material again.

	* txr.1: Tried to document the change.


2009-09-27  Kaz Kylheku  <kkylheku@gmail.com>

	* txr.1: following proofread, fixed various escaping problems and
	instances of missing text.

2009-09-26  Kaz Kylheku  <kkylheku@gmail.com>

	* lib.c (equal): Bugfixes: wrong fallthrough of FUN case.
	VEC case must return nil, not break.

2009-09-26  Kaz Kylheku  <kkylheku@gmail.com>

	Preparation for some sorting support.

	* extract.y (merge): Renamed to weird_merge.
	(map_leaf_lists): New functino.
	(match_file): Follow weird_merge rename.
	* lib.c (all_satisfy, none_satisfy, string_lt, do_bind2other,
	bind2other, merge, do_sort, sort): New functions.
	* lib.h (all_satsify, none_satisfy, string_lt,
	bind2other, sort): Declared.

2009-09-25  Kaz Kylheku  <kkylheku@gmail.com>

	Version 011

	New @(maybe) clause optionally matches (does not fail if none of
	its clauses match anything).

	New blocks feature: allows a query or subquery to be
	abruptly terminated by invoking an exit to a named or anonymous
	block. @(collect) and @(skip) have implicit anonymous blocks now.

	The @(skip) directive takes a numeric argument now, which limits
	how many lines are searched.

	* Makefile, extract.l, extract.y, extract.h, gc.c, gc.h, lib.c, lib.h,
	regex.c, regex.h, txr.1, unwind.c, unwind.h: Copyright notice and
	license text updated or added, and version bumped up to 011.
	* tests/001/query-1.txr, tests/001/query-2.txr, tests/001/query-3.txr,
	tests/002/query-1.txr: Assigned to public domain.

2009-09-25  Kaz Kylheku  <kkylheku@gmail.com>

	New features:
	- named blocks;
	- maybe clause;
	- optional iteration bound on skip.

	* extract.y: includes added: "unwind.h", <setjmp.h>.
	(MAYBE, OR): New grammar tokens.
	(maybe_clause): New nonterminal grammar symbol.
	(expr): A NUMBER can be an expression now, so that @(skip 42)
	is valid syntax.
	(match_files): Support for numeric argument in skip directive
	to bound the search to a maximum number of lines.
	Anonymous block established around skip.
	New directives implemented: maybe, block, accept and fail.
	Anonymous block established around collect.
	* txr.1: Documentation updated with new features.
	* Makefile: new object file unwind.o, and associated rules.
	* extract.l (yybadtoken): New cases for MAYBE and OR.
	(grammar): Likewise.
	* lib.c (block, fail, accept): New symbol variables.
	(obj_init): New symbols interned.
	* lib.h (block, fail, accept): Declared.
	(if2, if3): Macros fixed so test expression is not compared to nil,
	but implicitly tested as boolean.
	* unwind.c, unwind.h: New source files.

2009-09-24  Kaz Kylheku  <kkylheku@gmail.com>

	Stability fixes.

	* extract.y (match_files): Fixed invalid string("-") to
	string(chk_strdup("-")) which caused a freeing of
	a non-malloced string at gc finalization time.
	* regex.c (nfa_state_shallow_free): New function: does not
	free satellite objects, just the structure itself.
	(nfa_combine): Use nfa_state_shallow_free instead of nfa_state_free,
	because the merged state inherits ownership of objects from the state
	being spliced out.
	(nfa_state_set): Fix lack of initialization of s.visited member of the
	state structure.

2009-09-24  Kaz Kylheku  <kkylheku@gmail.com>

	Version 010

	A file specs can start with $, which means read a directory.

	Data sources are not into memory at once, but on demand,
	which can reduce memory for many queries.

	Regular expressions are now compiled once, when the
	query is parsed.

	Character escapes are now supported in regular expressions,
	and as a special syntax.

	* extract.l (version): Bumped to 010.
	(grammar): 8 and 9 are not octal digits; handle all regex
	backslash escaping in lexical grammar.
	* extract.y (grammar): Get rid of backslash handling from
	regex grammar. Lexer returns a REGCHAR for every escaped
	item. In situations where an operator character is implicily
	literal, like * in a character class, we use the grammar
	to include that alongside REGCHAR. Bugfixes: the character ], when not
	closing a class, is not a syntax error but stands for itself;
	the character - stands for itself outside of character class;
	the | character is literal in a character class.
	* txr.1: Updated version. Documented character escapes.

2009-09-24  Kaz Kylheku  <kkylheku@gmail.com>

	Lazy stream list improvement: no extra NIL element caused
	by end-of-file. Requires push-back support in streams.
	To avoid introducing a new structure member into streams,
	we extend the semantics of the label member, and rename
	it to label_pushback.

	* lib.c (stdio_line_stream, pipe_line_stream,
	dirent_stream): Follow rename of struct stream member;
	assert that label is an atom.
	(stream_get): Check pushback stack first and get item from there.
	(stream_pushback): New function.
	(lazy_stream_func): Pull one more item from the stream and
	use /that/ to decide whether to continue the lazy stream.
	The extra item is pushed back, if valid.
	(lazy_stream_cons): Simplified: no hack involving regular cons. Starts
	the induction by peeking into the stream. If something is there, it is
	pushed back, and a lazy cons is constructed which will fetch it.
	(obj_print): Made aware of the pushback, which must be skipped
	to get to the terminating label.
	* lib.h (struct stream): Member renamed from label to label_pushback.
	(stream_pushback): New function declaration.

2009-09-23  Kaz Kylheku  <kkylheku@gmail.com>

	Escape syntax in regexes, and text. The
	standard seven character escapes are supported,
	namely \a, \b, \t, \n, \v, \f, and \r,
	as well as hex and octal escapes, plus
	the code \e for ASCII ESC.

	* extract.l (char_esc, num_esc): New functions.
	(grammar): New lex cases.
	* lib.c (obj_print): Support all character escapes in printing.
	Bugfix: backslash printed as two backslashes, not one.

2009-09-23  Kaz Kylheku  <kkylheku@gmail.com>

	* tests/002/query-1.txr: Modified to use $ to scan thread
	subdirectories.
	* tests/002/query-1.expected: Updated.

2009-09-23  Kaz Kylheku  <kkylheku@gmail.com>

	New COBJ type for wrapping arbitrary C objects into the
	Lisp-like framework. Compiled regexes are objects now.
	Regexes in a query are now compiled just once.

	* extract.y (grammar): Regexes compiled while parsing.
	(match_line): Modify with respect to the abstract syntax
	tree change, and the interface changes in the match_regex,
	and search_regex functions.
	* gc.c (mark_obj, finalize): Handle marking and finalization
	of COBJ objects.
	* lib.c (typeof, equal, obj_print): Handle COBJ.
	(cobj, cobj_print_op): New functions.
	* lib.h (type_t): New enum element, COBJ.
	(struct cobj, struct subj_ops): New types.
	(union obj): New member, co.
	(cobj, cobj_print_op): New functions declared.
	* regex.c (regex_equal, regex_destroy, regex_compile, regex_nfa): New
	functions.
	(regex_obj_ops): New static struct.
	(search_regex, match_regex): Interface change. Regex arguments
	are now compiled regexes. Functions won't handle raw regexes.
	* regex.h (regex_compile, regex_nfa): New functions declared.

2009-09-23  Kaz Kylheku  <kkylheku@gmail.com>

	New feature: file specs that start with $ read directories.
	Reading from an ``ls'' pipe is too slow.

	Streams and lazy conses implemented. Lazy conses allow us to treat a
	file or other kind of stream exactly as if it were a list.
	We can use car and cdr, etc. But only the parts of the list
	that we actually touch are instantiated on-the-fly by
	reading from the underlying stream.

	* extract.l: inclusion of <dirent.h> added.
	* extract.l: inclusion of <dirent.h> added.
	* extract.y (fpip_closedir): new enumeration in struct fpip,
	and fpip_noclose removed.
	(complex_open): Check for leading $, use opendir.
	(complex_open_failed): New function.
	(complex_close): Handle fpip_closedir case. Not closing
	stdin and stdout is handled by explicit comparison now.
	(complex_snarf): New function, constructs stream of
	a suitable type, over object returned from complex_close,
	wraps it in a lazy list.
	(match_files): Use complex_snarf instead of snarf to get a lazy list.
	* gc.c: Handle LCONS and STREAM cases.
	* lib.c (stream_t, lcons_t): New variables holding symbols.
	(typeof, equal, obj_print): Handle LCONS and STREAM.
	(car, cdr, car_l, cdr_l, consp, atom, listp): Rewritten to handle
	LCONS.
	(chk_strdup, stdio_line_read, stdio_line_write, stdio_close
	stdio_line_stream, pipe_close, pipe_line_stream,
	dirent_read, dirent_close, dirent_stream,
	stream_get, stream_put, stream_close,
	make_lazycons, lazy_stream_func, lazy_stream_cons): New functions.
	(stdio_line_stream_ops, pipe_line_stream_ops,
	dirent_stream_ops): New static structs.
	(obj_init): Intern new symbols lstream, lcons, and dir.
	* lib.h (type_t): New enum members STREAM and LCONS.
	(struct stream, struct stream_ops, struct lazy_cons): New types.
	(union obj): New members sm and lc.
	(chk_strdup, stdio_line_stream, pipe_line_stream,
	dirent_stream, stream_get, stream_put, stream_close,
	lazy_stream_cons): New function declarations.
	* regex.c: inclusion of <dirent.h> added

2009-09-23  Kaz Kylheku  <kkylheku@gmail.com>

	Version 009

	User-friendly error messages from parser.
	Fixed -q option.

	* extract.l (version): Bumped to 009.
	* txr.1: Updated version.

2009-09-22  Kaz Kylheku  <kkylheku@gmail.com>

	* Makefile (LIBLEX): New variable.
	Refer to lex library as -lfl, using variable
	that can be overridden.

2009-09-22  Kaz Kylheku  <kkylheku@gmail.com>

	* extract.h (yybadtoken): New function declaration.
	* extract.l (yybadtoken): New function.
	(main): Fixed -q option.
	* extract.y (grammar): Lots of new error productions, some
	phrase rules refactored, resulting in much more user-friendly
	error diagnosis.
	* txr.1: -q option semantics clarified.