/*****************************************************************/
/**                                                             **/
/**             (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; 
 
	Invoke intop 6 
		Integer(1),Integer(1), 
		Integer(2), 
		Integer(4), Integer(4), 
		Integer(8),Integer(8),  
		Integer(20),Integer(20); 
 
End; 
 
  
main( argc, argv ) 
   int argc; 
   char *argv[]; 
{ 
   Integer(1) int1, int1Zero; 
   Integer(1) Rint1, Rint1Zero; 
   Integer(2) int2; 
   Integer(2) Rint2; 
   Integer(4) int4, int4Zero; 
   Integer(4) Rint4, Rint4Zero; 
   Integer(8) int8, int8Zero; 
   Integer(8) Rint8, Rint8Zero; 
   Integer(20) int20, int20Zero; 
   Integer(20) Rint20, Rint20Zero; 
 
   Control (sample) inst; 
  
   int index; 
 
   if( argc != 2 ) 
   { 
     printf("Need to supply data file name.\n"); 
     exit(1); 
   } 
 
   int1 = 0x7f; 
   int1Zero = 0; 
 
   int2 = 0x200;    
 
   int4 = 64000;    
   int4Zero = 0;    
 
#ifdef CRAY 
   int8 = 0x0707070707070707; 
   int8Zero = 0; 
#else 
   memset( &int8, 0, 8 ); 
   memset( &int8Zero, 0, 8 ); 
   for( index=0; index<8; index++) 
     int8.val[index] = 0x07; 
   for( index=0; index<8; index++) 
    int8Zero.val[index] = 0x00;    
#endif 
 
   memset( &int20, 0, 20 ); 
   memset( &int20Zero, 0, 20 ); 
   for( index=0; index<20; index++) 
      int20.val[index] = 0x07;    
   for( index=0; index<20; index++) 
      int20Zero.val[index] = 0x00;    
 
/***************** send it out ************************/

   Bind_STUB( inst, argv[1], "w", Asn_1_ber); 
   Give inst 
   { 
      intop( int1, int1Zero, int2, int4, int4Zero, int8, int8Zero, 
	     int20, int20Zero ); 
   } 
   Unbind(inst); 
  
/***************** receive it back ********************/

   Bind_STUB( inst, argv[1], "r", Asn_1_ber); 
 
   Accept inst 
    { 
      On intop( Rint1, Rint1Zero, Rint2, Rint4, Rint4Zero, Rint8, Rint8Zero, 
	        Rint20, Rint20Zero ) 
	{ 
/***************** report results *********************/

	   if( int1 != Rint1 ) 
		printf("### Compare int1 failed.\n"); 
 
	   if( int1Zero != Rint1Zero ) 
		printf("### Compare int1Zero failed.\n"); 
 
	   if(  int2 != Rint2 ) 
		printf("### Compare int2 failed.\n"); 
 
	   if(  int4 != Rint4 ) 
		printf("### Compare int4 failed.\n"); 
 
	   if(  int4Zero != Rint4Zero ) 
		printf("### Compare int4Zero failed.\n"); 
 
#ifdef CRAY 
	   if ( int8 != Rint8 ) 
#else 
	   if(  memcmp(int8.val, Rint8.val, 8 ) != 0 ) 
#endif 
		printf("### Compare int8 failed.\n"); 
 
#ifdef CRAY 
	   if ( int8Zero != Rint8Zero ) 
#else 
	   if(  memcmp(int8Zero.val, Rint8Zero.val, 8 ) != 0 ) 
#endif 
		printf("### Compare int8Zero failed.\n"); 
 
	   if(  memcmp( int20.val, Rint20.val, 20 ) != 0) 
		printf("### Compare int20 failed.\n"); 
 
	   if(  memcmp( int20Zero.val, Rint20Zero.val, 20 ) ) 
		printf("### Compare int20Zero failed.\n"); 
 	} 
    } 
    Unbind( inst ); 
  
    printf("test completed\n");
    return(0); 
} 
