Example #1
0
int compute_F_R_Clusters(int posStart, int posEnd, FILE *fp3)
{

  int startOfClusterR;
  int startOfClusterF;
  int posPrevREnd=posStart, posPrevFEnd=posStart;
  for (int count=posStart; count<posStart+maxSizeInst; count++)
    {
      if (listOfOEA_R[count]==1 &&(check_F(posPrevFEnd, count)||check_R(posPrevREnd, count+maxSizeInst)))
	{
 // printf("L110\n");
	  //  startOfClusterR=count;
	  //if (check_F(posPrevR, count)==true)
	  printCluster(posStart, count, count, count+maxSizeInst, fp3);
	  posPrevFEnd=count;
	  posPrevREnd=count+maxSizeInst;
	}
    }

  int count=posStart+maxSizeInst;
  bool endFound=false;
  //while (count<posStart+2*maxSizeInst && endFound==true)
  //{
  //  if (listOfOEA_R[count]==1)
  //{
  printCluster(posStart, posStart+maxSizeInst, count, posEnd, fp3);

  //  endFound=true;
  //}
  //count++;
  //}

}
Example #2
0
int createClusters(FILE *fp3)
{
  //  printf("L218\n");
  for (int count=0; count<chroSize; count++)
    {
      //printf("L222\n");
      if (listOfOEA_F[count]==1 && (check_R(EndClusterR, count+2*maxSizeInst)||check_F(EndClusterF, count+maxSizeInst)))
	{
	//    printf("L223\n");
	  compute_F_R_Clusters(count, count+2*maxSizeInst, fp3);
	  EndClusterR=count+2*maxSizeInst;
	  EndClusterF=count+maxSizeInst;
	}
    }
}
void execution(int argc,char* argv[])
{

	int in=0,flag_F=-1 ,io=0,jo=0 ,copy_flag=0 , flag_fname=0;
		char f[6];			
	in_len=argc;
	flag_h=0;
	flag_d=-1;	
	d_value=0;
	flag_f=-1;
	
	for(in=0; in< in_len ;in++)
	{
			strcpy(input_arra[in],argv[in]);
	}
	//	printf("val of srgasdc is %d \n",in_len);
	flag_f=check_f(in_len);
	flag_F=check_F(in_len);
	flag_h=check_h(in_len);
	flag_d=check_d(in_len);
//	printf("h is %d\n",flag_h);		
	if(flag_h == 1)
	{
		printf("help karo\n");
		return ;
	}			
	if(in_len < 2)
	{
		printf("\n usage ./a.out inputfile<test.cap>\n");
			return ;
	}
	if(flag_d != -1)
	{
		d_value=atoi(argv[flag_d]);
		//strcpy(inputfile,argv[flag_d]);
		
	}
	if(flag_F != -1)
	{

		//d_value=atoi(argv[flag_F]);
		strcpy(inputfile,argv[flag_F]);
	//	printf("d_value is %s \n\n",inputfile);
	//	return;	
	}
	else
	{
		printf("no input file \n -F <filename.cap>");
		return;

	}
	//check filename exists or not	
	//printf("filename is %s",inputfile);
	 flag_fname=check_filename();	
	if(flag_fname == 1 )
	{
		printf("\n input file name  format is wrong ...<*.cap>\n");
		return;

	}

		strcpy(runtimecmd," ");
	cmd_flag=0;
	int len=0;
	//printf("number is %d \n\n",in_len);
	//if(flag_d==1)
	//	len=in_len-3;
	//else
	//	len=in_len-1;
	if(flag_f != -1)
	{
			
		
		cmd_flag=1;		
	//	
		io=0;
		jo=0;
		strcpy(runtimecmd,input_arra[flag_f]);
	//	printf("%she%sre",runtimecmd,input_arra[flag_f]);
			//for(io=0;io<strlen(input_arra[flag_f]);io++)
			//{

			//	printf("%c",input_arra[flag_f][io]);
				//if(input_arra[flag_f][io] == ' ')				
				//	jo++;								
				//strcpy(runtimecmd[jo][io],input_arra[flag_f][io]);
				
			//}
			//return;		
	/*					for(io=0;io<strlen(runtimecmd);io++)
			printf("cmd is jgjnade %d us %s jhkj \n",flag_f,runtimecmd[io]);	*/					
	}		
	
	int ret, check_ret=0;
	check_ret=get_data();
	//return 1;
	if(check_ret==1)
		return;
	int checkt =-1, checkf=0;
	int checkfst=0;	
	
	//number of words in input
	int inputsize=in_len;

	strcpy(user_input,input_arra[1]);
	printdata();
	while(1)
	{
		//printf("inside while");
		checkt=-1;
		checkf=0;
		

		//checkf=check_f(inputsize);		

		if(checkfst==1)
		{
			strcpy(user_input,"");
			//checkfst=1;	


			printf(" \n enter the new commnad  \n ");
			//scanf(" %s ",input_value);
			int j=0,m=0;
			for(m=0;m<100;m++)
			{		
  				for(j=0;j<100;j++)
    					input_arra[m][j]='\0';
			}			
 			char c; 
       			for (m=0;m<100;)
            		{     
                 		for(j=0;j<100;j++)
                    		{	
                            		scanf("%c",&c);
                             		if(c==' ') 
					{
						 m++; break;
					}
                             		if(c=='\n') 
						break;
                             		input_arra[m][j]=c; 
                     		}
         			 
                		 if(c=='\n')break;
              

           		}	
			inputsize=m;
			//for( j=0;j<=m;j++)			
			  //    printf("in put is %s \n",input_arra[j]); 
                        strcpy(user_input,input_arra[0]);
		}
		checkt=check_t(inputsize);
		if(!strcmp(user_input,"exit"))
			break;			
		
		else if(!strcmp(user_input,"help"))
		{

			printf("\n am in help \n");

		}			
		else if(checkt !=-1 && checkfst == 1)
		{

	//		printf("t is present at pos %ddsf and in put size is %d \n",checkt , inputsize);			
			testcase(checkt,inputsize);
			
				
		}
		else
		{
			if(checkfst==1)
			{			
			printf("wrong command entered \n");
			}

		}
		checkfst=1;	
		


	}
	




}