aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/search.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-03-17fixed invalid memory accesses in the expression stack and reworked ↵Robin Haberkorn1-1/+1
expression stack this was probably a regression from d94b18819ad4ee3237c46ad43a962d0121f0c3fe and should not be in v0.5. The return value of Expressions::find_op() must always be checked since it might not find the operator, returning 0 (it used to be 0). A zero index pointed to uninitialized memory - in the worst case it pointed to invalid memory resulting in segfaults. Too large indices were also not handled. This was probably responsible for recent PPA build issues. Valgrind/memcheck reports this error but I misread it as a bogus warning. I took the opportunity to clean up the ValueStack implementation and made it more robust by adding a few assertions. ValueStacks now grow from large to small addresses (like stack data structures usually do). This means, there is no need to work with negative indices into the stack pointer. To reduce the potential for invalid stack accesses, stack indices are now unsigned and have origin 0. Previously, all indices < 1 were faulty but weren't checked. Also, I added some minor optimizations.
2015-03-02use g_assert_not_reached() instead of g_assert(false): works around Clang++ ↵Robin Haberkorn1-1/+1
warnings * Clang++ does not see that the PC will never go beyong g_assert(false), and so reports about possible unitialized variables
2015-03-01moved String helper functions from sciteco.h and main.cpp to ↵Robin Haberkorn1-0/+1
string-utils.cpp and string-utils.h * also improved performance of String::append() by using g_realloc() * added String::append() variant for non-null-terminated strings
2015-02-21fixed assertion in search.cppRobin Haberkorn1-1/+1
2015-02-11updated copyright to 2015Robin Haberkorn1-1/+1
2014-11-20allow a current buffer if we're editing a Q-RegisterRobin Haberkorn1-3/+7
this eases handling of the "*" register
2014-11-16rewritten View and Interface base classes using the Curiously Recurring ↵Robin Haberkorn1-1/+1
Template Pattern. * without the one-view-per-buffer designs, many Scintilla send message (SSM) calls could be inlined * with the new design, this was no longer possible using the abstract base classes. the CRT pattern allows inlining again but introduces a strange level of code obscurity. * tests suggest that at high optimization levels, the one-view-per-buffer design and the CRT pattern reduces typical macro runtimes by 30% (e.g. for symbols-extract.tes). * only updated the NCurses UI for the time being
2014-11-16first working version of the one-view-per-buffer designRobin Haberkorn1-7/+7
The user interface provides a Scintilla view abstraction and every buffer is based on a view. All Q-Register strings use a single dedicated view to save memory and initialization time when using many string registers. * this means we can finally implement a working lexer configuration and it only has to be done once when the buffer is first added to the ring. It is unnecessary to magically restore the lexer styles upon rubout of EB (very hard to implement anyway). It is also not necessary to rerun the lexer configuration macro upon rubout which would be hard to reconcile with SciTECO's basic design since every side-effect should be attached to a character. * this means that opening buffers is slightly slower now because of the view initialization * on the other hand, macros with many string q-reg operations are faster now, since the document must no longer be changed on the buffer's view and restored later on. * also now we can make a difference between editing a document in a view and changing the current view, which reduces UI calls * the Document class has been retained as an abstraction about Scintilla documents, used by QRegister Strings. It had to be made virtual, so the view on which the document is created can be specified by a virtual function. There is no additional space overhead for Documents.
2014-11-11refactored SciTECO runtime errors: moved from parser.cpp to error.cppRobin Haberkorn1-0/+1
* the GError expection has been renamed to GlibError, to avoid nameclashes when working from the SciTECO namespace
2014-11-11added all of SciTECO's declarations to the "SciTECO" namespaceRobin Haberkorn1-0/+4
normally, since SciTECO is not a library, this is not strictly necessary since every library should use proper name prefixes or namespaces for all global declarations to avoid name clashes. However * you cannot always rely on that * Scintilla does violate the practice of using prefixes or namespaces. The public APIs are OK, but it does define global functions/methods, e.g. for "Document" that clashed with SciTECO's "TECODocument" class at link-time. Scintilla can put its definitions in a namespace, but this feature cannot be easily enabled without patching Scintilla. * a "SciTECO" namespace will be necessary if "SciTECO" is ever to be turned into a library. Even if this library will have only a C-linkage API, it must ensure it doesn't clutter the global namespace. So the old "TECODocument" class was renamed back to "Document" (SciTECO::Document).
2014-11-09current_doc_must_undo(): check for undo-necessity when operating on the ↵Robin Haberkorn1-7/+12
current document if the current document is a local q-register from a macro call, we must not generate undo tokens, since the local documents are discarded on macro termination.
2014-02-18fixed array freeing using deleteRobin Haberkorn1-1/+1
* used `delete` instead of `delete[]` * don't know why this didn't cause problems (not even in valgrind)
2014-02-15updated Copyright to year 2014Robin Haberkorn1-1/+1
2014-02-15removed most exception specifications: allow bad_allocs to propagateRobin Haberkorn1-12/+12
* specifications resulted in runtime errors (unexpected exception) when bad_alloc ocurred * specs should be used scarcely: only when the errors that may be thrown are all known and for documentary purposes
2013-03-18remove all unused-attributes for parametersRobin Haberkorn1-3/+2
* compiler does not warn by default: this actually makes sense * so we don't need any unused-attributes * less GCC-extension based * on older GCCs I think -Wunused-parameters was enabled by -Wall we should add -Wno-unused-parameters if that's the case
2013-03-18make sure a (void*)0 is used as sentinelsRobin Haberkorn1-3/+3
since including glib.h on LLVM-Clang (32-bit) results in NULL being redefined to 0 and compiler warnings being emitted when NULL is used as sentinels
2013-03-17fixed ^EG pattern match character: use QRegSpecMachine to parse register ↵Robin Haberkorn1-3/+4
specifications * allows full Q-Reg syntax
2013-03-16documented remaining commandsRobin Haberkorn1-0/+167
* flow control and other structures have not been documented this ways. I have not yet decided whether they should be documented in separate sections or use the documentation tool.
2013-02-22use typedef for SciTECO integers and make it configurable at configure timeRobin Haberkorn1-2/+2
* storage size should always be 64 (gint64) to aid macro portability * however, for performance reasons users compiling from source might explicitly compile with 32 bit integers
2013-01-29fixed backward search-and-kill (e.g. -FK...$)Robin Haberkorn1-9/+19
2013-01-27prevent creating Scintilla UNDO token when FD or FK failsRobin Haberkorn1-14/+22
rubout would undo something different and screw up editor state
2013-01-20fixed search-replace commands if search fails (do not insert then)Robin Haberkorn1-2/+41
* updated TODO
2013-01-19updated copyright (2012-2013)Robin Haberkorn1-1/+1
2012-12-04added copyright notice to every source fileRobin Haberkorn1-0/+17
2012-12-04first working version of autotools based build-systemRobin Haberkorn1-0/+4
2012-12-04autoconf preparation: move everything into src/ subdirRobin Haberkorn1-0/+571