home *** CD-ROM | disk | FTP | other *** search
- /* $Log: fpgoc.c,v $
- * Revision 1.2 91/02/14 10:55:31 thomasn
- * include Log header in source
- * */
- /*********************************************************************
- (C) Copyright 1979-1992; Franklin L. DeRemer, Thomas J. Pennello,
- MetaWare Incorporated; Santa Cruz, CA 95060.
- This program is the unpublished property and trade secret of the above
- three. It is to be utilized solely under license from MetaWare and it
- is to be maintained on a confidential basis for internal company use
- only. The security and protection of the program is paramount to
- maintenance of the trade secret status. It is to be protected from
- disclosure to unauthorized parties, both within the Licensee company
- and outside, in a manner not less stringent than that utilized for Li-
- censee's own proprietary internal information. No copies of the
- Source or Object Code are to leave the premises of Licensee's business
- except in strict accordance with the license agreement signed by Li-
- censee with MetaWare.
- *********************************************************************/
-
- /*
- * LOC emulation routines for GOC.
- */
-
- #include <implemen.cf>
- #include <language.cf>
-
- #define func(x) _mw##x
- static int j = _DEFAULT_CALLING_CONVENTION;
-
- static long double S[12];
- static long double *sp = &S[0];
-
- #pragma calling_convention(PASCAL);
-
- #define push(value) (*++sp = value)
- #define pop() *sp--;
-
- void func(fload)(float f) {push(f);}
- void func(flload)(double d) {push(d);}
- void func(ftload)(long double *ld) {push(*ld);}
- void func(fdup)() { sp[1] = sp[0]; sp++; }
- float func(fret)() { return pop(); }
- double func(flret)() { return pop(); }
- long double func(ftret)() { return pop(); }
- #define two(name,op) void func(name)() { sp[-1] op##= *sp; sp--; }
- #define twoR(name,op) void func(name)() { sp[-1] = (*sp op sp[-1]); sp--; }
- two(fmpy,*)
- two(fadd,+)
- two(fdiv,/)
- two(fsub,-)
- twoR(fsubr,-)
- twoR(fdivr,/)
- void func(fmin)() { if (*sp < sp[-1]) sp[-1] = *sp; sp--; }
- void func(fmax)() { if (*sp > sp[-1]) sp[-1] = *sp; sp--; }
- void func(fabs)() { *sp = _abs(*sp); }
- void func(fneg)() { *sp = -*sp; }
- void func(fflt)(long l) { push(l); }
- void func(ufflt)(unsigned long l) { push(l); }
- long func(trunc)() { return pop(); }
- void func(fcmp)() { volatile int i; sp-=2; i = sp[1] < sp[2]; }
-