WARNING: I'm working on the new version of Clibtul. Please get in touch with me if you want to provide feedback or discuss addition/removal to the library. Email is in the source headers.
This library provides functions that could, hopefully, speed up the developemnt of a C program.
The functions are related to:
- Logging
- Finite State Machines
- Memory check
- Data structures
- Parsing Regular Expressions (PEG)
- Pattern matching over string
- Try/Catch exceptions
They provide simple and reasonably easy to use solutions to recurring problems.
Even if I made any effort to make them reasonably efficient, I favoured ease of use and simplicity above everything else. You may use them during development and replaced them later if something more efficient is needed.
For instance, the containers functions can help you shape the most appropriate data structures for your problem. Once done, you can replace them with something faster or more compact.
The point is to avoid having to think about trivial things (like logging, for instance) and directly jump into solving your problem.
The only requirement for clibutl to work is compliancy to C99 standard. I've tested it with gcc, clang, Pelles C and Microsoft C/C++
All you need is in the dist
directory:
- Copy
utl.c
andutl.h
in a place that is suitable for your project - Include the
utl.h
header in your source files. - Compile and link
utl.c
with the other files.
The documentation is in the doc
directory and I've also opened a blog
where I'll post about c-libutl from time to time.
There two building mechanisms supported:
-
A
makefile
(for Linux and Mingw). Targets are:all
: Compileclean
: Cleanup the directories from build leftoversdist
: Compile and the distribution directoryruntest
: Compile and run the tests
-
A batch script (
build.bat
) for Windows. Accepts the following options:clean
: Cleanup the directories from build leftoverstest
: Just run the tests (no compilation)MSC
: Compile and run tests (Microsoft C/C++)PCC
: Compile and run tests (Pelles C 32bit)PCC64
: Compile and run tests (Pelles C 64bit)
The "official" development environment for clibutl
is bash and
the GNU tool chain (gcc, make, ...). Tested with gcc
and clang
.
You may want to entirely exclude a portion of the library because
it is of no interest for your project. To do so you may define
one or more of the following symbols before including utl.h
:
-
UTL_NOLOG
will make the logging functionslogxxx
unavailble. -
UTL_NOTRY
will make the try/catch exceptions unavailble. -
UTL_NOFSM
will make the finite state machinesfsmxxx
constructors unavailble. -
UTL_NOPMX
will make the pattern matching functionspmxyyy
unavailble. -
UTL_NOPEG
will make the parsing expression grammars fnctionspegxxx
constructors unavailble. -
UTL_NOVEC
will make the containers functions (vecxxx
,bufxxx
, ...) unavailble.
The doc
directory contains the full documentation of the library functions