/* Generated with C2C (Cedar To C)*/
/* Copyright (C) 1993 by Xerox Corporation.  All rights reserved. */
/* time: January 26, 1993 3:31:51 pm PST */
/* C2C version: October 7, 1992 (native) */
/* ref-counting: off */
/* file: CommanderOnStandardStreamsImpl, module: CommanderOnStandardStreamsImpl */ 
/* switches: bcfhklnouw */ 
#include <cedar/InstallationSupport.h>
#include <cedar/CedarExtra.h>
static char versionStamp[] = "@(#)mob←version [1073670562,2656242597] CommanderOnStandardStreamsImpl";
typedef unsigned word, *ptr;
typedef unsigned char byte, *bPt;
typedef unsigned short half, *hPt;
typedef struct {word f0, f1, f2, f3, f4, f5, f6, f7;} W8;
typedef struct {word f0, f1;} W2;
typedef word (*fPt)();
#define SOURCE(p, l) /* source p, l */
static void NoName←Q288();
static void CommanderOnStandardStreamsImpl←P0();
static void RunCommander←P60();
static void Inner←P180();
static word GetEnv←P120();
static struct {unsigned f; char r[16];} string1 = {851984, "\257\300\363\223\326\161\300\017\164\046\072\104\304\000\000"};
static struct {unsigned f; char r[24];} string2 = {1376277, "\007\000\001\002\007\020\001\002\000\007\036\002\004\003\002\004\014\016\015\003\001\000\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[48];} string5 = {2883632, "\260\006\005\146\151\162\163\164\216\257\300\055\153\222\376\300\327\164\352\142\100\200\005\004\162\145\163\164\214\216\257\300\055\153\222\376\300\327\164\352\142\100\200\261\000\000\000"};
static struct {unsigned f; char r[4];} string6 = {131074, "\004\003\000"};
static struct {unsigned f; char r[16];} string7 = {851984, "\257\300\055\153\222\376\300\327\164\352\142\100\200\000\000"};
static struct {unsigned f; char r[44];} string8 = {2818092, "\216\260\007\006\154\145\156\147\164\150\210\241\000\200\177\377\005\004\164\145\170\164\254\206\012\011\155\141\170\114\145\156\147\164\150\210\241\000\200\177\377\243\261"};
static struct {unsigned f; char r[4];} string9 = {131076, "\216\251\000"};
static struct {unsigned f; char r[4];} string10 = {4, "\000\000\000"};
static struct {unsigned f; char r[8];} string11 = {458760, "Failure"};
static struct {unsigned f; char r[4];} string12 = {65540, "\012\000\000"};
static struct {unsigned f; char r[32];} string13 = {1835040, "[[COMMANDER←INITIAL←COMMAND=\000\000\000"};
static struct {unsigned f; char r[4];} string14 = {196612, "]]\012"};
static struct {unsigned f; char r[28];} string15 = {1638428, "COMMANDER←INITIAL←PERSIST\000\000"};
static struct {unsigned f; char r[28];} string16 = {1703964, "CommanderOnStandardStreams\000"};
static struct {unsigned f; char r[12];} string17 = {524300, "DontExit\000\000\000"};
static struct {unsigned f; char r[28];} string18 = {1769500, " Exiting Initial Commander\012"};
static struct {unsigned f; char r[28];} string19 = {1572892, " (some commands failed)\012\000\000\000"};
static struct {unsigned f; char r[28];} string20 = {1638428, "COMMANDER←INITIAL←COMMAND\000\000"};
static struct {unsigned f; char r[16];} string21 = {851984, "\257\300\077\376\351\242\300\236\123\013\245\100\164\000\000"};
static struct {unsigned f; char r[8];} string22 = {393222, "\006\0018\004O\377\000"};
static struct {unsigned f; char r[16];} string23 = {851984, "\257\300\055\153\222\376\300\327\164\352\142\100\150\000\000"};
static struct {unsigned f; char r[16];} string24 = {851984, "\257\300\311\235\133\064\300\165\175\234\175\100\150\000\000"};
static struct {unsigned f; char r[16];} string25 = {851984, "\257\300\015\277\004\146\300\034\367\146\045\100\164\000\000"};
static struct {unsigned f; char r[16];} string26 = {851984, "\257\300\363\223\326\161\300\017\164\046\072\100\150\000\000"};
static struct {unsigned f; char r[16];} string27 = {851984, "\257\300\240\236\274\315\300\111\163\325\023\100\150\000\000"};
static struct {unsigned f; char r[16];} string28 = {851984, "\257\300\314\116\377\204\300\167\024\373\125\100\150\000\000"};
static struct {unsigned f; char r[16];} string29 = {851984, "\257\300\241\235\001\025\300\065\011\226\172\100\150\000\000"};
static struct {
   word f0[4]; word f4; word f5[21]; word f26; 
   word f27; word f28; word f29; word f30; 
   word f31[8]; 
   } globalframe = {
   {0}, (word) 1, {0}, (word) GetEnv←P120, 
   0, (word) RunCommander←P60, 0, (word) CommanderOnStandardStreamsImpl←P0, 
   {0}
   };

static void NoName←Q288()
   {
   register ptr gf←c039 =  (ptr) &globalframe;
   word var←c9828;
   (* (( (ptr) gf←c039)+5) ) = (word) XR←GetTypeIndex((word) &string1, 0, (word) &string2);
   (* (( (ptr) gf←c039)+6) ) = (word) XR←GetTypeIndex((word) &string3, 0, (word) &string4);
   (* (( (ptr) gf←c039)+9) ) = (word) XR←GetTypeIndex((word) &string5, 0, (word) &string6);
   (* (( (ptr) gf←c039)+10) ) = (word) XR←GetTypeIndex((word) &string7, 0, (word) &string6);
   (* (( (ptr) gf←c039)+12) ) = (word) XR←GetTypeIndex((word) &string8, 0, (word) &string4);
   (* (( (ptr) gf←c039)+13) ) = (word) XR←GetTypeIndex((word) &string9, 0, (word) &string4);
   (*  (ptr) (( (bPt) gf←c039)+56) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+12) ), (word) &string10);
   (*  (ptr) (( (bPt) gf←c039)+60) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+13) ), (word) &string11);
   (*  (ptr) (( (bPt) gf←c039)+64) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string10);
   (*  (ptr) (( (bPt) gf←c039)+68) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string12);
   (*  (ptr) (( (bPt) gf←c039)+72) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string13);
   (*  (ptr) (( (bPt) gf←c039)+76) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string14);
   (*  (ptr) (( (bPt) gf←c039)+80) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string15);
   (*  (ptr) (( (bPt) gf←c039)+84) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+13) ), (word) &string16);
   (*  (ptr) (( (bPt) gf←c039)+88) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+13) ), (word) &string17);
   (*  (ptr) (( (bPt) gf←c039)+92) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string18);
   (*  (ptr) (( (bPt) gf←c039)+96) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string19);
   (*  (ptr) (( (bPt) gf←c039)+100) ) = (word) XR←GetRefLiteral((* (( (ptr) gf←c039)+6) ), (word) &string20);
   (void) XR←DeclareGlobalFrame((word) "CommanderOnStandardStreamsImpl", &globalframe, (word) XR←GetTypeIndex((word) &string21, 0, (word) &string22)
      , (word) (( (bPt) gf←c039)+120)/* var←c9188 */ );
   var←c9828 = (word) XR←ImportInterface((word) "Atom", (word) XR←GetTypeIndexS((word) (&string23)), 16);
   (* (( (ptr) gf←c039)+37)/* var←c9700 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 67895555);
   (void) XR←ImportProcS(var←c9828, 67634946);
   var←c9828 = (word) XR←ImportInterface((word) "CommanderOps", (word) XR←GetTypeIndexS((word) (&string24)), 14);
   (* (( (ptr) gf←c039)+33)/* var←c9348 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 67635970);
   (void) XR←ImportProcS(var←c9828, 67374337);
   (void) XR←ImportProcS(var←c9828, 134744322);
   (void) XR←ImportProcS(var←c9828, 68160516);
   var←c9828 = (word) XR←ImportInterface((word) "IO", (word) XR←GetTypeIndexS((word) (&string25)), 103);
   (* (( (ptr) gf←c039)+35)/* var←c9604 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 1071364);
   var←c9828 = (word) XR←ImportInterface((word) "Rope", (word) XR←GetTypeIndexS((word) (&string26)), 43);
   (* (( (ptr) gf←c039)+36)/* var←c9668 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 67373825);
   var←c9828 = (word) XR←ImportInterface((word) "Process", (word) XR←GetTypeIndexS((word) (&string27)), 22);
   (* (( (ptr) gf←c039)+38)/* var←c9732 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 266497);
   var←c9828 = (word) XR←ImportInterface((word) "ProcessProps", (word) XR←GetTypeIndexS((word) (&string28)), 6);
   (* (( (ptr) gf←c039)+34)/* var←c9540 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 524290);
   var←c9828 = (word) XR←ImportInterface((word) "UXIO", (word) XR←GetTypeIndexS((word) (&string29)), 7);
   (* (( (ptr) gf←c039)+32)/* var←c9284 */  ) = var←c9828;
   (void) XR←ImportProcS(var←c9828, 67371009);
   }

