Age | Commit message (Collapse) | Author | Files | Lines |
|
the error message
|
|
* This command exists in Video TECO.
In Video TECO it also supports reading multiple files with a glob pattern -- we do not support that
as I am not convinced of its usefulness.
* teco_view_load() has been extended, so it can read into dot without
discarding the existing document.
|
|
* ED hooks are not executed in this case
* <EF> is now allowed even when editing a Q-Reg, unless you try to close the
current buffer
|
|
Analoguous to :EX, but always saves the file like EW$, not only if it's dirty.
|
|
|
|
|
|
|
|
|
|
This is a total conversion of SciTECO to plain C (GNU C11).
The chance was taken to improve a lot of internal datastructures,
fix fundamental bugs and lay the foundations of future features.
The GTK user interface is now in an useable state!
All changes have been squashed together.
The language itself has almost not changed at all, except for:
* Detection of string terminators (usually Escape) now takes
the string building characters into account.
A string is only terminated outside of string building characters.
In other words, you can now for instance write
I^EQ[Hello$world]$
This removes one of the last bits of shellisms which is out of
place in SciTECO where no tokenization/lexing is performed.
Consequently, the current termination character can also be
escaped using ^Q/^R.
This is used by auto completions to make sure that strings
are inserted verbatim and without unwanted sideeffects.
* All strings can now safely contain null-characters
(see also: 8-bit cleanliness).
The null-character itself (^@) is not (yet) a valid SciTECO
command, though.
An incomplete list of changes:
* We got rid of the BSD headers for RB trees and lists/queues.
The problem with them was that they used a form of metaprogramming
only to gain a bit of type safety. It also resulted in less
readble code. This was a C++ desease.
The new code avoids metaprogramming only to gain type safety.
The BSD tree.h has been replaced by rb3ptr by Jens Stimpfle
(https://github.com/jstimpfle/rb3ptr).
This implementation is also more memory efficient than BSD's.
The BSD list.h and queue.h has been replaced with a custom
src/list.h.
* Fixed crashes, performance issues and compatibility issues with
the Gtk 3 User Interface.
It is now more or less ready for general use.
The GDK lock is no longer used to avoid using deprecated functions.
On the downside, the new implementation (driving the Gtk event loop
stepwise) is even slower than the old one.
A few glitches remain (see TODO), but it is hoped that they will
be resolved by the Scintilla update which will be performed soon.
* A lot of program units have been split up, so they are shorter
and easier to maintain: core-commands.c, qreg-commands.c,
goto-commands.c, file-utils.h.
* Parser states are simply structs of callbacks now.
They still use a kind of polymorphy using a preprocessor trick.
TECO_DEFINE_STATE() takes an initializer list that will be
merged with the default list of field initializers.
To "subclass" states, you can simply define new macros that add
initializers to existing macros.
* Parsers no longer have a "transitions" table but the input_cb()
may use switch-case statements.
There are also teco_machine_main_transition_t now which can
be used to implement simple transitions. Additionally, you
can specify functions to execute during transitions.
This largely avoids long switch-case-statements.
* Parsers are embeddable/reusable now, at least in parse-only mode.
This does not currently bring any advantages but may later
be used to write a Scintilla lexer for TECO syntax highlighting.
Once parsers are fully embeddable, it will also be possible
to run TECO macros in a kind of coroutine which would allow
them to process string arguments in real time.
* undo.[ch] still uses metaprogramming extensively but via
the C preprocessor of course. On the downside, most undo
token generators must be initiated explicitly (theoretically
we could have used embedded functions / trampolines to
instantiate automatically but this has turned out to be
dangereous).
There is a TECO_DEFINE_UNDO_CALL() to generate closures for
arbitrary functions now (ie. to call an arbitrary function
at undo-time). This simplified a lot of code and is much
shorter than manually pushing undo tokens in many cases.
* Instead of the ridiculous C++ Curiously Recurring Template
Pattern to achieve static polymorphy for user interface
implementations, we now simply declare all functions to
implement in interface.h and link in the implementations.
This is possible since we no longer hace to define
interface subclasses (all state is static variables in
the interface's *.c files).
* Headers are now significantly shorter than in C++ since
we can often hide more of our "class" implementations.
* Memory counting is based on dlmalloc for most platforms now.
Unfortunately, there is no malloc implementation that
provides an efficient constant-time memory counter that
is guaranteed to decrease when freeing memory.
But since we use a defined malloc implementation now,
malloc_usable_size() can be used safely for tracking memory use.
malloc() replacement is very tricky on Windows, so we
use a poll thread on Windows. This can also be enabled
on other supported platforms using --disable-malloc-replacement.
All in all, I'm still not pleased with the state of memory
limiting. It is a mess.
* Error handling uses GError now. This has the advantage that
the GError codes can be reused once we support error catching
in the SciTECO language.
* Added a few more test suite cases.
* Haiku is no longer supported as builds are instable and
I did not manage to debug them - quite possibly Haiku bugs
were responsible.
* Glib v2.44 or later are now required.
The GTK UI requires Gtk+ v3.12 or later now.
The GtkFlowBox fallback and sciteco-wrapper workaround are
no longer required.
* We now extensively use the GCC/Clang-specific g_auto
feature (automatic deallocations when leaving the current
code block).
* Updated copyright to 2021.
SciTECO has been in continuous development, even though there
have been no commits since 2018.
* Since these changes are so significant, the target release has
been set to v2.0.
It is planned that beginning with v3.0, the language will be
kept stable.
|
|
|
|
* we were basing the glib allocators on throwing std::bad_alloc just like
the C++ operators. However, this always was unsafe since we were throwing
exceptions across plain-C frames (Glib).
Also, the memory vtable has been deprecated in Glib, resulting in
ugly warnings.
* Instead, we now let the C++ new/delete operators work like Glib
by basing them on g_malloc/g_slice.
This means they will assert and the application will terminate
abnormally in case of OOM. OOMs cannot be handled properly anyway, so it is
more important to have a good memory limiting mechanism.
* Memory limiting has been completely revised.
Instead of approximating undo stack sizes using virtual methods
(which is unprecise and comes with a performance penalty),
we now use a common base class SciTECO::Object to count the memory
required by all objects allocated within SciTECO.
This is less precise than using global replacement new/deletes
which would allow us to control allocations in all C++ code including
Scintilla, but they are only supported as of C++14 (GCC 5) and adding compile-time
checks would be cumbersome.
In any case, we're missing Glib allocations (esp. strings).
* As a platform-specific extension, on Linux/glibc we use mallinfo()
to count the exact memory usage of the process.
On Windows, we use GetProcessMemoryInfo() -- the latter implementation
is currently UNTESTED.
* We use g_malloc() for new/delete operators when there is
malloc_trim() since g_slice does not free heap chunks properly
(probably does its own mmap()ing), rendering malloc_trim() ineffective.
We've also benchmarked g_slice on Linux/glib (malloc_trim() shouldn't
be available elsewhere) and found that it brings no significant
performance benefit.
On all other platforms, we use g_slice since it is assumed
that it at least does not hurt.
The new g_slice based allocators should be tested on MSVCRT
since I assume that they bring a significant performance benefit
on Windows.
* Memory limiting does now work in batch mode as well and is still
enabled by default.
* The old UndoTokenWithSize CRTP hack could be removed.
UndoStack operations should be a bit faster now.
But on the other hand, there will be an overhead due to repeated
memory limit checking on every processed character.
|
|
batch mode
* by using variadic templates, UndoStack::push() is now responsible
for allocating undo tokens. This is avoided in batch mode.
* The old UndoStack::push(UndoToken *) method has been made private
to avoid confusion around UndoStack's API.
The old UndoStack::push() no longer needs to handle !undo.enabled,
but at least asserts on it.
* C++11 support is now required, so variadic templates can be used.
This could have also been done using manual undo.enabled checks;
or using multiple versions of the template with different numbers
of template arguments.
The latter could be done if we one day have to support a non-C++11
compiler.
However since we're depending on GCC 4.4, variadic template use should
be OK.
Clang supports it since v2.9.
* Sometimes, undo token pushing passed ownership of some memory
to the undo token. The old behaviour was relied on to reclaim the
memory even in batch mode -- the undo token was always deleted.
To avoid leaks or repeated manual undo.enabled checking,
another method UndoStack::push_own() had to be
introduced that makes sure that an undo token is always created.
In batch mode (!undo.enabled), this will however create the object
on the stack which is much cheaper than using `new`.
* Having to know which kind of undo token is to be pushed (taking ownership
or not) is inconvenient. It may be better to add static methods to
the UndoToken classes that can take care of reclaiming memory.
* Benchmarking certain SciTECO scripts have shown 50% (!!!) speed increases
at the highest possible optimization level (-O3 -mtune=native -march=native).
|
|
* this allows you to exit and save only those buffers that are modified.
This was not yet possible using macros, since there is currently no way
to query the dirty state of buffers programmatically.
* even if there was, the necessary key presses might be too much for
some users.
* the ability to save all modified buffers has been explicitly requested
by an user in ticket #4.
* the new behaviour is not compatible with classic TECO where EX would
save the current file by default but provides a relatively short way
to do just that.
* updated the documentation: there was also one mistake regarding the
boolean that EX accepts non-colon-modified.
|
|
|
|
* expands to the value of $HOME (the env variable instead of
the register which currently makes a slight difference).
* supported for tab-completions
* supported for all file-name accepting commands.
The expansion is done centrally in StateExpectFile::done().
A new virtual method StateExpectFile::got_file() has been
introduced to pass the expanded/processed file name to
command implementations.
* sciteco(7) has been updated: There is now a separate section
on file name arguments and file name handling in SciTECO.
This information is important but has been scattered across
the document previously.
* optimized is_glob_pattern() in glob.h
|
|
|
|
* 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
|
|
|
|
* in batch mode, Scintilla undo actions are simply leaked memory
* Since we have more than one Scintilla view now, we must empty
the undo buffer of all scintilla views when a command line is committed ($$)
|
|
this will allow us to use the same algorithms for loading and saving
Q-Registers (from/to file).
* Saving with EW when a Q-Reg is edited has been fixed (was broken earlier)
* SciTECO save point files are now named .teco-X-BASENAME
When using IOView for Q-Regs, there will be no way to sensible count
the save points. Each write of a Q-Reg may be to another file.
Therefore, we number save-points globally.
If the sequence of writes has to be reconstructed manually,
one can still look at the save point files' modification dates
* give more informative error messages when saving a file fails
|
|
this is more consistent with SciTECO's idea of abstract registers
and allows the currend buffer to be saved on the Q-Register stack.
This allows the idiom: [* ! ...change current buffer... ! ]*
|
|
* 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.
|
|
this eases handling of the "*" register
|
|
* it must be initialized after the UI (Interface::main), so I added
a View::initialize() function
* the old initialize() method was renamed to setup()
* use a global instance of QRegister::view so it is guaranteed to
be destroyed only after any QRegisters that could still need it
* Document API adapted to work with ViewCurrent references
|
|
* 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)
|
|
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.
|
|
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.
|
|
|
|
* 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
|
|
* 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
|
|
init_priority attribute
* we cannot use weak symbols in MinGW, so we avoid init_priority for symbol
initialization by compiling the empty definitions into
sciteco-minimal but the real ones into sciteco
(had to add new file symbols-minimal.cpp)
* this fixes compilation/linking on LLVM Clang AND Dragonegg
since their init_priority attribute is broken!
this will likely be fixed in the near future but broken versions
will be around for some time
|
|
tab-completions
* StateExpectFile adds no functionality (currently), but is useful for checking state types
|
|
* 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
|
|
* also encapsulates data properly (previously there were many public
attributes to avoid permission issues)
* new class also cares about saving/and restoring scroll state.
now, buffer/q-reg edits and temporary accesses do not reset
the scroll state anymore.
|
|
occurs when rubbing out a switch from q-reg string or to q-reg string
|
|
|
|
|
|
|