home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol270 / sed5.inc < prev    next >
Text File  |  1986-05-22  |  1KB  |  47 lines

  1. procedure find1(var n:integer);
  2. var i,j:byte;
  3. begin
  4.   if line1='' then n:=0
  5.   else begin
  6.     pushbottom; j:=0;
  7.     for i:=x+1 to numbuf do begin j:=j+1; buffer[j]:=buffer[i] end;
  8.     numbuf:=j; n:=pos(line1,sbuffer); popbottom;
  9.     if n>0 then n:=x+n;
  10.     while (n=0) and (mem[pbotm]<>$1A) do
  11.       begin pushtop; popbottom; n:=pos(line1,sbuffer) end;
  12.     if n>0 then x:=n else begin textbottom; x:=numbuf end;
  13.     y:=halflength
  14.   end
  15. end;
  16.  
  17. procedure find;
  18. var n:integer; line:linetype;
  19. begin
  20.   readline('find',line);
  21.   if line<>'' then begin
  22.     fr:=findsym; line1:=line; find1(n) end;
  23. end;
  24.  
  25. procedure replace1(var n:integer);
  26. var c:char;
  27. begin
  28.   find1(n);
  29.   if n>0 then
  30.     begin
  31.       newscreen; sline(0); gotoxy(1,1);
  32.       write('replace - space -');
  33.       gotoxy(x,y+1); read(kbd,c); sline(0);
  34.       if c=' ' then replaceline(x,length(line1),line2)
  35.     end
  36. end;
  37.  
  38. procedure replace;
  39. var n:integer; line:linetype;
  40. begin
  41.   readline('replace from',line);
  42.   if line<>'' then begin
  43.     fr:=replacesym; line1:=line;
  44.     readline('to',line2); replace1(n)
  45.   end
  46. end;
  47.