static void CommanderOnStandardStreamsImpl←P0(formal←c016, formal←c015)
   word formal←c016;
   word formal←c015;
   {
   /* CommanderOnStandardStreamsImpl: */ 
SOURCE(82, 1570)
   /* moved to installation proc */ 
SOURCE(1638, 14)
   (void) RunCommander←P60();
   }

static void RunCommander←P60()
   {
   W8 var←c9860;
   register ptr gf←c9892 =  (ptr) &globalframe;
   /* declaration of var←c9220 skipped */ 
   /* declaration of cmd←v3084 skipped */ 
   /* declaration of initial←v3140 skipped */ 
   /* RunCommander: */ 
SOURCE(252, 1129)
   {
      word tmpAddr30;
      tmpAddr30 = (word) (( (ptr) &var←c9860)+4)/* var←c9220 */ ;
      (*  (ptr) tmpAddr30 ) = ( ((word)  (fPt) Inner←P180) );
      (* (( (ptr) tmpAddr30) + 1) ) = 1;
      };
SOURCE(275, 133)
   {
      word var←c9252;
      word var←c9316;
      {
         word pd31;
         pd31 = (* (( (ptr) (* (( (ptr) gf←c9892)+32)/* var←c9284 */  ))+4) );
         var←c9252 = (word) ( *( (fPt) ((*  (ptr) pd31 ))))(0, pd31);
         };
      {
         word pd32;
         pd32 = (* (( (ptr) (* (( (ptr) gf←c9892)+32)/* var←c9284 */  ))+4) );
         var←c9316 = (word) ( *( (fPt) ((*  (ptr) pd32 ))))(1, pd32);
         };
      {
         word pd33;
         pd33 = (* (( (ptr) (* (( (ptr) gf←c9892)+33)/* var←c9348 */  ))+16) );
         var←c9860.f6/* cmd←v3084 */  = (word) ( *( (fPt) ((*  (ptr) pd33 ))))(var←c9252, var←c9316, 0, 0, pd33);
         };
      };
SOURCE(1205, 82)
   var←c9860.f7/* initial←v3140 */  =  ( (0 != (* (( (ptr) gf←c9892)+4)/* firstTime←v2832 */  )) ? (word) GetEnv←P120(var←c9860.f6/* cmd←v3084 */ , (* (
         ( (ptr) gf←c9892)+25) )) : (* (( (ptr) gf←c9892)+16) ) ) ;
SOURCE(1289, 17)
   (* (( (ptr) gf←c9892)+4)/* firstTime←v2832 */  ) = 0;
SOURCE(1308, 73)
   {
      word var←c9380;
      {
         word var←c9412;
         word var←c9444;
         var←c9412 = XR←NewObject(8, (* (( (ptr) gf←c9892)+9) ));
         var←c9444 = var←c9412;
         {
            word var←c9508;
            var←c9508 = XR←NewObject(8, (* (( (ptr) gf←c9892)+10) ));
            (*  (ptr) var←c9508 ) = (* (( (ptr) gf←c9892)+14) );
            (* (( (ptr) var←c9508)+1) ) = (* (( (ptr) gf←c9892)+14) );
            (*  (ptr) var←c9444 ) = var←c9508;
            };
         var←c9380 = var←c9412;
         };
      {
         word pd34;
         pd34 = (* (( (ptr) (* (( (ptr) gf←c9892)+34)/* var←c9540 */  ))+4) );
         (void) ( *( (fPt) ((*  (ptr) pd34 ))))(var←c9380, (word) (( (bPt) &var←c9860)+16)/* var←c9220 */ , pd34);
         };
      };
   }

