19 |
void confluence(char [], char [], char [], char [], char [], int[]); |
void confluence(char [], char [], char [], char [], char [], int[]); |
20 |
void sort(char [], char [], char [], char[], char [], int[]); |
void sort(char [], char [], char [], char[], char [], int[]); |
21 |
|
|
22 |
char MYSQL[80]; |
char MYSQL[120]; |
23 |
char database[80]; |
char database[120]; |
24 |
|
char arina[120]; |
25 |
float YODA_flag; |
float YODA_flag; |
26 |
float transmit_flag; |
float transmit_flag; |
27 |
int print_flag; |
int print_flag; |
28 |
|
|
29 |
int main(int argc, char *argv[]) |
int main(int argc, char *argv[]) |
30 |
{ |
{ |
35 |
int rc=0; |
int rc=0; |
36 |
int r_counter; /*Route counter*/ |
int r_counter; /*Route counter*/ |
37 |
|
|
38 |
char MainPath[80]; /* /home/pamelaprod/rawreader/ */ |
char MainPath[120]; /* /home/pamelaprod/rawreader/ */ |
39 |
char timesync[80]; |
char timesync[120]; |
|
char arina[80]; |
|
40 |
char INF[80]; /*Full out information file name nnnnn_cln1.inf*/ |
char INF[80]; /*Full out information file name nnnnn_cln1.inf*/ |
41 |
char fni[80]; /*Full initial file name nnnnnmmm.pam*/ |
char fni[80]; /*Full initial file name nnnnnmmm.pam*/ |
42 |
char fno[80]; /*Full out helping file name nnnnn_work.dat*/ |
char fno[80]; /*Full out helping file name nnnnn_work.dat*/ |
52 |
char temp3[80]; /*For temporary file*/ |
char temp3[80]; /*For temporary file*/ |
53 |
char temp4[80]; |
char temp4[80]; |
54 |
|
|
55 |
char fni2[80]; /*Initial file mmm_nnnnn_cln1.pam*/ |
char fni2[100]; /*Initial file mmm_nnnnn_cln1.pam*/ |
56 |
char inf2[80]; /*File name mmm_nnnnn_cln2.inf*/ |
char inf2[100]; /*File name mmm_nnnnn_cln2.inf*/ |
57 |
char pam2[80]; /*File name mmm_nnnnn_cln2.pam*/ |
char pam2[100]; /*File name mmm_nnnnn_cln2.pam*/ |
58 |
char name2[80]; /*Initial file name mmm_counter_nnnnn_cln1.pam*/ |
char name2[100]; /*Initial file name mmm_counter_nnnnn_cln1.pam*/ |
59 |
char name_ql[80]; /*File name mmm_nnnnn_ql.log*/ |
char log2[100]; /*File name mmm_nnnnn_cln2.log*/ |
60 |
char log2[80]; /*File name mmm_nnnnn_cln2.log*/ |
char name_ql[80]; /*File name mmm_nnnnn_ql.log*/ |
61 |
char fno2[80]; /*Out help file mmm_nnnnn_work.dat*/ |
char fno2[80]; /*Out help file mmm_nnnnn_work.dat*/ |
62 |
char path2[80]; /*Path for ...Temp/nnnnn_TMP/mmm/Cln2/*/ |
char path2[80]; /*Path for ...Temp/nnnnn_TMP/mmm/Cln2/*/ |
63 |
char mmm[80]; /*For route number*/ |
char mmm[80]; /*For route number*/ |
64 |
char name_route[4]; /*Route number in the file name*/ |
char name_route[4]; /*Route number in the file name*/ |
65 |
|
|
66 |
char path3[80]; /*Path for ...Level0/nnnnn_mmm_L0/*/ |
char path3[100]; /*Path for ...Level0/nnnnn_mmm_L0/*/ |
67 |
char exten[10]; /*Extension for the raw initial file*/ |
char exten[10]; /*Extension for the raw initial file*/ |
68 |
char temporary[80], Tymesync[80]; |
char temporary[80], Tymesync[80]; |
69 |
int Rcount=0; /*Number of Routes*/ |
int Rcount=0; /*Number of Routes*/ |
70 |
int packet_type[NumberPack]={0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x16, 0x17, 0x18, 0x19, |
int packet_type[NumberPack]={0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x16, 0x17, 0x18, 0x19, |
71 |
0x1A, 0x1B, 0x1C, 0x1D, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x30, 0x50, 0x51, 0x52, 0x53, |
0x1A, 0x1B, 0x1C, 0x1D, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x30, 0x50, 0x51, 0x52, 0x53, |
72 |
0x54, 0x55, 0x60, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x81, 0x82, 0x83, 0x84, |
0x54, 0x55, 0x60, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x81, 0x82, 0x83, 0x84, |
83 |
|
|
84 |
//Read parameters from the initial file |
//Read parameters from the initial file |
85 |
fpath.open("/home/pamelaprod/rawreader/bin/parameters.dat", ios::out); |
fpath.open("/home/pamelaprod/rawreader/bin/parameters.dat", ios::out); |
86 |
if (!fpath) {cout<<"can not open file with input parameters \n"; exit(0);} |
if (!fpath) {cout<<"can not open file with input parameters \n"; exit(1);} |
87 |
fpath.getline(MainPath, 80, '\n'); |
fpath.getline(MainPath,100,'\n'); |
88 |
sscanf(MainPath,"%s",MainPath); |
sscanf(MainPath,"%s",MainPath); |
89 |
fpath.getline(timesync, 80, '\n'); |
fpath.getline(timesync,100,'\n'); |
90 |
sscanf(timesync,"%s",timesync); |
sscanf(timesync,"%s",timesync); |
91 |
fpath.getline(arina, 80, '\n'); |
fpath.getline(arina,100,'\n'); |
92 |
sscanf(arina,"%s",arina); |
sscanf(arina,"%s",arina); |
93 |
fpath.getline(MYSQL, 80, '\n'); |
fpath.getline(MYSQL,100,'\n'); |
94 |
sscanf(MYSQL,"%s",MYSQL); |
sscanf(MYSQL,"%s",MYSQL); |
95 |
fpath.getline(database, 80, '\n'); |
fpath.getline(database,100,'\n'); |
96 |
sscanf(database,"%s",database); |
sscanf(database,"%s",database); |
97 |
fpath.getline(temp, 120, '\n'); |
fpath.getline(temp,120,'\n'); |
98 |
sscanf(temp,"%f",&YODA_flag); |
sscanf(temp,"%f",&YODA_flag); |
99 |
fpath.getline(temp, 120, '\n'); |
fpath.getline(temp,120,'\n'); |
100 |
sscanf(temp,"%f",&transmit_flag); |
sscanf(temp,"%f",&transmit_flag); |
101 |
fpath.getline(temp, 120, '\n'); |
fpath.getline(temp,120,'\n'); |
102 |
sscanf(temp,"%i",&print_flag); |
sscanf(temp,"%i",&print_flag); |
103 |
|
|
104 |
/* cout<<MainPath<<"\n"; |
/* cout<<"MainPath="<<MainPath<<" "<<strlen(MainPath)<<"\n"; |
105 |
cout<<timesync<<"\n"; |
cout<<"timesync="<<timesync<<" "<<strlen(timesync)<<"\n"; |
106 |
cout<<arina<<"\n"; |
cout<<"arina="<<arina<<" "<<strlen(arina)<<"\n"; |
107 |
cout<<MYSQL<<"\n"; |
cout<<"MYSQL="<<MYSQL<<" "<<strlen(MYSQL)<<"\n"; |
108 |
cout<<database<<"\n"; |
cout<<"database="<<database<<" "<<strlen(database)<<"\n"; |
109 |
cout<<YODA_flag<<"\n"; |
cout<<"YODA_flag="<<YODA_flag<<"\n"; |
110 |
cout<<transmit_flag<<"\n"; |
cout<<"transmit_flag="<<transmit_flag<<"\n"; |
111 |
cout<<print_flag<<"\n";*/ |
cout<<"print_flag="<<print_flag<<"\n";*/ |
112 |
|
|
113 |
fpath.close(); |
fpath.close(); |
114 |
|
|
115 |
// mikhailov 06.12.2004 |
// mikhailov 06.12.2004 |
116 |
ftime_sync=fopen(timesync,"r+"); |
ftime_sync=fopen(timesync,"r+"); |
117 |
|
if (!ftime_sync) {cout<<"can not open file with time synchronization \n"; exit(1);} |
118 |
while(feof(ftime_sync)==0) |
while(feof(ftime_sync)==0) |
119 |
{fscanf(ftime_sync,"%u%[ ]%u%[ ]%u%[ ]%u\n",&RTtoMT, temp, &RT, temp, &Timesync, temp, &OBTtimesync);} |
{fscanf(ftime_sync,"%u%[ ]%u%[ ]%u%[ ]%u\n",&RTtoMT, temp, &RT, temp, &Timesync, temp, &OBTtimesync);} |
120 |
fclose(ftime_sync); |
fclose(ftime_sync); |
131 |
{exten[i]=name[i+9];} |
{exten[i]=name[i+9];} |
132 |
exten[3]='\0'; |
exten[3]='\0'; |
133 |
|
|
134 |
if ((strlen(argv[2])!=12)||(strncmp(exten,"pam",3)!=0)) {cout<<"WRONG RAW FILE NAME\n"; exit(0);} |
if ((strlen(argv[2])!=12)||(strncmp(exten,"pam",3)!=0)) {cout<<"WRONG RAW FILE NAME\n"; exit(1);} |
135 |
|
|
136 |
strcpy(fni,argv[1]); |
strcpy(fni,argv[1]); |
137 |
strcat(fni,argv[2]); |
strcat(fni,argv[2]); |
152 |
printf("directory %s already exists - rewriting \n",strncat(strcpy(temp1," "),argv[2],5)); |
printf("directory %s already exists - rewriting \n",strncat(strcpy(temp1," "),argv[2],5)); |
153 |
fclose(tmp); |
fclose(tmp); |
154 |
remove(temp); |
remove(temp); |
155 |
// exit(0); |
// exit(1); |
156 |
} |
} |
157 |
/****************************************************************/ |
/****************************************************************/ |
158 |
|
|
207 |
{strcat(strcat(strcat(strcat(strcat(strcat(strcpy(fni2,nnnnn_TMP),"/"),name_route),"_"),mmm),"/Cln1/"),name2);} |
{strcat(strcat(strcat(strcat(strcat(strcat(strcpy(fni2,nnnnn_TMP),"/"),name_route),"_"),mmm),"/Cln1/"),name2);} |
208 |
else |
else |
209 |
{strcat(strcat(strncat(strcpy(fni2,""),nnnnn_TMP,strlen(nnnnn_TMP)-5),"Cln1/"),name2);} |
{strcat(strcat(strncat(strcpy(fni2,""),nnnnn_TMP,strlen(nnnnn_TMP)-5),"Cln1/"),name2);} |
|
|
|
210 |
strcpy(temp4,path); |
strcpy(temp4,path); |
211 |
strcat(strcat(strcat(strcat(temp4,name_route),"_"),mmm),"/Cln2/tmp.dat"); |
strcat(strcat(strcat(strcat(temp4,name_route),"_"),mmm),"/Cln2/tmp.dat"); |
212 |
if ((tmp4=fopen(temp4,"w"))==0) |
if ((tmp4=fopen(temp4,"w"))==0) |
224 |
strcat(strcat(strcat(strcat(strcat(strcpy(path2,nnnnn_TMP),"/"),name_route),"_"),mmm),"/Cln2/"); |
strcat(strcat(strcat(strcat(strcat(strcpy(path2,nnnnn_TMP),"/"),name_route),"_"),mmm),"/Cln2/"); |
225 |
strcat(strncat(strcpy(inf2,path2),name2,13),"_cln2.inf"); |
strcat(strncat(strcpy(inf2,path2),name2,13),"_cln2.inf"); |
226 |
strcat(strncat(strcpy(log2,path2),name2,13),"_cln2.log"); |
strcat(strncat(strcpy(log2,path2),name2,13),"_cln2.log"); |
227 |
strcat(strncat(strcpy(pam2,path2),name2,13),"_cln2.pam"); |
strcat(strncat(strcpy(pam2,path2),name2,13),"_cln2.pam"); |
228 |
strcat(strncat(strcpy(fno2,path2),name2,13),"_work.dat"); |
strcat(strncat(strcpy(fno2,path2),name2,13),"_work.dat"); |
229 |
|
|
230 |
IndexQ=quality[i-1]; |
IndexQ=quality[i-1]; |
231 |
r_counter=i; |
r_counter=i; |
232 |
verify(fni2, inf2, log2, pam2, fno2, path2, name, name2, packet_type, IndexQ, r_counter, real_route); ///////////////////////////////// |
verify(fni2, inf2, log2, pam2, fno2, path2, name, name2, packet_type, IndexQ, r_counter, real_route); ///////////////////////////////// |
233 |
strcat(strcat(strcat(strcat(strcat(strcat(strcpy(fni2,nnnnn_TMP),"/"),name_route),"_"),mmm),"/Cln1/"),name2); |
strcat(strcat(strcat(strcat(strcat(strcat(strcpy(fni2,nnnnn_TMP),"/"),name_route),"_"),mmm),"/Cln1/"),name2); |
234 |
//Delete Cln1 |
//Delete Cln1 |
235 |
if (IndexQ>0.999) |
if (IndexQ>0.999) |