Columns


CUG New Releases

Update to TAVLTree Library: CUG #347

Victor R. Volkman


Victor R. Volkman received a BS in Computer Science from Michigan Technological University. He has been a frequent contributor to The C Users Journal since 1987. He is currently employed as Senior Analyst at H.C.I.A. of Ann Arbor, Michigan. He can be reached by dial-in at the HAL 9000 BBS (313) 663-4173 or by Usenet mail to sysop@ha19k.com.

The CUG Library always seeks to offer the latest and greatest versions of all the software in the collection. If you find and fix a bug, we want to know about it as soon as possible. This month, Bert C. Hughes sends us an update to TAVLTree Library (CUG #347). TAVLTree supports the creation and maintenance of a hybrid data structure called a "threaded height-balanced" tree. A height-balanced, or AVL tree is a binary tree that is kept in a balanced state to improve the performance of access routines. A threaded height-balanced tree (TAVL) contains extra links, which simplify movement through the tree structure. (The AVL in "TAVL" stands for Adelson-Velskii-Landis, who invented the height-balanced tree in 1962. A.J. Perlis and C. Thornton developed the idea of threaded binary trees as early as 1960.) Hughes deftly combines these two well-known concepts to develop the TAVLtree library.

The bug fix comprises TAVLTree v3.01 and replaces the previous version 3.00. Specifically, Hughes discovered a compiler bug in Borland C++ 3.1 in which bitfield assignment expressions in a function argument list were being evaluated after the function was called instead of beforehand. For example, in foo(mybar.bits+=1), mybar.bits+=1 would suffer late evaluation. TAVLTree v3.01 provides a workaround through simpler expressions.

New Library Acquistions

VGA FontLib, MakeFont and DXF viewer: CUG #389

Joseph V. Gagliano (Austin, TX) submits a pair of utilities for developing MS-DOS applications with VGA graphics fonts, and a standalone DXF (AutoCAD vector) viewer. FontLib is a set of 13 C functions for rendering fonts on EGA and VGA displays with a minimum resolution of at least 640x350. MakeFont is an editor for producing and editing your own font files. CDXF is a viewer for AutoCAD 2-D compatible vector files. The author provides all three as shareware and requires you to register each product seperately after an evaluation period. The latest versions of all three are immediately available as CUG #389.

The FontLib library was built under the Small memory model with Micro-soft QuickC v2.5. FontLib currently does not claim compatibility with any other compilers. Registration of FontLib for $25 gets you the full library source code (compatible with Microsoft compilers), technical support, and low-cost upgrades. Registration also grants you royalty-free use of the library functions. For an additional $10, you receive source code to MakeFont as well. Unlike Fontlib and Makefont, no source code is currently available for CDXF.

With FontLib, you can render characters in normal or boldface, in different colors, vertically or horizontally, and with shadowing effects. You can embed style rendering commands (escape codes) in a string to make color and shadowing changes within the context of a single string display call. The baker's dozen of functions appears below:

Function Name         Purpose
regfont               Load the font for immediate use
draw_letter           Display a single character
draw_letter_bold      As above, in boldface
letter                Display entire string
letter_bold           As above, in boldface
letter_w              Display string using window coords
letter_bold_w         As above, in boldface
letter_column         Display string as vertical column
letter_column_bold    As above, in boldface
letter_column_w       With window coords
letter_column_bold_w  And in boldface
freefont              Unload the font
set_shadow_color      Use this color for shadowing effect
set_font_color        Use this color for base colors
The CUG distribution includes four font files, for 8x5, 13x8, 20x12, and 20x20 characters. The font file format is plain ASCII and is well-documented in the 20-page reference manual on disk. FontLib and Makefont both work only with monospaced raster font files (released 09/16/93). CDXF requires a $25 registration for the first copy and $5 for every copy thereafter.

Another C Tools LIB — ACTLIB: CUG #390

Marc Stem of S.A. Philips Industrial and Telecommunication Systems (Brussels, Belgium) presents Another C Tools Library (ACTLIB) for MS-DOS developers. ACTLIB contains tricks and algorithms that will be very helpful to novice MS-DOS C programmers. ACTLIB offers some things for advanced C programmers as well. These low-level disk and keyboard functions provide useful hardware programming examples, and as such, answer many frequently asked questions about MS-DOS programming. The string and date function library should work on a broader base of platforms than MS-DOS computers. ACTLIB vl.4 (released 05/27/93) is immediately available as CUG #390.

ACTLIB has been compiled and tested with Borland C 3.1 and Microsoft C 7.0. ACTLIB includes only one assembly language file, which supplies a function to return the CPU type. No makefiles are included with the library. The TOOLS.LIB library provides the low-level functions specific to MS-DOS, including:

The STRINGS.LIB library provides 28 source files of functions to simplify common string handling tasks. These functions perform complex operations such as regular expression handling via recursion, evaluation of mathematical expressions in strings (e.g. "1 + 2 * 3/4"), and multiple substring replacement. Simpler functions perform BASIC-like "left", "right", and "mid" string extractions. Functions such as these can help out nearly any application.

The DATE.LIB library provides functions to validate dates, perform simple date arithmetic, and answer the question "What day of the week is it?"