search.cpp (bed-3.0.3.src.tar.xz) | : | search.cpp (bed-3.1.0.src.tar.xz) | ||
---|---|---|---|---|
#define SEARCHTIME 1 | //#define SEARCHTIME 1 | |||
#include "defines.h" | #include "defines.h" | |||
/* Bed a menu-driven multi dataformat binary editor for Linux */ | /* Bed a menu-driven multi dataformat binary editor for Linux */ | |||
/* Copyright (C) 1998 Jaap Korthals Altes <binaryeditor@gmx.com> */ | /* Copyright (C) 1998 Jaap Korthals Altes <binaryeditor@gmx.com> */ | |||
/* */ | /* */ | |||
/* This program is free software; you can redistribute it and/or modify */ | /* This program is free software; you can redistribute it and/or modify */ | |||
/* it under the terms of the GNU General Public License as published by */ | /* it under the terms of the GNU General Public License as published by */ | |||
/* the Free Software Foundation; either version 2 of the License, or */ | /* the Free Software Foundation; either version 2 of the License, or */ | |||
/* (at your option) any later version. */ | /* (at your option) any later version. */ | |||
/* */ | /* */ | |||
/* This program is distributed in the hope that it will be useful, */ | /* This program is distributed in the hope that it will be useful, */ | |||
skipping to change at line 166 | skipping to change at line 166 | |||
#else | #else | |||
endthread=true; | endthread=true; | |||
pthread_join(threadsearch,NULL); | pthread_join(threadsearch,NULL); | |||
backgroundsearch=0; | backgroundsearch=0; | |||
endthread=false; | endthread=false; | |||
#endif | #endif | |||
} | } | |||
}; | }; | |||
void * listthread(void *arg) { | void * listthread(void *arg) { | |||
sigset_t sigs; | ||||
struct threadgegs *geg=(struct threadgegs*)arg; | struct threadgegs *geg=(struct threadgegs*)arg; | |||
#ifdef HAVE_SIGADDSET | ||||
sigset_t sigs; | ||||
sigemptyset(&sigs); | sigemptyset(&sigs); | |||
sigaddset(&sigs,SIGINT); | sigaddset(&sigs,SIGINT); | |||
#ifdef DONTINTCURSES | #ifdef DONTINTCURSES | |||
sigaddset(&sigs, SIGUSR1) ; | sigaddset(&sigs, SIGUSR1) ; | |||
#endif | #endif | |||
sigaddset(&sigs,SIGWINCH); | sigaddset(&sigs,SIGWINCH); | |||
sigaddset(&sigs,SIGHUP); | sigaddset(&sigs,SIGHUP); | |||
sigaddset(&sigs,SIGCONT); | sigaddset(&sigs,SIGCONT); | |||
sigaddset(&sigs,SIGSTOP); | sigaddset(&sigs,SIGSTOP); | |||
sigaddset(&sigs,SIGTSTP); | sigaddset(&sigs,SIGTSTP); | |||
sigaddset(&sigs,SIGTERM); | sigaddset(&sigs,SIGTERM); | |||
sigaddset(&sigs,SIGQUIT); | sigaddset(&sigs,SIGQUIT); | |||
sigaddset(&sigs,SIGALRM); | sigaddset(&sigs,SIGALRM); | |||
pthread_sigmask(SIG_BLOCK,&sigs,NULL); | pthread_sigmask(SIG_BLOCK,&sigs,NULL); | |||
#endif | ||||
#ifdef USE_PTHREAD_CANCEL | #ifdef USE_PTHREAD_CANCEL | |||
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE ,NULL); | pthread_setcancelstate(PTHREAD_CANCEL_ENABLE ,NULL); | |||
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL); | pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL); | |||
#endif | #endif | |||
geg->ed->searchlister(geg->aim); | geg->ed->searchlister(geg->aim); | |||
myfree( geg->aim.str); | myfree( geg->aim.str); | |||
// delete geg->aim.datashown; | // delete geg->aim.datashown; | |||
#ifdef USE_PTHREAD_CANCEL | #ifdef USE_PTHREAD_CANCEL | |||
geg->aim.ant=NULL; | geg->aim.ant=NULL; | |||
geg->aim.part=NULL; | geg->aim.part=NULL; | |||
skipping to change at line 570 | skipping to change at line 573 | |||
part->reverse();\ | part->reverse();\ | |||
} | } | |||
#endif | #endif | |||
/* ask information | /* ask information | |||
Input: startstring, searchinfo | Input: startstring, searchinfo | |||
Output: search,searchlen, searchinfo, datatype | Output: search,searchlen, searchinfo, datatype | |||
mem.lastforward=forward|(cas<<1)|(reg<<2)|(boundary<<3); | mem.lastforward=forward|(cas<<1)|(reg<<2)|(boundary<<3); | |||
*/ | */ | |||
int subtypeoffset(const ScreenPart *part,const ScreenPart *super) { | ||||
int byt=0; | ||||
if(part->equal(super)) | ||||
return 0; | ||||
if(iscontain(super)) { | ||||
const Contains *con=(const Contains*)super; | ||||
for(int i=0;i<con->nrsubparts;i++) { | ||||
const ScreenPart *sub=con->subpart(i); | ||||
int subbyt=subtypeoffset(part,sub); | ||||
if(subbyt>=0) { | ||||
return byt+subbyt; | ||||
} | ||||
byt+=sub->bytes; | ||||
} | ||||
} | ||||
return -1; | ||||
} | ||||
int Editor::search(void) { | int Editor::search(void) { | |||
return searcher(0); | return searcher(0); | |||
} | } | |||
#define FOREVER | #define FOREVER | |||
#define ENDFOREVER(x) x: | #define ENDFOREVER(x) x: | |||
#define LEAVE(x) goto x; | #define LEAVE(x) goto x; | |||
#define findgetmode(foundmode)\ | #define findgetmode(foundmode)\ | |||
indatatype=0;\ | indatatype=0;\ | |||
FOREVER\ | FOREVER\ | |||
if(part->equal(parts[mode])) {\ | if(int byt=subtypeoffset(part,parts[mode]);byt>=0) {\ | |||
indatatype=byt;\ | ||||
LEAVE(foundmode)\ | LEAVE(foundmode)\ | |||
}\ | }\ | |||
if(iscontain(parts[mode])) {\ | ||||
if(part->equal(thesub)) {\ | ||||
\ | ||||
indatatype=getindatatype(thesub); \ | ||||
LEAVE(foundmode)\ | ||||
}\ | ||||
Contains *con=(Contains*)parts[mode];\ | ||||
int byt=0;\ | ||||
for(int i=0;i<con->nrsubparts;i++) {\ | ||||
if(part->equal(con->subparts[i])) {\ | ||||
indatatype=byt;\ | ||||
LEAVE(foundmode)\ | ||||
}\ | ||||
byt+=con->subparts[i]->bytes;\ | ||||
}\ | ||||
}\ | ||||
for(int i=0;i<nrparts;i++)\ | for(int i=0;i<nrparts;i++)\ | |||
if(i!=mode&&part->equal(parts[i])) {\ | if(i!=mode&&part->equal(parts[i])) {\ | |||
tomodenr(i);\ | tomodenr(i);\ | |||
LEAVE(foundmode)\ | LEAVE(foundmode)\ | |||
}\ | }\ | |||
installpart(part->newone(),0);\ | installpart(part->newone(),0);\ | |||
ENDFOREVER(foundmode) | ENDFOREVER(foundmode) | |||
extern char showfileinfo; | extern char showfileinfo; | |||
skipping to change at line 625 | skipping to change at line 630 | |||
stopthread(); | stopthread(); | |||
clearmessage(); | clearmessage(); | |||
return 0; | return 0; | |||
} | } | |||
clearmessage(); | clearmessage(); | |||
return -1; | return -1; | |||
} | } | |||
#endif | #endif | |||
ScreenPart *copythis=parts[mode]->newone(),*part,*digit=NULL,*ascii=NULL; | ScreenPart *copythis=parts[mode]->newone(),*part,*digit=NULL,*ascii=NULL; | |||
int fors,bins; | // int fors,bins; | |||
ScreenPart *thesub=parts[mode]->getsubpart(fors,bins, parts[mode]->half), | auto pro=progenitors(); | |||
*subpart; | ScreenPart *thesub=pro.back(), *subpart; | |||
// ScreenPart *thesub=parts[mode]->getsubpart(fors,bins, parts[mode]->half), | ||||
*subpart; | ||||
if(thesub&&thesub!=parts[mode]) { | if(thesub&&thesub!=parts[mode]) { | |||
// fprintf(stderr,"\nsubpart %s %s\n",thesub->getname(),parts[mode]- >getname()); | ||||
if(isasciimode(thesub)) { | if(isasciimode(thesub)) { | |||
part=ascii=thesub->newone(); | part=ascii=thesub->newone(); | |||
subpart=NULL; | subpart=NULL; | |||
} | } | |||
else { | else { | |||
if(isdigitmode(thesub)) { | if(isdigitmode(thesub)) { | |||
part=digit=thesub->newone(); | part=digit=thesub->newone(); | |||
subpart=NULL; | subpart=NULL; | |||
} | } | |||
else | else | |||
part=subpart=thesub->newone(); | part=subpart=thesub->newone(); | |||
} | } | |||
// for(auto el:pro) fprintf(stderr,"%s (%d) ",el->getname(),el->byte s); fprintf(stderr,"%s (%d) ",part->getname(),part->bytes); | ||||
} | } | |||
else { | else { | |||
// fprintf(stderr,"\nno subpart %s\n",parts[mode]->getname()); | ||||
subpart=NULL; | subpart=NULL; | |||
part=copythis; | part=copythis; | |||
} | } | |||
char ant[MAXSEARCHSTR]; ant[0]='\0'; | char ant[MAXSEARCHSTR]; ant[0]='\0'; | |||
char ascant[MAXSEARCHSTR]; | char ascant[MAXSEARCHSTR]; | |||
char bytes[maxbytes]; | char bytes[maxbytes]; | |||
char basestr[maxbase]; | char basestr[maxbase]; | |||
int flen=0,len,res=1,byt=1,dattype; | int flen=0,len,res=1,byt=1,dattype,regdattype; | |||
int oldbytes,oldorder; | int oldbytes,oldorder; | |||
int wlin=15,wcol=60; | int wlin=15,wcol=60; | |||
const int maxactive=30; | const int maxactive=30; | |||
char active[maxactive+5]; | char active[maxactive+5]; | |||
char subactive[maxactive+5]; | char subactive[maxactive+5]; | |||
bool reorder=false; | bool reorder=false; | |||
auto doreg= static_cast<std::underlying_type<RegexT>::type>(Stype.Regex); | auto doreg= static_cast<std::underlying_type<RegexT>::type>(Stype.Regex); | |||
if(askrepl) | if(askrepl) | |||
Stype.Regex=Stype.RegexReplace; | Stype.Regex=Stype.RegexReplace; | |||
skipping to change at line 726 | skipping to change at line 736 | |||
#define DEBUGUIT(...) | #define DEBUGUIT(...) | |||
DEBUGUIT("maxactive=%d, name=.%s., active=.%s.\n",maxactive, copythis->getname() ,active) | DEBUGUIT("maxactive=%d, name=.%s., active=.%s.\n",maxactive, copythis->getname() ,active) | |||
if(subpart) { | if(subpart) { | |||
int len=minnum((int)strlen(subpart->getname()),(maxactive-3)); | int len=minnum((int)strlen(subpart->getname()),(maxactive-3)); | |||
memcpy(subactive,subpart->getname(),len); | memcpy(subactive,subpart->getname(),len); | |||
subactive[len]='~'; | subactive[len]='~'; | |||
subactive[len+1]='.'; | subactive[len+1]='.'; | |||
subactive[len+2]='\0'; | subactive[len+2]='\0'; | |||
} | } | |||
Stype.Unit=Stype.keepUnit; | ||||
Stype.Align=Stype.keepAlign; | ||||
while(1) { | while(1) { | |||
int afterdata,forwardpos,cancelpos,placeascii,unitpos; | int afterdata,forwardpos,cancelpos,placeascii,unitpos=-4; | |||
const bool oldreg=doreg,oldforward=Stype.Forward,oldunit=Stype.Unit; | const bool oldreg=doreg,oldforward=Stype.Forward,oldunit=Stype.Unit; | |||
oldorder=reorder; | oldorder=reorder; | |||
oldbytes=byt; | oldbytes=byt; | |||
//#define placeascii 12 | //#define placeascii 12 | |||
#define startdia 1 | #define startdia 1 | |||
//fprintf(stderr,"Unit=%d\n",Stype.Unit); | ||||
initdialog(26); | initdialog(26); | |||
checkertrue("Rege~x",1+startdia,3, doreg); | checkertrue("Rege~x",1+startdia,3, doreg); | |||
if(doreg|| instance(part,Ascii)) | if(doreg|| instance(part,Ascii)) | |||
checker( "Ca~se",3+startdia,3,Stype.Case); | checker( "Ca~se",3+startdia,3,Stype.Case); | |||
if(doreg) { | if(doreg) { | |||
if(part->maxres>1) { | if(part->maxres>1) { | |||
Stype.Unit=Stype.keepUnit; | ||||
checkertrue( "~Unit",2+startdia,3,Stype.Unit);unitpos=sho wformsiter; | checkertrue( "~Unit",2+startdia,3,Stype.Unit);unitpos=sho wformsiter; | |||
} | } | |||
else Stype.Unit=0; | else Stype.Unit=0; | |||
#if defined(USE_RE2) || defined(USE_HYPERSCAN) | #if defined(USE_RE2) || defined(USE_HYPERSCAN) | |||
//#define regextype static_cast<underlying_type_t<Stype.Regex>>(Stype.Regex) | //#define regextype static_cast<underlying_type_t<Stype.Regex>>(Stype.Regex) | |||
#define regtype Stype.Regex //*reinterpret_cast<int *>(&Stype.Regex) /*Yes, C++ has an overly complicated syntax*/ | #define regtype Stype.Regex //*reinterpret_cast<int *>(&Stype.Regex) /*Yes, C++ has an overly complicated syntax*/ | |||
if(!(Stype.Forward||Stype.Unit)) { | if(!(Stype.Forward||Stype.Unit)) { | |||
skipping to change at line 778 | skipping to change at line 790 | |||
opt2("~GNU",1+startdia,23,RegType::RegGNU) | opt2("~GNU",1+startdia,23,RegType::RegGNU) | |||
#ifdef USE_RE2 | #ifdef USE_RE2 | |||
,opt2("~Re2",2+startdia,23,RegType::RegRE2) | ,opt2("~Re2",2+startdia,23,RegType::RegRE2) | |||
#endif | #endif | |||
); | ); | |||
} | } | |||
#endif | #endif | |||
} | } | |||
else | else | |||
Stype.Unit=0; | Stype.Unit=0; | |||
if(byt>1) { | if(byt>1||(doreg&&pro.size()>1)) { | |||
Stype.Align=Stype.keepAlign; | ||||
checker( "~Align",1+startdia,44,Stype.Align); | checker( "~Align",1+startdia,44,Stype.Align); | |||
} | } | |||
else | else | |||
Stype.Align=false; | Stype.Align=false; | |||
checkertrue( "For~ward",2+startdia,44,Stype.Forward); forwardpos=showform siter; | checkertrue( "For~ward",2+startdia,44,Stype.Forward); forwardpos=showform siter; | |||
checker( "~Edge file",3+startdia,44,Stype.Edge); | checker( "~Edge file",3+startdia,44,Stype.Edge); | |||
int selected=showformsiter; | int selected=showformsiter; | |||
if(askrepl) { | if(askrepl) { | |||
linerlennrmax("~Find:",flen,ant,5+startdia,6,43,MAXSEARCHSTR); | linerlennrmax("~Find:",flen,ant,5+startdia,6,43,MAXSEARCHSTR); | |||
skipping to change at line 806 | skipping to change at line 817 | |||
checkernr( "~List",8,3,Stype.List,2); | checkernr( "~List",8,3,Stype.List,2); | |||
#else | #else | |||
checker( "~List",8,3,Stype.List); | checker( "~List",8,3,Stype.List); | |||
#endif | #endif | |||
} | } | |||
oke(10+askrepl,3); | oke(10+askrepl,3); | |||
act("~Cancel", 12+askrepl,3); cancelpos=showformsiter; | act("~Cancel", 12+askrepl,3); cancelpos=showformsiter; | |||
checker( "~Keep",10+askrepl,10,Stype.Keep); | checker( "~Keep",10+askrepl,10,Stype.Keep); | |||
//if((!Stype.Regex)||standardascii(part)) { | //if((!Stype.Regex)||standardascii(part)) | |||
if((!doreg)) { | if((!doreg)) { | |||
saveact("Se~t", 10+askrepl,23); | saveact("Se~t", 10+askrepl,23); | |||
saveact("Co~nvert", 12+askrepl,20); | saveact("Co~nvert", 12+askrepl,20); | |||
placeascii=showformsiter; | placeascii=showformsiter; | |||
if(subpart) { | if(subpart) { | |||
optselect(dattype,dattype, | optselect(dattype,dattype, | |||
opt("Asc~ii",9+askrepl,30,0), | opt("Asc~ii",9+askrepl,30,0), | |||
opt("~Digit",10+askrepl,30,1), | opt("~Digit",10+askrepl,30,1), | |||
opt(active,11+askrepl,30,2), | opt(active,11+askrepl,30,2), | |||
opt(subactive,12+askrepl,30,3)); | opt(subactive,12+askrepl,30,3)); | |||
skipping to change at line 833 | skipping to change at line 844 | |||
opt(active,11+askrepl,30,2)); | opt(active,11+askrepl,30,2)); | |||
DEBUGUIT("active=.%s. ",active); | DEBUGUIT("active=.%s. ",active); | |||
afterdata=3; | afterdata=3; | |||
} | } | |||
linernrmax("~Base ",basestr,9+askrepl,45,3,maxbase); | linernrmax("~Base ",basestr,9+askrepl,45,3,maxbase); | |||
linernrmax("B~ytes: ",bytes,10+askrepl,45,3,maxbytes); | linernrmax("B~ytes: ",bytes,10+askrepl,45,3,maxbytes); | |||
if(byt>1) | if(byt>1) | |||
checker( "Re~verse",12+askrepl,45,reorder); | checker( "Re~verse",12+askrepl,45,reorder); | |||
else reorder=false; | else reorder=false; | |||
} | } | |||
else | else { | |||
const int prolen=pro.size(); | ||||
if(prolen>0) { | ||||
constexpr const int maxtype=maxactive+5; | ||||
char typestr[prolen][maxtype]; | ||||
bool didright=false,didleft=false; | ||||
const char usedkeys[]="acefghklorsuwx"; | ||||
const char *endkeys=usedkeys+sizeof(usedkeys)-1; | ||||
char nowused[10],*endnow=nowused; | ||||
beginoptions(regdattype) | ||||
int line=askrepl+8; | ||||
for(int i=0;i<prolen;i++) { | ||||
const char *name=pro[i]->getname(); | ||||
int pos=0; | ||||
for(;name[pos];pos++) { | ||||
char ch=tolower(name[pos]); | ||||
if(!std::binary_search(usedkeys,endkeys,ch)&&std: | ||||
:find(nowused,endnow,ch)==endnow) { | ||||
*endnow++=ch; | ||||
typestr[i][pos]='~'; | ||||
int len=strlen(name+pos); | ||||
memcpy(typestr[i]+pos+1,name+pos,len); | ||||
pos+=(len+1); | ||||
goto HAVEKEY; | ||||
} | ||||
typestr[i][pos]=name[pos]; | ||||
} | ||||
if(!didleft) { | ||||
snprintf(typestr[i]+pos,maxtype-pos," ~(%d)",pro[ | ||||
i]->bytes); | ||||
didleft=true; | ||||
} | ||||
else { | ||||
if(!didright) { | ||||
snprintf(typestr[i]+pos,maxtype-pos," (%d | ||||
~)",pro[i]->bytes); | ||||
didright=true; | ||||
} | ||||
else { | ||||
HAVEKEY: | ||||
snprintf(typestr[i]+pos,maxtype-pos," (%d | ||||
)",pro[i]->bytes); | ||||
} | ||||
} | ||||
opt(typestr[i],line++,30,i); | ||||
} | ||||
endoptions(prolen-1) | ||||
} | ||||
placeascii=afterdata=100; | placeascii=afterdata=100; | |||
} | ||||
dodialog(res,wlin,wcol,selected); | dodialog(res,wlin,wcol,selected); | |||
auto changedatatype =[&]() { | auto changedatatype =[&]() { | |||
switch(dattype) { | switch(dattype) { | |||
case 0:if(!isasciimode(copythis)) { | case 0:if(!isasciimode(copythis)) { | |||
if(!ascii) { | if(!ascii) { | |||
ascii=new Ascii(this);\ | ascii=new Ascii(this);\ | |||
} | } | |||
part=ascii; | part=ascii; | |||
skipping to change at line 893 | skipping to change at line 949 | |||
if(subpart) | if(subpart) | |||
delete subpart; | delete subpart; | |||
editup(); | editup(); | |||
Stype.Regex=static_cast<decltype(Stype.Regex)>(doreg); | Stype.Regex=static_cast<decltype(Stype.Regex)>(doreg); | |||
if(byt==1) | if(byt==1) | |||
Stype.Align=Stype.keepAlign; | Stype.Align=Stype.keepAlign; | |||
Stype.Unit=oldunit; | Stype.Unit=oldunit; | |||
return -1; | return -1; | |||
} | } | |||
else { | else { | |||
if((unitpos=res&&oldunit!=Stype.Unit)||(forwardpos=res&&o | //fprintf(stderr,"Align=%d, keepalign=%d\n", Stype.Align,Stype.keepAlign) | |||
ldforward!=Stype.Forward)||(res==1&&oldreg!=doreg)) | ; | |||
//fprintf(stderr,"new Unit=%d oldunit=%d res=%d, unitpos=%d\n",Stype.Unit | ||||
,oldunit,res,unitpos); | ||||
if((unitpos==res&&oldunit!=Stype.Unit)||(forwardpos==res& | ||||
&oldforward!=Stype.Forward)||(res==1&&oldreg!=doreg)) | ||||
continue; | continue; | |||
if(res==INT_MAX) { | if(res==INT_MAX) { | |||
menuresized(); | menuresized(); | |||
wrefresh(editscreen); | wrefresh(editscreen); | |||
continue; | continue; | |||
} | } | |||
char *endp; | char *endp; | |||
byt=mystrtol(bytes,&endp,10); | byt=mystrtol(bytes,&endp,10); | |||
if(bytes==endp) | if(bytes==endp) | |||
byt=oldbytes; | byt=oldbytes; | |||
tmode=mystrtol(basestr,&endp,10); | tmode=mystrtol(basestr,&endp,10); | |||
if(basestr==endp) | if(basestr==endp) | |||
tmode=oldtm; | tmode=oldtm; | |||
res-=(placeascii+1); | res-=(placeascii+1); | |||
if(res>=-1&&res<20) { | if(res>=-1&&res<20) { | |||
// fprintf(stderr," if(res>=-1&&res<20) {"); | ||||
if(res==(afterdata+2)) | if(res==(afterdata+2)) | |||
reorder=!oldorder; | reorder=!oldorder; | |||
if(res>=0&&res<afterdata) | if(res>=0&&res<afterdata) | |||
dattype=res; | dattype=res; | |||
len=makebytes(part,(unsigned char*)ascant,MAXSEAR CHSTR, (unsigned char*)ant, flen); | len=makebytes(part,(unsigned char*)ascant,MAXSEAR CHSTR, (unsigned char*)ant, flen); | |||
// if(rtmp) // askrepl | // if(rtmp) // askrepl | |||
if(askrepl) | if(askrepl) | |||
rlen= makebytes(part,(unsigned char *)rtm p,MAXSEARCHSTR,(unsigned char*)rep, rlen) ; | rlen= makebytes(part,(unsigned char *)rtm p,MAXSEARCHSTR,(unsigned char*)rep, rlen) ; | |||
changedatatype(); | changedatatype(); | |||
flen=frombytes(part,(unsigned char*)ant,(unsigned char*)ascant,len,MAXSEARCHSTR); | flen=frombytes(part,(unsigned char*)ant,(unsigned char*)ascant,len,MAXSEARCHSTR); | |||
skipping to change at line 952 | skipping to change at line 1011 | |||
output("Use space to clear"); | output("Use space to clear"); | |||
beep(); | beep(); | |||
erefresh(); | erefresh(); | |||
continue; | continue; | |||
} | } | |||
if(replacestr) | if(replacestr) | |||
myfree( replacestr); | myfree( replacestr); | |||
replacestr=myallocar( char,(rlen+1)*byt); | replacestr=myallocar( char,(rlen+1)*byt); | |||
} | } | |||
} | } | |||
if(doreg) { | ||||
if(regdattype!=(pro.size()-1)) { | ||||
if(part==subpart) | ||||
delete part; | ||||
subpart=part=pro[regdattype]->newone(); | ||||
} | ||||
} | ||||
if((!doreg)||standardascii(part)) { | if((!doreg)||standardascii(part)) { | |||
changedatatype(); | changedatatype(); | |||
len= makebytes(part,(unsigned char *)ascant,MAXSEARCHSTR,(unsigne d char *)ant, flen) ; | len= makebytes(part,(unsigned char *)ascant,MAXSEARCHSTR,(unsigne d char *)ant, flen) ; | |||
if(!len&&ant[0]) { | if(!len&&ant[0]) { | |||
output("Conversion failed"); | output("Conversion failed"); | |||
erefresh(); | erefresh(); | |||
continue; | continue; | |||
} | } | |||
if(askrepl) { | if(askrepl) { | |||
replacestrlen=makebytes(part,(unsigned char*)replacestr,M AXSEARCHSTR,(unsigned char*)rep, rlen); | replacestrlen=makebytes(part,(unsigned char*)replacestr,M AXSEARCHSTR,(unsigned char*)rep, rlen); | |||
skipping to change at line 1019 | skipping to change at line 1085 | |||
Stype.Raw=true; | Stype.Raw=true; | |||
else | else | |||
Stype.Raw=false; | Stype.Raw=false; | |||
if(Stype.Regex&&part->maxres>1) | if(Stype.Regex&&part->maxres>1) | |||
Stype.keepUnit=Stype.Unit; | Stype.keepUnit=Stype.Unit; | |||
if(part->bytes>1) | if(part->bytes>1) | |||
Stype.keepAlign=Stype.Align; | Stype.keepAlign=Stype.Align; | |||
if(Stype.Keep) | if(Stype.Keep) | |||
searchdefault(); | searchdefault(); | |||
if(!isleaf(part)) { | ||||
static_cast<HasSub *>(part)->active=-1; | ||||
} | ||||
lastaim = {.sense=Stype.Case,.doreplace=askrepl,.len=len,.align=part->byt es,.str=(signed char *)ascant,.matchlen=len, .start= searchstartpos() , .datasho wn=part}; | lastaim = {.sense=Stype.Case,.doreplace=askrepl,.len=len,.align=part->byt es,.str=(signed char *)ascant,.matchlen=len, .start= searchstartpos() , .datasho wn=part}; | |||
editup(); | editup(); | |||
if(ascii&&ascii!=part) | if(ascii&&ascii!=part) | |||
delete ascii; | delete ascii; | |||
if(digit&&digit!=part) | if(digit&&digit!=part) | |||
delete digit; | delete digit; | |||
if(copythis&©this!=part) | if(copythis&©this!=part) | |||
delete copythis; | delete copythis; | |||
if(subpart&&subpart!=part) | if(subpart&&subpart!=part) | |||
delete subpart; | delete subpart; | |||
End of changes. 24 change blocks. | ||||
32 lines changed or deleted | 106 lines changed or added |