#include "stdio.h"
#include "stdlib.h"
#include "string.h"

typedef struct  {
	int size;
	int id;
	float x1;
	float y1;
	float x2;
	float y2;
}block1;
typedef struct  {
	int size;
	int tip;
	int id;
	float x1;
	float y1;
	float x2;
	float y2;
}block2;
typedef struct  {
	int size;
	int id;
	float x1;
	float y1;
	float x2;
	float y2;
}block3;

typedef struct {
	block1 *flag_up;
	block2 *flag_cust;
	block3 *flag_line;
	int size;
	}blocks ;
	
int main(){
	int blcNum=0,*elements,item=0;
	char line[60];
	int getter;
	
	blocks block;
	// block = malloc(sizeof(blocks));
	
	int temp;
	// ///////////////////////////////////////////
	int id , size , tip;
	float x1,x2,y1,y2;
	
	FILE *fp;
	
	fp = fopen("IEEE_test_system_12.txt","r");
	while(!feof(fp)){
		fgets(line,60,fp);
		
		
		if ( strstr(line,"\0") != NULL && strstr(line,"X1") == NULL && strstr(line,"END") == NULL){
			item++ ;
			printf("%s",line);
			
			// size calculator
		}
		if(strstr(line,"ID") != NULL ){
		/*	if( blcNum == 1){
				fscanf(fp,"%d %.2f %.2f",&block.flag_up.id,&block.flag_up.x1,&block.flag_up.y1);
			}
			else if (blcNum == 2){
				fscanf(fp,"%d %d %.2f %.2f %.2f %.2f", &block.flag_cust.id,&block.flag_cust.tip,&block.flag_cust.x1
				,&block.flag_cust.y1,&block.flag_cust.x2,&block.flag_cust.y2);
			}
			else if ( blcNum == 3){
				fscanf(fp,"%d %.2f %.2f %.2f %.2f", &block.flag_line.id,&block.flag_line.x1
				,&block.flag_line.y1,&block.flag_line.x2,&block.flag_line.y2); 
			}  */
			blcNum++;
			
			if(blcNum == 1){
			//	printf("pes amk");
				fscanf(fp,"%d %.2f %.2f",&id,&x1,&y1);
			//	printf("sg");
			}
			
		//	printf("broken");
		}
		
	elements = &item;
	
	};
	
	fclose(fp);
	
	
	//	block.flag_up->id = id;
	printf("\nuploader id : %d",id);
    //	printf("uploader id : %d",block.flag_up->id);
	printf("\nblokc number : %d",blcNum);
	printf("\nelement number is : %d ",*elements);
	
	return 0;
}
