[comp.sys.atari.st] Fred Fish's dbug package on STs

exodus@uop.EDU (Freddy Kreuger) (11/18/87)

Following are my changes to Fred Fish'd now-public-domain debugging macro
package.  It fixes a few problems and adds support for the profiling timing
stuff.  Also, to compile dbug, have a getopts library ready.  I used the
getopt code from mkprog, posted to comp.sources a while ago (last year?).
[Use Mark William's C Compiler, know what you are doing.  Make the 
getopt library first with 'ar rs libopts.a getopt.o ...' then compile
dbug.o with that library included on the command line ('-lopts').   Be sure
to define ATARI when compiling '-DATARI'.

Make the dbug library with 'ar rs libdbug.a dbug.o'.  Then compile
analyze.c with the '-f' floating pt option, the dbug library '-ldbug'
and '-lopts'.  Yes, a lot of work, eh?  I should've just written a new 
makefile.]

Diffs: (produced by MWC diff: diff dbug.c newdbug.c)

=====---------===========-----------===========-----------========-------
68 a 69,71
> #ifdef ATARI
> #define HZ (200)
> #endif
240 c 243
< #if unix || AMIGA
---
> #if unix || AMIGA || ATARI
1766 c 1769
< #endif
---
> # endif
1804 a 1808,1833
> 
> #if ATARI
> 
> #include <time.h>
> static int first_clock = TRUE;
> static clock_t begin;
> static clock_t elapsed;
> 
> LOCAL unsigned long Clock ()
> {
>     register clock_t now;
>     register unsigned long millisec = 0;
> 
> 	if (first_clock == TRUE) {
> 	    first_clock = FALSE;
> 	    now = clock();
> 	    begin = now;
> 	}
> 	now = clock();
> 	millisec = (now - begin) * (1000 / HZ );
> 
>     return (millisec);
> 
> }
> #endif
> 
=====---------===========-----------===========-----------========-------

Greg Onufer
University of the Pacific
Postmaster and Root