New BRL-CAD Support Library, LIBbs

Mike Muuss


For some time there has been the desire to package up the numerous utility routines presently found in LIBRT into a new support/utility library, separate from all the geometry, database, and ray-tracing routines.

It has been proposed that this new library LIBbs have a single consolodated header file for it, much like raytrace.h covers most of LIBRT.

All routines in this new library would have a new prefix for their function and global variable names, in place of their current rt_ prefix. Because the library name and matching prefix have not been decided upon, in this document I continue to use the rt_ prefix for clarity. A compatibility header file would be provided to map the old names into the new names. In those cases where the ordering (but not the semantics) of the parameters was changed the compatability macros would take care of that change as well. The BRL-CAD convention for parameter ordering in function arguments is to place output arguments first, followed by input arguments. Input arguments should all be marked as CONST, both as an aid to optimizing compilers and as an aid to quick understanding of the routine.

While for the most part it is easy to determine which routines should be moved into this new library, there are some complications.

Most of the general support/utility routines depend on rt_malloc() which in turn depends on the RES_ACQUIRE()/RES_RELEASE() macros, the struct resource in raytrace.h, the res_syscall entry in struct rt_g, and the parallel processing support in librt/machine.c. It also depends on RES_INIT() having been called by the user's application code before any parallel operations have been performed. The question thus becomes one of deciding how to package up the parallel processing routines in a more generic form.

A partial proposal