#define americano 0 #define europeo 1 #define lmax 200 #define posin 18 #define ladat 132+posin #define estac 9+posin #define linea 21+posin #define durac 49+posin #define hor 43+posin //// casa real #define fech 37+posin #define tranf 0+posin #define numero 58+posin #define ccost 0 #define proye 0 #define cuenta 0 #define pulsos 0 #define ruta 18+posin #define prinum 0 #define ring 0 #define antran 0 // anexo transferido #define fofech americano char reg[300][ladat], password[6],Esegundos[1],Eminutos[1],Ehoras[1], lgua[lmax+3]; int aux,t,m,j,lb,lr,i,h,cont, encuentra,largo, pos_anexo; //lb posicion de ruta+linea de buf aux=0; t=0; m=0; lb=0; i=0; h=0; cont=0; encuentra=0;pos_anexo=0; //pos_anexo= posición de anexo char Xhor[1],Xmin[1],Xseg[1], Yhor[1],Ymin[1],Yseg[1]; int Bhor,Bmin,Bseg, Rhor,Rmin,Rseg, RTIEMPO, BTIEMPO, EDURA; int Mhor2,Mhor2,Mmin1,Mmin2,Mseg1,Mseg2, Tminutos , Tsegundos , Thoras ; extern void gua_rut(char *buf); extern char rgua[]; void in_central() { rgua[0]='\0'; } void gua_buf(char *buf) { strcpy(lgua,buf); } void fi_central() { } //compara la línea del registro actual (buf) con los registros anteriores (almacenados en el arreglo bidimencional) void busca_lin(char *buf) { for(m=t;m>=0;m--) { for(j=0; j<6 && isdigit(reg[m][pos_anexo+1+j]); j++){} if (j==6) lr=pos_anexo+1; //linea+ruta en origen else lr=pos_anexo+9; //línea+ruta en destino for(j=0; j<6 && reg[m][lr+j]==buf[lb+j]; j++) {} //compara lineas+rutas if (j==6) {encuentra=1; h=strlen(reg[m]); return;} //lineas+rutas iguales } } //almacena las llamadas con lineas distintas en un arreglo bidimencional (sobreescribe los registros de líneas iguales) void add_reg(char *buf, int vtranf, int vfech, int vproye) { busca_lin(buf); /*llamadas transferidas con password*/ if(encuentra && buf[vtranf]=='S' && reg[m][vtranf]=='A') {for(j=0; j<6 && (j+vproye)(vhor+4) && isalpha(buf[vtranf]) && buf[vfech+2]=='/' && buf[vhor+2]==':' ) { if (buf[vtranf]=='L') {vfech=vfech+12; vhor=vhor+12; vdurac=vdurac+12;} opera_ori = (buf[vestac] =='A' && buf[vestac+1]=='T'); //operadora en origen opera_des = (buf[vruta-1]=='A' && buf[vruta] =='T'); //operadora en destino anexo_ori = (isdigit(buf[vestac] ) && isdigit(buf[vestac+1])); //anexo en origen anexo_des = (isdigit(buf[vruta-1]) && isdigit(buf[vruta])); //anexo en destino tronc_ori = (isalpha(buf[vestac] ) && isdigit(buf[vestac+1])); //troncal en origen tronc_des = (isalpha(buf[vruta-1]) && isdigit(buf[vruta])); //troncal en destino tandem = (buf[vtranf]!='E' && tronc_ori && tronc_des); //llamadas troncal-troncal pablo: aux=0; k=0; encuentra=0; //TRANSFERENCIAS if (tronc_ori) lb=vestac+1; //posicion de la línea buscada else lb=vruta; if (buf[vtranf]=='E' || buf[vtranf]=='N') busca_lin(buf); //transferencias: busca por linea el anexo desde donde se transfirió else if (buf[vtranf]=='S' || buf[vtranf]=='A') add_reg (buf, vtranf, vfech, vproye); if(buf[vtranf]=='A') return; trans_in = (buf[vtranf]=='E' && encuentra && isalpha(reg[m][vestac]) && isdigit(reg[m][vestac+1])); //transferencia entrante trans_out = (buf[vtranf]=='E' && encuentra && isalpha(reg[m][vruta-1]) && isdigit(reg[m][vruta])); //transferencia saliente //anexo cont=0; if ( buf[vestac]=='D' ) { for (j=0;j<4;j++) if isdigit(buf[vestac+2+j]) { cont++; tel[k++]=buf[vestac+2+j];} } else { for (j=0;j<4;j++) if isdigit(buf[vruta+1+j]) { cont++; tel[k++]=buf[vruta+1+j];} } tel[k++]=' '; if ( buf[vestac]=='T' ) { for (j=0;j<3;j++) if isdigit(buf[vestac+1+j]) { cont++; tel[k++]=buf[vestac+1+j];} } else { for (j=0;j<3;j++) if isdigit(buf[vruta+j]) { cont++; tel[k++]=buf[vruta+j];} } tel[k++]=' '; if ( buf[vtranf]=='N') { tel[k++]=buf[vdurac];tel[k++]=buf[vdurac+1]; tel[k++]=':'; tel[k++]=buf[vdurac+3];tel[k++]=buf[vdurac+4];tel[k++]=':'; /// duracion tel[k++]=buf[vdurac+6];tel[k++]=buf[vdurac+7]; //tel[k++]=' '; } else if ( buf[vtranf]=='S') { tel[k++]='0';tel[k++]='0';tel[k++]=':'; tel[k++]='0';tel[k++]='0';tel[k++]=':'; tel[k++]='1';tel[k++]=buf[vhor+4]; } else if ( buf[vtranf]=='E' ) { if(encuentra && buf[vtranf]=='E' && h>(vhor+4) && reg[m][vtranf]=='S') //numero transferido { Xseg[0]=buf[15]; Xseg[1]=buf[16]; Xseg[2]='\n'; Bseg = atoi(Xseg); Xmin[0]=buf[12]; Xmin[1]=buf[13]; Xmin[2]='\n'; Bmin = atoi(Xmin); Bhor = 0; BTIEMPO = Bhor * 3600 + Bmin * 60 + Bseg; Yseg[0]= reg[m][15]; Yseg[1]= reg[m][16]; Yseg[2]='\n'; Rseg = atoi(Yseg); Ymin[0]= reg[m][12]; Ymin[1]= reg[m][13]; Ymin[2]='\n'; Rmin = atoi(Ymin); Rhor = 0; RTIEMPO = Rhor * 3600 + Rmin * 60 + Rseg; EDURA = BTIEMPO - RTIEMPO; Tsegundos = EDURA % 60; Tminutos = EDURA / 60; Thoras = EDURA / 60; _itoa(Tsegundos,Esegundos,10); _itoa(Tminutos,Eminutos,10); _itoa(Thoras,Ehoras,10); tel[k++]= '0'; tel[k++]= '0'; tel[k++]= ':'; if ( Thoras > 9 ) { tel[k++]= Eminutos[0]; tel[k++]= Eminutos[1]; } else { tel[k++]='0' ; tel[k++]= Eminutos[0]; } tel[k++]= ':'; if ( Tsegundos> 9 ) { tel[k++]= Esegundos[0]; tel[k++]= Esegundos[1]; } else { tel[k++]= '0'; tel[k++]= Esegundos[0];} } } tel[k++]=' '; tel[k++]=buf[vhor];tel[k++]=buf[vhor+1];tel[k++]=':'; // hora tel[k++]=buf[vhor+3];tel[k++]=buf[vhor+4]; tel[k++]=' '; tel[k++]=buf[vfech+0]; tel[k++]=buf[vfech+1]; tel[k++]='/'; tel[k++]=buf[vfech+3]; tel[k++]=buf[vfech+4]; tel[k++]='/'; tel[k++]=buf[6]; tel[k++] = buf[7]; tel[k++]=' ' ; if ((buf[vestac])=='D') tel[k++]='O'; else tel[k++]='I'; tel[k++]=' '; if(encuentra && buf[vtranf]=='E' && h>(vdurac+9)) //&& reg[m][vtranf]=='S') //numero transferido { for(j=0;j < 14 && (vdurac+9+j)(vdurac+15) ) // caso especial muñoz tamayo { for (j=0;j<14 && vnumero < i;j++) { if isdigit(buf[vnumero+j]) tel[k++] = buf[vnumero+j]; } } else tel[k++]='*'; tel[k++]=' '; tel[k++]='*'; tel[k++]='*'; tel[k++]='*'; /* centro de costo */ tel[k++]=' '; // if(isdigit(password[0]) && buf[vtranf]!='N') //password para transferencias // if(isdigit(password[0])) if (encuentra && isdigit(reg[m][vfech-8]) && isdigit(reg[m][vfech-7])) { for(j=0;j<6;j++) tel[k++]=reg[m][vfech-8+j]; // if (buf[vtranf]=='E') password[0]='\0'; //borra password para transferencias } else if(encuentra &&tandem==0 && isdigit(reg[m][vproye]) && reg[m][vtranf]=='A' && reg[m][vproye+2]!=':') { for(j=0;vproye+j