/* Generated with C2C (Cedar To C)*/ /* Copyright (C) 1992 by Xerox Corporation. All rights reserved. */ /* time: February 21, 1992 9:37:30 pm PST */ /* C2C version: October 16, 1990 (native) */ /* ref-counting: off */ /* file: TiogaFileIOImpl, module: TiogaFileIOImpl */ /* switches: bcfhklnouw */ #include <cedar/InstallationSupport.h> #include <cedar/CedarExtra.h> static char versionStamp[] = "@(#)mob←version [2052959156,1196779364] TiogaFileIOImpl"; typedef unsigned word, *ptr; typedef unsigned char byte, *bPt; typedef unsigned short half, *hPt; typedef word (*fPt)(); typedef struct {word f0, f1, f2, f3, f4, f5, f6;} W7; typedef W7 *W7Pt; #define SOURCE(p, l) /* source p, l */ #define SGNCK(i) ((int) (word) (i) < 0 ? XR←RaiseArithmeticFault(): i ) #define MIN(cast, x, y) ( ( cast x) < ( cast y) ? (x) : (y) ) #define MAX(cast, x, y) ( ( cast x) > ( cast y) ? (x) : (y) ) static void NoName←Q804(); static void TiogaFileIOImpl←P0(); static word GetFileId←P60(); static void PutFileId←P120(); static word Get16←P180(); static void Put16←P240(); static word GetTrailerLen←P300(); static void PutTrailerLen←P360(); static void GetParts←P420(); static word PutParts←P480(); static struct {unsigned f; char r[16];} string1 = {851984, "\257\300z]\253\264\300GUgd@t\000\000"}; static struct {unsigned f; char r[16];} string2 = {851984, "\257\300\015\277\004\146\300\034\367\146\045\100\164\000\000"}; static struct {unsigned f; char r[16];} string3 = {851984, "\257\300\203\256\002\131\300\364\237\146\374\100\150\000\000"}; static struct { word f0[4]; word f4; word f5; word f6; word f7; word f8; word f9; word f10; word f11; word f12; word f13; word f14; word f15; word f16; word f17; word f18; word f19; word f20; word f21[3]; } globalframe = { {0}, (word) PutParts←P480, 0, (word) GetParts←P420, 0, (word) PutTrailerLen←P360, 0, (word) GetTrailerLen←P300, 0, (word) Put16←P240, 0, (word) Get16←P180, 0, (word) PutFileId←P120, 0, (word) GetFileId←P60, 0, (word) TiogaFileIOImpl←P0, {0} }; static void NoName←Q804() { register ptr gf←c079 = (ptr) &globalframe; word var←c8148; (void) XR←DeclareGlobalFrame((word) "TiogaFileIOImpl", &globalframe, (word) XR←GetTypeIndexS((word) (&string1)), (word) ( ( (bPt) gf←c079)+80)/* var←c7860 */ ); var←c8148 = (word) XR←ImportInterface((word) "IO", (word) XR←GetTypeIndexS((word) (&string2)), 103); (* (( (ptr) gf←c079)+22)/* var←c7892 */ ) = var←c8148; (void) XR←ImportProcS(var←c8148, 67641090); (void) XR←ImportProcS(var←c8148, 1071364); (void) XR←ImportProcS(var←c8148, 67378689); (void) XR←ImportProcS(var←c8148, 67377409); (void) XR←ImportProcS(var←c8148, 67377921); (void) XR←ImportProcS(var←c8148, 528642); (void) XR←ImportProcS(var←c8148, 67372801); (void) XR←ImportProcS(var←c8148, 530946); var←c8148 = (word) XR←ExportInterface((word) "TiogaFileIO", (word) XR←GetTypeIndexS((word) (&string3)), 2); (* (( (ptr) gf←c079)+23)/* var←c8180 */ ) = var←c8148; (void) XR←ExportProcS(var←c8148, (word) (( (bPt) gf←c079)+24)/* var←c7636 */ , 470548483); (void) XR←ExportProcS(var←c8148, (word) (( (bPt) gf←c079)+16)/* var←c7604 */ , 67633410); } static void TiogaFileIOImpl←P0(formal←c014, formal←c013) word formal←c014; word formal←c013; { /* TiogaFileIOImpl: */ } static word GetFileId←P60(s←v3144, index←v3172) word s←v3144; word index←v3172; { register ptr gf←c8212 = (ptr) &globalframe; word id←v3216; /* GetFileId: */ SOURCE(787, 163) SOURCE(787, 163) id←v3216 = 0; SOURCE(861, 21) { word pd4; pd4 = (* (( (ptr) (* (( (ptr) gf←c8212)+22)/* var←c7892 */ ))+30) ); (void) ( *( (fPt) ((* (ptr) pd4 ))))(s←v3144, index←v3172, pd4); }; SOURCE(884, 66) { register word i←v4124 = 0; lab←L100003: ; SOURCE(921, 29) { word var←c7924; { word pd5; pd5 = (* (( (ptr) (* (( (ptr) gf←c8212)+22)/* var←c7892 */ ))+11) ); var←c7924 = (word) ( *( (fPt) ((* (ptr) pd5 ))))(s←v3144, pd5); }; (* (( (bPt) &id←v3216)+(i←v4124 + 2)) ) = var←c7924; }; if ((i←v4124 >= 1)) { goto lab←L100000; }; i←v4124 = (i←v4124 + 1); goto lab←L100003; lab←L100000: ; }; SOURCE(787, 163) return(id←v3216); } static void PutFileId←P120(s←v3276, id←v3304) word s←v3276; word id←v3304; { register ptr gf←c8244 = (ptr) &globalframe; /* PutFileId: */ SOURCE(956, 109) SOURCE(1000, 65) { register word i←v4168 = 0; lab←L100007: ; SOURCE(1037, 28) { word byte←v7556; byte←v7556 = (word) (* (( (bPt) &id←v3304)+(i←v4168 + 2)) ); { word pd6; pd6 = (* (( (ptr) (* (( (ptr) gf←c8244)+22)/* var←c7892 */ ))+21) ); (void) ( *( (fPt) ((* (ptr) pd6 ))))(s←v3276, byte←v7556, pd6); }; }; if ((i←v4168 >= 1)) { goto lab←L100004; }; i←v4168 = (i←v4168 + 1); goto lab←L100007; lab←L100004: ; }; } static word Get16←P180(s←v3364) word s←v3364; { register ptr gf←c8276 = (ptr) &globalframe; word var←c3408; word b0←v4212; word b1←v4240; /* Get16: */ SOURCE(1070, 117) SOURCE(1115, 24) { word pd7; pd7 = (* (( (ptr) (* (( (ptr) gf←c8276)+22)/* var←c7892 */ ))+11) ); b0←v4212 = (word) ( *( (fPt) ((* (ptr) pd7 ))))(s←v3364, pd7); }; SOURCE(1141, 24) { word pd8; pd8 = (* (( (ptr) (* (( (ptr) gf←c8276)+22)/* var←c7892 */ ))+11) ); b1←v4240 = (word) ( *( (fPt) ((* (ptr) pd8 ))))(s←v3364, pd8); }; SOURCE(1167, 20) return(((b0←v4212 << 8) + b1←v4240)); } static void Put16←P240(s←v3468, val←v3496) word s←v3468; word val←v3496; { register ptr gf←c8308 = (ptr) &globalframe; word b0←v4284; word b1←v4312; /* Put16: */ SOURCE(1193, 129) SOURCE(1234, 23) b0←v4284 = (val←v3496 >> 8); SOURCE(1259, 25) b1←v4312 = (val←v3496 & 0377); SOURCE(1286, 17) { word pd9; pd9 = (* (( (ptr) (* (( (ptr) gf←c8308)+22)/* var←c7892 */ ))+21) ); (void) ( *( (fPt) ((* (ptr) pd9 ))))(s←v3468, b0←v4284, pd9); }; SOURCE(1305, 17) { word pd10; pd10 = (* (( (ptr) (* (( (ptr) gf←c8308)+22)/* var←c7892 */ ))+21) ); (void) ( *( (fPt) ((* (ptr) pd10 ))))(s←v3468, b1←v4312, pd10); }; } static word GetTrailerLen←P300(s←v3556) word s←v3556; { word var←c3600; word h1←v4356; word h0←v4384; /* GetTrailerLen: */ SOURCE(1328, 148) SOURCE(1381, 21) h1←v4356 = (word) Get16←P180(s←v3556); SOURCE(1432, 21) h0←v4384 = (word) Get16←P180(s←v3556); SOURCE(1455, 21) return(((h0←v4384 << 16) + h1←v4356)); } static void PutTrailerLen←P360(s←v3660, len←v3688) word s←v3660; word len←v3688; { word h1←v4428; word h0←v4456; /* PutTrailerLen: */ SOURCE(1482, 161) SOURCE(1531, 28) h1←v4428 = ( (((unsigned)len←v3688 << 16) >> 16) ); SOURCE(1561, 26) h0←v4456 = (len←v3688 >> 16); SOURCE(1589, 12) (void) Put16←P240(s←v3660, h1←v4428); SOURCE(1631, 12) (void) Put16←P240(s←v3660, h0←v4456); } static void GetParts←P420(formal←c062, s←v3748, start←v3776, len←v3804) word formal←c062; word s←v3748; word start←v3776; word len←v3804; { register ptr gf←c8340 = (ptr) &globalframe; W7 var←c3848; word start1←v4500; word rem←v4528; word fileEnd←v4556; word dataLen←v4584; word commentLen←v4612; word controlLen←v4640; word propsLen←v4668; word fileLen←v4696; word end1←v4724; word commentStart←v4752; word start2←v4780; word end2←v4808; word controlStart←v4836; word start3←v4864; word propsStart←v4892; word controlTrailerStart←v4920; /* GetParts: */ SOURCE(1649, 2389) SOURCE(1737, 32) start1←v4500 = SGNCK(start←v3776); SOURCE(1787, 46) { word pd11; word idx12; pd11 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+31) ); rem←v4528 = ( idx12 = (word) ((word) ( *( (fPt) ((* (ptr) pd11 ))))(s←v3748, pd11) - start1←v4500), SGNCK(idx12) ); }; SOURCE(1835, 43) { word idx13; word x14; word idx15; fileEnd←v4556 = ( idx15 = (word) (start1←v4500 + (x14 = ( idx13 = (word) (MAX((int)(word), 0, len←v3804)), SGNCK(idx13) ), MIN( (unsigned) , rem←v4528, x14))), SGNCK(idx15) ); }; SOURCE(2034, 1692) SOURCE(2100, 111) if ((14 > (fileEnd←v4556 - start1←v4500))) { SOURCE(2148, 15) goto lab←L100009; } else { SOURCE(2163, 48) controlTrailerStart←v4920 = (fileEnd←v4556 - 14); }; SOURCE(2253, 215) if (((word) GetFileId←P60(s←v3748, controlTrailerStart←v4920) != 34199)) { SOURCE(2312, 15) goto lab←L100009; } else { SOURCE(2352, 27) propsLen←v4668 = (word) GetTrailerLen←P300(s←v3748); SOURCE(2381, 26) dataLen←v4584 = (word) GetTrailerLen←P300(s←v3748); SOURCE(2409, 26) fileLen←v4696 = (word) GetTrailerLen←P300(s←v3748); SOURCE(2437, 31) { word pd16; pd16 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+29) ); if (( (int)(word) ( *( (fPt) ((* (ptr) pd16 ))))(s←v3748, pd16) != (int)fileEnd←v4556)) { SOURCE(2468, 5) (void) XR←RaiseUnnamedError(); }; }; }; SOURCE(2478, 37) if ((fileLen←v4696 != (fileEnd←v4556 - start1←v4500))) { SOURCE(2515, 9) goto lab←L100009; }; SOURCE(2526, 106) if ((propsLen←v4668 > (controlTrailerStart←v4920 - start1←v4500))) { SOURCE(2576, 15) goto lab←L100009; } else { SOURCE(2591, 41) propsStart←v4892 = (controlTrailerStart←v4920 - propsLen←v4668); }; SOURCE(2665, 91) if ((dataLen←v4584 > (propsStart←v4892 - start1←v4500))) { SOURCE(2705, 15) goto lab←L100009; } else { SOURCE(2720, 36) { word var←c7956; var←c7956 = SGNCK((start1←v4500 + dataLen←v4584)); commentStart←v4752 = var←c7956; end1←v4724 = var←c7956; }; }; SOURCE(2795, 106) if (( (int)6 > (int)(propsStart←v4892 - commentStart←v4752))) { SOURCE(2847, 15) goto lab←L100009; } else { SOURCE(2862, 39) start2←v4780 = (commentStart←v4752 + 6); }; SOURCE(2934, 151) if (((word) GetFileId←P60(s←v3748, commentStart←v4752) != 0)) { SOURCE(2985, 15) goto lab←L100009; } else { SOURCE(3024, 29) commentLen←v4612 = (word) GetTrailerLen←P300(s←v3748); SOURCE(3055, 30) { word pd17; pd17 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+29) ); if (( (int)(word) ( *( (fPt) ((* (ptr) pd17 ))))(s←v3748, pd17) != (int)start2←v4780)) { SOURCE(3085, 5) (void) XR←RaiseUnnamedError(); }; }; }; SOURCE(3095, 161) if ((commentLen←v4612 < (start2←v4780 - commentStart←v4752))) { SOURCE(3136, 15) goto lab←L100009; } else { SOURCE(3151, 105) if ((commentLen←v4612 > (propsStart←v4892 - commentStart←v4752))) { SOURCE(3196, 15) goto lab←L100009; } else { SOURCE(3211, 45) { word var←c7988; var←c7988 = (commentStart←v4752 + commentLen←v4612); controlStart←v4836 = var←c7988; end2←v4808 = var←c7988; }; }; }; SOURCE(3295, 106) if (( (int)6 > (int)(propsStart←v4892 - controlStart←v4836))) { SOURCE(3347, 15) goto lab←L100009; } else { SOURCE(3362, 39) start3←v4864 = (controlStart←v4836 + 6); }; SOURCE(3434, 151) if (((word) GetFileId←P60(s←v3748, controlStart←v4836) != 40394)) { SOURCE(3485, 15) goto lab←L100009; } else { SOURCE(3524, 29) controlLen←v4640 = (word) GetTrailerLen←P300(s←v3748); SOURCE(3555, 30) { word pd18; pd18 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+29) ); if (( (int)(word) ( *( (fPt) ((* (ptr) pd18 ))))(s←v3748, pd18) != (int)start3←v4864)) { SOURCE(3585, 5) (void) XR←RaiseUnnamedError(); }; }; }; SOURCE(3595, 42) if ((controlLen←v4640 != (fileEnd←v4556 - controlStart←v4836))) { SOURCE(3637, 9) goto lab←L100009; }; goto lab←L100010; lab←L100009: ; SOURCE(3662, 62) XR←FillWords(&var←c3848, 7, 0); var←c3848.f1 = start1←v4500; var←c3848.f2 = (fileEnd←v4556 - start1←v4500); goto lab←L100008; lab←L100010: ; SOURCE(3729, 84) if (( (int)end1←v4724 > (int)start1←v4500)) { SOURCE(3751, 22) { word pd19; pd19 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+30) ); (void) ( *( (fPt) ((* (ptr) pd19 ))))(s←v3748, (end1←v4724 - 1), pd19); }; SOURCE(3775, 38) { word pd20; pd20 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+11) ); if (((word) ( *( (fPt) ((* (ptr) pd20 ))))(s←v3748, pd20) == 0)) { SOURCE(3799, 14) end1←v4724 = (end1←v4724 - 1); }; }; }; SOURCE(3816, 84) if (( (int)end2←v4808 > (int)start2←v4780)) { SOURCE(3838, 22) { word pd21; pd21 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+30) ); (void) ( *( (fPt) ((* (ptr) pd21 ))))(s←v3748, (end2←v4808 - 1), pd21); }; SOURCE(3862, 38) { word pd22; pd22 = (* (( (ptr) (* (( (ptr) gf←c8340)+22)/* var←c7892 */ ))+11) ); if (((word) ( *( (fPt) ((* (ptr) pd22 ))))(s←v3748, pd22) == 0)) { SOURCE(3886, 14) end2←v4808 = (end2←v4808 - 1); }; }; }; SOURCE(3903, 135) var←c3848.f0 = 1; var←c3848.f1 = start1←v4500; var←c3848.f2 = (end1←v4724 - start1←v4500); var←c3848.f3 = start2←v4780; var←c3848.f4 = (end2←v4808 - start2←v4780); var←c3848.f5 = start3←v4864; var←c3848.f6 = (propsStart←v4892 - start3←v4864); /* removed tail goto */ lab←L100008: ; (* (W7Pt) formal←c062 ) = var←c3848; return; } static word PutParts←P480(s←v3908, put←v3936) word s←v3908; word put←v3936; { register ptr gf←c8372 = (ptr) &globalframe; word var←c4096; word s2←v5004; word s3←v5032; word dataLen←v5060; word commentLen←v5088; word controlLen←v5116; word fileLen←v5144; word part2Len←v5172; word part3Len←v5200; word dataStart←v5256; word commentStart←v5284; word controlStart←v5312; /* PutParts: */ SOURCE(4044, 1298) SOURCE(4128, 21) { word pd23; pd23 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+34) ); s2←v5004 = (word) ( *( (fPt) ((* (ptr) pd23 ))))(0, pd23); }; SOURCE(4151, 21) { word pd24; pd24 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+34) ); s3←v5032 = (word) ( *( (fPt) ((* (ptr) pd24 ))))(0, pd24); }; SOURCE(4344, 26) { word pd25; pd25 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+29) ); dataStart←v5256 = (word) ( *( (fPt) ((* (ptr) pd25 ))))(s←v3908, pd25); }; SOURCE(4372, 14) (void) ( *( (fPt) ((* (ptr) put←v3936 ))))(s←v3908, s2←v5004, s3←v5032, put←v3936); SOURCE(4388, 162) lab←L100013: ; SOURCE(4431, 29) { word pd26; pd26 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+29) ); commentStart←v5284 = (word) ( *( (fPt) ((* (ptr) pd26 ))))(s←v3908, pd26); }; SOURCE(4462, 38) dataLen←v5060 = (commentStart←v5284 - dataStart←v5256); SOURCE(4502, 48) if (((dataLen←v5060 & 1) != 0)) { SOURCE(4528, 22) { word pd27; pd27 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+21) ); (void) ( *( (fPt) ((* (ptr) pd27 ))))(s←v3908, 0, pd27); }; } else { SOURCE(4550, 4) goto lab←L100012; }; goto lab←L100013; lab←L100012: ; SOURCE(4566, 165) lab←L100016: ; SOURCE(4609, 27) { word pd28; word idx29; pd28 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+31) ); part2Len←v5172 = ( idx29 = (word) ( *( (fPt) ((* (ptr) pd28 ))))(s2←v5004, pd28), SGNCK(idx29) ); }; SOURCE(4638, 39) commentLen←v5088 = (part2Len←v5172 + 6); SOURCE(4679, 52) if (((commentLen←v5088 & 1) != 0)) { SOURCE(4708, 23) { word pd30; pd30 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+21) ); (void) ( *( (fPt) ((* (ptr) pd30 ))))(s2←v5004, 0, pd30); }; } else { SOURCE(4731, 4) goto lab←L100015; }; goto lab←L100016; lab←L100015: ; SOURCE(4746, 29) (void) PutFileId←P120(s←v3908, 0); SOURCE(4777, 28) (void) PutTrailerLen←P360(s←v3908, commentLen←v5088); SOURCE(4807, 33) { word var←c8084; { word pd31; pd31 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+35) ); var←c8084 = (word) ( *( (fPt) ((* (ptr) pd31 ))))(s2←v5004, 1, pd31); }; { word pd32; pd32 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+93) ); (void) ( *( (fPt) ((* (ptr) pd32 ))))(s←v3908, var←c8084, 0, 2147483647, pd32); }; }; SOURCE(4842, 29) { word pd33; pd33 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+29) ); controlStart←v5312 = (word) ( *( (fPt) ((* (ptr) pd33 ))))(s←v3908, pd33); }; SOURCE(4873, 51) if (((controlStart←v5312 - commentStart←v5284) != commentLen←v5088)) { SOURCE(4924, 5) (void) XR←RaiseUnnamedError(); }; SOURCE(4932, 27) { word pd34; word idx35; pd34 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+31) ); part3Len←v5200 = ( idx35 = (word) ( *( (fPt) ((* (ptr) pd34 ))))(s3←v5032, pd34), SGNCK(idx35) ); }; SOURCE(4961, 67) controlLen←v5116 = (part3Len←v5200 + 20); SOURCE(5030, 29) (void) PutFileId←P120(s←v3908, 40394); SOURCE(5061, 28) (void) PutTrailerLen←P360(s←v3908, controlLen←v5116); SOURCE(5091, 33) { word var←c8116; { word pd36; pd36 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+35) ); var←c8116 = (word) ( *( (fPt) ((* (ptr) pd36 ))))(s3←v5032, 1, pd36); }; { word pd37; pd37 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+93) ); (void) ( *( (fPt) ((* (ptr) pd37 ))))(s←v3908, var←c8116, 0, 2147483647, pd37); }; }; SOURCE(5126, 30) (void) PutFileId←P120(s←v3908, 34199); SOURCE(5158, 26) (void) PutTrailerLen←P360(s←v3908, 0); SOURCE(5186, 25) (void) PutTrailerLen←P360(s←v3908, dataLen←v5060); SOURCE(5213, 57) { word var←c086; fileLen←v5144 = ((dataLen←v5060 + commentLen←v5088) + controlLen←v5116); var←c086 = fileLen←v5144; (void) PutTrailerLen←P360(s←v3908, var←c086); }; SOURCE(5272, 47) { word pd38; pd38 = (* (( (ptr) (* (( (ptr) gf←c8372)+22)/* var←c7892 */ ))+29) ); if ((((word) ( *( (fPt) ((* (ptr) pd38 ))))(s←v3908, pd38) - dataStart←v5256) != fileLen←v5144)) { SOURCE(5319, 5) (void) XR←RaiseUnnamedError(); }; }; SOURCE(5327, 15) return(SGNCK(dataLen←v5060)); } /* file: TiogaFileIOImpl, module: TiogaFileIOImpl, compiled at: February 21, 1992 9:37:29 pm PST */ extern void XR←install←TiogaFileIOImpl() { NoName←Q804(); } extern void XR←run←TiogaFileIOImpl() { XR←Start(&globalframe); }