Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
|
|
|
|
* It is still useful to have this in macros since you may want to
work with non-normalized file names.
For instance, env variables (including $SCITECOPATH and $SCITECOCONFIG)
may (and will probably) include backward-slash separators on Windows
|
|
CTL_KEY_ESC_STR
* the reason for the CTL_KEY() macro is to get the control character
resulting from a CTRL+Key press -- at least this is how SciTECO
presents these key presses.
It is also a macro and may be resolved to a constant expression,
so it can be used in switch-case statements.
Sometimes it is clearer to use standard C escape sequences (like '\t').
* CTL_KEY('[') for escape is hard to read, so I always used '\x1B' which
is even more cryptic.
|
|
|
|
cleanup/refactoring
* characters rubbed out are not totally removed from the command line,
but only from the *effective* command line.
* The rubbed out command line is displayed after the command line cursor.
On Curses it is grey and underlined.
* When characters are inserted that are on the rubbed out part of the command line,
the cursor simply moves forward.
NOTE: There's currently no immediate editing command for reinserting the
next character/word from the rubbed out command line.
* Characters resulting in errors are no longer simply discarded but rubbed out,
so they will stay in the rubbed out part of the command line, reminding you
which character caused the error.
* Improved Cmdline formatting on Curses UI:
* Asterisk is printed bold
* Control characters are printed in REVERSE style, similar to what
Scinterm does. The controll character formatting has thus been moved
from macro_echo() in cmdline.cpp to the UI implementations.
* Updated the GTK+ UI (UNTESTED): I did only, the most important API
adaptions. The command line still does not use any colors.
* Refactored entire command line handling:
* The command line is now a class (Cmdline), and most functions
in cmdline.cpp have been converted to methods.
* Esp. process_edit_cmd() (now Cmdline::process_edit_cmd()) has been
simplified. There is no longer the possibility of a buffer overflow
because of static insertion buffer sizes
* Cleaned up usage of the cmdline_pos variable (now Cmdline::pc) which
is really a program counter that used a different origin as macro_pc
which was really confusing.
* The new Cmdline class is theoretically 8-bit clean. However all of this
will change again when we introduce Scintilla views for the command line.
* Added 8-bit clean (null-byte aware) versions of QRegisterData::set_string()
and QRegisterData::append_string()
|
|
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
|
|
* acts as a safe-guard against uninterrupted infinite loops
or other operations that are costly to undo in interactive mode.
If we're out of memory, it is usually too late to react properly.
This implementation tries to avoid OOMs due to SciTECO behaviour.
We cannot fully exclude the chance of an OOM error.
* The undo stack size is only approximated using the
UndoToken::get_size() method.
Other ways to measure the exact amount of allocated heap
(including size fields in every heap object or using sbrk(0) and
similar) are either costly in terms of memory or platform-specific.
This implementation does not need any additional memory per heap
object or undo token but exploits the fact that undo tokens
are virtual already. The size of an undo token is determined
at compile time.
* Default memory limit of 500mb should be OK for most people.
* The current limit can be queried with "2EJ" and set with <x>,2EJ.
This also works interactively (a bit tricky!)
* Limiting can be disabled. In this case, undo token processing
is a bit faster.
* closes #3
|
|
without a corresponding loop start (<)
* assertions were introduced very early when there was no proper error handling
in SciTECO. However it points to a macro programming error instead of
a SciTECO programming error and should not crash the editor.
* Perhaps it would be best to check for this kind of "syntax" error also
in parse-only modes. This is not done currently.
* part of the solution to issue #3
|
|
* also did some whitespace cleanup in SciTECO now that tabs are
displayed properly
|
|
|
|
* the ^I command was altered to insert indention characters
rather than plain tabs always.
* The <TAB> immediate editing command was added for all
insertion arguments (I, ^I but also FR and FS)
* documentation was extended for a discussion of indention
|
|
|
|
|
|
* EW can save Q-Registers now
* the new E% may be used to save a q-register without making it
the current document
|
|
this is analoguous to EU as the string-build equivalent
of ^U.
|
|
it became apparent, that something like this is very useful,
when constructing the contents of a q-register without
editing it.
I have decided against introducing another modifier for toggling
string building. Most commands have string building enabled and it
doesn't hurt. For the few exceptions, an alternative variant can
be introduced.
|
|
* main motivation is to have a way of getting the number of buffers
in the ring. "EJ" or "1EJ" will do that.
This simplifies macros that will have to iterate all the buffers.
They no longer have to close the existing buffers to do that.
* "0EJ" will get the current user interface. This is useful to select
a different color scheme in the startup profile depending on the UI,
for instance.
|
|
* implements the same globbing as the EB command already did
* uses Globber helper class that behaves more like UNIX glob().
glib only has a glob-style pattern matcher.
* The Globber class may be extended later to provide more
UNIX-like globbing.
* lexer.tes has been updated to make use of globbing.
Now, lexers can be automatically loaded and registered at
startup. To install a new lexer, it's sufficient to copy
a file to the lexers/ directory.
|
|
|
|
introduced Error::set_coord()
|
|
This is only a problem if the macro created the local Q-Register table
(i.e. not when called with ":M") but resulted in segfaults.
Since we do not want to save in a Q-Reg whether it is local
(and that wouldn't suffice anyway), we do it in the Q-Register table
cleanup. The corresponding QRegisterTable::clear() must be called
explicitly, since the RBTree::clear() called on destruction does not
and cannot throw errors.
If QRegisterTable::clear() has been called successfully, the default object
destructor will not do much. If it has thrown an error, the destructor
will clean up the remaining Q-Registers.
|
|
it was not possible to inherit the parser state of the last command in
a macro. However, it was possible to exit the macro when its
last command was not properly terminated.
There is no useful conscious application of this behaviour.
* If something like an uncomplete E-Command was last in the
macro, there was absolutely no effect. However this points
to a macro programming error.
* If the last command started a string parameter but did not
terminate it, the command might be (partially) executed.
However the State's done() method wasn't called, which means
that some commands will not execute at all. Again there's
no useful application of this.
When on the other hand, the last command was not terminated
by accident, this was not reported to the user.
|
|
this eases handling of the "*" register
|
|
* allowed me to remove some obscure global functions and methods like
QRegister::update_string().
* Document updating is concentrated in qregisters.cpp now
* also fixes some bugs introduced earlier, like undo tokens being
generated for non-undo registers (resulting in segfaults on rubout)
|
|
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
|
|
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.
|
|
also changed precedence of + operator (higher than minus).
the effects of this should be minimal
|
|
* the GError expection has been renamed to GlibError, to avoid
nameclashes when working from the SciTECO namespace
|
|
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).
|
|
|
|
|
|
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.
|
|
|
|
|
|
powerful command for filtering a SciTECO buffer through an external
program. It will be described in the sciteco(7) man pages.
The implementation uses an asynchronous background process with
pipes but is platform independant thanks to glib's g_spawn functions,
GIOChannels and event loops.
There are however platform differences in how the operating system
command is interpreted/parsed.
|
|
the question remains what to do then.
FIXME: consult TECO standard
|
|
* referencing temporaries is unreliable/buggy in GNU C++, at least since v4.7
* in higher optimization levels it resulted in massive memory corruptions
* this is responsible for the build issues (PPA build issues)
* instead, always declare a buffer on the stack which guarantees that the
variable lives long enough
* the g_strdup(CHR2STR(x)) idiom has been replaced with String::chrdup(x)
|
|
|
|
|
|
* results in better error messages, e.g. when opening files
* the case that a file to be opened (EB) exists but is not readably is handled for the first time
|
|
* might throw other exceptions that must be associated with the parent macro level's (stack frame)
* add position information to "label not found" errors
* Error copy constructors
|
|
* 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
|
|
bad_allocs and convert them to State::Error
* will allow some degree of OOM handling
* currently does not work since the exception specifications prevent bad_allocs from propagating.
exception specification usage must be completely revised
|
|
* use to get line and column into a stack frame
|
|
* when an error is thrown, stack frames are collected on clean up, up to
the toplevel macro
* the toplevel macro decides how to display the error
* now errors in interactive and batch mode are displayed differently
* in batch mode, a backtrace is displayed as a sequence of messages
* Execute::file() forwards errors correctly
* the correct error in the file is displayed in interactive mode
* necessary to build the stack trace
|
|
register
I felt the urge to implement that after accidentally rubbing out my entire commandline
(the work of an hour) just by pressing "}"...
|
|
* fixes compilation on g++ 4.7 where compound literals are suddenly
temporaries (from which you cannot get a pointer)
* the compound statement (also GCC extension) should ensure that
the string is allocated on the stack with automatic lifetime
|
|
|