aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-03-16implemented automatic EOL translation supportRobin Haberkorn1-1/+15
* activated via bit 4 of the ED flag (enabled by default) * automatic EOL guessing on file loading and translation to LFs. * works with files that have inconsistent EOL sequences. * automatic translation to original EOL sequences on file saving * works with inconsistent EOL sequences in the buffer. This should usually not happen if the file was read in with automatic EOL translation enabled. * also works with the EC and EG commands * performance is OK, depending on the file being translated. When reading files with UNIX EOLs, the overhead is minimal typically-sized files. For DOS EOLs the overhead is larger but still acceptable. * Return (line feed) is now an immediate editing command. This centralizes EOL sequence insertion. Later, other features like auto-indent could be added to the editing command. * get_eol() has been moved to main.cpp (now called get_eol_seq() * Warn if file ownership could not be preserved when saving files. * IOView has been almost completely rewritten based on GIOChannels. The EOL translation code is also in IOView.
2015-03-10added --no-profile command line optionRobin Haberkorn1-2/+9
2015-03-07added hack for Windows to pause at the beginning of main() if DEBUG_PAUSE is ↵Robin Haberkorn1-0/+14
defined
2015-03-07canonicalize $SCITECOCONFIG and $SCITECOPATH variablesRobin Haberkorn1-1/+16
* this makes them absolute and also resolves links on Unix * macros can now assume the corresponding Q-regs to be absolute * Currently this does not make a big difference since the working directory of the SciTECO process cannot be changed. Once I implement a command to change the working dir, this is essential.
2015-03-07improved --help output and introduced PACKAGE_URL_DEV (for development home)Robin Haberkorn1-2/+13
* The PACKAGE_URL_DEV is also mentioned in --help output and sciteco(1)
2015-03-07cleaned up usage of the escape control character: introduced CTL_KEY_ESC and ↵Robin Haberkorn1-1/+1
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.
2015-03-02removed last remaining "throw" specificationsRobin Haberkorn1-9/+6
* They are harmful. I removed most of them a long time ago but kept some for their documenting character. However, they will always result in additional checks (runtime penalty) when the corresponding functions get called and cannot ensure that only the declared exceptions are thrown at compile time.
2015-03-01moved String helper functions from sciteco.h and main.cpp to ↵Robin Haberkorn1-23/+0
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-14updated Scintilla submodule: fixed tab stop calculation on CursesRobin Haberkorn1-1/+1
* also did some whitespace cleanup in SciTECO now that tabs are displayed properly
2015-02-11updated copyright to 2015Robin Haberkorn1-1/+1
2014-12-15always free glib's GError structuresRobin Haberkorn1-0/+1
* when throwing GlibError(), this is taken care of automatically. * fixes a memleak since there may be resources associated with the GError.
2014-11-24introduced $SCITECOCONFIG env variable, and set different default for ↵Robin Haberkorn1-27/+36
$SCITECOPATH on Windows * $SCITECOCONFIG has been introduced, so have a macro-accessible location for the profile, buffer session etc. This is set to the program dir on Windows. That way, the config files will be found, regardless of the current working dir, but it may also be set up for Unix-like environments on Windows. * $SCITECOPATH defaults to the program dir + "/lib" now on Windows. * The default profile is now always called ".teco_ini". Also on Windows. Platform differences like this would need to be documented. * The sample teco.ini has been renamed to "sample.teco_ini" for clarity
2014-11-24turn off Scintilla undo collection by default and fixed memleakRobin Haberkorn1-2/+5
* 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 ($$)
2014-11-24Q-Register loading and saving using the IOView classRobin Haberkorn1-1/+2
* EW can save Q-Registers now * the new E% may be used to save a q-register without making it the current document
2014-11-21finally implemented the CLOSE and QUIT hooksRobin Haberkorn1-1/+23
the QUIT hook is actually not that trivial and required some architectural changes. First, the QUIT hook execution and any error that might occurr cannot always be attached to an existing error stack frame. Thereforce, to give a stack frame for QUIT hooks and to improve the readability of error traces for ED hooks in general, a special EDHookFrame is added to every ED hook execution error. Secondly, since QUIT hooks can themselves throw errors, we cannot run it from an atexit() handler. Instead it's always called manually before __successful__ program termination. An error in a QUIT hook will result in a failure return code nevertheless. Thirdly, errors in QUIT hooks should not prevent program termination (in interactive mode), therefore they are only invoked from main() and always in batch mode. I.e. if the interactive mode is terminated (EX$$), SciTECO will switch back to batch mode and run the QUIT hook there. This is also symmetric to program startup, which is always in batch mode. This means that Interface::event_loop() no longer runs indefinitely. If it returns, this signals that the interface shut down and batch mode may be restored by SciTECO.
2014-11-17Make sure QRegister::view is properly initialized and cleaned upRobin Haberkorn1-3/+3
* 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
2014-11-16first working version of the one-view-per-buffer designRobin Haberkorn1-46/+4
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-3/+4
* 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-49/+61
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-02-15updated Copyright to year 2014Robin Haberkorn1-1/+1
2014-02-15all interface classes define the same type InterfaceCurrent, simplifying the ↵Robin Haberkorn1-5/+1
interface object definition * they still define their own classes (e.g. InterfaceNCurses), InterfaceCurrent is a typedef
2014-02-15added State::StdError class for constructing errors from std::exception objectsRobin Haberkorn1-1/+1
2014-02-15use GLib's GError information to yield errorsRobin Haberkorn1-2/+5
* 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
2014-02-15glib allocation functions throw std::bad_alloc exceptions now; catch all ↵Robin Haberkorn1-0/+58
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
2014-02-15String::get_coord() calculates line and column of a string positionRobin Haberkorn1-0/+23
* use to get line and column into a stack frame
2014-02-15added support for TECO stack tracingRobin Haberkorn1-15/+22
* 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
2013-03-18remove all unused-attributes for parametersRobin Haberkorn1-2/+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-18declare all global inter-dependant objects in main.cpp and get rid of ↵Robin Haberkorn1-0/+20
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
2013-03-18make sure a (void*)0 is used as sentinelsRobin Haberkorn1-2/+2
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-18prefer $HOME over passdb when looking for .teco_iniRobin Haberkorn1-1/+1
* fixes sudo sciteco: will still use the real user's .teco_ini * when run with real user as root, will look in root's home dir * use g_get_home_dir() as a fallback
2013-02-22use typedef for SciTECO integers and make it configurable at configure timeRobin Haberkorn1-1/+1
* 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-02-22fixed global object initialization order issueRobin Haberkorn1-3/+3
* Scintilla is now initialized from main() using Interface::main() * Scintilla initialization depends on initialization of objects in the global namespace (otherwise the Lexer catalogue may not be filled properly and lexing may not work). Lexer modules were initialized after SciTECO interface initialization * merged Scintilla initialization (Interface::main()) with interface option parsing
2013-02-22fixed margin configuration with GTK+ interfaceRobin Haberkorn1-1/+3
* line-number style must be explicitly set, even after CLEARALLSTYLES * margin widhts are in pixels (except in Scinterm), so we must determine the pixels requiered by a number of digits (e.g. 5 digits)
2013-02-22Windows (MinGW) compatibility fixes: suspending impossible and environment ↵Robin Haberkorn1-8/+7
initialization revised * g_get_environ() appears to be broken, at least in Wine and Win2k
2013-02-22clean up QRegisterTable::insert|initialize usageRobin Haberkorn1-5/+4
* distinction no longer useful since string part of register is now never pre-initialized
2013-02-15install standard macros into special standard library path (pkgdatadir/lib)Robin Haberkorn1-1/+5
* SCITECOPATH environment variable defaults to this directory * manpage updated * default teco.ini updated: no need to generate it anymore
2013-02-14initialize global Q-Registers (beginning with $) with environment variablesRobin Haberkorn1-0/+23
e.g. G{$HOME} will insert the HOME environment variable
2013-02-08use special Q-Register $ (<ESC>) to hold the replacement commandlineRobin Haberkorn1-0/+3
* allows us to switch between buffers/registers when editing the commandline
2013-02-01fixed buffer Ring initializationRobin Haberkorn1-2/+0
* there was a dependency on interface initialization. it did not cause issues because destruction order was by chance. * introduced INIT_PRIO and PRIO_* macros to easy initialization order declaration (using a PRIO_* formula makes code self-documenting) * also used this to clean up QRegisterTable initialization (we do not need the explicit initialize() method) * also used to clean up symbols initialization
2013-01-23added --eval commandline option allowing code to be executed on the commandlineRobin Haberkorn1-1/+19
useful, e.g. in Makefiles
2013-01-23implemented special save last commandline command ("*" at beginning of ↵Robin Haberkorn1-0/+1
commandline macro) * only works as part of commandline macro, * at the beginning of other macros, it is treated like an arithmetic asterisk * variables defined in cmdline.cpp are now declared by new cmdline.h
2013-01-19updated copyright (2012-2013)Robin Haberkorn1-1/+1
2013-01-19allow <CTRL/C> to be typed; aborts last typed charRobin Haberkorn1-0/+19
* CTRL/C will be a command so it is important to be able to type it directly * aborting character processing is important because it allows aborting infinite loops * since the loop interruption currently relies on SIGINT handling, there is only limited support for XCurses and GTK - CTRL/C has to be typed in the terminal window. later support for input queue polling might be added
2012-12-05windows compatibility changesRobin Haberkorn1-21/+7
* respect executable extensions * do not use weak symbols which appear to be broken on MinGW. Instead, the generated symbol constants contain constructor functions initializing the corresponding objects. Constructor priorities are used to ensure that the initialization takes place after the dummy (NULL) initialization. * do not change the working dir (causes trouble when sciteco gets passed relative paths but the exe is not in the current dir) instead look for teco.ini in program's directory
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/+208