| download | motivation | current state |
libmawk
Libmawk is a fork of mawk 1.3.3 restructured for embedding. This means the
user gets libmawk.h and libmawk.so and can embed awk scripting language
in any application written in C. Why? Because
awk is my favorite programming language.
If you are interested in the project, you may want to
download the sources.
features
Libmawk has the following main features:
- load and run multiple awk scripts independently, in parallel
- scripts do not read stdin but a memory buffer the embedding process can fill from time to time
- running scripts in (mostly) non-blocking manner - that is, the script will not block if the process can not provide new input
- all these without threads or fork() - leaving the choice to the application to implement async main loop, threads or multiple processes with IPC
- call awk functions from C, using vararg for smooth integration
- call C functions from awk scripts
- resolve existing awk variables from C - read or write variables
- virtual arrays: the application may create "builtin" arrays which with hooks (C function callbacks) on set/get/etc.; this allows the application to implement arrays with side effects
- save/load precompiled (binary) scripts
- accounting of memory allocation, optional limitation of memory allocation, per script
- language extensions (both in the lib and executable version):
- dynamic function calls (call functions by name using call() and acall())
- dynamic variable value fetch (valueof() returns the value of a variable by name)
- include "source.awk" allows an awk source to include another awk source (for modular scripts and awk libraries)
- compile-time configuration for avoiding floating point - in which case all numerics are integers (default setting is floating point with doubles, this is only an option)
- compile-time option to avoid any code that would fork() or exec()
- language fixes and unified operation on POSIX unspecified behavior:
- ENVIRON[] is inherited by children processes (both system() and getline-style calls); ENVIRON[] is a per script instance array
- floating point: support for NaN on all platforms; on some exotic platforms (some 80's and 90's UNIX systems) this is achieved by wrappers around match calls
License
Since mawk is licensed under the GNU GPL v2 and libmawk is a fork of
mawk, libmawk is licensed under the GNU GPL v2 too.
Contact
email: libmawk [( a t )] igor2.repo.hu