Beispiel #1
0
main()
{
   int                  sts, i, zro=0;
   OM_S_OBJID           a_objid[MAXA], b_objid[MAXB], c_objid;
   OM_S_OBJID           resa_objid[MAXA], resb_objid[MAXB], c2_objid;
   OM_S_CHANNUM         chan_a, chan_b;
   OM_S_CHANNUM         chan_resa, chan_resb;
   uword                count, siz;
   char                 *chan_acany,*chan_acbc,*chan_acb,*chan_bca;
   char                 *chan_sbca;
   char                 *chan_resacany,*chan_resacbc,*chan_resacb,*chan_resbca;
   char                 *chan_sca;
   OM_S_CHANSELECT      chansel;
   int		        relindex=0, to=0, from=0;
   OM_S_MESSAGE 	showb,showresb,connect_msg,move_chan_msg;
   uword        	OSnum;
   uword	        minorchan=0;
   
struct connect_struct
       {
	 OM_S_CHANSELECT      to_sel;
	 int		      to_idx;
	 OM_S_OBJID	      fr_objid;
	 uword                fr_os;
	 OM_S_CHANSELECT      fr_sel;
	 int		      fr_idx;
       } connect_args;
struct move_chan_struct
       {
	 OM_S_CHANSELECT      to_sel;
	 OM_S_OBJID	      fr_objid;
	 OMuword              fr_os;
	 OM_S_CHANSELECT      fr_sel;
       } move_chan_args;
   sts = om$runtime_init();
   if (!(sts&1))
   {
      printf (" error in om%runtine_init\n" );
      om$report_error(sts = sts);
      exit();
   }

   OSnum = OM_Gw_TransOSnum_0;
   

   chan_acb  = "A.acb";
   chan_acany  = "A.acany";
   chan_acbc = "A.acbc";
   chan_bca  = "B.bca";
   chan_sbca  = "C.sbca";

   for ( i=0; i<MAXA; i++ )
   {
      sts = om$construct(osname = "OM_TransOS_0",
                         classname = "A",
                         p_objid = &a_objid[i],
                         neighbor = OM_GS_NULL_NEIGHBOR);
      if (!(sts&1))
      {
         printf (" error in om$construct for A\n" );
         om$report_error(sts = sts);
         printf (" iteration : %d \n", i );
         exit();
      }
   }


   sts = om$get_channel_number(channame = "A.acb",
                               p_channum = &chan_a );
   if (!(sts&1))
   {
      printf (" error in om$get channel_number for acb\n" );
      om$report_error(sts = sts);
      exit();
   }

   sts = om$get_channel_number(channame = "B.bca",
                               p_channum = &chan_b );
   if (!(sts&1))
   {
      printf (" error in om$get_channel_number for bca\n" );
      om$report_error(sts = sts);
      exit();
   }


   for ( i=0; i<MAXB; i++ )
   {
      sts = om$construct(osname = "OM_TransOS_0",
                         classname = "B",
                         p_objid = &b_objid[i],
                         neighbor = OM_GS_NULL_NEIGHBOR);
      if (!(sts&1))
      {
         printf (" error in om$construct for B\n" );
         om$report_error(sts = sts);
         printf (" iteration : %d \n", i );
         exit();
      }
   } /* for */

/* Now I need to build the following relations for the test:
	a1 - b0    	Dipole
	a2,a3 - b1  	TO:FROM
	a4 - b2,b3	FROM:TO
	a5 - b4         Dipole
	a10 - b5	Dipole
*/

	connect_args.to_sel.type = OM_e_num;
	connect_args.to_sel.u_sel.number = chan_b;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[1];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_num;
	connect_args.fr_sel.u_sel.number = chan_a;
	connect_args.fr_idx            = 0;

	sts = om$make_message(classname = "Root",		
			      methodname = "connect",		
			      size = sizeof( struct connect_struct),
			      p_arglist = &connect_args,	
			      p_msg = &connect_msg );


	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[1],			
		       targetid = b_objid[0] );

   if (!(sts&1))
      {
      printf (" error in om$send (connect) for B\n" );
      om$report_error(sts = sts);
      exit();
      }
   printf ("A1 connected to B0\n");

   printf ("----- Dumping A[1]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[1], "acb" );

   printf ("----- Dumping B[0]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, b_objid[0], "bca" );
   
     
for(i=2; i<4; i++)
{
	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[i];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[i],			
		       targetid = b_objid[1] );
 
   switch(sts)
   {
      case OM_I_ADDEDATEND:
      case OM_S_SUCCESS:  printf("A%d connected to B1\n", i);
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("B1 is already connected\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (connect) for A%d to B1\n", i);
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[%d]'s acb channel\n",i);
   OMT_dump_relation( OM_Gw_current_OS, a_objid[i], "acb" );

   printf ("----- Dumping B[1]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, b_objid[1], "bca" );
}
      

for(i=2; i<4; i++)
{
	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[4];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[4],			
		       targetid = b_objid[i] );

   switch(sts)
   {
      case OM_I_ADDEDATEND:
      case OM_S_SUCCESS:  printf("A4 connected to B%d\n", i);
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (connect) for A4 to B%d\n", i);
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[4]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[4], "acb" );

   printf ("----- Dumping B[%d]'s bca channel\n",i);
   OMT_dump_relation( OM_Gw_current_OS, b_objid[i], "bca" );
}

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[5];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[5],			
		       targetid = b_objid[4] );
 
   if (!(sts&1))
      {
      printf (" error in om$send (connect)\n");
      om$report_error(sts = sts);
      exit();
      }
   printf ("A5 connected to B4\n");

   printf ("----- Dumping A[5]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[5], "acb" );

   printf ("----- Dumping B[4]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, b_objid[4], "bca" );

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[10];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[10],			
		       targetid = b_objid[5] );
   if (!(sts&1))
      {
      printf (" error in om$send (connect)\n");
      om$report_error(sts = sts);
      exit();
      }

   printf ("A10 connected to B5\n");

   printf ("----- Dumping A[10]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[10], "acb" );

   printf ("----- Dumping B[5]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, b_objid[5], "bca" );

/******************************************************************
Test # 1 - Source is a singleton.
*******************************************************************/

   printf ("\n\n******* Test 1 - A0.acb to A6.acb but A0 is empty\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acb;
	move_chan_args.fr_objid = a_objid[0];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$make_message(classname = "Root",		
			      methodname = "move_chan",		
			      size = sizeof( struct move_chan_struct),
			      p_arglist = &move_chan_args,	
			      p_msg = &move_chan_msg );

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[0],			
		       targetid = a_objid[6] );

   switch(sts)
   {
      case OM_I_CHAN_EMPTY:
      case OM_S_SUCCESS:  printf("\n\nA0.acb moved to A6.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A0 to A6\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[0]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[0], "acb" );

   printf ("----- Dumping A[6]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[6], "acb" );


/******************************************************************
Test # 2 - Source is a dipole.
*******************************************************************/

   printf ("\n\n******* Test 2 - A1.acb to A7.acb\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acb;
	move_chan_args.fr_objid = a_objid[1];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[1],			
		       targetid = a_objid[7] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nA1.acb moved to A7.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A1 to A7\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[1]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[1], "acb" );

   printf ("----- Dumping A[7]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[7], "acb" );

   sts = om$make_message(classname = "B",
                         methodname = "show_b",
                         size = 0,
                         p_arglist = 0,
                         p_msg = &showb);
   if(!(sts&1))
   {
	printf("error in om%make_message for show_b\n");
	om$report_error(sts = sts);
	exit();
   }
   chansel.type = OM_e_name;
   chansel.u_sel.name = chan_acb;
   sts = om$send(mode = OM_e_wrt_object,
                 msg = &showb,
                 senderid = a_objid[7],
                 p_chanselect = &chansel);
   if(!(sts&1))
   {
	printf("error in om$send (show_b)\n");
	om$report_error(sts = sts);
	exit();
   }

/******************************************************************
Test # 3 - Source is on the TO side of a relation.
*******************************************************************/

   printf ("\n\n******* Test 3 - A2.acb to A8.acb\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acb;
	move_chan_args.fr_objid = a_objid[2];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[2],			
		       targetid = a_objid[8] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nA2.acb moved to A8.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A2 to A8\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[2]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[2], "acb" );

   printf ("----- Dumping A[8]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[8], "acb" );

   chansel.type = OM_e_name;
   chansel.u_sel.name = chan_acb;
   sts = om$send(mode = OM_e_wrt_object,
                 msg = &showb,
                 senderid = a_objid[8],
                 p_chanselect = &chansel);
   if(!(sts&1))
   {
	printf("error in om$send (show_b)\n");
	om$report_error(sts = sts);
	exit();
   }

/******************************************************************
Test # 4 - Source is on the FROM side of a relation.
*******************************************************************/

   printf ("\n\n******* Test 4 - A4.acb to A9.acb\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acb;
	move_chan_args.fr_objid = a_objid[4];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[4],			
		       targetid = a_objid[9] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nA4.acb moved to A9.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A4 to A9\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[4]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[4], "acb" );

   printf ("----- Dumping A[9]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[9], "acb" );

   chansel.type = OM_e_name;
   chansel.u_sel.name = chan_acb;
   sts = om$send(mode = OM_e_wrt_object,
                 msg = &showb,
                 senderid = a_objid[9],
                 p_chanselect = &chansel);
   if(!(sts&1))
   {
	printf("error in om$send (show_b)\n");
	om$report_error(sts = sts);
	exit();
   }

/******************************************************************
Test # 5 - Source is a dipole and target is a dipole.  This should 
           generate a error because the target should be empty.
*******************************************************************/

   printf ("\n\n******* Test 5 - A5.acb to A10.acb but A10.acb is not empty\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acb;
	move_chan_args.fr_objid = a_objid[5];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[5],			
		       targetid = a_objid[10] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nA5.acb moved to A10\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("\nOM_E_INVCHAN - expected error\n\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A5 to A10\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[5]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[5], "acb" );

   printf ("----- Dumping A[10]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[10], "acb" );

/******************************************************************
Test # 6 - Source is a dipole and its channel has only Bs on rhs.  
           Target is empty and its channel accepts Bs & Cs on rhs.
	   Target channel is a superset of Source's channel.
*******************************************************************/

   printf ("\n\n******* Test 6 - A7.acb to A1.acbc\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acbc;
	move_chan_args.fr_objid = a_objid[7];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[7],			
		       targetid = a_objid[1] );

   switch(sts)
   {
      case OM_I_CHAN_EMPTY:
      case OM_S_SUCCESS:  printf("\n\nA7.acb moved to A1.acbc\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A7.acb to A1.acbc\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[7]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[7], "acb" );

   printf ("----- Dumping A[1]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[1], "acbc" );

/******************************************************************
Test # 7 - Source is FROM side of relation and its channel has
		 only Bs on rhs.  
           Target is empty and its channel accepts any class on rhs.
	   Target channel is a wildcard channel.
*******************************************************************/

   printf ("\n\n******* Test 7 - A9.acb to A10.acany\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acany;
	move_chan_args.fr_objid = a_objid[9];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[9],			
		       targetid = a_objid[10] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nA9.acb moved to A10.acany\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A9.acb to A10.acany\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[9]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[9], "acb" );

   printf ("----- Dumping A[10]'s acany channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[10], "acany" );

/******************************************************************
Test # 8 - Source is FROM side of relation and its channel has
	    only any class on rhs.  
           Target is empty and its channel accepts Bs & Cs on rhs.
	   Target channel is a subset of source channel but all
	    objects currently hooked to channel are allowed on source.
*******************************************************************/

   printf ("\n\n******* Test 8 - A10.acany to A4.acbc\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acbc;
	move_chan_args.fr_objid = a_objid[10];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acany;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[10],			
		       targetid = a_objid[4] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nA10.acany moved to A4.acbc\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A10.acany to A4.acbc\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[10]'s acany channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[10], "acany" );

   printf ("----- Dumping A[4]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[4], "acbc" );

/* Construct a C object and connect it to A[4].acbc */

      sts = om$construct(osname = "OM_TransOS_0",
                         classname = "C",
                         p_objid = &c_objid,
                         neighbor = OM_GS_NULL_NEIGHBOR);
      if (!(sts&1))
      {
         printf (" error in om$construct for C\n" );
         om$report_error(sts = sts);
         exit();
      }

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_sbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[4];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acbc;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[4],			
		       targetid = c_objid );
 
   if (!(sts&1))
      {
      printf (" error in om$send (connect) for C\n");
      om$report_error(sts = sts);
      exit();
      }

   printf ("A4 connected to C\n");

   printf ("----- Dumping A[4]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[4], "acbc" );

   printf ("----- Dumping C's sbca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, c_objid, "sbca" );
   

/******************************************************************
Test # 9 - Source is FROM side of relation and its channel has
	    Bs and Cs on rhs.  
           Target is empty and its channel accepts only Bs on rhs.
	   Target channel is a subset of source channel but all
	    objects currently hooked to channel are not allowed
	    on source.  This test should fail.
*******************************************************************/

   printf ("\n\n******* Test 9 - A4.acbc to A9.acb but C is not allowed on acb\n");
	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_acb;
	move_chan_args.fr_objid = a_objid[4];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_acbc;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = a_objid[4],			
		       targetid = a_objid[9] );

   switch(sts)
   {
      case OM_I_CHAN_EMPTY:
      case OM_S_SUCCESS:  printf("\n\nA4.acbc moved to A9.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_CLASS_CONFLICT: 
                         printf ("\nOM_E_CLASS_CONFLICT - expected error\n\n");
                         break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for A4.acbc to A9.acb\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping A[4]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[4], "acbc" );

   printf ("----- Dumping A[9]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, a_objid[9], "acb" );


   /*=========================================================*/
   /*=========================================================*/
   /*   R E S T R I C T E D     C H A N N E L    T E S T S    */
   /*=========================================================*/
   /*=========================================================*/

   printf ("\nStart of restrcited channel tests\n\n\n");

   chan_resacb    = "ResA.acb";
   chan_resacany  = "ResA.acany";
   chan_resacbc   = "ResA.acbc";
   chan_resbca    = "ResB.bca";
   chan_sca       = "C.sca";

   for ( i=0; i<MAXA; i++ )
   {
      sts = om$construct(osname = "OM_TransOS_0",
                         classname = "ResA",
                         p_objid = &resa_objid[i],
                         neighbor = OM_GS_NULL_NEIGHBOR);
      if (!(sts&1))
      {
         printf (" error in om$construct for ResA\n" );
         om$report_error(sts = sts);
         printf (" iteration : %d \n", i );
         exit();
      }
   }


   sts = om$get_channel_number(channame = "ResA.acb",
                               p_channum = &chan_a );
   if (!(sts&1))
   {
      printf (" error in om$get channel_number for acb\n" );
      om$report_error(sts = sts);
      exit();
   }

   sts = om$get_channel_number(channame = "ResB.bca",
                               p_channum = &chan_b );
   if (!(sts&1))
   {
      printf (" error in om$get_channel_number for bca\n" );
      om$report_error(sts = sts);
      exit();
   }


   for ( i=0; i<MAXB; i++ )
   {
      sts = om$construct(osname = "OM_TransOS_0",
                         classname = "ResB",
                         p_objid = &resb_objid[i],
                         neighbor = OM_GS_NULL_NEIGHBOR);
      if (!(sts&1))
      {
         printf (" error in om$construct for ResB\n" );
         om$report_error(sts = sts);
         printf (" iteration : %d \n", i );
         exit();
      }
   } /* for */

/* Now I need to build the following relations for the test:
	a1 - b0    	Dipole
	a2,a3 - b1  	TO:FROM
	a4 - b2,b3	FROM:TO
	a5 - b4         Dipole
	a10 - b5	Dipole
*/

	connect_args.to_sel.type = OM_e_num;
	connect_args.to_sel.u_sel.number = chan_b;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[1];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_num;
	connect_args.fr_sel.u_sel.number = chan_a;
	connect_args.fr_idx            = 0;

	sts = om$make_message(classname = "Root",		
			      methodname = "connect",		
			      size = sizeof( struct connect_struct),
			      p_arglist = &connect_args,	
			      p_msg = &connect_msg );


	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[1],			
		       targetid = resb_objid[0] );

   if (!(sts&1))
      {
      printf (" error in om$send (connect) for ResB\n" );
      om$report_error(sts = sts);
      exit();
      }
   printf ("ResA1 connected to ResB0\n");

   printf ("----- Dumping ResA[1]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[1], "acb" );

   printf ("----- Dumping ResB[0]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resb_objid[0], "bca" );
   
     
for(i=2; i<4; i++)
{
	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[i];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[i],			
		       targetid = resb_objid[1] );
 
   switch(sts)
   {
      case OM_I_ADDEDATEND:
      case OM_S_SUCCESS:  printf("ResA%d connected to ResB1\n", i);
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("ResB1 is already connected\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (connect) for ResA%d to ResB1\n", i);
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[%d]'s acb channel\n",i);
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[i], "acb" );

   printf ("----- Dumping ResB[1]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resb_objid[1], "bca" );
}
      

for(i=2; i<4; i++)
{
	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[4];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[4],			
		       targetid = resb_objid[i] );

   switch(sts)
   {
      case OM_I_ADDEDATEND:
      case OM_S_SUCCESS:  printf("ResA4 connected to ResB%d\n", i);
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (connect) for ResA4 to ResB%d\n", i);
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[4]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[4], "acb" );

   printf ("----- Dumping ResB[%d]'s bca channel\n",i);
   OMT_dump_relation( OM_Gw_current_OS, resb_objid[i], "bca" );
}

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[5];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[5],			
		       targetid = resb_objid[4] );
 
   if (!(sts&1))
      {
      printf (" error in om$send (connect)\n");
      om$report_error(sts = sts);
      exit();
      }
   printf ("ResA5 connected to ResB4\n");

   printf ("----- Dumping ResA[5]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[5], "acb" );

   printf ("----- Dumping ResB[4]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resb_objid[4], "bca" );

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[10];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[10],			
		       targetid = resb_objid[5] );
   if (!(sts&1))
      {
      printf (" error in om$send (connect)\n");
      om$report_error(sts = sts);
      exit();
      }

   printf ("ResA10 connected to ResB5\n");

   printf ("----- Dumping ResA[10]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[10], "acb" );

   printf ("----- Dumping ResB[5]'s bca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resb_objid[5], "bca" );

/******************************************************************
Test # 1 - Source is a singleton.
*******************************************************************/

   printf ("\n\n******* Test 1 - ResA0.acb to ResA6.acb but ResA0 is empty\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacb;
	move_chan_args.fr_objid = resa_objid[0];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$make_message(classname = "Root",		
			      methodname = "move_chan",		
			      size = sizeof( struct move_chan_struct),
			      p_arglist = &move_chan_args,	
			      p_msg = &move_chan_msg );

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[0],			
		       targetid = resa_objid[6] );

   switch(sts)
   {
      case OM_I_CHAN_EMPTY:
      case OM_S_SUCCESS:  printf("\n\nResA0.acb moved to ResA6.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for ResA0 to ResA6\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[0]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[0], "acb" );

   printf ("----- Dumping ResA[6]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[6], "acb" );


/******************************************************************
Test # 2 - Source is a dipole.
*******************************************************************/

   printf ("\n\n******* Test 2 - ResA1.acb to ResA7.acb\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacb;
	move_chan_args.fr_objid = resa_objid[1];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[1],			
		       targetid = resa_objid[7] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nResA1.acb moved to ResA7.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for ResA1 to ResA7\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[1]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[1], "acb" );

   printf ("----- Dumping ResA[7]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[7], "acb" );

   sts = om$make_message(classname = "ResB",
                         methodname = "show_b",
                         size = 0,
                         p_arglist = 0,
                         p_msg = &showresb);
   if(!(sts&1))
   {
	printf("error in om%make_message for show_b\n");
	om$report_error(sts = sts);
	exit();
   }
   chansel.type = OM_e_name;
   chansel.u_sel.name = chan_resacb;
   sts = om$send(mode = OM_e_wrt_object,
                 msg = &showresb,
                 senderid = resa_objid[7],
                 p_chanselect = &chansel);
   if(!(sts&1))
   {
	printf("error in om$send (show_b)\n");
	om$report_error(sts = sts);
	exit();
   }

/******************************************************************
Test # 3 - Source is on the TO side of a relation.
*******************************************************************/

   printf ("\n\n******* Test 3 - ResA2.acb to ResA8.acb\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacb;
	move_chan_args.fr_objid = resa_objid[2];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[2],			
		       targetid = resa_objid[8] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nResA2.acb moved to ResA8.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for ResA2 to ResA8\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[2]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[2], "acb" );

   printf ("----- Dumping ResA[8]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[8], "acb" );

   chansel.type = OM_e_name;
   chansel.u_sel.name = chan_resacb;
   sts = om$send(mode = OM_e_wrt_object,
                 msg = &showresb,
                 senderid = resa_objid[8],
                 p_chanselect = &chansel);
   if(!(sts&1))
   {
	printf("error in om$send (show_b)\n");
	om$report_error(sts = sts);
	exit();
   }

/******************************************************************
Test # 4 - Source is on the FROM side of a relation.
*******************************************************************/

   printf ("\n\n******* Test 4 - ResA4.acb to ResA9.acb\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacb;
	move_chan_args.fr_objid = resa_objid[4];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[4],			
		       targetid = resa_objid[9] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nResA4.acb moved to ResA9.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for ResA4 to ResA9\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[4]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[4], "acb" );

   printf ("----- Dumping ResA[9]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[9], "acb" );

   chansel.type = OM_e_name;
   chansel.u_sel.name = chan_resacb;
   sts = om$send(mode = OM_e_wrt_object,
                 msg = &showresb,
                 senderid = resa_objid[9],
                 p_chanselect = &chansel);
   if(!(sts&1))
   {
	printf("error in om$send (show_b)\n");
	om$report_error(sts = sts);
	exit();
   }

/******************************************************************
Test # 5 - Source is a dipole and target is a dipole.  This should 
           generate a error because the target should be empty.
*******************************************************************/

   printf ("\n\n******* Test 5 - ResA5.acb to ResA10.acb but ResA10.acb is not empty\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacb;
	move_chan_args.fr_objid = resa_objid[5];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[5],			
		       targetid = resa_objid[10] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nResA5.acb moved to ResA10\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("\nOM_E_INVCHAN - expected error\n\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for ResA5 to ResA10\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[5]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[5], "acb" );

   printf ("----- Dumping ResA[10]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[10], "acb" );

/******************************************************************
Test # 6 - Source is a dipole and its channel has only ResBs on rhs.  
           Target is empty and its channel accepts ResBs & Cs on rhs.
	   Target channel is a superset of Source's channel.
*******************************************************************/

   printf ("\n\n******* Test 6 - ResA7.acb to ResA1.acbc - should error\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacbc;
	move_chan_args.fr_objid = resa_objid[7];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[7],			
		       targetid = resa_objid[1] );

   switch(sts)
   {
      case OM_I_CHAN_EMPTY:
      case OM_S_SUCCESS:  printf("\n\nResA7.acb moved to ResA1.acbc\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      case OM_E_CLASS_CONFLICT:
                           printf("\nOM_E_CLASS_CONFLICT - expected error\n");
                           break;
      default:				
         printf("error in om$send (move_chan) for ResA7.acb to ResA1.acbc\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[7]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[7], "acb" );

   printf ("----- Dumping ResA[1]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[1], "acbc" );

/******************************************************************
Test # 7 - Source is FROM side of relation and its channel has
		 only ResBs on rhs.  
           Target is empty and its channel accepts any class on rhs.
	   Target channel is a wildcard channel.
*******************************************************************/

   printf ("\n\n******* Test 7 - ResA9.acb to ResA10.acany - should error\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacany;
	move_chan_args.fr_objid = resa_objid[9];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacb;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[9],			
		       targetid = resa_objid[10] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nResA9.acb moved to ResA10.acany\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      case OM_E_CLASS_CONFLICT:
                           printf("\nOM_E_CLASS_CONFLICT - expected error\n");
                           break;
      default:				
         printf("error in om$send (move_chan) for ResA9.acb to ResA10.acany\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[9]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[9], "acb" );

   printf ("----- Dumping ResA[10]'s acany channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[10], "acany" );

/******************************************************************
Test # 8 - Source is FROM side of relation and its channel has
	    only any class on rhs.  
           Target is empty and its channel accepts ResBs & Cs on rhs.
	   Target channel is a subset of source channel but all
	    objects currently hooked to channel are allowed on source.
*******************************************************************/

   printf ("\n\n******* Test 8 - ResA10.acany to ResA4.acbc but Res10.acany is empty\n");

	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacbc;
	move_chan_args.fr_objid = resa_objid[10];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacany;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[10],			
		       targetid = resa_objid[4] );

   switch(sts)
   {
      case OM_S_SUCCESS:  printf("\n\nResA10.acany moved to ResA4.acbc\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("an invalid channel was used\n");
      		          break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      case OM_I_CHAN_EMPTY:
                           printf("\nOM_I_CHAN_EMPTY - expected status\n");
                           break;
      default:				
         printf("error in om$send (move_chan) for ResA10.acany to ResA4.acbc\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[10]'s acany channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[10], "acany" );

   printf ("----- Dumping ResA[4]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[4], "acbc" );

/* Construct a C object and connect it to ResA[4].acbc */

      sts = om$construct(osname = "OM_TransOS_0",
                         classname = "C",
                         p_objid = &c2_objid,
                         neighbor = OM_GS_NULL_NEIGHBOR);
      if (!(sts&1))
      {
         printf (" error in om$construct for C2\n" );
         om$report_error(sts = sts);
         exit();
      }

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_sca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[4];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacbc;
	connect_args.fr_idx            = 0;

	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[4],			
		       targetid = c2_objid );
 
   if (!(sts&1))
      {
      printf (" error in om$send (connect) for C2\n");
      om$report_error(sts = sts);
      exit();
      }

   printf ("ResA4 connected to C2\n");

   printf ("----- Dumping ResA[4]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[4], "acbc" );

   printf ("----- Dumping C2's sca channel\n");
   OMT_dump_relation( OM_Gw_current_OS, c2_objid, "sca" );
   

/******************************************************************
Test # 9 - Source is FROM side of relation and its channel has
	    ResBs and C2s on rhs.  
           Target is empty and its channel accepts only ResBs on rhs.
	   Target channel is a subset of source channel but all
	    objects currently hooked to channel are not allowed
	    on source.  This test should fail.
*******************************************************************/

   printf ("\n\n******* Test 9 - ResA4.acbc to ResA9.acb but C2 is not allowed on acb\n");
	move_chan_args.to_sel.type = OM_e_name;
	move_chan_args.to_sel.u_sel.name = chan_resacb;
	move_chan_args.fr_objid = resa_objid[4];
	move_chan_args.fr_os = OM_Gw_current_OS;
	move_chan_args.fr_sel.type = OM_e_name;
	move_chan_args.fr_sel.u_sel.name = chan_resacbc;

	sts = om$send (msg = &move_chan_msg,			
		       senderid = resa_objid[4],			
		       targetid = resa_objid[9] );

   switch(sts)
   {
      case OM_I_CHAN_EMPTY:
      case OM_S_SUCCESS:  printf("\n\nResA4.acbc moved to ResA9.acb\n");
      			  break;
      case OM_E_CHAN_NOTEMPTY: printf("Channel is not empty\n");
      			       break;
      case OM_E_INVCHAN:  printf("\nOM_E_INVCHAN - expected error\n");
      		          break;
      case OM_E_CLASS_CONFLICT: 
                         printf ("\nOM_E_CLASS_CONFLICT - expected error\n\n");
                         break;
      case OM_E_REL_MISMATCH:  printf("relations don't match\n");
      				break;
      default:				
         printf("error in om$send (move_chan) for ResA4.acbc to ResA9.acb\n");
         om$report_error(sts = sts);
   }
   printf ("----- Dumping ResA[4]'s acbc channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[4], "acbc" );

   printf ("----- Dumping ResA[9]'s acb channel\n");
   OMT_dump_relation( OM_Gw_current_OS, resa_objid[9], "acb" );

return(1);
}  /* main */
Beispiel #2
0
main ()
{
/*	One extra set of data structures are allocated for A's and B's.
	The last A and B will be connected as a dipole.
*/
int		sts, i, half_A, half_B;
OM_S_OBJID	a_objid[MAXA+1], b_objid[MAXB+1];
OM_S_OBJID	resa_objid[MAXA+1], resb_objid[MAXB+1];
int		relindex=0;
uword		minorchan=0;
OM_S_MESSAGE	disconnect_msg,connect_msg,showa, showb;
OM_S_MESSAGE    range_disconnect_msg;
OM_S_CHANSELECT chansel;
char            *chan_acb,*chan_bca, *chan_resacb, *chan_resbca;

struct connect_struct
       {
	 OM_S_CHANSELECT      to_sel;
	 int		      to_idx;
	 OM_S_OBJID	      fr_objid;
	 OMuword              fr_os;
	 OM_S_CHANSELECT      fr_sel;
	 int		      fr_idx;
       } connect_args;

struct disconnect_struct
       {
	 OM_S_CHANSELECT      to_sel;
	 OM_S_OBJID	      fr_objid;
	 OMuword              fr_os;
	 OM_S_CHANSELECT      fr_sel;
       } disconnect_args;

struct range_disconnect_struct
       {
         OM_S_CHANSELECT      to_sel;
         int                  low_index;
         int                  hi_index;
       } range_disconnect_args;


half_A=MAXA/2; half_B=MAXB/2;

sts = om$runtime_init();
if (!(sts&1))
 {
  printf ("error in om$runtime_init: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }

chan_acb = "A.acb";
chan_bca = "B.bca";

/*
	Construct A's
*/
printf("\n>>> Table of A's object IDs::\n");
for (i=0; i<MAXA+1; i++)
 {
   sts = om$construct (osname="OM_TransOS_0",classname="A",	
					p_objid=&a_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$construct object A[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    exit();
   }
  printf("\n>>> A[%d]: %d",i,a_objid[i]);
 }
/*
	Construct B's
*/
printf("\n\n>>> Table of B's object IDs::\n");
for (i=0; i<MAXB+1; i++)
 {
   sts = om$construct (osname="OM_TransOS_0",classname="B",	
					p_objid=&b_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$construct object B[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    exit();
   }
  printf("\n>>> B[%d]: %d ",i,b_objid[i]);
 }
/*
	Connect last A to last B
*/
printf("\n\n>>> Connect Last A to Last B\n");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[MAXA];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

	sts = om$make_message(classname = "Root",		
			      methodname = "connect",		
			      size = sizeof( struct connect_struct),
			      p_arglist = &connect_args,	
			      p_msg = &connect_msg );
	if(!(sts&1))
 	{
  	   printf("error in om$make_message for connect: %x\n",  sts);
  	   om$report_error(sts=sts);
  	   exit();
 	}
	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[MAXA],			
		       targetid = b_objid[MAXB] );

if (!(sts&1))
 {
  printf ("error in om$send msg=connect LAST A to LAST B: %x\n", i, sts );
  om$report_error(sts=sts);
  exit();
 }
/*
	Connect last half of B's to A[0]

*/
printf("\n\n>>> Connect last half of B's to A[0]");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[0];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

for (i=half_B; i<MAXB; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[0],			
		       targetid = b_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$send msg=connect B[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }
/*
	Connect last half of A's to B[0]

*/

printf("\n\n>>> Connect last half of A's to B[0]");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_acb;
	connect_args.to_idx = 0;
	connect_args.fr_objid = b_objid[0];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_bca;
	connect_args.fr_idx            = 0;

for (i=half_A; i<MAXA; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = b_objid[0],			
		       targetid = a_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$send msg=connect A[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }
/*
	Connect first half of B's to A[1]

  note: a many-to-many object existed for B[0] thus a connection between
	two many-to-many objects occurs

*/

printf("\n\n>>> Connect first half of B's to A[1]");
printf("\n>>>>>> note: an entry was inserted into B[0]'s bca channel");
printf("\n>>>>>>       linking itself to A[1]'s acb channel");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_bca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = a_objid[1];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_acb;
	connect_args.fr_idx            = 0;

for (i=0; i<half_B; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = a_objid[1],			
		       targetid = b_objid[i] );
 
  if (!(sts&1))
   {
    printf ("error in om$send msg=connect B[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }
/*
	Connect first half of A's to B[1]

  note: a many-to-many connection existed for A[0] thus a connection between
	two many-to-many connections occurs

*/

printf("\n\n>>> Connect first half of A's to B[1]");
printf("\n>>>>>> note: an entry was inserted into A[0]'s acb channel");
printf("\n>>>>>>       linking itself to B[1]'s bca channel");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_acb;
	connect_args.to_idx = 0;
	connect_args.fr_objid = b_objid[1];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_bca;
	connect_args.fr_idx            = 0;

for (i=0; i<half_A; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = b_objid[1],			
		       targetid = a_objid[i] );
 
  if (!(sts&1))
   {
    printf ("error in om$send msg=connect A[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }
/*
	For each B dump relations
*/
printf("\n\n>>> For each B dump relations::\n");
for(i=0; i<MAXB+1; i++)
 {
  printf("\n>>> B[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, b_objid[i], chan_bca);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for B[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }
/*
	Make message to send to B objects
*/
sts = om$make_message(classname="B",methodname="show_b",p_msg=&showb);

if(!(sts&1))
 {
  printf("error in om$make_message for show_b: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Send message to all B objects connected on A[0]'s "acb" channel
*/
printf("\n>>> Send message to all B's connected on A[0]'s \"acb\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "acb";
sts = om$send (msg=&showb,mode=OM_e_wrt_object,senderid=a_objid[0],
					p_chanselect=&chansel );
if(!(sts&1))
 {
  printf("error in om$send msg=show_b A[0]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Send message to all B objects connected on A[1]'s "acb" channel
*/
printf("\n>>> Send message to all B's connected on A[1]'s \"acb\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "acb";
sts = om$send (msg=&showb,mode=OM_e_wrt_object,senderid=a_objid[1],
					p_chanselect=&chansel );

if(!(sts&1))
 {
  printf("error in om$send msg= show_b A[1]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	For each A dump relations
*/
printf("\n>>> For each A dump relations\n");
for(i=0; i<MAXA+1; i++)
 {
  printf("\n>>> A[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, a_objid[i], chan_acb);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for A[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }
/*
	Make message to send to A objects
*/
sts = om$make_message(classname="A",methodname="show_a",p_msg=&showa);

if(!(sts&1))
 {
  printf("error in om$make_message for show_a: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Send message to all A objects connected on B[0]'s "bca" channel
*/
printf("\n>>> Send message to all A's connected on B[0]'s \"bca\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "bca";
sts = om$send (msg=&showa,mode=OM_e_wrt_object,senderid=b_objid[0],
					p_chanselect=&chansel );

if(!(sts&1))
 {
  printf("error in om$send msg= show_a B[0]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Send message to all A objects connected on B[1]'s "bca" channel
*/
printf("\n>>> Send message to all A's connected on B[1]'s \"bca\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "bca";
sts = om$send (msg=&showa,mode=OM_e_wrt_object,senderid=b_objid[1],
					p_chanselect=&chansel );

if(!(sts&1))
 {
  printf("error in om$send msg= show_a B[1]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Disconnect the first A contained wihtin the last half of A's
	from it's associated B.

  note:	Remember that the last half of the A's were connected to B[0] (see above).
*/
printf("\n>>> Disconnect the 1st in the 2nd half of A from corresponding B\n");

     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_acb;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = 0;

     sts = om$make_message(classname = "Root",		
		           methodname = "range_disconnect",		
			   size = sizeof( struct range_disconnect_struct),
			   p_arglist = &range_disconnect_args,	
			   p_msg = &range_disconnect_msg );
     
     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = a_objid[half_A],			
	            targetid = a_objid[half_A]);

if (!(sts&1))
 {
  printf ("error in om$send msg=disconnect A[half_A] case: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "acb" of A[half_A]
*/
printf("\n>>> Dump relations of the channel \"acb\" of A[half_A]\n");
printf("\n>>> A[%d]:",half_A);
sts = OMT_dump_relation( OM_Gw_current_OS, a_objid[half_A], chan_acb);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for A[half_A]: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "bca" for B[0]
*/
printf("\n>>> Dump relations of the channel \"bca\" of B[0] (A[MAXA/2])\n");
printf("\n>>>>>> note: \"A[half_A]\" was connected to B[0]");
printf("\n>>> B[0]:");
sts = OMT_dump_relation( OM_Gw_current_OS, b_objid[0], chan_bca);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for B[0] ( A[MAXA/2] case ): %x\n",i,sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Disconnect 1st half of objects connected to B[1]
*/
printf("\n>>> Disconnect 1st half of objects connected to B[1]\n");

     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_bca;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = half_A/2;

     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = b_objid[1],			
	            targetid = b_objid[1] );

if (!(sts&1))
 {
  printf ("error in om$disconnect range B[1] case: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "bca" of B[1]
*/
printf("\n>>> Dump relations on the channel \"bca\" of B[1]\n");
sts = OMT_dump_relation( OM_Gw_current_OS, b_objid[1], chan_bca);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for B[1]: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations on channel "acb" of all A's
*/
printf("\n>>> Dump relations on channel \"acb\" of all A's\n");
for(i=0; i<MAXA+1; i++)
 {
  printf("\n>>> A[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, a_objid[i], chan_acb);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for A[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }
/*
	Disconnect All objects connected to A[0] on channel "acb"

  note: the last index of the relation is used if it is exceeded by the
	given "end" index

*/
printf("\n>>> Disconnect All objects connected to A[0] on channel \"acb\"\n");

     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_acb;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = MAXB+99;

     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = a_objid[0],			
	            targetid = a_objid[0] );

if (!(sts&1))
 {
  printf ("error in om$disconnect range A[0] case: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "acb" of A[0]
*/
printf("\n>>> Dump relations of the channel \"acb\" of A[0]\n");
sts = OMT_dump_relation( OM_Gw_current_OS, a_objid[0], chan_acb);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for A[0]: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "bca" for all B's
*/
printf("\n>>> Dump relations of the channel \"bca\" for all B's\n");
for(i=0; i<MAXB+1; i++)
 {
  printf("\n>>> B[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, b_objid[i], chan_bca);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for B[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }
/*
	Disconnect LAST A from LAST B
*/
printf("\n>>> Disconnect LAST A from LAST B \"acb\"\n");
     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_acb;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = MAXA;
     
     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = a_objid[MAXA],			
	            targetid = a_objid[MAXA] );

if (!(sts&1))
 {
  printf ("error in om$disconnect range LAST A & B case: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "acb" of A[MAXA]
*/
printf("\n>>> Dump relations of the channel \"acb\" of LAST A\n");
printf("\n>>> A[%d]:",MAXA);
sts = OMT_dump_relation( OM_Gw_current_OS, a_objid[MAXA], chan_acb);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for LAST A: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "bca" for B[MAXB]
*/
printf("\n>>> Dump relations of the channel \"bca\" of LAST B\n");
printf("\n>>> B[%d]:",MAXB);
sts = OMT_dump_relation( OM_Gw_current_OS, b_objid[MAXB], chan_bca);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for LAST B: %x\n", i, sts);
  om$report_error(sts=sts);
  exit();
 }

/*************************************************************/
/*		Restricted Section			     */
/*************************************************************/

printf("\n\n******************************************************\n");
printf("	     Restricted Tests\n");
printf("******************************************************\n\n");

chan_resacb = "ResA.acb";
chan_resbca = "ResB.bca";

/*
	Construct ResA's
*/

printf("\n>>> Table of ResA's object IDs::\n");
for (i=0; i<MAXA+1; i++)
 {
   sts = om$construct (osname="OM_TransOS_0",classname="ResA",	
					p_objid=&resa_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$construct object ResA[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    exit();
   }
  printf("\n>>> ResA[%d]: %d",i,resa_objid[i]);
 }

/*
	Construct ResB's
*/

printf("\n\n>>> Table of ResB's object IDs::\n");
for (i=0; i<MAXB+1; i++)
 {
   sts = om$construct (osname="OM_TransOS_0",classname="ResB",	
					p_objid=&resb_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$construct object ResB[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    exit();
   }
  printf("\n>>> ResB[%d]: %d ",i,resb_objid[i]);
 }

/*
	Connect last ResA to last ResB
*/

printf("\n\n>>> Connect Last ResA to Last ResB\n");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[MAXA];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

	sts = om$make_message(classname = "Root",		
			      methodname = "connect",		
			      size = sizeof( struct connect_struct),
			      p_arglist = &connect_args,	
			      p_msg = &connect_msg );
	if(!(sts&1))
 	{
  	   printf("error in om$make_message for connect: %x\n",  sts);
  	   om$report_error(sts=sts);
  	   exit();
 	}
	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[MAXA],			
		       targetid = resb_objid[MAXB] );

if (!(sts&1))
 {
  printf ("error in om$send msg=connect LAST ResA to LAST ResB: %x\n", i,
sts );
  om$report_error(sts=sts);
  exit();
 }

/*
	Connect last half of ResB's to ResA[0]

*/

printf("\n\n>>> Connect last half of ResB's to ResA[0]");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[0];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

for (i=half_B; i<MAXB; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[0],			
		       targetid = resb_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$send msg=connect ResB[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }

/*
	Connect last half of ResA's to ResB[0]

*/

printf("\n\n>>> Connect last half of ResA's to ResB[0]");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resacb;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resb_objid[0];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resbca;
	connect_args.fr_idx            = 0;

for (i=half_A; i<MAXA; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = resb_objid[0],			
		       targetid = resa_objid[i] );

  if (!(sts&1))
   {
    printf ("error in om$send msg=connect ResA[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }

/*
	Connect first half of ResB's to ResA[1]

  note: a many-to-many object existed for ResB[0] thus a connection between
	two many-to-many objects occurs

*/

printf("\n\n>>> Connect first half of ResB's to ResA[1]");
printf("\n>>>>>> note: an entry was inserted into ResB[0]'s bca channel");
printf("\n>>>>>>       linking itself to ResA[1]'s acb channel");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resbca;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resa_objid[1];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resacb;
	connect_args.fr_idx            = 0;

for (i=0; i<half_B; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = resa_objid[1],			
		       targetid = resb_objid[i] );
 
  if (!(sts&1))
   {
    printf ("error in om$send msg=connect ResB[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }

/*
	Connect first half of ResA's to ResB[1]

  note: a many-to-many connection existed for ResA[0] thus a connection
between
	two many-to-many connections occurs

*/

printf("\n\n>>> Connect first half of ResA's to ResB[1]");
printf("\n>>>>>> note: an entry was inserted into ResA[0]'s acb channel");
printf("\n>>>>>>       linking itself to ResB[1]'s bca channel");

	connect_args.to_sel.type = OM_e_name;
	connect_args.to_sel.u_sel.name = chan_resacb;
	connect_args.to_idx = 0;
	connect_args.fr_objid = resb_objid[1];
	connect_args.fr_os = OM_Gw_current_OS;
	connect_args.fr_sel.type = OM_e_name;
	connect_args.fr_sel.u_sel.name = chan_resbca;
	connect_args.fr_idx            = 0;

for (i=0; i<half_A; i++)
 {
	sts = om$send (msg = &connect_msg,			
		       senderid = resb_objid[1],			
		       targetid = resa_objid[i] );
 
  if (!(sts&1))
   {
    printf ("error in om$send msg=connect ResA[%d]: %x \n", i, sts );
    om$report_error(sts=sts);
    printf("iteration: %d\n", i);
    exit();
   }
 }

/*
	For each ResB dump relations
*/

printf("\n\n>>> For each ResB dump relations::\n");
for(i=0; i<MAXB+1; i++)
 {
  printf("\n>>> ResB[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, resb_objid[i], chan_resbca);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for ResB[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }

/*
	Make message to send to ResB objects
*/

sts = om$make_message(classname="ResB",methodname="show_b",p_msg=&showb);

if(!(sts&1))
 {
  printf("error in om$make_message for show_b: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Send message to all ResB objects connected on ResA[0]'s "acb" channel
*/

printf("\n>>> Send message to all ResB's connected on ResA[0]'s \"acb\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "ResA.acb";
sts = om$send (msg=&showb,mode=OM_e_wrt_object,senderid=resa_objid[0],
					p_chanselect=&chansel );
if(!(sts&1))
 {
  printf("error in om$send msg=show_b ResA[0]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Send message to all ResB objects connected on ResA[1]'s "acb" channel
*/

printf("\n>>> Send message to all ResB's connected on ResA[1]'s \"acb\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "ResA.acb";
sts = om$send (msg=&showb,mode=OM_e_wrt_object,senderid=resa_objid[1],
					p_chanselect=&chansel );

if(!(sts&1))
 {
  printf("error in om$send msg= show_b ResA[1]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	For each ResA dump relations
*/

printf("\n>>> For each ResA dump relations\n");
for(i=0; i<MAXA+1; i++)
 {
  printf("\n>>> ResA[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, resa_objid[i], chan_resacb);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for ResA[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }

/*
	Make message to send to ResA objects
*/

sts = om$make_message(classname="ResA",methodname="show_a",p_msg=&showa);

if(!(sts&1))
 {
  printf("error in om$make_message for show_a: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Send message to all ResA objects connected on ResB[0]'s "bca" channel
*/

printf("\n>>> Send message to all ResA's connected on ResB[0]'s \"bca\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "ResB.bca";
sts = om$send (msg=&showa,mode=OM_e_wrt_object,senderid=resb_objid[0],
					p_chanselect=&chansel );

if(!(sts&1))
 {
  printf("error in om$send msg= show_a ResB[0]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Send message to all ResA objects connected on ResB[1]'s "bca" channel
*/

printf("\n>>> Send message to all ResA's connected on ResB[1]'s \"bca\" chan\n");
chansel.type = OM_e_name;
chansel.u_sel.name = "ResB.bca";
sts = om$send (msg=&showa,mode=OM_e_wrt_object,senderid=resb_objid[1],
					p_chanselect=&chansel );

if(!(sts&1))
 {
  printf("error in om$send msg= show_a ResB[1]: %x\n",  sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Disconnect the first ResA contained wihtin the last half of ResA's
	from it's associated ResB.

  note:	Remember that the last half of the ResA's were connected to
ResB[0] (see above).
*/

printf("\n>>> Disconnect the 1st in the 2nd half of ResA from corresponding ResB\n");

     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_resacb;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = 0;

     sts = om$make_message(classname = "Root",		
		           methodname = "range_disconnect",		
			   size = sizeof( struct range_disconnect_struct),
			   p_arglist = &range_disconnect_args,	
			   p_msg = &range_disconnect_msg );
     
     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = resa_objid[half_A],			
	            targetid = resa_objid[half_A]);

if (!(sts&1))
 {
  printf ("error in om$send msg=disconnect ResA[half_A] case: %x \n",
sts );
  om$report_error(sts=sts);
  exit();
 }

/*
	Dump relations of the channel "acb" of ResA[half_A]
*/

printf("\n>>> Dump relations of the channel \"acb\" of ResA[half_A]\n");
printf("\n>>> ResA[%d]:",half_A);
sts = OMT_dump_relation( OM_Gw_current_OS, resa_objid[half_A], chan_resacb);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for ResA[half_A]: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Dump relations of the channel "bca" for ResB[0]
*/

printf("\n>>> Dump relations of the channel \"bca\" of ResB[0] (ResA[MAXA/2])\n");
printf("\n>>>>>> note: \"ResA[half_A]\" was connected to ResB[0]");
printf("\n>>> ResB[0]:");
sts = OMT_dump_relation( OM_Gw_current_OS, resb_objid[0], chan_resbca);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for ResB[0] ( ResA[MAXA/2] case ): %x\n",i,sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Disconnect 1st half of objects connected to ResB[1]
*/

printf("\n>>> Disconnect 1st half of objects connected to ResB[1]\n");

     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_resbca;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = half_A/2;

     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = resb_objid[1],			
	            targetid = resb_objid[1] );

if (!(sts&1))
 {
  printf ("error in om$disconnect range ResB[1] case: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }

/*
	Dump relations of the channel "bca" of ResB[1]
*/

printf("\n>>> Dump relations on the channel \"bca\" of ResB[1]\n");
sts = OMT_dump_relation( OM_Gw_current_OS, resb_objid[1], chan_resbca);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for ResB[1]: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations on channel "acb" of all ResA's
*/
printf("\n>>> Dump relations on channel \"acb\" of all A's\n");
for(i=0; i<MAXA+1; i++)
 {
  printf("\n>>> ResA[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, resa_objid[i], chan_resacb);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for ResA[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }

/*
	Disconnect All objects connected to ResA[0] on channel "acb"

  note: the last index of the relation is used if it is exceeded by the
	given "end" index

*/
printf("\n>>> Disconnect All objects connected to ResA[0] on channel \"acb\"\n");

     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_resacb;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = MAXB+99;

     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = resa_objid[0],			
	            targetid = resa_objid[0] );

if (!(sts&1))
 {
  printf ("error in om$disconnect range ResA[0] case: %x \n", sts );
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "acb" of A[0]
*/
printf("\n>>> Dump relations of the channel \"acb\" of ResA[0]\n");
sts = OMT_dump_relation( OM_Gw_current_OS, resa_objid[0], chan_resacb);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for ResA[0]: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "bca" for all ResB's
*/
printf("\n>>> Dump relations of the channel \"bca\" for all ResB's\n");
for(i=0; i<MAXB+1; i++)
 {
  printf("\n>>> ResB[%d]:",i);
  sts = OMT_dump_relation( OM_Gw_current_OS, resb_objid[i], chan_resbca);
  if(!(sts&1))
   {
    printf("error in OMT_dump_relation for ResB[%d]: %x\n", i, sts);
    om$report_error(sts=sts);
    exit();
   }
 }

/*
	Disconnect LAST A from LAST ResB
*/
printf("\n>>> Disconnect LAST ResA from LAST ResB \"acb\"\n");
     range_disconnect_args.to_sel.type = OM_e_name;
     range_disconnect_args.to_sel.u_sel.name = chan_resacb;
     range_disconnect_args.low_index = 0;
     range_disconnect_args.hi_index = MAXA;
     
     sts = om$send (msg = &range_disconnect_msg,			
		    senderid = resa_objid[MAXA],			
	            targetid = resa_objid[MAXA] );

if (!(sts&1))
 {
  printf ("error in om$disconnect range LAST ResA & ResB case: %x \n", sts
);
  om$report_error(sts=sts);
  exit();
 }
/*
	Dump relations of the channel "acb" of ResA[MAXA]
*/
printf("\n>>> Dump relations of the channel \"acb\" of LAST ResA\n");
printf("\n>>> ResA[%d]:",MAXA);
sts = OMT_dump_relation( OM_Gw_current_OS, resa_objid[MAXA], chan_resacb);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for LAST ResA: %x\n", sts);
  om$report_error(sts=sts);
  exit();
 }

/*
	Dump relations of the channel "bca" for ResB[MAXB]
*/

printf("\n>>> Dump relations of the channel \"bca\" of LAST ResB\n");
printf("\n>>> ResB[%d]:",MAXB);
sts = OMT_dump_relation( OM_Gw_current_OS, resb_objid[MAXB], chan_resbca);
if(!(sts&1))
 {
  printf("error in OMT_dump_relation for LAST ResB: %x\n", i, sts);
  om$report_error(sts=sts);
  exit();
 }

}