/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1992 by Xerox Corporation.  All rights reserved. */
/* time: February 21, 1992 11:09:26 pm PST */
/* C2C version: October 16, 1990 (native) */
/* ref-counting: off */
/* file: RopeFileStreamImpl, module: RopeFileStreamImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [1564014747,399322368] RopeFileStreamImpl";
typedef unsigned word, *ptr;
typedef unsigned char byte, *bPt;
typedef unsigned short half, *hPt;
typedef word (*fPt)();
typedef struct {word f0, f1, f2;} W3;
typedef struct {word f0, f1, f2, f3, f4, f5, f6, f7;} W8;
typedef struct {word f0, f1;} W2;
typedef struct {W8 f; W2 r;} W10;
typedef W3 *W3Pt;
#define SOURCE(p, l) /* source p, l */
#define SGNCK(i) ((int) (word) (i) < 0 ? XR←RaiseArithmeticFault(): i )
static void NoName←Q516();
static void RopeFileStreamImpl←P0();
static word StreamDeactivate←P60();
static word StreamEqual←P120();
static void StreamDescribe←P180();
static word StreamMove←P240();
static word NoName←Q576();
static word ByteSequenceObjectFromStream←P300();
static word FromStream←P360();
static void NoName←Q636();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\135\070\370\233\300\027\315\055\000\100\214\000\000"};
static struct {unsigned f; char r[4];} string2 = {131074, "\004\007\000"};
static struct {unsigned f; char r[16];} string3 = {917520, "\216\257\300\363\223\326\161\300\017\164\046\072\104\350\000"};
static struct {unsigned f; char r[4];} string4 = {65537, "\001\000\000"};
static struct {unsigned f; char r[8];} string5 = {458760, "<anon: "};
static struct {unsigned f; char r[4];} string6 = {65540, ">\000\000"};
static struct {unsigned f; char r[4];} string7 = {131076, "??\000"};
static struct {unsigned f; char r[16];} string8 = {851984, "\257\300\135\070\370\233\300\027\315\055\000\100\200\000\000"};
static struct {unsigned f; char r[4];} string9 = {196611, "\004G\000"};
static struct {unsigned f; char r[16];} string10 = {851984, "\257\300\255\053\300\023\300\142\135\315\105\100\150\000\000"};
static struct {unsigned f; char r[16];} string11 = {851984, "\257\300\015\277\004\146\300\034\367\146\045\100\164\000\000"};
static struct {unsigned f; char r[16];} string12 = {851984, "\257\300\363\223\326\161\300\017\164\046\072\100\150\000\000"};
static struct {unsigned f; char r[8];} string13 = {1383034981, "File"};
static struct {unsigned f; char r[16];} string14 = {851984, "\257\300\262\334\125\203\300\272\176\356\230\100\150\000\000"};
static struct {
   word f0[11]; word f11; word f12; word f13; 
   word f14; word f15; word f16; word f17; 
   word f18; word f19; word f20; word f21; 
   word f22; word f23; word f24[6]; 
   } globalframe = {
   {0}, (word) FromStream←P360, 0, (word) ByteSequenceObjectFromStream←P300, 
   0, (word) StreamMove←P240, 0, (word) StreamDescribe←P180, 
   0, (word) StreamEqual←P120, 0, (word) StreamDeactivate←P60, 
   0, (word) RopeFileStreamImpl←P0, {0}
   };

