TnFOX
Developer(s) | Niall Douglas |
---|---|
Stable release | v0.88
/ June 13, 2008 |
Repository | |
Written in | C++, Python |
Operating system | Cross-platform |
Type | Development Library |
License | GNU Lesser General Public License |
Website | http://www.nedprod.com/TnFOX/ |
The TnFOX portability toolkit is a fork of the FOX GUI toolkit with most of the added code implementing orthogonal features (i.e. not substantially changing the FOX API) such that applications developed for FOX can be easily recompiled for TnFOX. Unusually, TnFOX also contains API emulations of some Qt library classes - according to the author, this was done to port a substantial project from Qt to FOX. Most of the added features implement a full "portability toolkit" library such that one can write one program to run anywhere - this differs from FOX which mostly just provides the GUI portability alone. TnFOX is therefore an example of an operating system abstraction layer.
Unlike FOX, TnFOX supports only a restricted set of C++ compilers and operating systems. It only supports Microsoft's C++ compiler v7.1 and later, GCC v3.2 and later and Intel C++ compiler v8 or later. It also only runs on Windows 2000 or later, Linux 2.6 kernels or later, FreeBSD and Mac OS X 10.4 or later, though on any processor or architecture.
TnFOX contains its own automatically generated bindings for Python based on Boost.Python library - such were the complexity of these it required adding the -fvisibility feature to GCC v4 onwards.[1] However, the quality and state of these have languished in recent years.
The library is no longer maintained by its author, as of 2012. [2]
Substantial Features of TnFOX
One of the more unique features of TnFOX is its heavy usage of C++ metaprogramming though this is entirely kept away from the GUI side of things (for FOX compatibility). A full lightweight metaprogramming toolkit is included which allows many of the operations provided by the Boost metaprogramming library, including typelists, type traits, compile-time logic, functors, virtual table compilation, horizontal type list instantiation and more. Unlike Boost, due to the requirement for a modern C++ compiler, all the metaprogramming operates consistently across compilers without the need for ugly macros.
Another unusual feature is the use of pervasive exception handling and safety whereby any line is assumed to always potentially throw an exception. TnFOX provides a C++ rollback mechanism (as originally proposed by Andrei Alexandrescu) to keep track of what operations need to be undone at any given stage should an error occur - rather like a SQL transaction. One problem with this approach is the possibility of nested exception throws during object destruction which under the ISO C++ standard requires an immediate program termination - TnFOX works around this problem via preprocessing of the source to add extra support code.
A quirky addition of the v0.88 release is to use Google Translations to convert its locale strings. While of dubious utility, especially for shorter strings, it nevertheless may save time during translations.
Unlike most portability toolkits, TnFOX has been very extensively profiled and performance tuned for maximum speed and minimal memory usage. It has strong multithreading support including tuning to avoid two threads writing to the same cache line (which causes cache line bouncing and greatly bottlenecks parallel throughput). It optionally uses its own thread caching memory allocator, automatically uses dynamic algorithms which will trade speed for memory usage according to memory low conditions and has very strong x86 and x64 specific optimisations including a metaprogramming implementation of SIMD vectors which will automatically compile down into SSE operations (right up to SSE4 support). It has its own assembler written fast mutex implementation, extensive internal caching to avoid syscalls to the kernel and its own inter-process communication framework which can transport arbitrary C++ object instances from one place to another by leveraging metaprogramming to automatically implement serialisation & deserialisation. This is particularly evident in its SQL database interface where one can simply bind an arbitrary C++ object instance to a BLOB field and no further code is required.
TnFOX optionally includes copies of the OpenSSL library and the SQLite library in order to implement its strong encryption and its default SQL database implementation respectively. It can be built modularly as a set of separate DLLs or monolithically. It also has full portable support for host operating system ACL security and knows how to protect sensitive data from entering the swap file, plus automatically shredding any deleted portions. It can access which user is running the process and how to escalate its privileges as necessary.
It has a no GUI build suitable as a portability toolkit for daemon and system processes. This has no X11/GDI dependencies.
TnFOX has already begun to add C++0x features for those compilers which support them - this being the next revision of the ISO C++ standard.
Additions to FOX
The modifications to FOX itself are minimal: the only big change is the ability to run multiple parallel window trees, one per thread, which greatly aids reporting errors to the user without deadlocking the user interface. FOX can only operate one window tree and it is always by the main thread.
TnFOX does also completely reimplement a number of FOX classes using its own classes which it calls "the FOX compatibility layer" which can be enabled or disabled at compilation. TnFOX also fatally exits whenever any FOX exception is thrown which is inconsistent with how it handles its own exceptions.
See also
References
- ^ ned Productions - GCC Symbol Visibility Patch
- ^ See March 2012 comment by Niall Douglas: There hasn't been much work on TnFOX in recent years ... Probably, and sadly, most of the 40,000+ lines of my own code in TnFOX will be left to bit rot.