static void Inner←P180(formal←c9956)
   word formal←c9956;
   {
   register ptr gf←c9924 =  (ptr) &globalframe;
   word result←v3200;
   word msg←v3228 = 0;
   word hadFailure←v3256 = 0;
   word persist←v3284 = 0;
   word var←c9636;
   formal←c9956 = (formal←c9956 - 16);
   /* Inner: */ 
SOURCE(410, 790)
SOURCE(426, 22)
   result←v3200 = (* (( (ptr) gf←c9924)+15) );
SOURCE(516, 94)
   if (((* (( (ptr) formal←c9956)+7) ) != 0)) {
SOURCE(540, 70)
      {
         W2 var←c9572;
         {
            word pd35;
            pd35 = (* (( (ptr) (* (( (ptr) gf←c9924)+33)/* var←c9348 */  ))+13) );
            (void) ( *( (fPt) ((*  (ptr) pd35 ))))((word) &var←c9572, (* (( (ptr) formal←c9956)+6) ), (* (( (ptr) formal←c9956)+7) ), pd35)
            ;
            };
         msg←v3228 = var←c9572.f1;
         result←v3200 = var←c9572.f0;
         };
      };
SOURCE(615, 71)
   if ((msg←v3228 != 0)) {
SOURCE(635, 24)
      {
         word pd36;
         pd36 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd36 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+1) ), msg←v3228, 0, 2147483647, pd36);
         };
