#include "chdecl.h"
void CH_rshell(current, sched, cop)
#define ARGUMENTS 7
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto cb4;
    case 4: goto c5;
    case 5: goto c9;
    case 6: goto cb23;
    case 7: goto c24;
    case 8: goto cb27;
    case 9: goto c28;
    case 10: goto cb29;
    case 11: goto c30;
    case 12: goto c33;  }
c0:
/* block , 0 */
  if((ch_returncode = che_block(QUAL(0),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 1;
cb1:
/* receive 3 0 */
  if ((ch_returncode = che_receive(DEF(3),DEF(0),sched)) != Normal)
     goto ch_raise_exception;
  return;
c2:
/* chs_lit 4 , "remote shell" */
  if( !chs_lit(DEF(4),"remote shell") ) goto ch_depletion;
/* chs_lit 5 , "" */
  if( !chs_lit(DEF(5),"") ) goto ch_depletion;
  current->ip = 3;
cb4:
/* call 3.2.2 4 5 6 , 1 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(2),
          arguments[1] = DEF(4),
          arguments[2] = DEF(5),
          arguments[3] = DEF(6),
          arguments[3+1] = nil,& arguments[0]),QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  return;
c5:
/* unwrap 7 6 , 2 */
  if ((ch_returncode = che_unwrap(DEF(7),DEF(6),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
/* new_table 8 , 3 */
  if ((ch_returncode = che_new_table(DEF(8),QUAL(3),sched)) != Normal) 
     goto ch_raise_exception;
/* copy 9 3.0 */
  if((ch_returncode = cp_table(& ch_val, REF(3)DOT(0).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).value = ch_val;
  REF(9).tsdr = & dr_table;
/* initget 10 9 , 0,0 */
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  if ((ch_returncode = init_selector(DEF(10),DEF(9),nil,sched,GET,0,0
    )) != Normal) goto ch_raise_exception;
c9:
/* get_or_goto 10 9 , 19 */
  if ((ch_returncode = get_selected_object(DEF(10),DEF(9),sched)) != Normal)
     goto c19;
/* position 11 10 */
  ch_frame = get_selector_frame(DEF(10),sched);
  ch_t = ch_frame->inspectee->value.table;
  REF(11).value.integer = ch_frame->rmvcount +
    (*(ch_t->tbls[ORDER_TBL].des->position_of))(ch_t,ORDER_TBL,ch_frame->pos);
  REF(11).tsdr = &dr_integer;
/* ilt . 11 =(2) , 9 */
  if ( REF(11).value.integer < 2 ) goto c9;
/* chs_lit 12 , " " */
  if( !chs_lit(DEF(12)," ") ) goto ch_depletion;
/* concat 13 10 12 */
  if ((ch_returncode = che_concat(DEF(13),DEF(10),DEF(12),sched)) != Normal)
     goto ch_raise_exception;
/* discard 12 */
  (*(REF(12).tsdr)->finalize)(REF(12).value,F_DISCARD,sched);
  REF(12).tsdr = & dr_bottom;
/* merge 8 13 */
  if ((ch_returncode = mergefunc(DEF(8),DEF(13),FALSE,0)) != Normal)
     goto ch_raise_exception;
/* branch , 9 */
   goto c9;
c19:
/* endget 10 9 */
  end_selector(DEF(10),DEF(9),sched,GET);
/* discard 9 */
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).tsdr = & dr_bottom;
/* chs_lit 14 , "stdin" */
  if( !chs_lit(DEF(14),"stdin") ) goto ch_depletion;
/* chs_lit 15 , "stdio" */
  if( !chs_lit(DEF(15),"stdio") ) goto ch_depletion;
  current->ip = 6;
cb23:
/* call 3.2.2 14 15 16 , 1 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(2),
          arguments[1] = DEF(14),
          arguments[2] = DEF(15),
          arguments[3] = DEF(16),
          arguments[3+1] = nil,& arguments[0]),QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  return;
c24:
/* unwrap 17 16 , 4 */
  if ((ch_returncode = che_unwrap(DEF(17),DEF(16),QUAL(4),sched)) != Normal)
     goto ch_raise_exception;
/* chs_lit 18 , "stdout" */
  if( !chs_lit(DEF(18),"stdout") ) goto ch_depletion;
/* chs_lit 19 , "stdio" */
  if( !chs_lit(DEF(19),"stdio") ) goto ch_depletion;
  current->ip = 8;
cb27:
/* call 3.2.2 18 19 20 , 1 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(3)DOT(2)DOT(2),
          arguments[1] = DEF(18),
          arguments[2] = DEF(19),
          arguments[3] = DEF(20),
          arguments[3+1] = nil,& arguments[0]),QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  return;
c28:
/* unwrap 21 20 , 5 */
  if ((ch_returncode = che_unwrap(DEF(21),DEF(20),QUAL(5),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 10;
cb29:
/* call 7 8 17 21 3.1 , 6 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(7),
          arguments[1] = DEF(8),
          arguments[2] = DEF(17),
          arguments[3] = DEF(21),
          arguments[4] = DEF(3)DOT(1),
          arguments[4+1] = nil,& arguments[0]),QUAL(6),sched)) != Normal)
     goto ch_raise_exception;
  return;
c30:
/* return 3 */
  if (ch_caller = do_return(REF(3).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(3).value);
  REF(3).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
c33:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
