egisin@orchid.UUCP (08/04/87)
Version 1.2 of the Mark Johnson shareware C compiler follows in two parts. Each part is a separate uuencoded ARC file. This compiler implements a decent subset of K&R C. Floats and static are missing, and initializers are somewhat limited. The library has most common functions from K&R, but is lacking documentation. There is also a small make program, and a program called "bug" to print a symbolic stack trace after a program bombs. This version contains many improvements over version 1.0 posted earlier. In addition to the two new programs mentioned above, the library has been greatly extended. The compiler has several bugs fixed, and now allows register arguments and structure assignment. I'm impressed by this package. The compiler itself compares favourably with some of the commerical compilers (I won't mention names). You get library source, and there is chance the Schumacher PD C library will be ported to MJ C soon. I've included osbind.h from the Schumacher C library that I have adapted to use the MJ C "trap" builtin. This allows you to use the dos/bios/xbios functions with the "standard" names. There are several obscure bugs in the C preprocessor that will cause problems using this, see the note below. Changing the names of the formal arguments helps sometimes. --- osbind.h --- /* * OSBIND.H Mnemonic names for operating system calls * * Adapted from Dale Schumacher's version to Mark Johnson C by Eric Gisin. * Notes: * There are bugs in MJ C's macro expansion. * If you get syntax errors using these macros, * Try enclosing the macro call with asm() and compile. * Then look at the yc.out to see the macro expansion. */ /* * GEMDOS (trap1) */ #define Pterm0() trap(1,0x00) #define Cconin() trap(1,0x01) #define Cconout(c) trap(1,0x02,c) #define Cauxin() trap(1,0x03) #define Cauxout(c) trap(1,0x04,c) #define Cprnout(c) trap(1,0x05,c) #define Crawio(data) trap(1,0x06,data) #define Crawcin() trap(1,0x07) #define Cnecin() trap(1,0x08) #define Cconws(s) trap(1,0x09,s) #define Cconrs(buf) trap(1,0x0A,buf) #define Cconis() (int)trap(1,0x0B) #define Dsetdrv(d) trap(1,0x0E,d) #define Cconos() trap(1,0x10) #define Cprnos() trap(1,0x11) #define Cauxis() trap(1,0x12) #define Cauxos() trap(1,0x13) #define Dgetdrv() (int)trap(1,0x19) #define Fsetdta(dta) trap(1,0x1A,dta) #define Super(ptr) trap(1,0x20,ptr) #define Tgetdate() (int)trap(1,0x2A) #define Tsetdate(date) trap(1,0x2B,date) #define Tgettime() (int)trap(1,0x2C) #define Tsettime(time) trap(1,0x2D,time) #define Fgetdta() trap(1,0x2F) #define Sversion() (int)trap(1,0x30) #define Ptermres(save,rv) trap(1,0x31,save,rv) #define Dfree(buf,d) trap(1,0x36,buf,d) #define Dcreate(path) trap(1,0x39,path) #define Ddelete(path) trap(1,0x3A,path) #define Dsetpath(path) trap(1,0x3B,path) #define Fcreate(fn,mode) trap(1,0x3C,fn,mode) #define Fopen(fn,mode) trap(1,0x3D,fn,mode) #define Fclose(H) trap(1,0x3E,H) #define Fread(H,cnt,buf) trap(1,0x3F,H,cnt,buf) #define Fwrite(H,cnt,buf) trap(1,0x40,H,cnt,buf) #define Fdelete(fn) trap(1,0x41,fn) #define Fseek(where,H,how) trap(1,0x42,where,H,how) #define Fattrib(fn,rwflag,attr) trap(1,0x43,fn,rwflag,attr) #define Fdup(H) trap(1,0x45,H) #define Fforce(Hstd,Hnew) trap(1,0x46,Hstd,Hnew) #define Dgetpath(buf,d) trap(1,0x47,buf,d) #define Malloc(size) trap(1,0x48,size) #define Mfree(ptr) trap(1,0x49,ptr) #define Mshrink(ptr,size) trap(1,0x4A,0,ptr,size) #define Pexec(mode,prog,tail,env) trap(1,0x4B,mode,prog,tail,env) #define Pterm(rv) trap(1,0x4C,rv) #define Fsfirst(filespec,attr) (int)trap(1,0x4E,filespec,attr) #define Fsnext() (int)trap(1,0x4F) #define Frename(zero,old,new) trap(1,0x56,zero,old,new) #define Fdatime(timeptr,H,rwflag) trap(1,0x57,timeptr,H,rwflag) /* * BIOS (trap13) */ #define Bconstat(DEV) trap(13,1,DEV) #define Bconin(DEV) trap(13,2,DEV) #define Bconout(DEV,c) trap(13,3,DEV,c) #define Rwabs(rwflag,buf,n,sector,d) trap(13,4,rwflag,buf,n,sector,d) #define Setexc(vnum,vptr) trap(13,5,vnum,vptr) #define Tickcal() trap(13,6) #define Getbpb(d) trap(13,7,d) #define Bcostat(DEV) trap(13,8,DEV) #define Mediach(d) trap(13,9,a) #define Drvmap() trap(13,10) #define Getshift() trap(13,11,-1) #define Kbshift(data) trap(13,11,data) /* * XBIOS (trap14) */ #define Initmous(type,param,vptr) trap(14,0,type,param,vptr) #define Physbase() trap(14,2) #define Logbase() trap(14,3) #define Getrez() (int)trap(14,4) #define Setscreen(lscrn,pscrn,rez) trap(14,5,lscrn,pscrn,rez) #define Setpallete(palptr) trap(14,6,palptr) #define Setcolor(colornum,mixture) trap(14,7,colornum,mixture) #define Floprd(buf,x,d,sect,trk,side,n) trap(14,8,buf,x,d,sect,trk,side,n) #define Flopwr(buf,x,d,sect,trk,side,n) trap(14,9,buf,x,d,sect,trk,side,n) #define Flopfmt(b,x,d,spt,trk,sd,i,m,v) trap(14,10,b,x,d,spt,trk,sd,i,m,v) #define Midiws(cnt,ptr) trap(14,12,cnt,ptr) #define Mfpint(vnum,vptr) trap(14,13,vnum,vptr) #define Iorec(ioDEV) trap(14,14,ioDEV) #define Rsconf(baud,flow,uc,rs,ts,sc) trap(14,15,baud,flow,uc,rs,ts,sc) #define Keytbl(nrml,shft,caps) trap(14,16,nrml,shft,caps) #define Random() trap(14,17) #define Protobt(buf,serial,dsktyp,exec) trap(14,18,buf,serial,dsktyp,exec) #define Flopver(buf,x,d,sect,trk,sd,n) trap(14,19,buf,x,d,sect,trk,sd,n) #define Scrdmp() trap(14,20) #define Cursconf(func,rate) trap(14,21,func,rate) #define Settime(time) trap(14,22,time) #define Gettime() trap(14,23) #define Bioskeys() trap(14,24) #define Ikbdws(len_minus1,ptr) trap(14,25,len_minus1,ptr) #define Jdisint(vnum) trap(14,26,vnum) #define Jenabint(vnum) trap(14,27,vnum) #define Giaccess(data,reg) trap(14,28,data,reg) #define Offgibit(ormask) trap(14,29,ormask) #define Ongibit(andmask) trap(14,30,andmask) #define Xbtimer(timer,ctrl,data,vnum) trap(14,31,timer,ctrl,data,vnum) #define Dosound(ptr) trap(14,32,ptr) #define Setprt(config) trap(14,33,config) #define Kbdvbase() trap(14,34) #define Kbrate(delay,reprate) trap(14,35,delay,reprate) #define Prtblk(pblkptr) trap(14,36,pblkptr) #define Vsync() trap(14,37) #define Supexec(funcptr) trap(14,38,funcptr)