static void NoName←Q516()
   {
   register ptr gf←c057 =  (ptr) &globalframe;
   word var←c10628;
   (* (( (ptr) gf←c057)+4) ) = (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2);
   (* (( (ptr) gf←c057)+6) ) = (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4);
   (*  (ptr) (( (bPt) gf←c057)+32) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c057)+6) ), (word) &string5);
   (*  (ptr) (( (bPt) gf←c057)+36) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c057)+6) ), (word) &string6);
   (*  (ptr) (( (bPt) gf←c057)+40) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c057)+6) ), (word) &string7);
   (void) XR←DeclareGlobalFrame((word) "RopeFileStreamImpl", &globalframe, (word) XR←GetTypeIndex((word) &string8, 0, (word) &string9)
      , (word) (( (bPt) gf←c057)+92)/* var←c10244 */ );
   var←c10628 = (word) XR←ImportInterface((word) "Convert", (word) XR←GetTypeIndexS((word) (&string10)), 73);
   (* (( (ptr) gf←c057)+26)/* var←c10500 */  ) = var←c10628;
   (void) XR←ImportProcS(var←c10628, 67641858);
   var←c10628 = (word) XR←ImportInterface((word) "IO", (word) XR←GetTypeIndexS((word) (&string11)), 103);
   (* (( (ptr) gf←c057)+25)/* var←c10276 */  ) = var←c10628;
   (void) XR←ImportProcS(var←c10628, 67917827);
   (void) XR←ImportProcS(var←c10628, 67377921);
   (void) XR←ImportProcS(var←c10628, 68160002);
   (void) XR←ImportProcS(var←c10628, 530946);
   (void) XR←ImportProcS(var←c10628, 530434);
   var←c10628 = (word) XR←ImportInterface((word) "Rope", (word) XR←GetTypeIndexS((word) (&string12)), 43);
   (* (( (ptr) gf←c057)+27)/* var←c10532 */  ) = var←c10628;
   (void) XR←ImportProcS(var←c10628, 68419845);
   var←c10628 = (word) XR←ImportInterface((word) &string13, (word) XR←GetTypeIndexS((word) (&string14)), 7);
   (* (( (ptr) gf←c057)+28)/* var←c10596 */  ) = var←c10628;
   (void) XR←ImportProcS(var←c10628, 67633666);
   (void) XR←ImportProcS(var←c10628, 68681734);
   var←c10628 = (word) XR←ExportInterface((word) &string13, (word) XR←GetTypeIndexS((word) (&string14)), 7);
   (* (( (ptr) gf←c057)+29)/* var←c10660 */  ) = var←c10628;
   (void) XR←ExportProcS(var←c10628, (word) (( (bPt) gf←c057)+44)/* var←c10052 */ , 68158212);
   (void) XR←ExportProcS(var←c10628, (word) (( (bPt) gf←c057)+52)/* var←c10084 */ , 67372033);
   }

static void RopeFileStreamImpl←P0(formal←c017, formal←c016)
   word formal←c017;
   word formal←c016;
   {
   /* RopeFileStreamImpl: */ 
   }

static word StreamDeactivate←P60(self←v3136, final←v3164)
   word self←v3136;
   word final←v3164;
   {
   register ptr gf←c10692 =  (ptr) &globalframe;
   word var←c3208;
   word data←v3980;
   /* StreamDeactivate: */ 
SOURCE(424, 271)
   (void) (XR←MonitorEntry(self←v3136));
SOURCE(524, 30)
   data←v3980 = XR←Narrow((* (( (ptr) self←v3136)+5) ), (* (( (ptr) gf←c10692)+4) ));
SOURCE(556, 50)
   if (((*  (ptr) data←v3980 ) == 0)) {
SOURCE(582, 24)
      (void) (XR←MonitorExit(self←v3136));
      return(2);
      };
SOURCE(608, 70)
   if ((0 != final←v3164)) {
SOURCE(624, 21)
      {
         word pd15;
         pd15 = (* (( (ptr) (* (( (ptr) gf←c10692)+25)/* var←c10276 */  ))+28) );
         (void) ( *( (fPt) ((*  (ptr) pd15 ))))((*  (ptr) data←v3980 ), 0, pd15);
         };
SOURCE(647, 17)
      (*  (ptr) data←v3980 ) = 0;
SOURCE(666, 12)
      (void) (XR←MonitorExit(self←v3136));
      return(0);
      };
SOURCE(681, 14)
   (void) (XR←MonitorExit(self←v3136));
   return(1);
   }

static word StreamEqual←P120(self←v3268, other←v3296)
   word self←v3268;
   word other←v3296;
   {
   register ptr gf←c10724 =  (ptr) &globalframe;
   word var←c3340;
   word data←v4024;
   /* StreamEqual: */ 
SOURCE(699, 124)
   (void) (XR←MonitorEntry(self←v3268));
SOURCE(776, 30)
   data←v4024 = XR←Narrow((* (( (ptr) self←v3268)+5) ), (* (( (ptr) gf←c10724)+4) ));
SOURCE(808, 15)
   (void) (XR←MonitorExit(self←v3268));
   return(0);
   }

static void StreamDescribe←P180(formal←c034, self←v3400)
   word formal←c034;
   word self←v3400;
   {
   register ptr gf←c10756 =  (ptr) &globalframe;
   word fileName←v3444;
   word created←v3472;
   word open←v3500;
   word data←v4068;
   /* StreamDescribe: */ 
SOURCE(827, 221)
   (void) (XR←MonitorEntry(self←v3400));
SOURCE(827, 221)
   fileName←v3444 = 0;
SOURCE(827, 221)
   created←v3472 = 0;
SOURCE(937, 30)
   data←v4068 = XR←Narrow((* (( (ptr) self←v3400)+5) ), (* (( (ptr) gf←c10756)+4) ));
SOURCE(969, 79)
   fileName←v3444 = (* (( (ptr) data←v4068)+1) );
   created←v3472 = (* (( (ptr) data←v4068)+2) );
   open←v3500 = ((*  (ptr) data←v4068 ) != 0);
   /* removed tail goto */ 
   (void) (XR←MonitorExit(self←v3400));
   (*  (ptr) formal←c034 ) = fileName←v3444;
   (* (( (ptr) formal←c034)+1) ) = created←v3472;
   (* (( (ptr) formal←c034)+2) ) = open←v3500;
   return;
   }

