columnwiserepl()
By SalimMeghani
- 279 reads
void columnwiserepl(HWND hWnd, int repstrx, int repstry, int rependx, int rependy, int repfrmx, int repfrmy, int y, char *nwdll,char *dcell)
{
int gloop=0;
int dloop=0;
int crloop=0;
int alloop=0;
int locx=0;
int locy=0;
int prvalue=0;
char cref[20];
char alpp[20];
char num[20];
char source;
while (dcell[gloop]!='#')
{
while(isdigit(dcell[gloop]) || isstop(dcell[gloop]) || isoperator(dcell[gloop]) || isbracket(dcell[gloop]) || (dcell[gloop]=='E') || ( (gloop>=1) && isdigit(dcell[gloop-1]) && (dcell[gloop]=='e')))
{
nwdll[dloop]=dcell[gloop];
dloop++;
gloop++;
}
if (dcell[gloop]=='#') break;
if (isalpha(dcell[gloop]))
{
crloop=0;
do
{
cref[crloop]=dcell[gloop];
gloop++;
crloop++;
}
while (isalpha(dcell[gloop])||isdigit(dcell[gloop]));
}
cref[crloop]='\0';
crloop=0;
alloop=0;
prvalue=0;
while(isalpha(cref[crloop]) || isdigit(cref[crloop]))
{
if (isalpha(cref[crloop])) {nwdll[dloop]=cref[crloop]; dloop++;prvalue++;}
else
if (isdigit(cref[crloop])) {alpp[alloop]=cref[crloop]; alloop++;}
crloop++;
}
alpp[alloop]='\0';
if (prvalue == 1)
locx = nwdll[dloop - 1] - 96;
else
if (prvalue==2)
locx=((nwdll[dloop-2]-96)*26)+nwdll[dloop-1]-96;
else
{
locx=0;
errflag=1;
return;
}
clr_str(cref);
locy=atoi(alpp);
if ((locx<1)||(locx>100))
{
errflag=1;
return;
}
if ((locy<1)||(locy>100))
{
errflag=1;
return;
}
if (y<=9){
nwdll[dloop]=48+y;
dloop++;}
else if ( y <= 99) {
sprintf(alpp, "%d", y);
nwdll[dloop] = alpp[0];
dloop++;
nwdll[dloop] = alpp[1];
dloop++;
}
else {
sprintf(alpp, "%d", y);
nwdll[dloop] = alpp[0];
dloop++;
nwdll[dloop] = alpp[1];
dloop++;
nwdll[dloop] = alpp[2];
dloop++;
}
}
nwdll[dloop]='#';
dloop++;
nwdll[dloop]='\0';
}
- Log in to post comments