Harold Ogg is Automation Librarian for Chicago State University. He holds an M.S. in Library Science and an M.Ed. in Information Systems and has been involved in library automation for a number of years. He is currently a member of the adjunct faculties of Indiana University Northwest and Triton College, where he teaches classes in computer science. He can be contacted at (312) 995-2541 or 995-2251 (office), or at (708) 628-8610 (home).
C Programmer's Toolkit is a handy potpourri of callable routines and functions not part of the ANSI C standard library. The Toolkit includes a 360K floppy disk of source code for all the subroutines in the book, including the corresponding header files. The target machine/operating system is the PC and compatibles running MS-DOS or PC-DOS, but the material is easily adapted to UNIX environments or other micro/minicomputers and their operating systems.
C Programmer's Toolkit features routines to invoke screen manipulations, handle strings, extend the capabilities of basic I/O operations, and perform some of the more complex mathematical, searching, and parsing algorithms. Its contents are reminiscent of the specialized libraries found in such packages as Roundhill's PANEL Plus II and the Greenleaf C Functions. What is lacking is the detail and depth that might be found in a collection such as the Wiley Scientific Subroutine package. However, the $200-$400 price tag is also missing; at $39.95, the C Programmer's Toolkit is a virtual bargain.
The Toolkit might best be labeled a sampler of the aforementioned high-end packages. This is not to say that it copies or mimics any of them. On the contrary, the C Programmer's Toolkit can be a valuable aid in allowing the aspiring developmental programmer to make intelligent choices about whose libraries to affix his/her loyalty. The chapters lend enough explanation to the various genres of C libraries to allow programmers to identify those areas of supplemental routines necessary to realize success in their software coding projects.
In addition to being a consumer's guide, the C Programmer's Toolkit is an excellent teaching tool for programmers who have advanced beyond the string print and file I/O stages. Each chapter contains ample material on which to base a study on a number of specific C topics. Purdum has deliberately avoided making the code machine specific in all but a very few instances. Targeted for Borland's Turbo C, Ecosoft's Eco-C88 and Microsoft's QuickC, the subroutines should be adaptable to most other C compilers as well. I ported a number of routines to Lattice C v3.4 and Microsoft C v6.0. With few exceptions, I had little difficulty in producing executable modules.
The C Programmer's Toolkit is at the same time an experimenter's treasure trove. While it is possible that some chapters have a minimally adequate number of routines with which to develop distributable end-user products, there is certainly an ample supply of functions within topical groups to generate demonstration programs. The book contains sufficient material to create a reasonably sophisticated class project and even offer stand-alone attract mode presentations.
The author expresses the intent to "extend the minimal ANSI set," a task he accomplishes quite well. In fact, his libraries are not seriously duplicative of tasks addressed in the extended function sets of any of the more popular C compilers. Many of the subroutines are not unique in performance, however, but their advantage lies in the availability in the book of their underlying source code. At least with the C Programmer's Toolkit, the aspiring C programmer can dissect the steps and logic of routines of particular interest to him or her, without paying considerable additional money for the privilege of examining library source.
There is sufficient depth in some of the chapters that a neophyte programmer could reasonably create a major, complex program. The chapter on screen functions contains an adequate number of cursor placement routines and color manipulators to generate a full screen text editor. The video mode is set with setvmode(), and the cursor is addressed with find_cursor(), get_cursor(), and set_cursor(). Text can be output in color with colorchr() or colorstr(), if desired, and borders/backgrounds can be determined with border() for frame color and cls_c() to clear the screen to a specific color. Video paging is possible with getvpage() and setvpage(), if needed. It is up to the individual programmer to create his or her own algorithms for such things as word insertion, line counting, and block moves.
The author offers a number of utility functions for tweaking strings. He includes some not-so-unusual character manipulation functions such as strdelcn() to delete n occurrences of a character and strdigit() to display a string as digits. But there are also some less typical tools such as the strdollar() routine to pass a double as a dollar string (e.g., to convert 12345.67 to $12,345.67), and strsub(), a masking routine to replace one string pattern with another. While these functions are rather self-evident to experienced programmers, showing some sample input and ouput would have clarified the discussion on string utilities (as it would have with subroutines in other parts of the book).
C Programmer's Toolkit exhibits its "fun" side where it presents mouse functions and menuing systems. There are a dozen mouse-based subroutines, enough for the curious to determine "what makes it tick" and apply new knowledge to the handling of mouse events in more complex routines. The necessary functions are all present mouse_press() to ascertain whether a mouse button has been pressed; mouse_counters() to test for mouse movement; and set_mouse() to set the mouse position. The toolkit doesn't present enough information to construct a full-fledged drawing package, but by the end of the chapter, an experimenter will have gained much insight on the point-and-click and screen addressing aspects of mouse-based digitizer technology.
What is conspicuously absent from the list of topics is much reference to graphics or windowing routines. However, the chapter on menuing systems more than compensates for this lack. The chapter describes sidebar and box menus and discusses data structures relevant to menuing. This is not so much a chapter of functions as one of code examples, with emphasis on highlighting (reverse video) bars and positioning selection lists.
The book is presented in a clear, readable format with little clutter from page to page. On the negative side, the text could be upheld with more illustrations. This omission was acutely conspicuous in the screens, mouse and menuing discussions.
The "Time and Dates" chapter is the one section of the book where most of the material is ordinary. maketime() and timeset() get and set system time, and validdate() checks for proper date input format. Easter() computes the value of the obvious, and leapyear() also checks for just what you'd imagine. The "Working with Numbers" chapter doesn't get too involved, emphasizing basic statistics, such as Chi_square() and regression(). There are some elementary matrix functions such as put_mat() to change a value in a matrix and check_symmetry() to check a matrix for symmetry. The remainder of the mathematics chapter is devoted to financial utilities and emphasizes the computation of compound interest.
The "Disk and Directory Control Functions" chapter becomes particularly MS-DOS specific. Certain utilities here could possibly have been more efficiently implemented through BIOS calls, but the value in this chapter lies in the principles the functions teach. There are functions to test for file size and disk capacity, and killfile() for file deletion. Setting file date and time, sfiledate() and sfiletime(), and some related time/date manipulators could possibly have been more appropriately placed in the "Time and Dates" chapter, but this arrangement does not detract from their usefulness.
For any of its shortcomings, C Programmer's Toolkit is a no-nonsense, nitty-gritty kind of book. Explanations of functions accompany the code subroutines usually on the same page, and there are not paragraphs upon paragraphs of text to wade through before putting "hands on" to the functions. The author makes no pretense of offering an "all things to all programmers" book, and what is left is his collection of favorite tools, things which may have helped him understand the intricacies of the C language. And, he makes it obvious that he'd like to share the benefits of this collection with you.
While not a powerful reference work, Toolkit carries a good index and arranges the functions in a logical order. Locating cross-referenced information is a simple matter , and relating functions from one part of the book to another is easy. There is no author's "pet project" that demands one-fourth to one-third of the book as an appendix. In other words, you don't buy C Programmer's Toolkit and spend money on hard copy of a special program you don't need. Purdum wants you to learn by example and use his utilities to write your own code. The resulting appendix if there is to be one is up to your own creativity.
C Programmer's Toolkit is a good addition to any programmer's library for its alternate point-of-view on implementing standard programming routines. I recommend this book as a purchase for intermediate level programmers who wish to polish their skills and especially for educators who need fresh outlooks for teaching programming strategies.
C Programmer's Toolkit
Jack Purdum
Que Corp., 1990
$39.95, 350 pages
ISBN 0-88022-457-6