The CUG goldmine of reusable code keeps getting richer.
Introduction
Since 1981, the mission of the C/C++ Users Group (CUG) has been committed to low-cost distribution of shareware and freeware C/C++ source code. The CUG is an independent organization sponsored by C/C++ Users Journal. CUG remains impartial to compiler vendors or platforms. Currently, CUG focuses heavily on cross-platform compatability with UNIX, MS Windows, and other platforms.
World Wide Web Update
The CUG website (http:/www.HAL9K.com/cug/) has undergone tremendous growth since its inception last year. I have personally edited more than 70,000 words of information (text and indices) to help you make the most of CUG. Information about every new volume added to CUG since 1991 is instantly available.
You can also browse the CUG offline using your favorite WWW browser or the specially licensed I-VIEW HTML viewer included on the CD-ROM. Those more comfortable with databases can query the included MS Access database directly.
What's New on the CUG CD-ROM
This edition represents the single biggest installment to the CUG Library in its 16-year history. There is a greater emphasis on C++, though we haven't forgotten our C roots. Here's a brief summary of the new titles:
- CUG 456, LZHLIB: LZH data compression library
- CUG 457, DMALLOC: debug memory allocation library
- CUG 458, GrayImage: grayscale image C++ Class Library
- CUG 459, MasterMind: C++ game pits man against computer
- CUG 460, Yet Another Class Lib: multiplatform framework
- CUG 461, Railroad Signalling Modeler
- CUG 462, Sherlock 2.0 for Macintosh: debugging tools
- CUG 463, Linteger: arbitrary precision integer class lib
- CUG 464, Miracle C Compiler for MS-DOS
- CUG 465, Fader Custom Control for Windows
- CUG 466, Autoduck: automated API documentation extraction
You can order your updated copy of the CUG Library CD-ROM for $49.95 directly from Miller Freeman Inc. by calling +1-913-841-1631 or via the WWW from Walnut Creek CD-ROM (http://www.cdrom.com). Ordering a subscription from Walnut Creek for only $24.95 per issue saves you 50% and insures you never miss an installment.
Updated CUG 422, MICRO-c V3.14 C Compiler for small Model
Dave Dunfield's MICRO-C is a tiny compiler that can run with less than 32K RAM and yet is highly independent of CPU and OS. Specifically, platform support is available separately for 68HC08, 6809, 68HC11, 68HC16, 8051/52, 8080/8085, 80x86, and 8096 CPUs. The CUG Library distribution includes a fully functional MICRO-C compiler executable built for the MS-DOS 80x86 environment. This version generates code in .ASM format so Microsoft MASM, Borland TASM, or equivalent are required (not included).
Highlights of version 3.14 include:
- Compiler executable changed from .COM to .EXE format (allows larger internal tables)
- #if and #error directives added to MCP
- A fix to allow sizeof() in array declarations
- A fix to detect redeclarations differing in dimension
- A fix to prevent index being promoted with type of array
New on the CUG CD-ROM
CUG 456, LZHLIB LZH Data Compression Library
Kerwin F. Medina (New Westminster, BC) contributes LZHLIB, a small C library with the minimum code neccessary to compress and uncompress using the LZH algorithm. This library is a direct derivative of the source code from Haruhiko Okumura's popular "ar" archiver. Medina has created the library so an application can make use of compression with a function call and without having to spawn an external compression program. The library has only two API functions: lzh_freeze (to compress) and lzh_melt (to decompress). In both cases, the caller has to provide only the I/O functions and memory allocation functions. The interface is simple enough that you can integrate it with fewer than 20 additional lines of code in your program. LZHLIB can be built on MS-DOS, UNIX, and other platforms. LZHLIB as released on 04/18/96 is now available on the CUG CD-ROM.
CUG 457, DMALLOC Debug Memory Allocation Library
Gray Watson (Pittsburgh, PA) submits dmalloc, the debug memory allocation library. The dmalloc library has been designed as a drop-in replacement for C runtime malloc(), realloc(), calloc(), free() and other memory management routines. It provides many debugging facilities that you can configure at run time, including: memory-leak tracking, fence-post write detection, file/line number reporting, and general logging of statistics.
Dmalloc is highly portable and users report success on many platforms, including: AIX, BSDI, DG/UX, HPUX, Irix, Linux, MS-DOS, NeXT, OSF, Solaris, SunOS, Ultrix, Unixware, and Cray Y-MP. The package includes the library, configuration scripts, debug utility application, test program, and docs (ASCII and PostScript). Dmalloc is free for academic and non-commercial use. Commercial users must register as shareware for US$35. Dmalloc version 3.2.1 as released on 9/30/95 is now available on the CUG CD-ROM.
CUG 458, Grayimage Grayscale Image Class Library
Oleg Kiselyov (Denton, TX) contributes Grayimage, a C++ class library for dealing with full-depth grayscale images. Grayimage supports all standard image algebra/arithmetics including dealing with image slices, histogram equalization, and computing various norms and scalar products. The package reads and writes PGM, XWD, and Group G (grayscale) TIFF file formats with automatic recognition of the input image file format. It's possible to assign one image to another to fit, no matter what their dimensions are.
Grayimage is highly portable: Oleg has personally verified ports for UNIX with GNU C++ (SUN, HP-UX), Macintosh with Metrowerk's C++, and Windows 95 and NT with Borland C++. Grayimage v2.2.3 as released on 03/31/96 is now available on the CUG CD-ROM.
CUG 459, MasterMind Game Pits Man Against Computer
Alex Hunger (Adlington, Lancashire UK) submits MMND, a C++ game that puts the computer in the role of "codebreaker" in the classic MasterMind (TM) board game. The interesting aspect of Hunger's implementation is that the computer can guess a pattern that you choose. It uses an optimal information-theoretic algorithm and so it plays extraordinarily well better than any human being. This algorithm takes a lot of computation, so patterns chosen are stored in a data file so a computation never needs to be made twice. Mastermind puts the chosen patterns through a randomizing algorithm that makes the game more interesting to play, without losing optimality.
MMND is written in C++ and should compile under any C++ compiler with multiple inheritance, ANSI header files, and ANSI libraries. This includes MS-DOS and UNIX platforms. MMND provides a pipe mode so it can be run with an X-Windows or other windowing system wrapper. Hunger has generously placed the source code in the public domain. MMND v2.17 as released on 3/28/97 is now available on the CUG CD-ROM.
CUG 460, YACL Cross-Platform App Framework
M.A. Sridhar of the faculty of the University of South Carolina (Columbia, SC) contributes "Yet Another Class Library" (YACL), an innovative cross-platform application framework. YACL is a C++ class library that offers high-level abstractions for common programming problems. Its design goal is to be both application-centric and take advantage of C++ facilities (e.g. operator overloading and templates) wherever possible. YACL implements both scalar (String, Integer, Date, etc.) and container (sequence, set, tree, etc.) core classes. The GUI classes are based on a variation of the model-view-controller (MVC) paradigm. YACL supports all expected GUI objects (menus, dialogs, buttons, listboxes, button groups, etc.) and resources (cursors, fonts, pens, colors, and brushes).
The YACL application framework supports the widest variety of compilers, GUIs and OSes I've ever seen in a freeware library, including Windows 3.1, Windows NT, OS/2 2.x and 3.0, SGI, SUN, Ultrix, Linux, RS/6000, and HP-UX. YACL version 1.60 as released on 11/11/96 is now available on the CUG CD-ROM.
CUG 461, Railroad Signalling Modeler
Dean Lance Smith and Mohammad Musa present their paper "Two Software Data Organizations that Support Railroad Signalling" and accompanying C source. This program models a control system capable of understanding an entire railroad line composed of any combination of Automatic Blocking System (ABS) and Centralized Traffic Control (CTC) blocks. In railroad parlance, a "signal block" or "block," is a length of rail track that is controlled by a block signal. A block may contain two or more tracks in various track configurations. Most blocks have at least one main track. Two or more main tracks may also be in parallel in a block. A block may also contain lines that cross the main track(s), turnouts, branch lines, or sidings. Two or more blocks constitute a rail line.
The package contains both the signal modeller data entry program and a second program capable of combining several adjacent blocks into single blocks. The programs are designed for MS-DOS using Borland C but could probably be ported to other environments by modifying the display code (which uses INT 10h). Railroad Signalling modeler as released on 1/3/93 is now available on the CUG CD-ROM.
CUG 462, Sherlock 2.0 Macintosh Debugging Tool
Ed Ream (Madison, WI) submits the Sherlock 2.0 set of debugging tools for Macintosh as CUG volume 462. Longtime CUJ readers may recall earlier incarnations as Sherlock 1.7 for MS-DOS (CUG 355) and Macintosh (CUG 356). Sherlock is a debugging tool different from currently popular interactive debugging tools such as CodeView. Sherlock uses C macro expansion capabilities to implant debugging calls and functions without manual coding. Those calls are enabled/disabled from the command line and removing those calls from the source is also done automatically. Sherlock uses far less memory than a full-size debugger. In addition, Sherlock provides detailed statistics about your program.
The distribution disk contains full source code for all portions of Sherlock, along with all test files, batch files, executable files, and detailed documentation. Sherlock is in the public domain and may be used for any commercial or non-commercial purpose. Sherlock can be used in Motorola MC68xxx or PowerPC Macs. Sherlock 2.0 as released on 4/8/96 is now available on the CUG CD-ROM.
CUG 463, LInteger Arbitrary Precision Integer Class Lib
Leonard Janke (University of British Columbia, Vancouver) contributes LInteger, a C++ library that lets you create and perform arithmetic on objects representing nearly arbitrary precision integers. Thanks to C++ support for operator overloading, the use of the large integers in this library should be nearly as easy as the use of regular int types. In many cases, converting your application to use LInteger can be as simple as substituting "LInteger" for "int" in your editor.
The current version of this library requires Intel 386 or better CPU and is only guaranteed to compile perfectly with GNU C++. Linteger originally appeared on the Linux platform and has now been ported to Windows NT. Janke predicts it should work with OS/2 or Windows 95 with only "minor hacking." He has coded the multiprecision methods in assembly language for speed. Multiplication can be performed via recursion or Montgomery style. LInteger also supplies implementations of the FIPS hashing algorithm and pseudo-random number generation. LInteger includes documentation in HTML for public methods. This library is free for both commercial and non-commercial use. LInteger v0.2 as released on 2/9/97 is now available on the CUG CD-ROM
CUG 464, Miracle C Compiler for MS-DOS
B.T. Szocik (Ottawa, Ontario) submits the Miracle C compiler, a complete language and runtime implementation for MS-DOS. Szocik intends Miracle C to be used primarily as a teaching support tool. Miracle C supports only the small memory model (code < 64K, data < 64K). Pointers are always 16-bit; no "far" extensions are allowed. All K&R C syntax and data types are fully supported (plus some ANSI extensions); there's nothing small about the language implementation.
Miracle C generates .OBJ object code files but does not include a linker. You may be able use the LINK.EXE suplied with some versions of MS-DOS or use one provided on the Microsoft software library site (such as ftp://ftp.microsoft.com/softlib/MSLFILES/lnk563.exe). Miracle C does include a 45-page Users Manual and runtime library reference in Word for Windows and ASCII formats.
Since Miracle C is distributed as shareware, you must register it if you plan to use it beyond the evaluation period. Registration is only US$15 and entitles you to full compiler source code of the next version. Miracle C compiler version 1.6 as released on 10/3/96 is now available on the CUG CD-ROM.
CUG 465, Fader Custom Control for Windows
Victor R. Volkman (Ann Arbor, MI) contributes his "Fader" custom control for Windows, a slider control for use with Windows 3.1 and compatible environments. The Fader is a custom control designed to return a continuous range of values based on the position of a thumb that slides along a rail. This idea is similar to the Windows scrollbar in many respects. Since the scrollbar is almost inseparably associated with scrolling the client area, it quickly becomes unfamiliar in other contexts. The fader provides an analog range in the same way the potentiometers are used in a stereo equalizer or mixer. For example, a fader could be used to apply equalization to a waveform or to regulate the hue of a color.
Fader compiles under Microsoft C 7.0 or later. The archive includes an accompanying 10-page tutorial on custom controls which originally appeared in "Windows Developers Journal," Feb/Mar 1992. Fader is in the public domain and may be used for any commercial or non-commercial purpose. Fader as released on 2/1/92 is now available on the CUG CD-ROM.
CUG 466, Autoduck Automated API Documentation Extraction
Eric Artzt of Microsoft Corporation (Bellevue, WA) releases Autoduck, a Windows 95/Windows NT console utility that extracts specially tagged comment blocks from C/C++, Visual Basic, and Assembly source files. Autoduck formats the information in the comment blocks and produces documentation files in Rich Text Format (RTF) for use with Microsoft Word or the Windows Help Compiler. Autoduck can also produce HTML files for Internet or intranet use.
Autoduck is an extremely easy and efficient way to produce nicely formatted documentation files for your programming interfaces. The program extracts information from tagged comment blocks and from the language elements themselves. The tagset supports most C/C++ constructs including classes, member functions, function, enumeration types, structures, etc. Autoduck includes full source code in C++ and requires MFC. Autoduck version 2.00.96.1220, as released on 12/20/96, is now available on the CUG CD-ROM.
CUG Call for Submissions
The deadline for submissions for the next edition of CUG Library CD-ROM is coming soon. If you have an innovative C or C++ application or library that you'd like to share with the world, please contact me by email <SYSOP@HAL9K.COM> or visit the CUG website (http://www.HAL9K.com/cug). As a small token of our appreciation, you will receive a complimentary copy of CUG CD-ROM if your submission is accepted. o
Victor R. Volkman received a BS in Computer Science from Michigan Technological University. He has been a frequent contributor to the C/C++ Users Journal since 1987. He is the author of the book Windows Programming with Shareware Tools. He can be reached at http://www.HAL9K.com, or email to sysop@hal9k.com.