libmba
A library of generic C modules

The libmba package is a collection of mostly independent C modules potentially useful to any project. There are ADTs like linkedlist, pool, and varray, a path canonicalization routine, CSV parser, I18N text abstraction, a "mini DOM" for easy XML processing, a configuration file api (like Java properties), and more. The code is designed so that individual modules can be integrated into existing codebases rather than requiring the user to commit to the entire library. The code has no typedefs, few comments, and extensive man pages and HTML documentation.

News

libmba-0.7.0 released
Wed Oct 15, 2003
Microsoft Windows support has been improved. The Win32 debug build now properly creates DLLs with PDB information for listing source code after a memory fault. The standard __cplusplus macro guards have been added. Macros for prefixing __declspec(dllexport) directives have been added in favor of an explicit DEF file. These changes have been performed during the development of a non-trial MFC application so this release should work smoothly in a Win32 or MFC environment. The text module appears to work as advertised although a few adjustments have been made.

The csv module has been converted to support the text module text handling. The multibyte function is now csv_row_parse_str, the wide character function is csv_row_parse_wcs, and the csv_row_parse function is now a macro that accepts tchar parameters. The prototypes of these functions have also been changed to accept the specification of the separator that is used (e.g. '\t' rather than ',').

A new eval module has been added that will "calculate" the value of an expression such as '(5 + 3) * N', '(10+10-((10*10/11)|(10&10)))^0xFF78', etc.

The msgno functions have been adjusted to perform better in environments where variadic macros are not supported (e.g. MSVC).

libmba-0.6.15 released
Sat Aug 23, 2003
There have been significant and pervasive changes however to emphasize that all of these changes are binary compatible I have not incremented the major version number. All code that uses the published interfaces of libmba should work without modification.

The most significant change is the addition of text.h which contains a tchar typedef and many macros that abstract wide and multi-byte string functions. Depending on whether or not USE_WCHAR is defined these string functions will accept wide or multi-byte strings. This will permit programs to run using wide or locale dependent multi-byte text handling. Some of the libmba modules such as cfg have been modified to support both wide and locale dependent multi-byte text using this abstraction. Do not be alarmed that these prototypes have changed. Because the tchar typedef is defined as either unsigned char or wchar_t users can continue to use these modules as before without using tchar at all. It is also easy to globally substitute and replace tchar with the desired type in the source of interest. If you choose to take advantage of this new I18N functionality please read the following document for important information:

http://www.ioplex.com/~miallen/libmba/dl/docs/ref/text_details.html
One big advantage of this new text abstraction is that libmba will soon support Unicode on the Microsoft Windows platform (cfg and domnode modules already do).

The test suite has been cleaned up considerably. Just run make followed by the generated tmba program in the tcase directory to run all tests.

The build process has been formalized further. The code is now compiled using -D_XOPEN_SOURCE=500 meaning an SUSv2/UNIX98 is desired but most of the code does not require this standards level. In fact #ifdefs have been added to consider lesser environments.

Finally, a path module has been introduced. Currently this module contains one function; path_canon which canonicalizes a filesystem pathname. The state machine design is very safe when given the full range of possible inputs (see tcase/tests/data/PathCanonExamples.data).

libmba-0.6.1
Sat May 17, 2003
Several bugs and buffer overruns were fixed in the csv module. The trim parameter did not work as advertised and a malformed CSV file could cause memory to be overwritten unintentionaly. A bug in the cfg_load_cgi_query_string function that prevented the last query parameter from being parsed has also been fixed. The linkedlist_insert_sorted function is now documented.

Mailing List Moved
Fri May 9, 2003
The mailing list has been moved to http://www.ioplex.com/mailman/listinfo/libmba/. The old mailing list will be disabled shortly.

libmba-0.6.0 released
Tue May 6, 2003
There have been siginificant bugs fixed as well as API changes.

The iterate and next functions of the linkedlist, cfg, hashmap, pool, stack, and varray modules now accept an iter_t object defined in new mba/iterator.h header to hold the state of iterations. These modules now permit multiple iterators per object (i.e. they are now fully reentrant).

The library has been profiled with ccmalloc. Several memory leaks have been detected and repaired. The shellout module was not freeing the struct sho * in sho_close. The linkedlist_insert_sorted function (previously undocumented) did not free a struct entry * if it was being replaced and it was the first element. The cfg_store function did not close the file pointer it opened. The cfg_del function did not delete the struct cfg * allocated in cfg_new. And finally, the linkedlist_remove_last function did not free the struct node * if the list contained only one element.

The linkedlist_get function has been optimized for forward-sequential access (an O(1) operation now whereas previously it was O(log N)).

The linkedlist_insert_sorted function has been reviewed and documented as an official part of the linkedlist interface.

libmba-0.5.2 released
Tue Apr 29, 2003
A csv module has been added. This module properly parses the CSV format. It can handle quoted elements, quotes within quoted elements, and commas and quotes withing quotes. It should be able to handle anything exported by Excel or Gnumeric (but don't quote me on that).

libmba-0.5.1 released
Tue Apr 1, 2003
The varray module did not properly initialize the array hosting allocated memory chunks which could result in dereferencing an invalid pointer. The 0.5.1 package fixes this problem.

libmba-0.5.0 released
Sat Mar 22, 2003
Many function return codes have changed. Previously the convention was to return 0 on error and 1 for success. This has changed to -1 on error and 0 for success to be more consistent with UNIX, POSIX, and interfaces of other standards. The functions that are affected by this change in convention are cfg_load, cfg_load_str, cfg_load_env, cfg_load_cgi_query_string, cfg_store, cfg_write, cfg_get_str, cfg_vget_str, cfg_get_short, cfg_get_int, cfg_get_long, cfg_vget_short, cfg_vget_int, cfg_vget_long, domnode_load, domnode_store, domnode_attrs_put, hashmap_put, linkedlist_add, linkedlist_insert, linkedlist_insert_sorted, linkedlist_toarray, msgno_add_codes, pool_release, stack_push as well as some functions of new interfaces.

Two new modules are introduced. The shellout module will spawn a shell connected to a pseudo-tty and premits the caller to read and write data to it as if it had been typed on the keyboard. This is analygous to the popular expect(1) but with only 400 lines of code (not available in Win32 build). The varray module is a variable array that dynamically allocates storage in increasingly larger chunks are elements of an index are accessed. This is a very effcient method of allocating storage in programs like network servers and clients.

libmba-0.4.6 released
Wed Nov 20, 2002
An important symbols was missing from the Win32 DLL exports definition. The header files have also been moved within the source package to permit other packages to build against the package without actually installing it.

libmba-0.4.5 released
Tue Nov 5, 2002
The portability of libmba has been greatly improved. It is known to compile on Linux, Solaris, and Windows. Other platforms may require adjustments in src/defines.h. The web page, API reference, and man pages are now generated using the CStyleX package.

This release also introduces the cfg module which provides a simple load/store Java Properties like interface.

mba-0.3.6 released
Fri Mar 29, 2002
Some XSLT templates have been added for generating documentation.


Sept 14, 2003
libmba-0.7.0
API documentation and website generated with CSytleX