SOURCE(661, 25)
      {
         word pd37;
         pd37 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd37 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+1) ), (* (( (ptr) gf←c9924)+17) ), 0, 2147483647, pd37)
         ;
         };
      };
SOURCE(691, 136)
   if ((result←v3200 == (* (( (ptr) gf←c9924)+15) ))) {
SOURCE(717, 51)
      {
         word pd38;
         pd38 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd38 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+1) ), (* (( (ptr) gf←c9924)+18) ), 0, 2147483647, pd38)
         ;
         };
SOURCE(770, 28)
      {
         word pd39;
         pd39 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd39 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+1) ), (* (( (ptr) formal←c9956)+7) ), 0, 2147483647, pd39)
         ;
         };
SOURCE(800, 27)
      {
         word pd40;
         pd40 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd40 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+1) ), (* (( (ptr) gf←c9924)+19) ), 0, 2147483647, pd40)
         ;
         };
      };
SOURCE(832, 48)
   {
      word pd41;
      pd41 = (* (( (ptr) (* (( (ptr) gf←c9924)+33)/* var←c9348 */  ))+17) );
      hadFailure←v3256 = (word) ( *( (fPt) ((*  (ptr) pd41 ))))((* ((( (ptr) formal←c9956)+6)) ), pd41);
      };
