Пример #1
0
int ie_savebin(struct bin_file *fajl)
{
 int f,i=0,l;
 char *r;

#ifdef POSIX
 f = a_open( fajl->filename, O_WRONLY | O_CREAT | O_TRUNC, S_IREAD|S_IWRITE);
#else
 f = a_sopen( fajl->filename, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC,
     SH_COMPAT | SH_DENYNONE, S_IREAD|S_IWRITE );
#endif
 if ( f == -1 ) return 2; //error while opening

 while(i<fajl->len)
 {
  r=ie_getswap(fajl->lineadr[i]);
  if (r!=NULL)
  {
   l=fajl->linesize[i];
   if(write(f,&l,sizeof(unsigned short))!=sizeof(unsigned short)) 
    {a_close (f); return 4;} //write error!
   if(write(f,r,l)!=l) 
    {a_close (f); return 4;} //write error!
  }//endif
  i++;
 }//loop
 a_close(f);
 fajl->modified=0;
 return 1;
}//end sub
Пример #2
0
//close HTML atom == set coordinates of right bottom corner
char closeatom(XSWAP adr,int deltax,long absy)
{
 char expand=0;
 struct HTMLrecord *atomptr;


 if(adr!=IE_NULL)
 {
  atomptr=(struct HTMLrecord *)ie_getswap(adr);
  if(atomptr)
  {
   if(abs((int)atomptr->x+deltax-(int)atomptr->xx)>FUZZYPIX)
    expand=1;
   p->xsum+=(atomptr->x+deltax)-atomptr->xx;
   atomptr->xx=atomptr->x+deltax;
   if(absy) //0...don't overwrite!
    atomptr->yy=absy;
   swapmod=1;
  }
  else
//!!glennmcc: Mar 03, 2007 -- too many atoms, return instead of crashing
//"Page too long !" message will then be displayed
//and the incomplete page can be viewed.
return NULL;
//   MALLOCERR();
//!!glennmcc: end
 }
 return expand;
}//end if
Пример #3
0
void ReadWriteTextarea(char sw)
{
 struct HTMLrecord *aptr=(struct HTMLrecord *)ie_getswap(focusedatom);
 char fname[80];
 if(aptr)
 {
  memcpy(&activeatom,aptr,sizeof(struct HTMLrecord));
  activeatomptr=&activeatom;
  activeadr=focusedatom;
  getTXTprompt(fname,79);
  editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr);
  if(editorptr)
  {
   memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor));
   if(sw==INPUT_READFILE)
   {
    ie_insblock(&tmpeditor,fname);
    editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr);
    if(editorptr)
    {
     memcpy(editorptr,&tmpeditor,sizeof(struct ib_editor));
     swapmod=1;
    }
    else
     MALLOCERR();
   }
   else
   {
    strcpy(tmpeditor.filename,fname);
    outs(MSG_WRITE);
    ie_savef(&tmpeditor);
   }
  }
  else
   MALLOCERR();
  redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL);
  activeatomptr=&activeatom;
  activeadr=focusedatom;
  activeatomcursor(1);
 }//end if pointer exists - else "nonfatal error"
}
Пример #4
0
//delete file from memory:
void ie_resetbin(struct bin_file *fajl)
{
 int i=0;

 while(i<fajl->len)
 {
  if (ie_getswap(fajl->lineadr[i]))
   ie_delswap(fajl->lineadr[i],fajl->linesize[i]);
  i++;
 }//loop

 fajl->len=0;
}//end sub
Пример #5
0
void getTXTprompt(char *str,int lim)
{
 char *ptr;

 editorptr=(struct ib_editor *)ie_getswap(TXTprompt.ptr);
 if(!editorptr)
   MALLOCERR();
 memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor));
 ptr=ie_getline(&tmpeditor,0);
 if(!ptr)
   MALLOCERR();
 makestr(str,ptr,lim);
}
Пример #6
0
//Meni j*z existujici radku (tr.: changes already existing line)
//-------------------------
XSWAP ie_chngswap(char*line, XSWAP adr, int context)
{
 char *ptr;
 XSWAP lswap,ladr;

 ptr=ie_getswap(adr);
 if(ptr!=NULL)
 {
  if(strlen(ptr)==strlen(line))
  {
   lswap = adr & 0xFC00;
   lswap >>= 10;
   ladr  = adr & 0x3FF;
   if(ladr>swaplen[lswap]) return IE_NULL; //erroneous address !
   if(ie_swap(lswap)!=1) return IE_NULL;
   if(swapidx[ladr]<IE_SWAPSTART) return IE_NULL; //(implicitne je tam totiz nula)
          // tr.: because implicitely there is zero
   strcpy(&swapstr[swapidx[ladr]],line);
   swapmod=1;
   return adr;
  }
  else
   if (ie_delswap(adr,-1)!=1) return IE_NULL;
Пример #7
0
Файл: PRINT.C Проект: ifilex/SRC
void generateprt(void)
{
 unsigned currentHTMLatom;
 struct ib_editor txt;
 int x,y,l,k;
 char radka[IE_MAXLEN+2], *ptr;
 struct HTMLrecord *atomptr;

/* printf("Console width is: %d\n\n",CONSOLEWIDTH);
#ifndef CLEMENTINE
 fflush(stdout);
#endif*/
 
 ie_openf_lim(&txt,CONTEXT_TMP,MAXLINES2PRINT);
 strcpy(txt.filename,PRINTFNAME);

 currentHTMLatom=p->firstHTMLatom;

 while(currentHTMLatom!=IE_NULL)
 {
//  kbhit();
  atomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom);
  if(!atomptr)
   MALLOCERR();
  currentHTMLatom=atomptr->next;

  if(atomptr->frameID==p->activeframe &&
     atomptr->type==TEXT ||
     atomptr->type==HR ||
     atomptr->type==LI ||
     atomptr->type==TD_BACKGROUND ||
     (atomptr->type==TD)
      && (atomptr->data1 || atomptr->data2) ||
     (atomptr->type==TABLE)
      && (atomptr->data1) ||
     atomptr->type==INPUT
      && (atomptr->data1==TEXT ||
          atomptr->data1==SUBMIT ||
          atomptr->data1==BUTTON))

  {
   x=atomptr->x/FIXEDFONTX;
   y=(int)((atomptr->y+FIXEDFONTY/2-1)/FIXEDFONTY);

   if(x>=0 && x<IE_MAXLEN && y>=0 && y<MAXLINES2PRINT)
   {
    if(atomptr->type==LI)
    {
     if(x>0)x--;
     virtualtextdraw(&txt,x,y,"*",1);
    }
    else
    if(atomptr->type==HR || atomptr->type==TD ||
       atomptr->type==TD_BACKGROUND || atomptr->type==TABLE)
    {
     char z='-';
     int yy;
     if(atomptr->type==HR)
      z='=';

     l=atomptr->xx/FIXEDFONTX-x;
     if(l<0)l=0;
     if(l>IE_MAXLEN)l=IE_MAXLEN;
     radka[l]='\0';
     k=l;
     while(--k>=0)
      radka[k]=z;

     if(atomptr->type==TD || atomptr->type==TD_BACKGROUND)
     {
      strcat(radka,"+-");
      yy=(int)((atomptr->yy+FIXEDFONTY/2)/FIXEDFONTY);

      while(y<yy)
       virtualtextdraw(&txt,x+l,y++,"|",1);

      l++; //+-
     }
     else
     if(atomptr->type==TABLE)
     {
      radka[0]=',';
      yy=(int)(atomptr->yy/FIXEDFONTY)-1;

      while(yy>y)
       virtualtextdraw(&txt,x,yy--,"|",1);

      l--;
     }

     virtualtextdraw(&txt,x,y,radka,l);
    }
    else
    {
     if(atomptr->type==INPUT)
     {
      editorptr=(struct ib_editor *)ie_getswap(atomptr->ptr);
      if(editorptr)
      {
       memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor));
       ptr=ie_getline(&tmpeditor,0);
      }
      else
       ptr=NULL;
     }
     else
      ptr=ie_getswap(atomptr->ptr);

     if(!ptr)
      memerr();

     l=strlen(ptr);
     if(l+x>IE_MAXLEN)l=IE_MAXLEN-x;
     if(l<0)l=0;
     makestr(radka,ptr,l);
     virtualtextdraw(&txt,x,y,radka,l);
    }
   }
  }
 }
 if(txt.lines+4<txt.maxlines)
 {
  int l;

  ie_insline(&txt,0,"");

  memset(radka,'_',CONSOLEWIDTH);
  radka[CONSOLEWIDTH]='\0';
  ie_insline(&txt,0,radka);

  memset(radka,' ',CONSOLEWIDTH);
  l=strlen(p->htmlframe[p->activeframe].cacheitem.URL);
  if(l>CONSOLEWIDTH-28)
  {
   l=CONSOLEWIDTH-28;
   strncpy(&radka[CONSOLEWIDTH-28],"...",3);
  }
  strncpy(radka,p->htmlframe[p->activeframe].cacheitem.URL,l);
  inettime(&radka[CONSOLEWIDTH-25]);
  ie_insline(&txt,0,radka);

   memset(radka,' ',CONSOLEWIDTH);
  l=strlen(arachne.title);
  if(l>CONSOLEWIDTH-16)
  {
   l=CONSOLEWIDTH-16;
   strncpy(&radka[CONSOLEWIDTH-16],"...",3);
  }
  strncpy(radka,arachne.title,l);
//!!glennmcc: Jan 26, 2005 -- keep aligned regardless of changes to VER
//also added lowercase 'v' in front of version number
  sprintf(&radka[CONSOLEWIDTH-(9+strlen(VER))],"Arachne v%s",VER);
//  sprintf(&radka[CONSOLEWIDTH-17],"Arachne %s",VER);
//!!glennmcc: end
  ie_insline(&txt,0,radka);
 }
 {
  char ffeed[2]=" ";
  ffeed[0]=12; //form feed?

  ie_insline(&txt,txt.lines,ffeed);
 }
 ie_savef(&txt);

 ie_killcontext(CONTEXT_TMP); //clear temporary file
