gSlip
Gnu Slip (SLIP) is a rearchitected and enhanced version of SLIP, a list processing API developed in 1964. It differs from the C++ STL <list> in that gSLIP handles acyclic graphs, trees, lists and queues while the C++ STL <list> and <forward-list> only supports lists. gSLIP supports a set of primitive data values (byte, int, word, float, double and string). Using internal types, and with some C++ magic, gSLIP cells can be used in the same way that C++ variables can be used.
gSLIP contains its own space allocator and iterators, and it provides a mechanism for the inclusion of application data objects, flexibly extending gSLIP to application specific needs. Application data objects can be treated as primitives in the same way as gSLIP primitive types.
Data types are dynamic. In an assignment, x = value, where x is a gSLIP cell and value may or may not be, the <type> of x is converted to <type> value, overwritting the original data type of x.
gSLIP acts as a variable in the same way as C++ variables. In the expression x = y + z any or all of x, y or z can be a gSLIP cell.
I/O of graph objects is included. Output a gSLIP graph and input of the same graph yields the same internal structure. Reql numbers are input without loss of precision.
New cell creation and deletion does not require use of the heap except for the initial space allocation. There is no garbage collection, so real-time time constraints are preserved. This is qualified only in that application defined managed objects are managed by the application and gSLIP managed strings use the heap for string allocation and deallocation. Once space is allociated it is reused for all primitive, non-string, types.
And now for a little advertisement.
gSLIP | STL | ||
---|---|---|---|
support lists | YES | YES | support is automatic |
support queues | YES | YES | support is automatic |
linear iterator | YES | YES | support is automatic |
structural iterator | YES | NO | STL only supports lists |
dynamic list operations | YES | YES | support is automatic |
double linked lists | YES | YES | support is automatic |
single linked lists | NO | YES | gSLIP is doubly linked only |
static user defined objects | NO | YES | STL uses templates |
graphs | YES | NO | STL only supports lists |
trees | YES | NO | STL only supports lists |
data objects in expressions | YES | NO | a + b with a or b gSLIP cells |
dynamic user defined objects | YES | NO | STL uses static typing |
maps | YES | NO | <key, value> pairs |
I/O | YES | NO | STL has no I/O |
an input data language | YES | NO | gSLIP allows offline list construction |
list sharing | YES | NO | STL has no sublists |
non-heap cell allocation | YES | NO | gSLIP implements delete/new |
a vibrant community of developers | YES | NO | Well, what did you expect |
Some departures from the original SLIP development where done to make the API accessible and interesting. Some function names where changed, some added, the API takes care of space management, and an I/O layer was added. Although the end result may seem very different from the original design, I am indebted to Dr. Weizenbaum for the original and feel that this is an extension of that original rather than something new.
You can look at some additional material at Gnu gSLIP. A Linux/Cygwin installable package is provided here and here. A zip file containing the source code and documentation can be found here
BUGS
- List Output: Line splitting does not work correctly.