home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 1.ddi / MWHC.001 / K < prev    next >
Encoding:
Text File  |  1992-12-09  |  2.3 KB  |  62 lines

  1. /* $Log:    fpgoc.c,v $
  2.  * Revision 1.2  91/02/14  10:55:31  thomasn
  3.  * include Log header in source
  4.  *  */
  5. /*********************************************************************
  6. (C) Copyright 1979-1992;  Franklin L. DeRemer,   Thomas J. Pennello,
  7.                          MetaWare Incorporated;  Santa Cruz, CA 95060.
  8. This program is the unpublished property and trade secret of the above
  9. three.  It is to be utilized solely under license from MetaWare and it
  10. is to be maintained on a confidential basis for internal  company  use
  11. only.  The  security  and  protection  of  the program is paramount to
  12. maintenance of the trade secret status.  It is to  be  protected  from
  13. disclosure  to  unauthorized parties, both within the Licensee company
  14. and outside, in a manner not less stringent than that utilized for Li-
  15. censee's own proprietary  internal  information.   No  copies  of  the
  16. Source or Object Code are to leave the premises of Licensee's business
  17. except  in  strict accordance with the license agreement signed by Li-
  18. censee with MetaWare.
  19. *********************************************************************/
  20.  
  21. /*
  22.  *  LOC emulation routines for GOC. 
  23.  */
  24.  
  25. #include <implemen.cf>
  26. #include <language.cf>
  27.  
  28. #define func(x) _mw##x
  29. static int j = _DEFAULT_CALLING_CONVENTION;
  30.  
  31. static long double S[12];
  32. static long double *sp = &S[0];
  33.  
  34. #pragma calling_convention(PASCAL);
  35.  
  36. #define push(value) (*++sp = value)
  37. #define pop() *sp--;
  38.  
  39. void func(fload)(float f) {push(f);}
  40. void func(flload)(double d) {push(d);}
  41. void func(ftload)(long double *ld) {push(*ld);}
  42. void func(fdup)() { sp[1] = sp[0]; sp++; }
  43. float func(fret)() { return pop(); }
  44. double func(flret)() { return pop(); }
  45. long double func(ftret)() { return pop(); }
  46. #define two(name,op) void func(name)() { sp[-1] op##= *sp; sp--; }
  47. #define twoR(name,op) void func(name)() { sp[-1] = (*sp op sp[-1]); sp--; }
  48. two(fmpy,*)
  49. two(fadd,+)
  50. two(fdiv,/)
  51. two(fsub,-)
  52. twoR(fsubr,-)
  53. twoR(fdivr,/)
  54. void func(fmin)() { if (*sp < sp[-1]) sp[-1] = *sp; sp--; }
  55. void func(fmax)() { if (*sp > sp[-1]) sp[-1] = *sp; sp--; }
  56. void func(fabs)() { *sp = _abs(*sp); }
  57. void func(fneg)() { *sp = -*sp; }
  58. void func(fflt)(long l) { push(l); }
  59. void func(ufflt)(unsigned long l) { push(l); }
  60. long func(trunc)() { return pop(); }
  61. void func(fcmp)() { volatile int i; sp-=2; i = sp[1] < sp[2]; }
  62.