// ie_closef(&txt);

}
Пример #8
0
//. Mix only the paletes on screen (visible)
void MixVisiblePaletes(char writepal)
{

 int pocet=0,i,celkpocet=0;
 int secidx[MAXPALMIX+1];
 XSWAP atomadr[MAXPALMIX+1];
 struct picinfo *dataptr;
 struct picinfo *obrazky;
 struct Url url;
 int maxpocet;//,frameID;
 XSWAP dummy1;
 unsigned dummy2;
 unsigned currentHTMLatom=p->firstHTMLatom,nextHTMLatom;
 struct HTMLframe *frame;
 struct HTMLrecord *imgatomptr;
 struct HTTPrecord HTTPdoc;
// struct TMPframedata *htmldata;

#ifdef POSIX
 maxpocet=MAXPALMIX;
#else 
 maxpocet=(int)((farcoreleft()-2000l)/(5500+sizeof(struct picinfo)));
 if(maxpocet>MAXPALMIX)
  maxpocet=MAXPALMIX;
 else if(maxpocet<1)
  maxpocet=1;
#endif

 obrazky=farmalloc(sizeof(struct picinfo)*maxpocet);
 if(!obrazky)memerr();

// while(HTMLdoc.cur<HTMLdoc.len)
 while(currentHTMLatom!=IE_NULL)
 {
  kbhit();
  imgatomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom);
  if(!imgatomptr)
   MALLOCERR();
  nextHTMLatom=imgatomptr->next;
  frame=&(p->htmlframe[imgatomptr->frameID]);
  if( (imgatomptr->type==IMG || imgatomptr->type==TD_BACKGROUND) &&
      (imgatomptr->y>=frame->posY ||
       imgatomptr->yy>=frame->posY) &&
      (imgatomptr->y<frame->posY+frame->scroll.ysize ||
       imgatomptr->yy<frame->posY+frame->scroll.ysize) &&
      (imgatomptr->x>=frame->posX ||
       imgatomptr->xx>=frame->posX) &&
      (imgatomptr->x<frame->posX+frame->scroll.xsize ||
       imgatomptr->xx<frame->posX+frame->scroll.xsize)
      || imgatomptr->type==BACKGROUND)
  {
//   idx[celkpocet]=HTMLdoc.cur;
   atomadr[celkpocet]=currentHTMLatom;
   dataptr=(struct picinfo *)ie_getswap(imgatomptr->ptr);
   if(dataptr)
   {
    dataptr->palismap=0;
    swapmod=1;

    if(celkpocet<MAXPALMIX)
    {
     memcpy(&obrazky[pocet],dataptr,sizeof(struct picinfo));
     AnalyseURL(obrazky[pocet].URL,&url,IGNORE_PARENT_FRAME);
     if(SearchInCache(&url,&HTTPdoc,&dummy1,&dummy2))
     {
      i=0;
      while(i<pocet)
      {
       if(!strcmp(obrazky[i].filename,HTTPdoc.locname))
       {
        secidx[celkpocet++]=i;
        goto nextobrazek;
       }
       i++;
      }
      //pocitaji se jenom GIFy a bitmapy:
      // tr.: only GIFs and bitmaps are counted/calculated
      if(HTTPdoc.locname[0] &&
      (strstr(HTTPdoc.locname,".GIF") ||
       strstr(HTTPdoc.locname,".BMP")))
      {
       strcpy(obrazky[pocet].filename,HTTPdoc.locname);
       secidx[celkpocet++]=pocet; //u prvniho obrazku 0, u druheho 1;
         // tr.: at the first picture 0, at the second 1
       pocet++;
      }

      if(pocet==maxpocet)
       goto allobrazky;

     }


    }
    else
     goto allobrazky;

   }//endif nasel sem neco (tr.: endif I found something)
   else
    MALLOCERR();

  }
  nextobrazek:
//  HTMLdoc.cur++;
  currentHTMLatom=nextHTMLatom;
 }
 allobrazky:


 i=0;
 if(celkpocet>0)
 {
  if(!MixPal(obrazky,pocet,writepal)) //zkusim smichat palety...
    // tr.: I try to mix the palette
   goto ven;
  while(i<celkpocet)
  {

   //zrychlena verze (tr.: accelerated version)
   imgatomptr=(struct HTMLrecord *)ie_getswap(atomadr[i]);
   if(imgatomptr && (imgatomptr->type==IMG || imgatomptr->type==BACKGROUND || imgatomptr->type==TD_BACKGROUND))
   {
    dataptr=(struct picinfo *)ie_getswap(imgatomptr->ptr);
    if(dataptr)
    {
     int resize_x=dataptr->resize_x;
     int resize_y=dataptr->resize_y;
     memcpy(dataptr,&obrazky[secidx[i]],sizeof(struct picinfo));
     dataptr->resize_x=resize_x;
     dataptr->resize_y=resize_y;
     swapmod=1;
    }
    else
     MALLOCERR();
   }
   else
    MALLOCERR();
   i++;
  }
 }
 ven:
 if(obrazky) farfree(obrazky);
}
Пример #9
0
//called after the current line has been processed
void alignrow(int x,long y,int islist)
{
 int xhop;
 //int idx;
 long vsize;
 unsigned currentHTMLatom=p->lastHTMLatom;
 struct HTMLrecord *atomptr;

 if(p->HTMLatomcounter==0)
  return;

 if(!p->sizeTextRow)p->sizeTextRow=p->sizeRow;

 alignloop:
 atomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom);
 if(!atomptr)
