/*****************************************************************/
/**                                                             **/
/**             (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; 
 
Array Real(48,10) realarray[12]; 
 
   Invoke iop 5 
      realarray,realarray,realarray,realarray,realarray; 
 
End; 
  
#define ARRAYSIZE	12 


main(argc,argv) 
   int argc; 
   char *argv[]; 
{ 
   realarray src1,src2,src3,src4,dest1,dest2,dest3,dest4,dest5; 
   Control (sample) inst; 
  
   int i; 
   static double a[ARRAYSIZE] = {1.1, 7.0, 2.0, 0.5, 255, 
			  123.45, -1.1, -8.7, -2, 0, 
			  959.3E-17, 24.5E8 }; 
   int c1=ARRAYSIZE,c2=ARRAYSIZE,c3=ARRAYSIZE/2+1,c4=0,c5=2; 
 
   if (argc != 2) 
      exit(1);    
 
   for (i=0; i<ARRAYSIZE; i++) 
   { 
      src1[i] = a[i]; 
      src2[i] = a[i]; 
      src3[i] = a[i]; 
      src4[i] = a[i]; 
   } 
 
/***************** send it out ************************/
 
   Bind_STUB(inst,argv[1],"w",Asn_1_ber); 
   Give inst 
   { 
      iop(src1, src2 {ARRAYSIZE}, src3 {ARRAYSIZE/2},src4 {0}); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber); 
   Accept inst 
   { 
      On iop(dest1 {c1}, dest2 {c2}, dest3{c3}, dest4{c4}, dest5{c5}) 
       { 
/***************** report results *********************/

         if (c1 != ARRAYSIZE) 
            printf("###c1(%d) should be %d\n",c1,ARRAYSIZE); 
         if (c2 != ARRAYSIZE) 
            printf("###c2(%d) should be %d\n",c2,ARRAYSIZE); 
         if (c3 != ARRAYSIZE/2) 
            printf("###c3(%d) should be %d\n",c3,ARRAYSIZE/2); 
         if (c4 != 0) 
            printf("###c4(%d) should be %d\n",c4,0); 
         if (c5 != 0) 
            printf("###c5(%d) should be %d\n",c5,0); 
      }  
   } 
   Unbind(inst); 
  
   printf("test completed\n");
   return(0); 
} 
 
