/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/
 
Interface sample; 

Names 
   Enumerated(2) dog 4095, 
   Enumerated(4) cat 4096; 
 
   Invoke yard 60 
	cat,dog; 

End; 
  

main(argc,argv) 
   int argc; 
   char *argv[]; 
{ 
   Enumerated(2) rover,lassie; 
   Enumerated(4) sam,willy; 
   Control (sample) inst; 
  
   int done=0,count=0; 
 
   rover=2001; 
   sam=2010; 
   if (argc != 2) 
      exit(1);    
  
/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber); 
   Give inst 
   { 
      yard(cat:sam,dog:rover); 
      yard(cat:sam,dog:rover); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber); 
 
   while (!done) 
   {  
   Accept inst 
   { 
      On yard(cat:willy,dog:lassie) 
       { 
	if (sam != willy || lassie != rover) 
	   printf("###values wrong\n"); 
        count++; 
      }  
   } 
   Exceptions 
   { 
      On Done 
      { 
	done = 1; 
      }  
   } 
   }  
 
   Unbind(inst); 
  
/***************** report results *********************/

   if (count != 2) 
      printf("###wrong count %d\n",count); 
   if (!done) 
      printf("###Not done\n"); 

   printf("test completed\n");
   return(0); 
} 
  