SOURCE(882, 125)
   {
      word pd42;
      word pd43;
      var←c9636 = (word) GetEnv←P120((* (( (ptr) formal←c9956)+6) ), (* (( (ptr) gf←c9924)+20) ));
      pd42 = (* (( (ptr) (* (( (ptr) gf←c9924)+36)/* var←c9668 */  ))+15) );
      if (( (int)(word) ( *( (fPt) ((*  (ptr) pd42 ))))(var←c9636, pd42) >  (int)0)) {
         persist←v3284 = 1;
         }
      else {
         pd43 = (* (( (ptr) (* (( (ptr) gf←c9924)+37)/* var←c9700 */  ))+11) );
         persist←v3284 = ((word) ( *( (fPt) ((*  (ptr) pd43 ))))((* (( (ptr) gf←c9924)+21) ), (* (( (ptr) gf←c9924)+22) ), pd43) != 0);
         };
      };
SOURCE(1009, 71)
   if ((0 == persist←v3284)) {
SOURCE(1029, 51)
      {
         word pd44;
         pd44 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd44 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+1) ), (* (( (ptr) gf←c9924)+23) ), 0, 2147483647, pd44)
         ;
         };
      };
SOURCE(1082, 68)
   if ((0 != hadFailure←v3256)) {
SOURCE(1102, 48)
      {
         word pd45;
         pd45 = (* (( (ptr) (* (( (ptr) gf←c9924)+35)/* var←c9604 */  ))+93) );
         (void) ( *( (fPt) ((*  (ptr) pd45 ))))((* (( (ptr) (* (( (ptr) formal←c9956)+6) ))+2) ), (* (( (ptr) gf←c9924)+24) ), 0, 2147483647, pd45)
         ;
         };
      };
SOURCE(1154, 46)
   lab←L100002: ;
   if (persist←v3284) {
      }
   else {
      goto lab←L100000;
      };
SOURCE(1171, 29)
   {
      word pd46;
      pd46 = (* (( (ptr) (* (( (ptr) gf←c9924)+38)/* var←c9732 */  ))+21) );
      (void) ( *( (fPt) ((*  (ptr) pd46 ))))(400000, pd46);
      };
   goto lab←L100002;
   lab←L100000: ;
   }

static word GetEnv←P120(cmd←v2984, key←v3012)
   word cmd←v2984;
   word key←v3012;
   {
   register ptr gf←c9988 =  (ptr) &globalframe;
   word var←c3056;
   /* GetEnv: */ 
SOURCE(1450, 182)
SOURCE(1517, 115)
   {
      word var←c9796;
      {
         word var←c9764;
         {
            word pd47;
            pd47 = (* (( (ptr) (* (( (ptr) gf←c9988)+37)/* var←c9700 */  ))+5) );
            var←c9764 = (word) ( *( (fPt) ((*  (ptr) pd47 ))))(key←v3012, 0, 2147483647, pd47);
            };
         {
            word pd48;
            pd48 = (* (( (ptr) (* (( (ptr) gf←c9988)+33)/* var←c9348 */  ))+15) );
            var←c9796 = (word) ( *( (fPt) ((*  (ptr) pd48 ))))(cmd←v2984, var←c9764, pd48);
            };
         };
      if ((var←c9796 == 0)) {
         goto lab←L100003;
         };
      {
         word tc49;
         if (((* (( (ptr) gf←c9988)+5) ) == XR←GetReferentType(var←c9796))) {
            tc49 =  (word) ((*(int*)var←c9796<0) == 0);
            }
         else {
            tc49 =  (word) 0;
            };
         if (tc49) {
            {
               word rope←v3344;
               rope←v3344 = var←c9796;
SOURCE(1594, 13)
               return(rope←v3344);
               };
            }
         else {
            lab←L100003: ;
SOURCE(1620, 12)
            return(0);
            };
         };
      };
   }

/* file: CommanderOnStandardStreamsImpl, module: CommanderOnStandardStreamsImpl, compiled at: January 26, 1993 3:31:50 pm PST */ 
extern void XR←install←CommanderOnStandardStreamsImpl() {
   NoName←Q288();
   }
extern void XR←run←CommanderOnStandardStreamsImpl() { XR←Start(&globalframe); }