2 * Copyright (c) 1998-2007 Matthijs Hollemans
3 * All rights reserved. Distributed under the terms of the MIT License.
13 // Executes "grep" in a background thread.
16 Grepper(const char* pattern
, const Model
* model
,
17 const BHandler
* target
,
18 FileIterator
* iterator
);
27 // Spawns the real grepper threads.
28 static int32
_SpawnRunnerThread(void* cookie
);
29 static int32
_SpawnWriterThread(void* cookie
);
31 // The threads functions that does the actual grepping.
32 int32
_RunnerThread();
33 int32
_WriterThread();
35 // Remembers, and possibly escapes, the search pattern.
36 void _SetPattern(const char* source
);
38 // Prepends all quotes, dollars and backslashes with at backslash
39 // to prevent the shell from misinterpreting them.
40 bool _EscapeSpecialChars(char* buffer
,
44 // The (escaped) search pattern.
47 // The settings from the model.
49 bool fRegularExpression
: 1;
50 bool fCaseSensitive
: 1;
53 // The supplier of files to grep
54 FileIterator
* fIterator
;
57 thread_id fRunnerThreadId
;
61 // Whether our thread must quit.
62 volatile bool fMustQuit
;