static word StreamMove←P240(formal←c068, formal←c069, formal←c070)
   word formal←c068;
   W3 formal←c069;
   word formal←c070;
   {
   W10 var←c10788;
   /* declaration of self←v3560 skipped */ 
   /* declaration of block←v3588 skipped */ 
   /* declaration of start←v3616 skipped */ 
   /* declaration of charsMoved←v3660 skipped */ 
   (* (( (ptr) &var←c10788)+4)/* self←v3560 */  ) = formal←c068;
   (*  (W3Pt) (( (ptr) &var←c10788)+5)/* block←v3588 */  ) = formal←c069;
   (* (( (ptr) &var←c10788)+8)/* start←v3616 */  ) = formal←c070;
   /* StreamMove: */ 
SOURCE(1052, 306)
   (void) (XR←MonitorEntry(* (( (ptr) &var←c10788)+4)/* self←v3560 */  ));
SOURCE(1052, 306)
   (* (( (ptr) &var←c10788)+9)/* charsMoved←v3660 */  ) = 0;
SOURCE(1192, 166)
   {
      word var←c065;
      var←c065 = (word) &var←c10788;
       (void) (word) XR←Enable(( ((word)  (fPt) NoName←Q576) ), ( ((word)  (fPt) NoName←Q636) ), var←c065);
      };
SOURCE(1052, 306)
   (void) (XR←MonitorExit(* (( (ptr) &var←c10788)+4)/* self←v3560 */  ));
   return((* (( (ptr) &var←c10788)+9)/* charsMoved←v3660 */  ));
   }

static word NoName←Q576(formal←c062)
   word formal←c062;
   {
   register ptr gf←c061 =  (ptr) &globalframe;
SOURCE(1215, 30)
   {
      word data←v4112;
SOURCE(1215, 30)
      data←v4112 = XR←Narrow((* (( (ptr) (* (( (ptr) formal←c062)+4) ))+5) ), (* (( (ptr) gf←c061)+4) ));
SOURCE(1247, 111)
      if (((*  (ptr) data←v4112 ) != 0)) {
SOURCE(1275, 31)
         {
            word pd16;
            pd16 = (* (( (ptr) (* (( (ptr) gf←c061)+25)/* var←c10276 */  ))+30) );
            (void) ( *( (fPt) ((*  (ptr) pd16 ))))((*  (ptr) data←v4112 ), (* (( (ptr) formal←c062)+8) ), pd16);
            };
SOURCE(1308, 50)
         {
            word pd17;
            pd17 = (* (( (ptr) (* (( (ptr) gf←c061)+25)/* var←c10276 */  ))+14) );
            (* (( (ptr) formal←c062)+9) ) = (word) ( *( (fPt) ((*  (ptr) pd17 ))))((*  (ptr) data←v4112 ), (*  (W3Pt) (( (ptr) formal←c062)+5)
                ), pd17);
            };
         };
      };
   return(0);
   }

