/*****************************************************************/
/**                                                             **/
/**             (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; 
 
Record 
{ 
   Real(20,5) f; 
   Real(48,10) d; 
} realrec; 
 
Array realrec realarray[12]; 
 
   Invoke iop 5 
      realarray; 
 
End; 

#define ARRAYSIZE	12 
  

main(argc,argv) 
   int argc; 
   char *argv[]; 
{ 
   realarray src,dest; 
   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 }; 
 
   if (argc != 2) 
      exit(1);    
 
   for (i=0; i<ARRAYSIZE; i++) 
   { 
      src[i].f = a[i]; 
      src[i].d = a[i]; 
   } 
  
/***************** send it out ************************/

   Bind_STUB(inst,argv[1],"w",Asn_1_ber); 
   Give inst 
   { 
      iop(src); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB(inst,argv[1],"r",Asn_1_ber); 
   Accept inst 
   { 
      On iop(dest) 
       { 
         for (i=0; i<ARRAYSIZE; i++) 
         { 
            if (src[i].f != dest[i].f) 
               printf("###float[%d]: %f != %f\n",i,src[i].f,dest[i].f); 
            if (src[i].d != dest[i].d) 
               printf("###double[%d]: %lf != %lf\n",i,src[i].d,dest[i].d); 
         } 
      }  
   } 
   Unbind(inst); 
 
   printf("test completed\n");
   return(0); 
} 
