I spent most of my professional life writing programs and even do it as a hobby from time to time. I wrote various application programs that might be useful for others as well. All programs below are under the Apache license.
Note that all my programs are written in ANSI-C, possibly using POSIX- standardized functions where appropriate. Thus I expect only minor problems when porting to a new platform.
All programs below are published as gzipped TAR archives suitable to be unpacked and compiled under Linux and various other UNIXes. Alternatively, I can provide ZIP archives on demand to be compiled under Windows.
As a third option, I can provide a "merged" version of programs. The merged version consists of one C file for the main program, one C file for the library, and one single header file. This is convenient for use in some IDE's where you only want to add a C source and a header to your project. Just drop a me mail and will send such a version to you.
This is my implementation of Bayer-Trees, which are normally used for indices of data bases. These routines provide all stuff that is needed: Create and destroy; insert, update and delete; load and destroy; search and traverse; check a tree. Included is a test program "testbtree" to demonstrate programming.
File access is done through a modular package "fcache" which allows multi user access via shared memory (System V or POSIX) and provides locking. This part can also be used separately. A administration program "fcacheadmin" and a test program "testfcache" are included for demonstration purposes.
For the file format I introduced "dbasefs" - a file system implementation as another modular layer. "dbasefs" employs a schema to protect integrity of written data similar to a journaling file system. The data is written to one or multiple files which is similar to containers (or tablespaces) in a database. Changes to multiple places of a "file" (or a group of files in the container) are either fully applied or non at all (transactional behaviour). One can also create snapshots of the current status and later revert back to them. An administration program "dbfsadmin" and a test program "testdbfs" are included for demonstration purposes.
Again, this part could be used separately! You can also convert ordinary files in-place to "dbasefs" format and vice versa. By modifying an existing application to use the file I/O API of "dbasefs", one could run the application normally and later convert the file to "dbasefs" format and the application can take advantage of the transactional features or snapshots etc. Also, due to the underlying "fcache" library, multi-user access is possible.
Preprocessor + parser for code instrumentation and analysis.
Contains an ANSI-C compliant preprocessor and parser. It can analyze your
code and show for example function dependencies. Most prominent is a mode
which instruments your code to emit tracing for function calls and returns.
You may also trace variable usage and changes. Furthermore, you can have
tracing for each individual source line and quickly fill your disk :).
Comes along with a compiler frontend wrapper "jscc" to
make usage very simple.
Another small program included is "jstokmat" which
does pattern matching and changing on C-code ("jstokmat -h"
shows how).
To maintain and modularize libraries of subroutines, I use some utilities to extract prototypes, definitions, and error messages from the sources.
I also have files that define source code dependencies, i. e. which routine uses which etc. These dependencies can be analyzed by jsmakedeps. Maybe less useful is a source code encryption program jscrypt that makes a source code unreadable but still compilable on a target machine. This might be used if one wants to give sources away while restricting the others ability to do much with the program except compiling it.
jshex is a small utility to print binary files as a combined hex dump with printable characters shown as well. Another useful program is jscrcval which adapts/adds checksum tags in files to make the total checksum (as calculated by cksum) any desired value.
jstsort does standard topological sorting, but also specialized topological sorting that groups symbols that are independent, thus resolving the inherent ambiguity in standard topological sorts.
Additionally, this collection contains an archiver jsar, a command line calculator with some additional features like generating function tables jsexpr, and a little utility that replaces parts in a file.
In a lot of programs my gensort-utility turned out to be very
useful. It consists simply of the header file
"gensort.h", contained in the above package. To obtain
a sorting routine, simply define the name of the routine, the data type you
want to sort and how to compare items with preprocessor symbols, and then
simply say
#include <gensort.h>There you have a fast and reliable Quicksort (or alternatively Heapsort) routine! The abilities of the
gensort generated routines are
identical to those obtained by using the qsort routine from the
ANSI-C standard, but by far faster! The package contains
a test program testsort.c that compares the qsort
routines versus the gensort-generated ones.
NEW: I added code to produce "mergesort" routines suitable for linked lists.
A long description how to use it along with some easy examples is at the
begin of the header file gensort.h itself.
The bigsort routine implements a way to sort huge amounts of
data that do not fit into main memory by using a multi-phase sorting on files.
It is a implementation from the book "Algorithms and data structures"
by Niklaus Wirth. Additionally, this routine recognizes small amounts of data
that do fit into memory and resorts to a in-place quicksort.
A program to test a compiler's compliance to the ANSI-C standard. Some more esoteric but allowed features of the ANSI standard are tested, some preprocessor behaviour is tested. If your compiler does not complain, it's ok!
Depending on the architecture, compilers do padding of structures to force certain types to be aligned. This program shows quickly what alignments are required (i. e. otherwise you get a core dump when accessing values at unaligned addresses) and the imposed ones (i. e. padding in structures).
Well, has anybody ever counted how many times people have written this? I have to admit: I did it, too! This is a CURSES based program. It has a nice introduction and -most notably- an autopilot! So if you are tired of playing yourself, watch the computer play.