home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Utilities / Winter Shell 1.0d2 / Source / Libraries / ANSI-stubs.c next >
Encoding:
C/C++ Source or Header  |  1994-01-16  |  755 b   |  40 lines  |  [TEXT/KAHL]

  1. /* stubs for ANSI library
  2.     94/01/06 aih removed THINK C console stubs
  3.     93/12/01 aih created */
  4.     
  5. #include <stdio.h>
  6.  
  7. #if ! PROFILE
  8.     int _profile, _trace;
  9.     short _profile_depth;
  10. #endif /* PROFILE */
  11.  
  12. /* the following is hacked out of the THINK C <math.c> source file */
  13.  
  14. #define _NOINTRINSICS_
  15. #define _NOSYNONYMS_
  16. #include "math.h"
  17. #include <SANE.h>
  18.  
  19. #if __option(native_fp)
  20.  
  21.     #define addr(p)            p
  22.     #define univ(p)            p
  23.  
  24. #else
  25.  
  26.     #pragma parameter A0 addr(A0)
  27.     static extended80 *addr(_double *) = {
  28.         0x5488,                            //        addq.l    #2,a0
  29.     };
  30.     
  31.     #pragma parameter A0 univ(A0)
  32.     static _double *univ(_double *) = {
  33.         0x30A8, 0x0002                    //        move.w    2(a0),(a0)
  34.     };
  35.  
  36. #endif
  37.  
  38. #define SQRT(p) (fp68k(addr(p), FSQRTX), univ(p))
  39. double sqrt(double x) { return(*SQRT(&x)); }
  40.