Welcome to the first installment of "C/C++ Sources". Longtime readers of CCUJ may remember my previous column, "C User's Group New Releases" which ran from 1993 to 1995. Whereas CUG New Releases focused solely on the CUG Library collection, this column will tell you about shareware and freeware source code archives available in a variety of locations, including:
Although the focus is on C/C++ programming source libraries and tools, I'll also highlight products that include C/C++ code with them or upon registration. If you're the author of such an archive, please write to me and I'll feature it in an upcoming column. Even if you just want to recommend a product, I'd like to hear from you. Each month, one reader who has submitted a tip on an archive will receive a FREE shareware CD-ROM from me. This month, I present a special theme product (MICRO-C) and a look at the GNU C/C++ suite.
Dave Dunfield (Nepean, Ontario, Canada) supports an entire suite of C compiler tools from the MICRO-C development system. This includes the MICRO-C C compiler itself for MS-DOS, many sample C programs, and a demonstration version of MICRO-C for embedded systems. MICRO-C is a tiny compiler which 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. There also 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). MICRO-C version 3.02 was released on 03/22/94.
MICRO-C provides much more functionality than Small-C and its many derivatives. Specifically, MICRO-C supports all C statements, operators, and preprocessor directives as well as in-line assembler. MICRO-C includes data types for int, char, unsigned, struct, union, pointers, and typecasting. Saying it another way, MICRO-C gives you everything possible except for typedef, long, double, float, enumerated, and bit fields. The runtime library does include a long arithmetic package with arbitrary precision up to 256 bits.
Even if you're not especially interested in the MICRO-C compiler, the you may wish to take advantage of the collection of more than 70 sample programs. Although there are simply too many to catalog here, I've listed sixteen of the most interesting:
CCREF - 'C' source cross referencing program OBSCURE - Make 'C' program un-readable (but it still compiles) CMOS - Read/Write/Verify CMOS RAM from/to/with disk file CSET - TSR map of IBM PC character set GREP - Like unix "GREP" search utility HEM - Hardware Exception Monitor TSR to trap unexpected ints LZC - Laser commander TSR to control HP compatible printers MTERM - Tiny (10k!) TSR ANSI terminal with XMODEM TFB - TSR File Browser VALIDATE - Verify files with two CRC's, like McCaffee LAPTALK - A terminal program with script interpreter XMODEM - External file transfer program MICROCAD - Mouse based drawing program FE - Font Editor ASM86 - 8086 assembler BASIC - A simple BASIC interpreter DIS85 - 8085 Cross Disassembler TTT3D - 3 dimensional tic-tac-toe
All files in the MICRO-C archives are for personal use only. Any commercial use of information or programs contained in these archives requires written permission from Dunfield Development Systems. Source code for the MICRO-C compiler itself can be obtained separately by purchasing a license for $100 from them.
MICRO-C is available on the SimTel FTP server on the Internet (and its mirrors), CUG Library, and the Walnut Creek SimTel CD-ROM. The primary FTP site for SimTel is ftp.coast.net:/SimTel/msdos/c. WWW users may access the URL http://www.acs.oakland.edu/oak/. You may access it via Gopher client to Gopher.Oakland.Edu.
Please use an alternate mirror site to save bandwidth, if it is closer to you. Here's an abbreviated list of SimTel mirror sites to get you started:
Location Server -------- ------------------------------- Switzerland nic.switch.ch:/mirror/simtel/msdos/c Japan ftp.iij.ad.jp:/pub/msdos/c U.K. micros.hensa.ac.uk:/mirrors/simtel/msdos/c Brazil ftp.unicamp.br:/pub/simtel/msdos/c Here's a list of MICRO-C products and filenames featured in this issue: Filename Description Size ------------- ------------------- ----- MC302EMB.ZIP MICRO-C embedded control - Test Drive 213K MC302PC1.ZIP MICRO-C PC 'C' compiler (fully functional) 194K MC302PC2.ZIP Over 70 example MICRO-C programs 276K
|Available on C/C++ Users Group CD-ROM|
The Walnut Creek SimTel Cd-ROM is a two-volume set of utilities, programming tools, source code, technical documentation, etc. The current edition was made in September 1994 and is MSDOS BBS ready. This disc is available by quarterly subscription for $19.95 per issue plus appropriate shipping. The single issue price for this two disc set is $34.95. To order, call (800)786-9907 or email to firstname.lastname@example.org.
The GNU project, brainchild of the Free Software Foundation (FSF), is one of the software industry's best kept secrets. GNU, a recursive acronymn which stands for "GNU's Not Unix", focuses primarily on providing enhanced versions of Unix programs and libraries. All GNU programs include complete source and a special license for redistribution of it. The cornerstone of the GNU project is the GNU C/C++ compiler and library (better known as g++ and libg++). Though GNU undoubtedly deserves book-length treatment, the remainder of this column provides only a brief overview of the C/C++ compiler and some related tools.
The GNU g++ compiler has been acknowledged by many users as one of the best compilers and is used in production mode at many commercial software houses. It certainly ranks as the most portable compiler in the world; it has support on every significant platform including:
Using the built-in configuration scheme, you can build cross-compiler combinations as well. This is extremely useful when building executables for embedded systems that may have not have sufficient OS capability to host compilation.
The GNU g++ compiler supports multiple languages through the choice of compiler option or file extension (e.g. ".cpp" for C++). The standard distribution includes support for C, C++ and Objective-C (courtesy of NeXT). The g++ compiler now tracks the evolving draft ANSI standard as rapidly as possible, which is not necessarily the same as the AT&T cfront compiler.
The g++ system supports full ANSI C, traditional C, as well as the GNU extensions. In the GNU tradition of providing more than just emulation, the GNU extensions include support for nested functions, nonlocal gotos, and taking the address of a label.
The g++ compiler can perform a full suite of optimizations including hoisting invariant code out of loops, instruction scheduling, loop unrolling, common subexpression elimination, tail recursion eliminination, and many other optimizations too numerous to list.
The runtime library is an integral part of any C/C++ compiler implementation. In keeping with the C/C++ conventions, the GNU C Library and GNU C++ Library (libg++) are quite distinct entities of their own. As such, I'll provide specific details on each.
The GNU C library supports ANSI C-1989, POSIX 1003.1-1990 and most of the functions in POSIX 1003.2-1992. It is upwardly compatible with 4.4BSD and includes many System V functions, plus GNU extensions. GNU stdio library lets you define new kinds of streams by writing a few user-defined C functions. For example, fmemopen() uses this to open a stream on a string which can dynamically grow. You can define your own printf() formats to use a C function you have written.
The GNU C++ library (libg++) contains an extensive collection of C++ "forest" classes, IOStream library, and support tools. Supported classes include: object stacks, multiple-precision integers and rational numbers, complex numbers, and arbitrary length strings, BitSets, and BitStrings. GNU libg++ now supplies the libstdc++ library defined by the ANSI/ISO C++ draft standard, including the Standard Template Library (STL).
GDB enables source-level debugging for C, C++, and FORTRAN. GDB also works with executables produced by many different compilers. GDB can even use the symbol tables emitted by most MIPS-based compilers, including DEC. However, if you use C++ compilers other g++ then debugging will have some limitations. GDB supplies a command-line user interface. Alternately, you can run it from an EMACS or X Windows interface (unsupported).
GDB uses the GNU Binary File Descriptor (BFD) library to read executable files and symbol tables. BFD allows a single version of GDB to debug programs with multiple object file formats (such as COFF and ELF). GDB also offers a complete command language, remote debugging over serial ports or TCPIP, and breakpoints on expressions (a.k.a. watchpoints). Additionally, GDB can use a standard remote interface to a library which can simulate the Zilog Z8001/2, Hitachi H8/300, H8/500, and Super-H microprocessors.
GDB can perform some cross-debugging. Platforms supported in target mode can perform native or cross-debugging; platforms supported in host mode cannot necessarily debug native programs. The permutations of supported host and target modes are too numerous to list here.
D.J. Delorie has ported GNU C/C++ 2.6.0 and libraries to the Intel 80386 architecture for MS-DOS. Delorie also provides a 32-bit DOS extender (to run applications in Protected Mode), symbolic debugger, and even ports of Bison (GNU YACC), flex (GNU LEX), GAS (GNU Assembler), and Binutils (platform-independent binary file I/O). Collectively, this entire system is known as DJGPP.
As with all GNU products, DJGPP provides full source code. It supports SVGA (up to 1024x768 resolution), XMS & VDISK style memory allocation, HIMEM.SYS extended memory manager, VCPI (Virtual Control Program Interface used by QEMM, DESQview & 386MAX), and DPMI (DOS Protected Mode Interface as used by Windows 3.x, OS/2, and QEMM). You may join the DJGPP users mailing list by sending your request to email@example.com.
Of course, GNU provides more than just a great C/C++ compiler. In their quest towards a complete GNU-based OS, FSF provides many more languages and utilities. Nearly all of them provide significantly enhancements over their traditional Unix counterparts. As of this writing there are nearly 100 separate packages offered by GNU, far more than can even be listed in this story.
GNU software is available direct from the Free Software Foundation (FSF), by FTP over the Internet, or on Walnut Creek archive CD-ROMs. Portions of the GNU distribution also appear on the CUG Library CD-ROM. When you buy direct from the FSF, you help to financially support its continuing freeware projects. Alternately, you can get a free copy of GNU software and make a tax-deductible contribution to FSF. Of course, you are under no obligation to pay anything.
The primary GNU FTP site is prep.ai.mit.edu:/pub/gnu (Artificial Intelligence Department, Massachusettes Institute of Technology). The file /pub/gnu/DESCRIPTIONS provides a paragraph on each of the GNU products. Please use an alternate mirror site to save bandwidth, if it is closer to you. Here's an abbreviated list of GNU FTP mirror sites to get you started (complete list in /pub/gnu/GNUinfo/FTP):
Location Server -------- ------------------------------- Virginia ftp.uu.net:/archive/systems/gnu Australia archie.au:/gnu BC, Canada ftp.cs.ubc.ca:/mirror2/gnu Japan utsun.s.u-tokyo.ac.jp:/ftpsync/prep Switzerland nic.switch.ch:/mirror/gnu Here's a list of GNU products and filenames featured in this issue: Filename Description Size ---------------- ------------------- ----- gcc-2.7.0.tar.gz GNU g++ (C/C++) v2.7.0 7.0 MB libg++-2.7.0a.tar.gz GNU C++ library v2.7.0a 1.6 MB gdb-4.14.tar.gz GNU Debugger v4.14 4.5 MB
Note that DJGPP is not an official FSF sponsored project so it is found instead on oak.oakland.edu:/SimTel/vendors/djgpp. The filenames on that server meet the MS-DOS 8.3 limitations and are in smaller pieces for easier downloading and disk copying. Note that DJGPP versions of g++ will always trail major releases by a few months. For example, the current DJGPP is version 2.6.2 as of this writing.
FSF refuses to use the standard Unix "compress" utility for ideological reasons. Instead of compress, you are advised to use GNU gzip which actually achieves better reduction. You can recognize a gzipped file by its .gz extension. This is a totally different file format than used by pkZIP. To extract sources that are in files ending in `.tar.gz' you can use the command gzip -d < foo.tar.gz | tar xf - where `foo.tar.gz' is the name of the file.
The Walnut Creek GNU CDROM contains the complete GNU software library, as well as binaries for both SunOS 4.1.3 and Solaris 2.3. This software is ready to be compiled on a great number of platforms, and includes such packages as Emacs 19.25 and gcc 2.6.0. This disc is in Rock Ridge format, so full Unix pathnames are visible. This CDROM was last cut in August 1994 and costs $40 (add $5 S/H). To order, call (800)786-9907 or email to firstname.lastname@example.org.
Many of the GNU products have their own mailing lists for interested users and co-developers. GNU has also established a complete hierarchy of Usenet newsgroups (Gnusgroups?). There is a ".bug" newsgroup for each of the major products (e.g. gnu.g++.bug for g++ problems). Here's a brief overview some of the nearly 50 newsgroups in the gnu.* hierarchy:
Newsgroup name Description -------------- ----------------------------------- gnu.announce General announcements for GNU and FSF gnu.bash GNU Bourne-Again Shell (BASH) gnu.emacs.* 11 newsgroups devoted to EMACS gnu.g++.* 6 newsgroups about g++ (GNU C++) gnu.gcc.* 4 newsgroups about GNU C gnu.gdb.* 2 newsgroups about GDB gnu.ghostscript.* 2 newsgroups about GNU postscript gnu.misc Miscellaneous announcements gnu.misc.discuss Discussion of above gnu.smalltalk.* 2 newsgroups about GNU Smalltalk gnu.test Test for the GNU hierarchy gnu.utils.* 2 newsgroups about Unix type tools