#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 #define fech 37+posin #define tranf 0+posin #define numero 58+posin #define ccost 0 #define proye 49+posin #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[60][ladat], *cuf, *ruf, *buf2, lgua[lmax+3]; int aux=0,t=0,m=0,j,lb,i,y,h,cont,x=0,tpo=1, encuentra=0; //lb posicion de ruta+linea de buf 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<7 && (reg[m][lb+j]==buf[lb+j]); j++) //compara lineas+rutas if (j>=6) {encuentra=1; 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) { busca_lin(buf); if (!encuentra) {m=t;t++;} if ( !(reg[m][18]=='A' && buf[18]=='S')) {for(j=0;j<=i;j++) reg[m][j]=buf[j];} } void DatCentral(char *buf, char *tel, int vestac, int vlinea,int vdurac,int vhor, int vfech, int vtranf, int vnumero, int vccost,int vproye, int vcuenta, int vpulsos, int vruta, int vprinum, int vring, int vantran, int vfofech) { int k, j,paso; int acep_prim, acep_seg, saliente, entrante, trans_ini, trans_fin, trans_in, trans_out,proce, tandem; acep_prim=0; acep_seg=0; saliente=0; entrante=0; trans_ini=0; trans_fin=0; trans_in=0; trans_out=0; tandem=0;proce=1; k=0; encuentra=0; i=strlen(buf); //y=strlen(cuf); if (i>36 && buf[vruta-2]=='X' && tpo==1) proce=0; if ( i>36 && isdigit(buf[vtranf+3]) && (x!=0 || buf[vruta-1]!='X') && proce==1 && ( buf[vestac+7]==' ' || (buf[vestac+6]=='X' && buf[vestac+7]=='X') )) { x++;tpo=0; acep_prim = (i>(vdurac+2) && isalpha(buf[vtranf]) && buf[vestac+5]!='X' ); //primera línea válida acep_seg = (i>(vestac+2) && buf[vestac+6]=='X' ); //segunda línea válida saliente = (acep_prim && isalpha(buf[vestac+1])); //llamada saliente entrante = (acep_prim && isdigit(buf[vestac+1])) || (acep_seg && buf[vestac]=='A'); //llamada entrante /*isdigit(cuf[vestac+1]*/ trans_ini = (acep_prim && buf[vtranf]=='S'); //inicio de transferencia trans_fin = (acep_prim && buf[vtranf]=='E'); //fin de transferencia //TRANSFERENCIAS if (entrante) lb=vestac+1; //posicion de la línea buscada else lb=vruta; if (buf[vtranf]=='E' || buf[vtranf]=='N') busca_lin(buf); //transferncias: busca por linea el anexo desde donde se transfirió else if (/*buf[vtranf]=='S' ||*/ buf[vtranf]=='A') add_reg(buf); trans_in = (trans_fin && encuentra && isdigit(reg[m][vestac+1])); //transferencia entrante trans_out = (trans_fin && encuentra && isalpha(reg[m][vestac+1])); //transferencia saliente if(acep_prim && entrante && ( !trans_out || trans_in) && buf[vestac]!='T') { gua_buf(buf); cuf = lgua; return; } else if (acep_seg) { ruf=cuf; cuf=buf; buf=ruf; //cuf->buf y buf->cuf } tandem = (isdigit(buf[vestac+1]) && isdigit(buf[ruta])); //llamadas troncal-troncal paso=0; aux=0; // if ((buf[vestac+3]=='X' && cuf[vestac+3]=='X') || buf[vdurac+2]!=':') goto pasar; if ((acep_prim || acep_seg) && buf[vestac+5]!='X' /*&& cuf[vestac+5])*/ && buf[vtranf]!='A' && isdigit(buf[estac-3]) ) { i=strlen(buf); k=0; if ( buf[vestac]!='D' && buf[vruta-1]!='D' ) { tel[k++]='R'; //if (paso==1) for (j=0;j<3;j++) tel[k++]=buf[vestac+1+j]; saliente=1; //else if (paso==0) // for (j=0;j<3;j++) { tel[k++]=buf[vruta+j];} } else if (saliente) { for (j=0;j<4;j++) tel[k++]=buf[vestac+2+j]; } else if (entrante) { for (j=0;j<4;j++) tel[k++]=buf[vruta+1+j]; } else if (buf[vruta-1]=='D') { for (j=0;j<4;j++) tel[k++]=buf[vruta+1+j]; } else if (tandem>0) tel[k++]='*'; //anexo else tel[k++]='*'; tel[k++]=' '; if ( buf[vestac]!='D' && buf[vruta-1]!='D' )// lineA { //if (paso==1) for (j=0;j<3;j++) { tel[k++]=buf[vruta+3+j]; } //else if (paso==0) // for (j=0;j<3;j++) { tel[k++]=buf[vestac+4+j];} } else if (entrante) //línea { for (j=0;j<3;j++) tel[k++]=buf[vestac+4+j]; } else if (saliente) { for (j=0;j<3;j++) tel[k++]=buf[vlinea+j]; } else if (buf[vruta-1]=='D') //línea { for (j=0;j<3;j++) tel[k++]=buf[vestac+4+j]; } else tel[k++]='*'; tel[k++] = ' ' ; if (buf[vdurac+2]==':') { for(j=0;j<8;j++) tel[k++]=buf[vdurac+j] ; } else { tel[k++]='0';tel[k++]='0';tel[k++]=':';tel[k++]='0';tel[k++]='0';tel[k++]=':';tel[k++]='0';tel[k++]='0';} tel[k++] = ' ' ; if isdigit(buf[vhor]) { for(j=0;j<5;j++) tel[k++]=buf[vhor+j] ; } else tel[k++]='*'; 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 (encuentra && isalpha(reg[m][vestac+1])) tel[k++]='O'; if ( buf[vruta-1]=='D') tel[k++]='I'; //else if ( buf[vestac]!='D' && buf[vruta-1]!='D' && paso==0 ) tel[k++]='I'; else if ( buf[vestac]!='D' && buf[vruta-1]!='D' ) tel[k++]='O'; else if (buf[vestac]=='D') tel[k++]='O'; else if (trans_out) tel[k++]='O'; else if (entrante) tel[k++]='I'; else if (buf[vtranf]=='L') tel[k++]='T'; else tel[k++]='O'; tel[k++] = ' ' ; if ( buf[vestac]!='D' && buf[vruta-1]!='D' ) // numero {for (j=0;(vnumero+j)