//!!glennmcc: Mar 03, 2007 -- too many atoms, return instead of crashing
//"Page too long !" message will then be displayed
//and the incomplete page can be viewed.
return;
//  MALLOCERR();
//!!glennmcc: end
 if(atomptr->y==y && //eliminate unclosed buttons:
   !(atomptr->type==INPUT && (atomptr->data2 & 2) && atomptr->x==atomptr->xx) &&
    !(atomptr->type==TD || atomptr->type==TD_BACKGROUND ||
      atomptr->type==TABLE || atomptr->type==NAME))
 {
  if(atomptr->align & BOTTOM) //ALIGN=BOTTOM
  {
   if(atomptr->type==TEXT) //text
   {
    atomptr->y+=p->sizeTextRow;
    atomptr->yy=atomptr->y;
    atomptr->y-=fonty((int)atomptr->data1,atomptr->data2);
   }
   else if(atomptr->type!=INPUT || ! (atomptr->data2 & 2))
        //^^^^^^^^^^^^^^^^^ this is for <BUTTON> tags
   {
    vsize=atomptr->yy-atomptr->y;
    atomptr->y+=p->sizeRow;
    atomptr->yy=atomptr->y;
    atomptr->y-=vsize;
   }
   swapmod=1; //I have written to swapped memory!
  }

  if(atomptr->align & CENTER) //ALIGN=CENTER
  {
   xhop=(p->docRight-x)/2;
   atomptr->x+=xhop;
   atomptr->xx+=xhop;
   swapmod=1; //I have written to swapped memory!
  }
  else
  if(atomptr->align & RIGHT) //ALIGN=RIGHT
  {
   xhop=(p->docRight-x);
   atomptr->x+=xhop;
   atomptr->xx+=xhop;
   swapmod=1; //I have written to swapped memory!
  }

  if(atomptr->align & SUP) //ALIGN=SUP
  {
   vsize=fonty((int)atomptr->data1,atomptr->data2)/3;
   atomptr->y-=vsize;
   atomptr->yy-=vsize;
   swapmod=1; //I have written to swapped memory!
  }

  if(atomptr->align & SUB) //ALIGN=SUB
  {
   vsize=fonty((int)atomptr->data1,atomptr->data2)/3;
   atomptr->y+=vsize;
   atomptr->yy+=vsize;
   swapmod=1; //I have written to swapped memory!
  }

  atomptr->align=0;
  if(atomptr->prev!=IE_NULL && atomptr->yy>y)
  {
   currentHTMLatom=atomptr->prev;
   goto alignloop;
  }
 }
 if(p->docClearRight && y+p->sizeRow>=p->docClearRight)
 {
  p->docRight=p->docRightEdge;
  p->docClearRight=0;
 }
 if(p->docClearLeft && y+p->sizeRow>=p->docClearLeft)
 {
  if(islist==0)p->docLeft=p->docLeftEdge;
  p->docClearLeft=0;
 }

 p->sizeTextRow=0;
}//end sub
Пример #10
0
//add atom to metafile
void addatom(struct HTMLrecord *atom,void *ptr,int len,char t, char align,
           char d1, unsigned char d2,unsigned currentlink,char norightedge)
{
 unsigned dataptr,prevHTMLatom=p->lastHTMLatom;

 // printf("Adding atom of type %d...\n",t);

 if(len==0 && t==TEXT) return;


 if(len)
  dataptr=ie_putswap((char *)ptr,len,CONTEXT_HTML);
 else
  dataptr=IE_NULL;
 atom->type=t;
 atom->align=align;
 atom->data1=d1;
 atom->data2=d2;
// atom->R=r;   //this comes pre-defined in HTML atom...
// atom->G=g;
// atom->B=b;
 atom->ptr=dataptr;
 atom->datalen=len;
 atom->linkptr=currentlink;
 atom->next=IE_NULL;
 atom->prev=prevHTMLatom;
 atom->frameID=p->currentframe;
#ifdef JAVASCRIPT
 atom->jsptr=IE_NULL;
#endif

 p->lastHTMLatom=ie_putswap((char *)atom,sizeof(struct HTMLrecord),CONTEXT_HTML);
 if(p->firstHTMLatom==IE_NULL)
  p->firstHTMLatom=p->lastHTMLatom;
 else
 {
  struct HTMLrecord *atomptr=(struct HTMLrecord *)ie_getswap(prevHTMLatom);
  if(atomptr)
  {
   atomptr->next=p->lastHTMLatom;
   swapmod=1;
  }
  else
//!!glennmcc: Mar 03, 2007 -- too many atoms, return instead of crashing
//"Page too long !" message will then be displayed
//and the incomplete page can be viewed.
return;
//   MALLOCERR();
//!!glennmcc: end
 }

 if(p->lastHTMLatom==IE_NULL)
 {
  p->memory_overflow=1;
  return;
 }
 else
  p->HTMLatomcounter++;

 if(!norightedge)
 {
  if(atom->xx>p->docRight)
   p->docRight=atom->xx;
  if(atom->xx>p->docRightEdge)
   p->docRightEdge=atom->xx;
  if(atom->xx+HTMLBORDER>p->htmlframe[p->currentframe].scroll.total_x)
   p->htmlframe[p->currentframe].scroll.total_x=atom->xx+HTMLBORDER;

  p->xsum+=(long)(atom->xx-atom->x);
 }

}
Пример #11
0
//search in HTML document
void SearchString(void)
{
 struct HTMLrecord HTMLatom,foundatom;
 unsigned currentHTMLatom=p->firstonscr,foundHTMLatom,nextHTMLatom;
 struct HTMLframe *frame=&(p->htmlframe[p->activeframe]);
 long minY=0l;
 char *str,*tmp,*foundstr,*ptr,found=0;
 struct HTMLrecord *atomptr;

 str=farmalloc(IE_MAXLEN+2);
 tmp=farmalloc(IE_MAXLEN+2);
 foundstr=farmalloc(IE_MAXLEN+2);
 if(!str || !tmp || !foundstr)
  memerr();

 getTXTprompt(str,IE_MAXLEN);

 if(p->HTMLatomcounter>1000)
 {
  sprintf(tmp,MSG_SRCH1,str);
  outs(tmp);
 }
 strlwr(str);

 while(currentHTMLatom!=IE_NULL)
 {
//  kbhit();
  atomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom);
  if(!atomptr)
   MALLOCERR();
  nextHTMLatom=atomptr->next;
  if(atomptr->type==TEXT && atomptr->frameID==p->activeframe &&
     atomptr->y>=frame->posY)
  {
   memcpy(&HTMLatom,atomptr,sizeof(struct HTMLrecord));
   ptr=ie_getswap(atomptr->ptr);
   if(!ptr)
     MALLOCERR();
   strcpy(tmp,ptr);
   //tmp[IE_MAXLEN]='\0';
   strlwr(tmp);
   if(strstr(tmp,str) && HTMLatom.y>frame->posY && lastfound!=currentHTMLatom &&
      (lastfoundY<HTMLatom.y || lastfoundY==HTMLatom.y  && lastfoundX<HTMLatom.x) &&
      (!found || HTMLatom.y<minY))
   {
    minY=HTMLatom.y;
    memcpy(&foundatom,&HTMLatom,sizeof(struct HTMLrecord));
    makestr(foundstr,ptr,IE_MAXLEN);
    foundHTMLatom=currentHTMLatom;
    found=1;
    if(foundHTMLatom==p->firstHTMLatom)
     break;
   }
  }
  currentHTMLatom=nextHTMLatom;
 }//loop

 if(found)
 {
  if(foundatom.yy>frame->posY+frame->scroll.ysize)
  {
   frame->posY=foundatom.y-FUZZYPIX;
   if(frame->posY+frame->scroll.ysize>frame->scroll.total_y)
       frame->posY=frame->scroll.total_y-frame->scroll.ysize;
   if(frame->posY<0)
    frame->posY=0;
  }

  if(foundatom.xx>frame->posX+frame->scroll.xsize || foundatom.x<frame->posX)
  {
   frame->posX=foundatom.x;
   if(frame->posX+frame->scroll.xsize>frame->scroll.total_x)
       frame->posX=frame->scroll.total_x-frame->scroll.xsize;
  }

//!!glennmcc: Sep 21, 2007 -- place pointer at new postion
#ifdef CAV
   ImouseSet((int)foundatom.x,(int)foundatom.y);
#endif
//!!glennmcc: end

  if(arachne.framescount)
  {
   p->activeframe=0;
   redrawHTML(REDRAW_NO_MESSAGE,REDRAW_CREATE_VIRTUAL);
  }
  else
   redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL);


  highlightatom(&foundatom);

  lastfound=foundHTMLatom;
  lastfoundY=foundatom.y;
  lastfoundX=foundatom.x;
  outs(foundstr);
  ie_appendclip(foundstr);
  GLOBAL.clipdel=0;
 }
 else
 {
  redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL);
  outs(MSG_SRCH2);
 }
 farfree(foundstr);
 farfree(tmp);
 farfree(str);

}
Пример #12
0
//search in active TEXTAREA...
void SearchInTextarea(char cont)
{
 int i=0;
 struct HTMLrecord *aptr=(struct HTMLrecord *)ie_getswap(focusedatom);
 if(aptr)
 {
  char searchstring[IE_MAXLEN+1],str[IE_MAXLEN+80],*ptr;
  int l1,l2,x;

  memcpy(&activeatom,aptr,sizeof(struct HTMLrecord));
  activeatomptr=&activeatom;
  activeadr=focusedatom;
  getTXTprompt(searchstring,IE_MAXLEN);
  sprintf(str,MSG_SRCH1,searchstring);
  outs(str);
  l1=strlen(searchstring);
  if(l1==0)
   goto redraw_and_exit;

  editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr);
  if(editorptr)
  {
   memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor));
   if(cont)
    i=tmpeditor.y;
   while(i<tmpeditor.lines)
   {
    ptr=ie_getline(&tmpeditor,i);
    if(cont)
    {
     x=tmpeditor.x+l1;
     ptr+=x;
     cont=0;
    }
    else
     x=0;
    l2=strlen(ptr);
    while(l2>=l1)
    {
     if(!strncmpi(searchstring,ptr,l1))
     {
      tmpeditor.y=i;
      tmpeditor.x=x;
      editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr);
      if(editorptr)
      {
       memcpy(editorptr,&tmpeditor,sizeof(struct ib_editor));
       swapmod=1;
      }
      activeatomtick(ZOOM_SYNCHRO,TEXTAREA_NOREFRESH); //found
      goto redraw_and_exit;
     }
     ptr++;
     l2--;
     x++;
    }//loop
    i++;
   }//loop
  }
  else
   MALLOCERR();
  outs(MSG_SRCH2); //not found

  redraw_and_exit:
  redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL);
  activeatomptr=&activeatom;
  activeadr=focusedatom;
  activeatomcursor(1);
 }//end if pointer exists - else "nonfatal error"
}