/* Generated with C2C (Cedar To C)*/ /* Copyright (C) 1992 by Xerox Corporation. All rights reserved. */ /* time: February 21, 1992 9:06:08 pm PST */ /* C2C version: October 16, 1990 (native) */ /* ref-counting: off */ /* file: RealSupportImpl, module: RealSupportImpl */ /* switches: bcfhklnouw */ #include <cedar/InstallationSupport.h> #include <cedar/CedarExtra.h> static char versionStamp[] = "@(#)mob←version [1972848211,830939493] RealSupportImpl"; typedef unsigned word, *ptr; typedef unsigned char byte, *bPt; typedef unsigned short half, *hPt; typedef word (*fPt)(); static float fc1 = 2147483647.0; #define SOURCE(p, l) /* source p, l */ #define BCK(idx, lim) ( ((unsigned) idx) >= ((unsigned) lim) ? (XR←RaiseBoundsFault()) : (idx) ) static float fc8 = 0.0; static float fc11 = 256.0; #define INEG(x) ( (word) ( - ((int) (word) (x)) ) ) static float fc18 = 2.0; #define FMIN(x, y, tx, ty) ( (tx=((float) x)) <= (ty=((float) y)) ? tx : ty ) #define FMAX(x, y, tx, ty) ( (tx=((float) x)) >= (ty=((float) y)) ? tx : ty ) static void NoName←Q1800(); static void RealSupportImpl←P0(); static word Classify←P60(); static word Example←P120(); static word IntToReal←P180(); static word CardToReal←P240(); static word Fix←P300(); static word Round←P360(); static word FScale←P420(); static word Neg←P480(); static word Abs←P600(); static word Add←P660(); static word Sub←P720(); static word Mul←P780(); static word Div←P840(); static word Gt←P900(); static word Ge←P960(); static word Lt←P1020(); static word Le←P1080(); static word Eq←P1140(); static word Ne←P1200(); static word Min←P1260(); static word Max←P1320(); static word Pwr←P1380(); static word Floor←P1440(); static word Ceiling←P1500(); static void OtherError←P1740(); static struct {unsigned f; char r[16];} string2 = {851984, "\257\300u\227FS\3001\207!e@t\000\000"}; static struct {unsigned f; char r[16];} string3 = {851984, "\257\300\150\261\123\070\300\276\161\220\062\100\150\000\000"}; static struct {unsigned f; char r[16];} string4 = {851984, "\257\300\321\335\027\212\300\103\063\273\041\100\150\000\000"}; static struct { word f0[59]; } globalframe = { {0} }; static void NoName←Q1800() { register ptr gf←c0105 = (ptr) &globalframe; word var←c9384; (* (( (ptr) gf←c0105)+4)/* floatLastInt←v3504 */ ) = (* (ptr) &fc1 ); (* (( (ptr) gf←c0105)+55) ) = ( ((word) (fPt) RealSupportImpl←P0) ); (* (( (ptr) gf←c0105)+53) ) = ( ((word) (fPt) Classify←P60) ); (* (( (ptr) gf←c0105)+51) ) = ( ((word) (fPt) Example←P120) ); (* (( (ptr) gf←c0105)+49) ) = ( ((word) (fPt) IntToReal←P180) ); (* (( (ptr) gf←c0105)+47) ) = ( ((word) (fPt) CardToReal←P240) ); (* (( (ptr) gf←c0105)+45) ) = ( ((word) (fPt) Fix←P300) ); (* (( (ptr) gf←c0105)+43) ) = ( ((word) (fPt) Round←P360) ); (* (( (ptr) gf←c0105)+41) ) = ( ((word) (fPt) FScale←P420) ); (* (( (ptr) gf←c0105)+39) ) = ( ((word) (fPt) Neg←P480) ); (* (( (ptr) gf←c0105)+37) ) = ( ((word) (fPt) Abs←P600) ); (* (( (ptr) gf←c0105)+35) ) = ( ((word) (fPt) Add←P660) ); (* (( (ptr) gf←c0105)+33) ) = ( ((word) (fPt) Sub←P720) ); (* (( (ptr) gf←c0105)+31) ) = ( ((word) (fPt) Mul←P780) ); (* (( (ptr) gf←c0105)+29) ) = ( ((word) (fPt) Div←P840) ); (* (( (ptr) gf←c0105)+27) ) = ( ((word) (fPt) Gt←P900) ); (* (( (ptr) gf←c0105)+25) ) = ( ((word) (fPt) Ge←P960) ); (* (( (ptr) gf←c0105)+23) ) = ( ((word) (fPt) Lt←P1020) ); (* (( (ptr) gf←c0105)+21) ) = ( ((word) (fPt) Le←P1080) ); (* (( (ptr) gf←c0105)+19) ) = ( ((word) (fPt) Eq←P1140) ); (* (( (ptr) gf←c0105)+17) ) = ( ((word) (fPt) Ne←P1200) ); (* (( (ptr) gf←c0105)+15) ) = ( ((word) (fPt) Min←P1260) ); (* (( (ptr) gf←c0105)+13) ) = ( ((word) (fPt) Max←P1320) ); (* (( (ptr) gf←c0105)+11) ) = ( ((word) (fPt) Pwr←P1380) ); (* (( (ptr) gf←c0105)+9) ) = ( ((word) (fPt) Floor←P1440) ); (* (( (ptr) gf←c0105)+7) ) = ( ((word) (fPt) Ceiling←P1500) ); (* (( (ptr) gf←c0105)+5) ) = ( ((word) (fPt) OtherError←P1740) ); (void) XR←DeclareGlobalFrame((word) "RealSupportImpl", &globalframe, (word) XR←GetTypeIndexS((word) (&string2)), (word) ( ( (bPt) gf←c0105)+220)/* var←c9096 */ ); var←c9384 = (word) XR←ImportInterface((word) "FloatingPointCommon", (word) XR←GetTypeIndexS((word) (&string3)), 5); (* (( (ptr) gf←c0105)+57)/* var←c9352 */ ) = var←c9384; var←c9384 = (word) XR←ExportInterface((word) "RealSupport", (word) XR←GetTypeIndexS((word) (&string4)), 24); (* (( (ptr) gf←c0105)+58)/* var←c9416 */ ) = var←c9384; (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+212)/* var←c9064 */ , 67371009); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+204)/* var←c9032 */ , 67633410); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+196)/* var←c9000 */ , 67371521); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+188)/* var←c8968 */ , 67371777); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+180)/* var←c8936 */ , 67372033); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+172)/* var←c8904 */ , 67372289); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+164)/* var←c8872 */ , 67634690); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+156)/* var←c8840 */ , 67372801); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+148)/* var←c8808 */ , 67373057); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+140)/* var←c8776 */ , 67635458); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+132)/* var←c8744 */ , 67635714); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+124)/* var←c8712 */ , 67635970); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+116)/* var←c8680 */ , 67636226); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+108)/* var←c8648 */ , 67636482); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+100)/* var←c8616 */ , 67636738); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+92)/* var←c8584 */ , 67636994); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+84)/* var←c8552 */ , 67637250); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+76)/* var←c8520 */ , 67637506); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+68)/* var←c8488 */ , 67637762); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+60)/* var←c8456 */ , 67638018); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+52)/* var←c8424 */ , 67638274); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+44)/* var←c8392 */ , 67638530); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+28)/* var←c8328 */ , 67376641); (void) XR←ExportProcS(var←c9384, (word) (( (bPt) gf←c0105)+36)/* var←c8360 */ , 67376897); } static void RealSupportImpl←P0(formal←c032, formal←c031) word formal←c032; word formal←c031; { /* RealSupportImpl: */ /* moved to installation proc */ } static word Classify←P60(d←v3848) word d←v3848; { word var←c3892; word f←v7636; /* Classify: */ SOURCE(531, 300) SOURCE(596, 27) f←v7636 = d←v3848; SOURCE(625, 206) { word var←c9128; var←c9128 = (((unsigned)f←v7636 << 1) >> 24); if ((var←c9128 == 0)) { SOURCE(648, 53) if ((( (((unsigned)f←v7636 << 9) >> 9) ) == 0)) { SOURCE(664, 19) return(0); } else { SOURCE(683, 18) return(1); }; } else { if ((var←c9128 == 255)) { SOURCE(713, 90) { word var←c9160; var←c9160 = ( (((unsigned)f←v7636 << 9) >> 9) ); if ((var←c9160 == 0)) { SOURCE(734, 17) return(3); } else { if ((var←c9160 == 1)) { SOURCE(758, 14) return(4); } else { SOURCE(785, 18) return(5); }; }; }; } else { SOURCE(816, 15) return(2); }; }; }; } static word Example←P120(c←v3952, min←v3980) word c←v3952; word min←v3980; { word var←c4024; word f←v7680 = 0; /* Example: */ SOURCE(837, 410) SOURCE(951, 264) { word var←c9192; var←c9192 = c←v3952; switch (var←c9192) { case 0: break; case 1: SOURCE(990, 42) if ((0 != min←v3980)) { SOURCE(1002, 13) f←v7680 = (f←v7680 & 4286578688) | ((1)); } else { SOURCE(1015, 17) f←v7680 = (f←v7680 & 4286578688) | ((8388607)); }; break; case 2: SOURCE(1044, 67) if ((0 != min←v3980)) { SOURCE(1056, 15) f←v7680 = (f←v7680 & 2155872255) | (((1)) << 23); } else { SOURCE(1072, 20) f←v7680 = (f←v7680 & 2155872255) | (((254)) << 23); SOURCE(1094, 17) f←v7680 = (f←v7680 & 4286578688) | ((8388607)); }; break; case 3: SOURCE(1126, 14) f←v7680 = (f←v7680 & 2155872255) | (((255)) << 23); break; case 4: SOURCE(1152, 14) f←v7680 = (f←v7680 & 2155872255) | (((255)) << 23); SOURCE(1168, 7) f←v7680 = (f←v7680 & 4286578688) | ((1)); break; case 5: SOURCE(1192, 14) f←v7680 = (f←v7680 & 2155872255) | (((255)) << 23); SOURCE(1208, 7) f←v7680 = (f←v7680 & 4286578688) | ((2)); break; }; }; SOURCE(1227, 20) return(f←v7680); } static word IntToReal←P180(i←v4084) word i←v4084; { word ret←v4128; /* IntToReal: */ SOURCE(1253, 71) SOURCE(1317, 7) { float tf5; ret←v4128 = ( tf5 = (float)(int)i←v4084, *(word*)&tf5 ); }; SOURCE(1253, 71) return(ret←v4128); } static word CardToReal←P240(c←v4188) word c←v4188; { word ret←v4232; /* CardToReal: */ SOURCE(1329, 73) SOURCE(1395, 7) { float tf6; ret←v4232 = ( tf6 = (float)(unsigned)c←v4188, *(word*)&tf6 ); }; SOURCE(1329, 73) return(ret←v4232); } static word Fix←P300(x←v4292) word x←v4292; { register ptr gf←c9448 = (ptr) &globalframe; word var←c4336; /* Fix: */ SOURCE(1407, 100) SOURCE(1452, 35) if ((((x←v4292 << 1) >> 1) > (* (( (ptr) gf←c9448)+4)/* floatLastInt←v3504 */ ))) { SOURCE(1475, 12) (void) OtherError←P1740(); }; SOURCE(1489, 18) return((word) XR←REAL32←Fix(x←v4292)); } static word Round←P360(x←v4396) word x←v4396; { register ptr gf←c9480 = (ptr) &globalframe; word var←c4440; /* Round: */ SOURCE(1510, 104) SOURCE(1557, 35) if ((((x←v4396 << 1) >> 1) > (* (( (ptr) gf←c9480)+4)/* floatLastInt←v3504 */ ))) { SOURCE(1580, 12) (void) OtherError←P1740(); }; SOURCE(1594, 20) return((word) XR←REAL32←Round(x←v4396)); } static word FScale←P420(a←v4500, scale←v4528) word a←v4500; word scale←v4528; { word var←c4572; word r←v7724; word exp←v7752; /* FScale: */ SOURCE(1618, 494) SOURCE(1683, 27) r←v7724 = a←v4500; SOURCE(1712, 28) exp←v7752 = ((((unsigned)r←v7724 << 1) >> 24) + scale←v4528); SOURCE(1742, 370) if ( ( ( ( (int)exp←v7752 > (int)0) ? ( (int)exp←v7752 < (int)255) : 0 ) ? (((((unsigned)r←v7724 << 1) >> 24) - 1) <= 253) : 0 ) ) { SOURCE(1792, 11) r←v7724 = (r←v7724 & 2155872255) | (((BCK(exp←v7752, 256))) << 23); SOURCE(1805, 21) return(r←v7724); } else { SOURCE(1835, 26) { word x7; word x9; if ((( x7 = a←v4500, *(float*)&x7 ) == ( x9 = (* (ptr) &fc8 ), *(float*)&x9 ))) { SOURCE(1851, 10) return(a←v4500); }; }; SOURCE(1863, 60) lab←L100002: ; if (( (int)scale←v4528 >= (int)8)) { } else { goto lab←L100000; }; SOURCE(1883, 17) scale←v4528 = (scale←v4528 - 8); SOURCE(1902, 21) { word x10; word x12; *(float*)&a←v4500 = ( x10 = a←v4500, *(float*)&x10 ) * ( x12 = (* (ptr) &fc11 ), *(float*)&x12 ); }; goto lab←L100002; lab←L100000: ; SOURCE(1925, 53) lab←L100005: ; if (( (int)scale←v4528 > (int)0)) { } else { goto lab←L100003; }; SOURCE(1944, 17) scale←v4528 = (scale←v4528 - 1); SOURCE(1963, 15) { word x13; word x14; *(float*)&a←v4500 = ( x13 = a←v4500, *(float*)&x13 ) + ( x14 = a←v4500, *(float*)&x14 ); }; goto lab←L100005; lab←L100003: ; SOURCE(1980, 61) lab←L100008: ; if (( (int)INEG(scale←v4528) >= (int)8)) { } else { goto lab←L100006; }; SOURCE(2001, 17) scale←v4528 = (scale←v4528 + 8); SOURCE(2020, 21) { word x15; word x16; *(float*)&a←v4500 = ( x15 = a←v4500, *(float*)&x15 ) / ( x16 = (* (ptr) &fc11 ), *(float*)&x16 ); }; goto lab←L100008; lab←L100006: ; SOURCE(2043, 56) lab←L100011: ; if (( (int)INEG(scale←v4528) > (int)0)) { } else { goto lab←L100009; }; SOURCE(2063, 17) scale←v4528 = (scale←v4528 + 1); SOURCE(2082, 17) { word x17; word x19; *(float*)&a←v4500 = ( x17 = a←v4500, *(float*)&x17 ) / ( x19 = (* (ptr) &fc18 ), *(float*)&x19 ); }; goto lab←L100011; lab←L100009: ; SOURCE(2101, 11) return(a←v4500); }; } static word Neg←P480(d←v4632) word d←v4632; { word ret←v4676; word f←v7796; /* Neg: */ SOURCE(2118, 126) SOURCE(2177, 27) f←v7796 = d←v4632; SOURCE(2206, 19) f←v7796 = (f←v7796 & 2147483647) | ((( ! ((int)f←v7796<0))) << 31); SOURCE(2227, 17) ret←v4676 = f←v7796; SOURCE(2118, 126) return(ret←v4676); } static word Abs←P600(d←v4840) word d←v4840; { word ret←v4884; /* Abs: */ SOURCE(2354, 77) SOURCE(2413, 18) ret←v4884 = ((d←v4840 << 1) >> 1); SOURCE(2354, 77) return(ret←v4884); } static word Add←P660(x←v4944, y←v4972) word x←v4944; word y←v4972; { word ret←v5016; /* Add: */ SOURCE(2436, 73) SOURCE(2498, 11) { word x20; word x21; *(float*)&ret←v5016 = ( x20 = x←v4944, *(float*)&x20 ) + ( x21 = y←v4972, *(float*)&x21 ); }; SOURCE(2436, 73) return(ret←v5016); } static word Sub←P720(x←v5076, y←v5104) word x←v5076; word y←v5104; { word ret←v5148; /* Sub: */ SOURCE(2514, 73) SOURCE(2576, 11) { word x22; word x23; *(float*)&ret←v5148 = ( x22 = x←v5076, *(float*)&x22 ) - ( x23 = y←v5104, *(float*)&x23 ); }; SOURCE(2514, 73) return(ret←v5148); } static word Mul←P780(x←v5208, y←v5236) word x←v5208; word y←v5236; { word ret←v5280; /* Mul: */ SOURCE(2592, 73) SOURCE(2654, 11) { word x24; word x25; *(float*)&ret←v5280 = ( x24 = x←v5208, *(float*)&x24 ) * ( x25 = y←v5236, *(float*)&x25 ); }; SOURCE(2592, 73) return(ret←v5280); } static word Div←P840(x←v5340, y←v5368) word x←v5340; word y←v5368; { word ret←v5412; /* Div: */ SOURCE(2670, 73) SOURCE(2732, 11) { word x26; word x27; *(float*)&ret←v5412 = ( x26 = x←v5340, *(float*)&x26 ) / ( x27 = y←v5368, *(float*)&x27 ); }; SOURCE(2670, 73) return(ret←v5412); } static word Gt←P900(x←v5472, y←v5500) word x←v5472; word y←v5500; { word var←c5544; /* Gt: */ SOURCE(2748, 70) SOURCE(2804, 14) { word x28; word x29; return((( x28 = x←v5472, *(float*)&x28 ) > ( x29 = y←v5500, *(float*)&x29 ))); }; } static word Ge←P960(x←v5604, y←v5632) word x←v5604; word y←v5632; { word var←c5676; /* Ge: */ SOURCE(2823, 71) SOURCE(2879, 15) { word x30; word x31; return((( x30 = x←v5604, *(float*)&x30 ) >= ( x31 = y←v5632, *(float*)&x31 ))); }; } static word Lt←P1020(x←v5736, y←v5764) word x←v5736; word y←v5764; { word var←c5808; /* Lt: */ SOURCE(2899, 70) SOURCE(2955, 14) { word x32; word x33; return((( x32 = x←v5736, *(float*)&x32 ) < ( x33 = y←v5764, *(float*)&x33 ))); }; } static word Le←P1080(x←v5868, y←v5896) word x←v5868; word y←v5896; { word var←c5940; /* Le: */ SOURCE(2974, 71) SOURCE(3030, 15) { word x34; word x35; return((( x34 = x←v5868, *(float*)&x34 ) <= ( x35 = y←v5896, *(float*)&x35 ))); }; } static word Eq←P1140(x←v6000, y←v6028) word x←v6000; word y←v6028; { word var←c6072; /* Eq: */ SOURCE(3050, 70) SOURCE(3106, 14) { word x36; word x37; return((( x36 = x←v6000, *(float*)&x36 ) == ( x37 = y←v6028, *(float*)&x37 ))); }; } static word Ne←P1200(x←v6132, y←v6160) word x←v6132; word y←v6160; { word var←c6204; /* Ne: */ SOURCE(3125, 70) SOURCE(3181, 14) { word x38; word x39; return((( x38 = x←v6132, *(float*)&x38 ) != ( x39 = y←v6160, *(float*)&x39 ))); }; } static word Min←P1260(x←v6264, y←v6292) word x←v6264; word y←v6292; { word ret←v6336; /* Min: */ SOURCE(3200, 77) SOURCE(3262, 15) { word x40; float tf41; float tf42; word x43; float tf44; ret←v6336 = ( tf44 = FMIN(( x40 = x←v6264, *(float*)&x40 ), ( x43 = y←v6292, *(float*)&x43 ), tf41, tf42), *(word*)&tf44 ); }; SOURCE(3200, 77) return(ret←v6336); } static word Max←P1320(x←v6396, y←v6424) word x←v6396; word y←v6424; { word ret←v6468; /* Max: */ SOURCE(3282, 77) SOURCE(3344, 15) { word x45; float tf46; float tf47; word x48; float tf49; ret←v6468 = ( tf49 = FMAX(( x45 = x←v6396, *(float*)&x45 ), ( x48 = y←v6424, *(float*)&x48 ), tf46, tf47), *(word*)&tf49 ); }; SOURCE(3282, 77) return(ret←v6468); } static word Pwr←P1380(x←v6528, y←v6556) word x←v6528; word y←v6556; { word ret←v6600; /* Pwr: */ SOURCE(3364, 74) SOURCE(3426, 12) ret←v6600 = XR←RealPwr(x←v6528, y←v6556); SOURCE(3364, 74) return(ret←v6600); } static word Floor←P1440(x←v6660) word x←v6660; { register ptr gf←c9512 = (ptr) &globalframe; word ret←v6704; /* Floor: */ SOURCE(3443, 118) SOURCE(3504, 35) if ((((x←v6660 << 1) >> 1) > (* (( (ptr) gf←c9512)+4)/* floatLastInt←v3504 */ ))) { SOURCE(3527, 12) (void) OtherError←P1740(); }; SOURCE(3541, 20) { float tf50; return(( tf50 = (float)(int)(word) XR←REAL32←Floor(x←v6660), *(word*)&tf50 )); }; } static word Ceiling←P1500(x←v6764) word x←v6764; { register ptr gf←c9544 = (ptr) &globalframe; word ret←v6808; /* Ceiling: */ SOURCE(3564, 122) SOURCE(3627, 35) if ((((x←v6764 << 1) >> 1) > (* (( (ptr) gf←c9544)+4)/* floatLastInt←v3504 */ ))) { SOURCE(3650, 12) (void) OtherError←P1740(); }; SOURCE(3664, 22) { float tf51; return(( tf51 = (float)(int)(word) XR←REAL32←Ceiling(x←v6764), *(word*)&tf51 )); }; } static void OtherError←P1740() { register ptr gf←c9576 = (ptr) &globalframe; /* OtherError: */ SOURCE(4383, 59) SOURCE(4404, 38) { word var←c0104 = 5; (void) XR←RaiseError((* (( (ptr) (* (( (ptr) gf←c9576)+57)/* var←c9352 */ ))+4) ), (word) &var←c0104); }; } /* file: RealSupportImpl, module: RealSupportImpl, compiled at: February 21, 1992 9:06:07 pm PST */ extern void XR←install←RealSupportImpl() { NoName←Q1800(); } extern void XR←run←RealSupportImpl() { XR←Start(&globalframe); }