static word ByteSequenceObjectFromStream←P300(stream←v3720)
   word stream←v3720;
   {
   register ptr gf←c10820 =  (ptr) &globalframe;
   word var←c3764;
   word length←v4156;
   word data←v4184;
   /* ByteSequenceObjectFromStream: */ 
SOURCE(1367, 547)
SOURCE(1462, 34)
   {
      word pd18;
      pd18 = (* (( (ptr) (* (( (ptr) gf←c10820)+25)/* var←c10276 */  ))+31) );
      length←v4156 = (word) ( *( (fPt) ((*  (ptr) pd18 ))))(stream←v3720, pd18);
      };
SOURCE(1498, 74)
   data←v4184 = XR←NewObject(12, (* (( (ptr) gf←c10820)+4) ));
   (*  (ptr) data←v4184 ) = stream←v3720;
   (* (( (ptr) data←v4184)+2) ) = (* (( (ptr) gf←c10820)+10) );
SOURCE(1574, 22)
   {
      word pd19;
      pd19 = (* (( (ptr) (* (( (ptr) gf←c10820)+25)/* var←c10276 */  ))+30) );
      (void) ( *( (fPt) ((*  (ptr) pd19 ))))(stream←v3720, 0, pd19);
      };
SOURCE(1648, 100)
   {
      word var←c10436;
      {
         word var←c10468;
         {
            word pd20;
            pd20 = (* (( (ptr) (* (( (ptr) gf←c10820)+25)/* var←c10276 */  ))+92) );
            var←c10468 = (word) ( *( (fPt) ((*  (ptr) pd20 ))))(stream←v3720, 30, 0, pd20);
            };
         {
            word pd21;
            pd21 = (* (( (ptr) (* (( (ptr) gf←c10820)+26)/* var←c10500 */  ))+38) );
            var←c10436 = (word) ( *( (fPt) ((*  (ptr) pd21 ))))(var←c10468, 0, pd21);
            };
         };
      {
         word pd22;
         pd22 = (* (( (ptr) (* (( (ptr) gf←c10820)+27)/* var←c10532 */  ))+5) );
         (* (( (ptr) data←v4184)+1) ) = (word) ( *( (fPt) ((*  (ptr) pd22 ))))((* (( (ptr) gf←c10820)+8) ), var←c10436, (* (( (ptr) gf←c10820)+9)
             ), 0, 0, pd22);
         };
      };
SOURCE(1750, 164)
   {
      word pd23;
      pd23 = (* (( (ptr) (* (( (ptr) gf←c10820)+28)/* var←c10596 */  ))+4) );
      return((word) ( *( (fPt) ((*  (ptr) pd23 ))))(SGNCK(length←v4156), data←v4184, (word) (( (bPt) gf←c10820)+76)/* var←c10180 */ , (word) (
            ( (bPt) gf←c10820)+84)/* var←c10212 */ , (word) (( (bPt) gf←c10820)+68)/* var←c10148 */ , (word) (( (bPt) gf←c10820)+60)/* var←c10116 */ , pd23)
      );
      };
   }

static word FromStream←P360(stream←v3824, start←v3852, len←v3880, flatten←v3908)
   word stream←v3824;
   word start←v3852;
   word len←v3880;
   word flatten←v3908;
   {
   register ptr gf←c10852 =  (ptr) &globalframe;
   word rope←v3952;
   /* FromStream: */ 
SOURCE(1920, 379)
SOURCE(1920, 379)
   rope←v3952 = 0;
SOURCE(2050, 249)
   if ((0 != flatten←v3908)) {
SOURCE(2068, 26)
      {
         word pd24;
         pd24 = (* (( (ptr) (* (( (ptr) gf←c10852)+25)/* var←c10276 */  ))+30) );
         (void) ( *( (fPt) ((*  (ptr) pd24 ))))(stream←v3824, start←v3852, pd24);
         };
SOURCE(2096, 37)
      {
         word pd25;
         pd25 = (* (( (ptr) (* (( (ptr) gf←c10852)+25)/* var←c10276 */  ))+92) );
         rope←v3952 = (word) ( *( (fPt) ((*  (ptr) pd25 ))))(stream←v3824, len←v3880, 0, pd25);
         };
SOURCE(2135, 16)
      {
         word pd26;
         pd26 = (* (( (ptr) (* (( (ptr) gf←c10852)+25)/* var←c10276 */  ))+28) );
         (void) ( *( (fPt) ((*  (ptr) pd26 ))))(stream←v3824, 0, pd26);
         };
      }
   else {
SOURCE(2160, 141)
      {
         word byteSequenceObject←v4228;
SOURCE(2162, 77)
         byteSequenceObject←v4228 = (word) ByteSequenceObjectFromStream←P300(stream←v3824);
SOURCE(2241, 58)
         {
            word pd27;
            pd27 = (* (( (ptr) (* (( (ptr) gf←c10852)+28)/* var←c10596 */  ))+6) );
            rope←v3952 = (word) ( *( (fPt) ((*  (ptr) pd27 ))))(byteSequenceObject←v4228, 0, pd27);
            };
         };
      };
SOURCE(1920, 379)
   return(rope←v3952);
   }

static void NoName←Q636(formal←c056, formal←c200000, formal←c200001, formal←c200002, formal←c200003)
   word formal←c056;
   word formal←c200000;
   word formal←c200001;
   word formal←c200002;
   word formal←c200003;
   {
   if ((formal←c200001 == XR←Unwind)) {
      (void) (XR←MonitorExit(* (( (ptr) formal←c200000)+4) ));
      };
   (*  (ptr) formal←c056 ) = 0;
   (* (( (ptr) formal←c056)+1) ) = 0;
   return;
   }

/* file: RopeFileStreamImpl, module: RopeFileStreamImpl, compiled at: February 21, 1992 11:09:26 pm PST */ 
extern void XR←install←RopeFileStreamImpl() {
   NoName←Q516();
   }
extern void XR←run←RopeFileStreamImpl() { XR←Start(&globalframe); }