TnFOX
Encyclopedia
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 - such were the complexity of these it required adding the -fvisibility feature to GCC v4 onwards. However, the quality and state of these have languished in recent years.
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.
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.
FOX toolkit
The FOX toolkit is an open source, cross-platform widget toolkit, that is, a library of basic elements for building a graphical user interface...
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
GNU Compiler Collection
The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain...
v3.2 and later and Intel C++ compiler v8 or later. It also only runs on Windows 2000
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
or later, Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...
2.6 kernels or later, FreeBSD
FreeBSD
FreeBSD is a free Unix-like operating system descended from AT&T UNIX via BSD UNIX. Although for legal reasons FreeBSD cannot be called “UNIX”, as the direct descendant of BSD UNIX , FreeBSD’s internals and system APIs are UNIX-compliant...
and Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
10.4 or later, though on any processor or architecture.
TnFOX contains its own automatically generated bindings for Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
based on Boost.Python - such were the complexity of these it required adding the -fvisibility feature to GCC v4 onwards. However, the quality and state of these have languished in recent years.
Substantial Features of TnFOX
One of the more unique features of TnFOX is its heavy usage of C++ metaprogrammingMetaprogramming
Metaprogramming is the writing of computer programs that write or manipulate other programs as their data, or that do part of the work at compile time that would otherwise be done at runtime...
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
Andrei Alexandrescu
Andrei Alexandrescu is a Romanian C++ programmer and author. He is particularly known for his pioneering work on policy-based design implemented via template metaprogramming. These ideas are articulated in his book Modern C++ Design and were first implemented in his programming library, Loki. He...
) to keep track of what operations need to be undone at any given stage should an error occur - rather like a SQL
SQL
SQL is a programming language designed for managing data in relational database management systems ....
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
OpenSSL
OpenSSL is an open source implementation of the SSL and TLS protocols. The core library implements the basic cryptographic functions and provides various utility functions...
library and the SQLite
SQLite
SQLite is an ACID-compliant embedded relational database management system contained in a relatively small C programming library. The source code for SQLite is in the public domain and implements most of the SQL standard...
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
C++0x
C++11, also formerly known as C++0x, is the name of the most recent iteration of the C++ programming language, replacing C++03, approved by the ISO as of 12 August 2011...
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
- Widget toolkitWidget toolkitIn computing, a widget toolkit, widget library, or GUI toolkit is a set of widgets for use in designing applications with graphical user interfaces...
- Operating System Abstraction Layer
- List of widget toolkits
- FOX toolkitFOX toolkitThe FOX toolkit is an open source, cross-platform widget toolkit, that is, a library of basic elements for building a graphical user interface...
- QtQt (toolkit)Qt is a cross-platform application framework that is widely used for developing application software with a graphical user interface , and also used for developing non-GUI programs such as command-line tools and consoles for servers...