#include "chdecl.h"
void CH_libwriteobj(current, sched, cop)
#define ARGUMENTS 5
#include "chhead.h"
select: switch (SELECTOR) {
    case 0: goto c0;
    case 1: goto cb1;
    case 2: goto c2;
    case 3: goto c7;
    case 4: goto cb11;
    case 5: goto c12;
    case 6: goto c13;
    case 7: goto cb20;
    case 8: goto c21;
    case 9: goto c24;
    case 10: goto c26;
    case 11: goto c28;
    case 12: goto c30;  }
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:
/* copy 4 3.0 */
  if((ch_returncode = cp_outport(& ch_val, REF(3)DOT(0).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(4).tsdr)->finalize)(REF(4).value,F_DISCARD,sched);
  REF(4).value = ch_val;
  REF(4).tsdr = & dr_outport;
/* copy 5 3.1 */
  if((ch_returncode = cp_outport(& ch_val, REF(3)DOT(1).value)) != Normal)
     goto ch_raise_exception;
  (*(REF(5).tsdr)->finalize)(REF(5).value,F_DISCARD,sched);
  REF(5).value = ch_val;
  REF(5).tsdr = & dr_outport;
/* new_inport 6 */
  if ((ch_val.inport = make_inport()) == nil) goto ch_depletion;
  (*(REF(6).tsdr)->finalize)(REF(6).value,F_DISCARD,sched);
  REF(6).value = ch_val; REF(6).tsdr = & dr_inport;
/* connect 3.2 6 */
  if (REF(6).value.inport->refcount == MAXCOUNTER) goto ch_depletion;
  (*(REF(3)DOT(2).tsdr)->finalize)(REF(3)DOT(2).value,F_DISCARD,sched);
  REF(6).value.inport->refcount++;
  REF(3)DOT(2).value.outport = REF(6).value.inport;
  REF(3)DOT(2).tsdr = & dr_outport;
/* 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;
c7:
/* discard 7 */
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  REF(7).tsdr = & dr_bottom;
/* block , 1 */
  if((ch_returncode = che_block(QUAL(1),sched)) != Normal)
     goto ch_raise_exception;
  current->ip = 4;
cb11:
/* receive 8 6 */
  if ((ch_returncode = che_receive(DEF(8),DEF(6),sched)) != Normal)
     goto ch_raise_exception;
  return;
c12:
/* call 5 9 , 2 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(5),
          arguments[1] = DEF(9),
          arguments[1+1] = nil,& arguments[0]),QUAL(2),sched)) != Normal)
     goto ch_raise_exception;
  return;
c13:
/* chs_lit 10 , "/" */
  if( !chs_lit(DEF(10),"/") ) goto ch_depletion;
/* concat 11 9 10 */
  if ((ch_returncode = che_concat(DEF(11),DEF(9),DEF(10),sched)) != Normal)
     goto ch_raise_exception;
/* discard 9 */
  (*(REF(9).tsdr)->finalize)(REF(9).value,F_DISCARD,sched);
  REF(9).tsdr = & dr_bottom;
/* discard 10 */
  (*(REF(10).tsdr)->finalize)(REF(10).value,F_DISCARD,sched);
  REF(10).tsdr = & dr_bottom;
/* concat 12 11 8.0 */
  if ((ch_returncode = che_concat(DEF(12),DEF(11),DEF(8)DOT(0)
    ,sched)) != Normal) goto ch_raise_exception;
/* discard 11 */
  (*(REF(11).tsdr)->finalize)(REF(11).value,F_DISCARD,sched);
  REF(11).tsdr = & dr_bottom;
/* move 7 12 */
  (*(REF(7).tsdr)->finalize)(REF(7).value,F_DISCARD,sched);
  REF(7) = REF(12);
  REF(12).tsdr = & dr_bottom;
  current->ip = 7;
cb20:
/* call 4 7 8.1 , 3 */
  if ((ch_returncode = che_call((
          arguments[0] = DEF(4),
          arguments[1] = DEF(7),
          arguments[2] = DEF(8)DOT(1),
          arguments[2+1] = nil,& arguments[0]),QUAL(3),sched)) != Normal)
     goto ch_raise_exception;
  return;
c21:
/* return 8 */
  if (ch_caller = do_return(REF(8).value)) {
    if (ch_caller->type < CProcess) ch_caller->ip++;
      sched->wakeup_proc(sched, ch_caller);}
  else rem_return(REF(8).value);
  REF(8).tsdr = & dr_bottom;
/* endblock */
  che_endblock(sched);
/* branch , 7 */
   goto c7;
c24:
/* return_exception 8 , 4 */
  if (ch_caller = do_return(REF(8).value)) {
    raise_user(QUAL(4),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(8),QUAL(4));
  REF(8).tsdr = & dr_bottom;
/* branch , 7 */
   goto c7;
c26:
/* return_exception 8 , 5 */
  if (ch_caller = do_return(REF(8).value)) {
    raise_user(QUAL(5),ch_caller); 
    sched->wakeup_proc(sched,ch_caller);}
  else rem_return_exception(DEF(8),QUAL(5));
  REF(8).tsdr = & dr_bottom;
/* branch , 7 */
   goto c7;
c28:
/* endblock */
  che_endblock(sched);
c30:
/* endprocess */
  che_endprocess(sched); return;
#include "chtail.h"
