Columns


CUG New Releases

Sherlock And CSTAR

Kenji Hino


Kenji Hino is a member of The C Users' Group technical staff. He holds a B.S.C.S. from McPherson College and an undergraduate degree in metallurgy from a Japanese university. He enjoys playing drums in a reggae band.

CUG355 Sherlock for MS-DOS; CUG356 Sherlock for Macintosh

Edward K. Ream (WI) has placed all of the Sherlock v1.7 debugging package into the public domain and contributed it all to the CUG library. Sherlock was formerly a commercial product and represents more than four years of programming effort.

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 offers great advantages over interactive debuggers especially when it comes to the development of memory-hogging applications because Sherlock's overhead is small. 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. For the MS-DOS version (CUG355), the code was developed and tested using Microsoft C v5.0 and Turbo C v2.0. Make files and link files are provided for both compilers. For the Macintosh version (CUG356), the code was developed using Think C v2.0 and then ported to MPW. Sherlock has been tested with System 7 and System 6 with Multi-Finder. The Macintosh version of Sherlock differs in several important respects from the MS-DOS version: the Sherlock Preprocessor has been extensively revised and uses an object-oriented library. Due to the subdirectories included in the distribution disk, the disk format is restricted to MS-DOS (CUG355) or Macintosh (CUG356).

CUG357 CSTAR

Edward K. Ream has also placed all of CSTAR into the public domain. The CSTAR language is essentially a superset of K&R C with some extensions to allow assembly code to be specified in a C-language format. The CSTAR compiler is a cross compiler: it runs on MS-DOS and produces Digital Research (CRI) format 68000 assembly language output. It would be simple to change the output to another 68000 format, but changing to another target machine would be difficult. CSTAR produces locally optimal code in almost all circumstances: it produces code for arithmetic operations and flow of control constructs that is at least as good as would typically be produced by an expert assembly language programmer. The CSTAR language extensions include: the ability to treat C variables which have the same name as 68000 registers as if they were register variables assigned to the corresponding register; the ability to treat functions which have the same name as 68000 instructions as if the corresponding 68000 instruction were inserted in line; and finally, the #enum preprocessor directive, an abbreviation for a sequence of #define's.

CSTAR doesn't support ANSI C features such as blocks (all variables of a function must be declared as format parameters), bit fields, complex initializers involving arrays of structs or unions, enum data type, function prototyping.

By combining the front end of SPP tool (Sherlock Preprocessor in CUG355 and 356) with the back end of the CSTAR compiler, one could create a full ANSI C compiler although it wouldn't be very easy.

The distribution disk contains full source code for all portions of CSTAR, along with all test files, batch files, executable files and documentation. The source code for CSTAR can be compiled using Miscrosoft C v5.1 or later, or Turbo C v1.5 or later. Make files and link files for both compilers are provided.