Browse Source

+ default extension for save in the editor
+ Separate Text to Find for the grep dialog
* fixed redir crash with tp7

peter 26 years ago
parent
commit
30fdaddcb8

+ 10 - 2
ide/text/Makefile

@@ -37,7 +37,7 @@ endif
 
 
 ifdef GDB
 ifdef GDB
 override NEEDUNITDIR+=../../$(GDBINT)
 override NEEDUNITDIR+=../../$(GDBINT)
-NEEDLIBDIR+=../../$(GDBINT)/libgdb
+NEEDLIBDIR+=../../$(GDBINT)/libgdb /pp/dj/lib
 NEEDOBJDIR+=../../$(GDBINT)/libgdb
 NEEDOBJDIR+=../../$(GDBINT)/libgdb
 else
 else
 override NEEDUNITDIR+=../fake/gdb
 override NEEDUNITDIR+=../fake/gdb
@@ -88,6 +88,9 @@ endif
 
 
 fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
 fp$(EXEEXT): $(wildcard *.pas) $(wildcard *.inc)
 
 
+gdb:
+	make all GDB=1
+
 full:
 full:
 	make all FULL=1
 	make all FULL=1
 
 
@@ -99,7 +102,12 @@ clean_compiler:
 
 
 #
 #
 # $Log$
 # $Log$
-# Revision 1.9  1999-02-16 10:43:53  peter
+# Revision 1.10  1999-02-22 02:15:12  peter
+#   + default extension for save in the editor
+#   + Separate Text to Find for the grep dialog
+#   * fixed redir crash with tp7
+#
+# Revision 1.9  1999/02/16 10:43:53  peter
 #   * use -dGDB for the compiler
 #   * use -dGDB for the compiler
 #   * only use gdb_file when -dDEBUG is used
 #   * only use gdb_file when -dDEBUG is used
 #   * profiler switch is now a toggle instead of radiobutton
 #   * profiler switch is now a toggle instead of radiobutton

+ 7 - 2
ide/text/fpide.pas

@@ -116,7 +116,7 @@ uses
   Video,Mouse,Keyboard,
   Video,Mouse,Keyboard,
   Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
   Dos,Objects,Memory,Menus,Dialogs,StdDlg,ColorSel,Commands,HelpCtx,
   AsciiTab,
   AsciiTab,
-  Systems,BrowCol,
+  Systems,BrowCol,Version,
   WHelp,WHlpView,WINI,
   WHelp,WHlpView,WINI,
   FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
   FPConst,FPVars,FPUtils,FPSwitch,FPIni,FPIntf,FPCompile,FPHelp,
   FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools,FPDebug,FPRedir;
   FPTemplt,FPCalc,FPUsrScr,FPSymbol,FPTools,FPDebug,FPRedir;
@@ -682,7 +682,12 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.17  1999-02-20 15:18:30  peter
+  Revision 1.18  1999-02-22 02:15:13  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.17  1999/02/20 15:18:30  peter
     + ctrl-c capture with confirm dialog
     + ctrl-c capture with confirm dialog
     + ascii table in the tools menu
     + ascii table in the tools menu
     + heapviewer
     + heapviewer

+ 9 - 1
ide/text/fpini.pas

@@ -63,6 +63,7 @@ const
   ieHelpFiles        = 'Files';
   ieHelpFiles        = 'Files';
   ieDefaultTabSize   = 'DefaultTabSize';
   ieDefaultTabSize   = 'DefaultTabSize';
   ieDefaultEditorFlags='DefaultFlags';
   ieDefaultEditorFlags='DefaultFlags';
+  ieDefaultSaveExt   = 'DefaultSaveExt';
   ieOpenExts         = 'OpenExts';
   ieOpenExts         = 'OpenExts';
   ieHighlightExts    = 'Exts';
   ieHighlightExts    = 'Exts';
   ieTabsPattern      = 'NeedsTabs';
   ieTabsPattern      = 'NeedsTabs';
@@ -251,6 +252,7 @@ begin
 {$ifndef EDITORS}
 {$ifndef EDITORS}
   DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   DefaultTabSize:=INIFile^.GetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   DefaultCodeEditorFlags:=INIFile^.GetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
   DefaultCodeEditorFlags:=INIFile^.GetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
+  DefaultSaveExt:=INIFile^.GetEntry(secEditor,ieDefaultSaveExt,DefaultSaveExt);
 {$endif}
 {$endif}
 { Highlight }
 { Highlight }
   HighlightExts:=INIFile^.GetEntry(secHighlight,ieHighlightExts,HighlightExts);
   HighlightExts:=INIFile^.GetEntry(secHighlight,ieHighlightExts,HighlightExts);
@@ -330,6 +332,7 @@ begin
 {$ifndef EDITORS}
 {$ifndef EDITORS}
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultTabSize,DefaultTabSize);
   INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
   INIFile^.SetIntEntry(secEditor,ieDefaultEditorFlags,DefaultCodeEditorFlags);
+  INIFile^.SetEntry(secEditor,ieDefaultSaveExt,DefaultSaveExt);
 {$endif}
 {$endif}
 { Highlight }
 { Highlight }
   INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
   INIFile^.SetEntry(secHighlight,ieHighlightExts,'"'+HighlightExts+'"');
@@ -384,7 +387,12 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  1999-02-19 18:43:46  peter
+  Revision 1.13  1999-02-22 02:15:14  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.12  1999/02/19 18:43:46  peter
     + open dialog supports mask list
     + open dialog supports mask list
 
 
   Revision 1.11  1999/02/10 09:53:14  pierre
   Revision 1.11  1999/02/10 09:53:14  pierre

+ 27 - 5
ide/text/fpmhelp.inc

@@ -160,16 +160,33 @@ end;
 procedure TIDEApp.About;
 procedure TIDEApp.About;
 var R,R2: TRect;
 var R,R2: TRect;
     D: PCenterDialog;
     D: PCenterDialog;
+    OSStr: string;
 begin
 begin
-  R.Assign(0,0,38,12);
+  OSStr:='';
+{$ifdef go32v2}
+  OSStr:='Dos';
+{$endif}
+{$ifdef tp}
+  OSStr:='Dos';
+{$endif}
+{$ifdef linux}
+  OSStr:='Linux';
+{$endif}
+{$ifdef win32}
+  OSStr:='Win32';
+{$endif}
+{$ifdef os2}
+  OSStr:='OS/2';
+{$endif}
+  R.Assign(0,0,46,12);
   New(D, Init(R, 'About'));
   New(D, Init(R, 'About'));
   with D^ do
   with D^ do
   begin
   begin
     GetExtent(R); R.Grow(-3,-2);
     GetExtent(R); R.Grow(-3,-2);
     R2.Copy(R); R2.B.Y:=R2.A.Y+1;
     R2.Copy(R); R2.B.Y:=R2.A.Y+1;
-    Insert(New(PStaticText, Init(R2, ^C'FreePascal IDE / DOS')));
-    R2.Move(0,2);
-    Insert(New(PStaticText, Init(R2, ^C'Version '+VersionStr)));
+    Insert(New(PStaticText, Init(R2, ^C'FreePascal IDE for '+OSStr+' Version '+VersionStr)));
+    R2.Move(0,1);
+    Insert(New(PStaticText, Init(R2, ^C'(Compiler Version '+Version_String+')')));
     R2.Move(0,2);
     R2.Move(0,2);
     Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-99 by')));
     Insert(New(PStaticText, Init(R2, ^C'Copyright (C) 1998-99 by')));
     R2.Move(0,2);
     R2.Move(0,2);
@@ -186,7 +203,12 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.4  1999-01-21 11:54:18  peter
+  Revision 1.5  1999-02-22 02:15:16  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.4  1999/01/21 11:54:18  peter
     + tools menu
     + tools menu
     + speedsearch in symbolbrowser
     + speedsearch in symbolbrowser
     * working run command
     * working run command

+ 72 - 45
ide/text/fpmtools.inc

@@ -55,9 +55,10 @@ procedure TIDEApp.Grep;
 
 
   var PGrepDialog : PCenterDialog;
   var PGrepDialog : PCenterDialog;
       R,R2 : TRect;
       R,R2 : TRect;
-      IL : PInputLine;
+      IL1,IL2 : PInputLine;
       p,lineNb : longint;
       p,lineNb : longint;
       error : word;
       error : word;
+      searchword,
       GrepExe,GrepArgs,Line,ModuleName : String;
       GrepExe,GrepArgs,Line,ModuleName : String;
       GrepOut : text;
       GrepOut : text;
       Params : Array[0..4] of longint;
       Params : Array[0..4] of longint;
@@ -69,13 +70,22 @@ procedure TIDEApp.Grep;
    GrepExeName = 'grep.exe';
    GrepExeName = 'grep.exe';
 {$endif linux}
 {$endif linux}
 begin
 begin
+{ Find grep.exe }
   GrepExe:=GrepExeName;
   GrepExe:=GrepExeName;
   If not LocateExeFile(GrepExe) then
   If not LocateExeFile(GrepExe) then
     Begin
     Begin
       ErrorBox('Grep program not found',nil);
       ErrorBox('Grep program not found',nil);
       Exit;
       Exit;
     End;
     End;
-  R.Assign(0,0,45,6);
+{ Try to load the word from the editor }
+  If not(DeskTop^.First=nil) and
+     (DeskTop^.First^.HelpCtx=hcSourceWindow) then
+    Searchword:=PSourceWindow(DeskTop^.First)^.Editor^.GetCurrentWord
+  else
+    Searchword:='';
+  GrepArgs:='-n -i $TEXT *.pas *.pp *.inc';
+{ Dialog }
+  R.Assign(0,0,45,8);
   new(PGrepDialog,Init(R,'Grep arguments'));
   new(PGrepDialog,Init(R,'Grep arguments'));
   with PGrepDialog^ do
   with PGrepDialog^ do
     begin
     begin
@@ -83,61 +93,78 @@ begin
       R2.B.Y:=R2.A.Y+1;
       R2.B.Y:=R2.A.Y+1;
       R2.A.X:=R.A.X+3;
       R2.A.X:=R.A.X+3;
       R2.B.X:=R.B.X-3;
       R2.B.X:=R.B.X-3;
-      New(IL, Init(R2, 128));
-      If not(DeskTop^.First=nil) and
-         (DeskTop^.First^.HelpCtx=hcSourceWindow) then
-        GrepArgs:=PSourceWindow(DeskTop^.First)^.Editor^.GetCurrentWord
-      else
-        GrepArgs:='';
-      GrepArgs:='-n -i '+GrepArgs+' *.pas *.pp *.inc';
-      IL^.Data^:=GrepArgs;
-      Insert(IL);
+      New(IL1, Init(R2, 128));
+      IL1^.Data^:=SearchWord;
+      Insert(IL1);
       R2.Move(0,-1);
       R2.Move(0,-1);
-      Insert(New(PLabel, Init(R2, '~G~rep arguments', IL)));
+      Insert(New(PLabel, Init(R2, '~T~ext to find', IL1)));
+
+      R2.Move(0,4);
+      New(IL2, Init(R2, 128));
+      IL2^.Data^:=GrepArgs;
+      Insert(IL2);
+      R2.Move(0,-1);
+      Insert(New(PLabel, Init(R2, '~G~rep arguments', IL2)));
     end;
     end;
 
 
     InsertButtons(PGrepDialog);
     InsertButtons(PGrepDialog);
+    IL1^.Select;
+
     if Desktop^.ExecView(PGrepDialog)=cmOK then
     if Desktop^.ExecView(PGrepDialog)=cmOK then
     begin
     begin
-      GrepArgs:=IL^.Data^;
-      { Linux ? }
-      if not ExecuteRedir(GrepExe,GrepArgs,GrepOutName,'grep$$.err') then
-        Begin
-           { 2 as exit code just means that
-             some file vwere not found ! }
-           if (IOStatus<>0) or (ExecuteResult<>2) then
-             begin
-               Params[0]:=IOStatus;
-               Params[1]:=ExecuteResult;
-               WarningBox(#3'Error running Grep'#13#3'DosError = %d'#13#3'Exit code = %d',@Params);
-             end;
-        End;
-      Assign(GrepOut,GrepOutName);
-      Reset(GrepOut);
-      While not eof(GrepOut) do
-        begin
-          readln(GrepOut,Line);
-          p:=pos(':',line);
-          if p>0 then
-            begin
-              ModuleName:=copy(Line,1,p-1);
-              Line:=Copy(Line,p+1,255);
-              p:=pos(':',Line);
-              val(copy(Line,1,p-1),lineNb,error);
-              if error=0 then
-                ProgramInfoWindow^.AddMessage(V_Normal,Copy(Line,p+1,255),
-                  ModuleName,LineNb);
+      SearchWord:=IL1^.Data^;
+      if SearchWord<>'' then
+       begin
+         GrepArgs:=IL2^.Data^;
+         ReplaceStr(GrepArgs,'$TEXT',SearchWord);
+         { Linux ? }
+         if not ExecuteRedir(GrepExe,GrepArgs,GrepOutName,'grep$$.err') then
+           Begin
+              { 2 as exit code just means that
+                some file vwere not found ! }
+              if (IOStatus<>0) or (ExecuteResult<>2) then
+                begin
+                  Params[0]:=IOStatus;
+                  Params[1]:=ExecuteResult;
+                  WarningBox(#3'Error running Grep'#13#3'DosError = %d'#13#3'Exit code = %d',@Params);
                 end;
                 end;
-              ProgramInfoWindow^.Show;
-              ProgramInfoWindow^.MakeFirst;
+           End;
+         {$I-}
+         Assign(GrepOut,GrepOutName);
+         Reset(GrepOut);
+         While not eof(GrepOut) do
+           begin
+             readln(GrepOut,Line);
+             p:=pos(':',line);
+             if p>0 then
+               begin
+                 ModuleName:=copy(Line,1,p-1);
+                 Line:=Copy(Line,p+1,255);
+                 p:=pos(':',Line);
+                 val(copy(Line,1,p-1),lineNb,error);
+                 if error=0 then
+                   ProgramInfoWindow^.AddMessage(V_Normal,Copy(Line,p+1,255),
+                     ModuleName,LineNb);
+               end;
+             ProgramInfoWindow^.Show;
+             ProgramInfoWindow^.MakeFirst;
            end;
            end;
-         end;
-      Close(GrepOut);
+         Close(GrepOut);
+         Erase(GrepOut);
+         {$I+}
+         EatIO;
+       end;
+    end;
   Dispose(PGrepDialog, Done);
   Dispose(PGrepDialog, Done);
 end;
 end;
 {
 {
   $Log$
   $Log$
-  Revision 1.7  1999-02-20 15:18:31  peter
+  Revision 1.8  1999-02-22 02:15:17  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.7  1999/02/20 15:18:31  peter
     + ctrl-c capture with confirm dialog
     + ctrl-c capture with confirm dialog
     + ascii table in the tools menu
     + ascii table in the tools menu
     + heapviewer
     + heapviewer

+ 59 - 50
ide/text/fpredir.pas

@@ -25,9 +25,11 @@ Interface
 
 
 {$ifdef TP}
 {$ifdef TP}
   {$define in_dos}
   {$define in_dos}
+  {$define usedup}
 {$endif TP}
 {$endif TP}
 {$ifdef Go32v2}
 {$ifdef Go32v2}
   {$define in_dos}
   {$define in_dos}
+  { $define usedup}
 {$endif}
 {$endif}
 
 
 Var
 Var
@@ -94,7 +96,7 @@ function dup(fh : longint) : longint;
     Regs : Registers;
     Regs : Registers;
 
 
 begin
 begin
-    Regs.ax:=$45;
+    Regs.ah:=$45;
     Regs.bx:=fh;
     Regs.bx:=fh;
     MsDos (Regs);
     MsDos (Regs);
     If (Regs.Flags and fCarry)=0 then
     If (Regs.Flags and fCarry)=0 then
@@ -113,11 +115,9 @@ begin
         dup2:=nh;
         dup2:=nh;
         exit;
         exit;
       end;
       end;
-    Regs.ax:=$46;
+    Regs.ah:=$46;
     Regs.bx:=fh;
     Regs.bx:=fh;
-{$ifndef TP}
-    Regs.cs:=nh;
-{$endif}
+    Regs.cx:=nh;
     MsDos (Regs);
     MsDos (Regs);
     If (Regs.Flags and fCarry)=0 then
     If (Regs.Flags and fCarry)=0 then
       Dup2:=nh
       Dup2:=nh
@@ -154,25 +154,24 @@ function ChangeRedir(Const Redir : String; AppendToFile : Boolean) : Boolean;
     RedirError:=IOResult;
     RedirError:=IOResult;
     IOStatus:=RedirError;
     IOStatus:=RedirError;
     If IOStatus <> 0 then Exit;
     If IOStatus <> 0 then Exit;
-{$ifndef FPC}
-    Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
-    OldHandle:=Handles^[1];
-    Handles^[1]:=Handles^[FileRec (F).Handle];
-    ChangeRedir:=True;
-{$else}
 {$ifdef UseDUP}
 {$ifdef UseDUP}
     TempH:=dup(1);
     TempH:=dup(1);
     if dup2(1,FileRec(F).Handle)=FileRec(F).Handle then
     if dup2(1,FileRec(F).Handle)=FileRec(F).Handle then
 {$else UseDUP}
 {$else UseDUP}
+  {$ifndef FPC}
+    Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
+    OldHandle:=Handles^[1];
+    Handles^[1]:=Handles^[FileRec (F).Handle];
+  {$else}
     DosMemGet(prefseg,HandlesOffset+1,OldHandle,1);
     DosMemGet(prefseg,HandlesOffset+1,OldHandle,1);
     DosMemGet(prefseg,HandlesOffset+FileRec(F).handle,temp,1);
     DosMemGet(prefseg,HandlesOffset+FileRec(F).handle,temp,1);
     dosmemput(prefseg,HandlesOffset+1,temp,1);
     dosmemput(prefseg,HandlesOffset+1,temp,1);
     { NO MEM use as %fs is distroyed somewhere !!
     { NO MEM use as %fs is distroyed somewhere !!
     OldHandle:=Mem[prefseg:HandlesOffset+1];
     OldHandle:=Mem[prefseg:HandlesOffset+1];
     Mem[prefseg:HandlesOffset+1]:=Mem[prefseg:HandlesOffset+FileRec(F).handle];}
     Mem[prefseg:HandlesOffset+1]:=Mem[prefseg:HandlesOffset+FileRec(F).handle];}
+  {$endif}
 {$endif UseDUP}
 {$endif UseDUP}
       ChangeRedir:=True;
       ChangeRedir:=True;
-{$endif}
      RedirChanged:=True;
      RedirChanged:=True;
   end;
   end;
 
 
@@ -186,78 +185,83 @@ function ChangeErrorRedir(Const Redir : String; AppendToFile : Boolean) : Boolea
       Begin
       Begin
       Reset(FE,1);
       Reset(FE,1);
       Seek(FE,FileSize(FE));
       Seek(FE,FileSize(FE));
-      End else Rewrite (FE);
+      End
+    else
+      Rewrite (FE);
 
 
     RedirError:=IOResult;
     RedirError:=IOResult;
     IOStatus:=RedirError;
     IOStatus:=RedirError;
     If IOStatus <> 0 then Exit;
     If IOStatus <> 0 then Exit;
-{$ifndef FPC}
-    Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
-    OldErrorHandle:=Handles^[2];
-    Handles^[2]:=Handles^[FileRec (FE).Handle];
-    ChangeErrorRedir:=True;
-{$else}
 {$ifdef UseDUP}
 {$ifdef UseDUP}
     TempErrorH:=dup(2);
     TempErrorH:=dup(2);
     if dup2(2,FileRec(F).Handle)=FileRec(F).Handle then
     if dup2(2,FileRec(F).Handle)=FileRec(F).Handle then
 {$else UseDUP}
 {$else UseDUP}
+  {$ifndef FPC}
+    Handles:=Ptr (prefseg, PWord (Ptr (prefseg, $34))^);
+    OldErrorHandle:=Handles^[2];
+    Handles^[2]:=Handles^[FileRec (FE).Handle];
+  {$else}
     DosMemGet(prefseg,HandlesOffset+2,OldErrorHandle,1);
     DosMemGet(prefseg,HandlesOffset+2,OldErrorHandle,1);
     DosMemGet(prefseg,HandlesOffset+FileRec(F).handle,temp,1);
     DosMemGet(prefseg,HandlesOffset+FileRec(F).handle,temp,1);
     dosmemput(prefseg,HandlesOffset+1,temp,1);
     dosmemput(prefseg,HandlesOffset+1,temp,1);
     {OldErrorHandle:=Mem[prefseg:HandlesOffset+2];
     {OldErrorHandle:=Mem[prefseg:HandlesOffset+2];
     Mem[prefseg:HandlesOffset+2]:=Mem[prefseg:HandlesOffset+FileRec(FE).handle];}
     Mem[prefseg:HandlesOffset+2]:=Mem[prefseg:HandlesOffset+FileRec(FE).handle];}
+  {$endif}
 {$endif UseDUP}
 {$endif UseDUP}
       ChangeErrorRedir:=True;
       ChangeErrorRedir:=True;
-{$endif}
      RedirErrorChanged:=True;
      RedirErrorChanged:=True;
   end;
   end;
 
 
-{............................................................................}
 
 
 {$IfDef MsDos}
 {$IfDef MsDos}
-  procedure CompactHeap;
 
 
-  var
-    Regs : Registers;
-
-  begin
-    Regs.AH:=$4A;
-    Regs.ES:=PrefSeg;
-    Regs.BX:=MinBlockSize + (PtrRec (HeapPtr).Seg - PtrRec (HeapOrg).Seg);
-    MsDos (Regs);
-  end;
-
-{............................................................................}
+{Set HeapEnd Pointer to Current Used Heapsize}
+Procedure SmallHeap;assembler;
+asm
+                mov     bx,word ptr HeapPtr
+                shr     bx,4
+                inc     bx
+                add     bx,word ptr HeapPtr+2
+                mov     ax,PrefixSeg
+                sub     bx,ax
+                mov     es,ax
+                mov     ah,4ah
+                int     21h
+end;
 
 
-  procedure ExpandHeap;
 
 
-  var
-    Regs : Registers;
 
 
-  begin
-    Regs.AH:=$4A;
-    Regs.ES:=PrefSeg;
-    Regs.BX:=MyBlockSize;
-    MsDos (Regs);
-  end;
+{Set HeapEnd Pointer to Full Heapsize}
+Procedure FullHeap;assembler;
+asm
+                mov     bx,word ptr HeapEnd
+                shr     bx,4
+                inc     bx
+                add     bx,word ptr HeapEnd+2
+                mov     ax,PrefixSeg
+                sub     bx,ax
+                mov     es,ax
+                mov     ah,4ah
+                int     21h
+end;
 
 
 {$EndIf MsDos}
 {$EndIf MsDos}
-{............................................................................}
+
 
 
   procedure RestoreRedir;
   procedure RestoreRedir;
 
 
   begin
   begin
     If not RedirChanged then Exit;
     If not RedirChanged then Exit;
-{$ifndef FPC}
-    Handles^[1]:=OldHandle;
-{$else}
 {$ifdef UseDUP}
 {$ifdef UseDUP}
     dup2(1,TempH);
     dup2(1,TempH);
 {$else UseDUP}
 {$else UseDUP}
+{$ifndef FPC}
+     Handles^[1]:=OldHandle;
+{$else}
     dosmemput(prefseg,HandlesOffset+1,OldHandle,1);
     dosmemput(prefseg,HandlesOffset+1,OldHandle,1);
     {Mem[prefseg:HandlesOffset+1]:=OldHandle;}
     {Mem[prefseg:HandlesOffset+1]:=OldHandle;}
-{$endif UseDUP}
 {$endif}
 {$endif}
+{$endif UseDUP}
     Close (F);
     Close (F);
     RedirChanged:=false;
     RedirChanged:=false;
   end;
   end;
@@ -288,7 +292,7 @@ function ChangeErrorRedir(Const Redir : String; AppendToFile : Boolean) : Boolea
 
 
   Begin
   Begin
 {$IfDef MsDos}
 {$IfDef MsDos}
-  CompactHeap;
+    SmallHeap;
 {$EndIf MsDos}
 {$EndIf MsDos}
     SwapVectors;
     SwapVectors;
     Dos.Exec (ProgName, ComLine);
     Dos.Exec (ProgName, ComLine);
@@ -296,7 +300,7 @@ function ChangeErrorRedir(Const Redir : String; AppendToFile : Boolean) : Boolea
     ExecuteResult:=DosExitCode;
     ExecuteResult:=DosExitCode;
     SwapVectors;
     SwapVectors;
 {$IfDef MsDos}
 {$IfDef MsDos}
-  Expandheap;
+    Fullheap;
 {$EndIf MsDos}
 {$EndIf MsDos}
   End;
   End;
 
 
@@ -380,7 +384,12 @@ Begin
 End.
 End.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  1999-02-20 15:18:32  peter
+  Revision 1.8  1999-02-22 02:15:18  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.7  1999/02/20 15:18:32  peter
     + ctrl-c capture with confirm dialog
     + ctrl-c capture with confirm dialog
     + ascii table in the tools menu
     + ascii table in the tools menu
     + heapviewer
     + heapviewer

+ 9 - 30
ide/text/fptools.pas

@@ -102,9 +102,10 @@ type
     end;
     end;
 
 
 const
 const
-     HotKeys : array[0..9] of THotKeyDef =
+     HotKeys : array[0..8] of THotKeyDef =
       ( (Name : '~U~nassigned' ; KeyCode : kbNoKey   ),
       ( (Name : '~U~nassigned' ; KeyCode : kbNoKey   ),
-        (Name : 'Shift+F~2~'   ; KeyCode : kbShiftF2 ),
+{ Used for Grep, so it can't be assigned for user tools
+        (Name : 'Shift+F~2~'   ; KeyCode : kbShiftF2 ), }
         (Name : 'Shift+F~3~'   ; KeyCode : kbShiftF3 ),
         (Name : 'Shift+F~3~'   ; KeyCode : kbShiftF3 ),
         (Name : 'Shift+F~4~'   ; KeyCode : kbShiftF4 ),
         (Name : 'Shift+F~4~'   ; KeyCode : kbShiftF4 ),
         (Name : 'Shift+F~5~'   ; KeyCode : kbShiftF5 ),
         (Name : 'Shift+F~5~'   ; KeyCode : kbShiftF5 ),
@@ -472,33 +473,6 @@ begin
   ReDraw;
   ReDraw;
 end;
 end;
 
 
-procedure ReplaceStr(var S: string; const What,NewS: string);
-var I : Sw_integer;
-begin
-  repeat
-    I:=Pos(What,S);
-    if I>0 then
-    begin
-      Delete(S,I,length(What));
-      Insert(NewS,S,I);
-    end;
-  until I=0;
-end;
-
-procedure ReplaceStrI(var S: string; What: string; const NewS: string);
-var I : integer;
-    UpcaseS: string;
-begin
-  UpcaseS:=UpcaseStr(S); What:=UpcaseStr(What);
-  repeat
-    I:=Pos(What,UpcaseS);
-    if I>0 then
-    begin
-      Delete(S,I,length(What));
-      Insert(NewS,S,I);
-    end;
-  until I=0;
-end;
 
 
 function ParseToolParams(var Params: string; CheckOnly: boolean): Sw_integer;
 function ParseToolParams(var Params: string; CheckOnly: boolean): Sw_integer;
 var Err: integer;
 var Err: integer;
@@ -732,7 +706,12 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  1999-02-19 15:43:21  peter
+  Revision 1.3  1999-02-22 02:15:19  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.2  1999/02/19 15:43:21  peter
     * compatibility fixes for FV
     * compatibility fixes for FV
 
 
   Revision 1.1  1999/01/21 11:54:25  peter
   Revision 1.1  1999/01/21 11:54:25  peter

+ 104 - 52
ide/text/fputils.pas

@@ -37,7 +37,7 @@ const
 function IntToStr(L: longint): string;
 function IntToStr(L: longint): string;
 function IntToStrZ(L: longint; MinLen: byte): string;
 function IntToStrZ(L: longint; MinLen: byte): string;
 function IntToStrL(L: longint; MinLen: byte): string;
 function IntToStrL(L: longint; MinLen: byte): string;
-function StrToInt(S: string): longint;
+function StrToInt(const S: string): longint;
 function IntToHex(L: longint): string;
 function IntToHex(L: longint): string;
 function IntToHexL(L: longint; MinLen: byte): string;
 function IntToHexL(L: longint; MinLen: byte): string;
 function HexToInt(S: string): longint;
 function HexToInt(S: string): longint;
@@ -49,12 +49,12 @@ function MakeExeName(const fn:string):string;
 function LExpand(S: string; MinLen: byte): string;
 function LExpand(S: string; MinLen: byte): string;
 function RExpand(S: string; MinLen: byte): string;
 function RExpand(S: string; MinLen: byte): string;
 function FitStr(const S: string; Len: byte): string;
 function FitStr(const S: string; Len: byte): string;
-function LTrim(S: string): string;
-function RTrim(S: string): string;
-function Trim(S: string): string;
+function LTrim(const S: string): string;
+function RTrim(const S: string): string;
+function Trim(const S: string): string;
 function KillTilde(S: string): string;
 function KillTilde(S: string): string;
-function UpcaseStr(S: string): string;
-function LowerCaseStr(S: string): string;
+function UpcaseStr(const S: string): string;
+function LowerCaseStr(const S: string): string;
 function Max(A,B: longint): longint;
 function Max(A,B: longint): longint;
 function Min(A,B: longint): longint;
 function Min(A,B: longint): longint;
 function DirOf(const S: string): string;
 function DirOf(const S: string): string;
@@ -65,7 +65,7 @@ function StrToExtended(S: string): Extended;
 function Power(const A,B: double): double;
 function Power(const A,B: double): double;
 function GetCurDir: string;
 function GetCurDir: string;
 function MatchesMask(What, Mask: string): boolean;
 function MatchesMask(What, Mask: string): boolean;
-function MatchesMaskList(What, MaskList: string): boolean;
+function MatchesMaskList(const What:string;MaskList: string): boolean;
 function MatchesFileList(What, FileList: string): boolean;
 function MatchesFileList(What, FileList: string): boolean;
 function EatIO: integer;
 function EatIO: integer;
 function ExistsFile(const FileName: string): boolean;
 function ExistsFile(const FileName: string): boolean;
@@ -74,6 +74,8 @@ function LocateFile(FileList: string): string;
 function LocatePasFile(const FileName:string):string;
 function LocatePasFile(const FileName:string):string;
 function LocateExeFile(var FileName:string): boolean;
 function LocateExeFile(var FileName:string): boolean;
 function GetStr(P: PString): string;
 function GetStr(P: PString): string;
+procedure ReplaceStr(var S: string; const What,NewS: string);
+procedure ReplaceStrI(var S: string; What: string; const NewS: string);
 
 
 const LastStrToIntResult : integer = 0;
 const LastStrToIntResult : integer = 0;
       LastHexToIntResult : integer = 0;
       LastHexToIntResult : integer = 0;
@@ -91,7 +93,7 @@ begin
   IntToStr:=S;
   IntToStr:=S;
 end;
 end;
 
 
-function StrToInt(S: string): longint;
+function StrToInt(const S: string): longint;
 var L: longint;
 var L: longint;
     C: integer;
     C: integer;
 begin
 begin
@@ -162,13 +164,13 @@ begin
      case s[i] of
      case s[i] of
  {$ifdef Linux}
  {$ifdef Linux}
   '/','\' : begin
   '/','\' : begin
-	      FixFileName[i]:='/';
-	      NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
-	    end;
+              FixFileName[i]:='/';
+              NoPath:=false; {Skip lowercasing path: 'X11'<>'x11' }
+            end;
  'A'..'Z' : if NoPath then
  'A'..'Z' : if NoPath then
-	     FixFileName[i]:=char(byte(s[i])+32)
-	    else
-	     FixFileName[i]:=s[i];
+             FixFileName[i]:=char(byte(s[i])+32)
+            else
+             FixFileName[i]:=s[i];
  {$else}
  {$else}
       '/' : FixFileName[i]:='\';
       '/' : FixFileName[i]:='\';
  'A'..'Z' : FixFileName[i]:=char(byte(s[i])+32);
  'A'..'Z' : FixFileName[i]:=char(byte(s[i])+32);
@@ -223,20 +225,28 @@ begin
   KillTilde:=S;
   KillTilde:=S;
 end;
 end;
 
 
-function UpcaseStr(S: string): string;
-var I: Longint;
+function UpcaseStr(const S: string): string;
+var
+  i  : Sw_word;
 begin
 begin
-  for I:=1 to length(S) do
-      S[I]:=Upcase(S[I]);
-  UpcaseStr:=S;
+  for i:=1 to length(s) do
+   if s[i] in ['a'..'z'] then
+    UpcaseStr[i]:=char(byte(s[i])-32)
+   else
+    UpcaseStr[i]:=s[i];
+  UpcaseStr[0]:=s[0];
 end;
 end;
 
 
-function LowerCaseStr(S: string): string;
-var I: byte;
+function LowercaseStr(const S: string): string;
+var
+  i  : Sw_word;
 begin
 begin
-  for I:=1 to length(S) do
-    if S[I] in ['A'..'Z'] then S[I]:=chr(ord(S[I])+32);
-  LowerCaseStr:=S;
+  for i:=1 to length(s) do
+   if s[i] in ['A'..'Z'] then
+    LowercaseStr[i]:=char(byte(s[i])+32)
+   else
+    LowercaseStr[i]:=s[i];
+  LowercaseStr[0]:=s[0];
 end;
 end;
 
 
 function Max(A,B: longint): longint;
 function Max(A,B: longint): longint;
@@ -293,7 +303,7 @@ end;
 function Power(const A,B: double): double;
 function Power(const A,B: double): double;
 begin
 begin
   if A=0 then Power:=0
   if A=0 then Power:=0
-	 else Power:=exp(B*ln(A));
+         else Power:=exp(B*ln(A));
 end;
 end;
 
 
 function GetCurDir: string;
 function GetCurDir: string;
@@ -304,6 +314,7 @@ begin
   GetCurDir:=S;
   GetCurDir:=S;
 end;
 end;
 
 
+
 function IntToHex(L: longint): string;
 function IntToHex(L: longint): string;
 const HexNums : string[16] = '0123456789ABCDEF';
 const HexNums : string[16] = '0123456789ABCDEF';
 var S: string;
 var S: string;
@@ -326,6 +337,7 @@ begin
   IntToHex:=S;
   IntToHex:=S;
 end;
 end;
 
 
+
 function HexToInt(S: string): longint;
 function HexToInt(S: string): longint;
 var L,I: longint;
 var L,I: longint;
     C: char;
     C: char;
@@ -344,6 +356,7 @@ begin
   HexToInt:=L;
   HexToInt:=L;
 end;
 end;
 
 
+
 function IntToHexL(L: longint; MinLen: byte): string;
 function IntToHexL(L: longint; MinLen: byte): string;
 var S: string;
 var S: string;
 begin
 begin
@@ -352,23 +365,33 @@ begin
   IntToHexL:=S;
   IntToHexL:=S;
 end;
 end;
 
 
-function LTrim(S: string): string;
+function LTrim(const S: string): string;
+var
+  i : Sw_integer;
 begin
 begin
-  while copy(S,1,1)=' ' do Delete(S,1,1);
-  LTrim:=S;
+  i:=1;
+  while (i<length(S)) and (S[i]=' ') do
+   inc(i);
+  LTrim:=Copy(S,i,255);
 end;
 end;
 
 
-function RTrim(S: string): string;
+
+Function RTrim(const S:string):string;
+var
+  i : Sw_integer;
 begin
 begin
-  while copy(S,length(S),1)=' ' do Delete(S,length(S),1);
-  RTrim:=S;
+  i:=length(S);
+  while (i>0) and (S[i]=' ') do
+   dec(i);
+  RTrim:=Copy(S,1,i);
 end;
 end;
 
 
-function Trim(S: string): string;
+function Trim(const S: string): string;
 begin
 begin
   Trim:=RTrim(LTrim(S));
   Trim:=RTrim(LTrim(S));
 end;
 end;
 
 
+
 function MatchesMask(What, Mask: string): boolean;
 function MatchesMask(What, Mask: string): boolean;
 var P: integer;
 var P: integer;
     Match: boolean;
     Match: boolean;
@@ -388,7 +411,7 @@ begin
   MatchesMask:=Match;
   MatchesMask:=Match;
 end;
 end;
 
 
-function MatchesMaskList(What, MaskList: string): boolean;
+function MatchesMaskList(const What:string;MaskList: string): boolean;
 var P: integer;
 var P: integer;
     Match: boolean;
     Match: boolean;
 begin
 begin
@@ -418,7 +441,7 @@ begin
     F:=copy(FileList,1,P-1);
     F:=copy(FileList,1,P-1);
     FSplit(F,FD.D,FD.N,FD.E);
     FSplit(F,FD.D,FD.N,FD.E);
     Match:=MatchesMask(WD.D+WD.N,FD.D+FD.N) and
     Match:=MatchesMask(WD.D+WD.N,FD.D+FD.N) and
-	   MatchesMask(WD.E,FD.E);
+           MatchesMask(WD.E,FD.E);
     Delete(FileList,1,P);
     Delete(FileList,1,P);
   until Match or (FileList='');
   until Match or (FileList='');
   MatchesFileList:=Match;
   MatchesFileList:=Match;
@@ -515,23 +538,19 @@ begin
     end;
     end;
 
 
   S:=GetEnv('PATH');
   S:=GetEnv('PATH');
-  i:=1;
-  While Length(S)>0 do
-    begin
-      While (i<=Length(S)) and not (S[i] in ListSep) do
-	Inc(i);
-      Dir:=CompleteDir(Copy(S,1,i-1));
-      if i<Length(S) then
-	S:=Copy(S,i+1,255)
-      else
-	S:='';
-      if ExistsFile(Dir+FileName) then
-	Begin
-	   FileName:=Dir+FileName;
-	   LocateExeFile:=true;
-	   Exit;
-	End;
-   end;
+  repeat
+    i:=0;
+    While (i<=Length(S)) and not (S[i] in ListSep) do
+     Inc(i);
+    Dir:=CompleteDir(Copy(S,1,i-1));
+    Delete(S,1,i);
+    if ExistsFile(Dir+FileName) then
+     Begin
+       FileName:=Dir+FileName;
+       LocateExeFile:=true;
+       Exit;
+     End;
+  until s='';
 end;
 end;
 
 
 function GetStr(P: PString): string;
 function GetStr(P: PString): string;
@@ -539,12 +558,45 @@ begin
   if P=nil then GetStr:='' else GetStr:=P^;
   if P=nil then GetStr:='' else GetStr:=P^;
 end;
 end;
 
 
+procedure ReplaceStr(var S: string; const What,NewS: string);
+var I : Sw_integer;
+begin
+  repeat
+    I:=Pos(What,S);
+    if I>0 then
+    begin
+      Delete(S,I,length(What));
+      Insert(NewS,S,I);
+    end;
+  until I=0;
+end;
+
+procedure ReplaceStrI(var S: string; What: string; const NewS: string);
+var I : integer;
+    UpcaseS: string;
+begin
+  UpcaseS:=UpcaseStr(S); What:=UpcaseStr(What);
+  repeat
+    I:=Pos(What,UpcaseS);
+    if I>0 then
+    begin
+      Delete(S,I,length(What));
+      Insert(NewS,S,I);
+    end;
+  until I=0;
+end;
+
 
 
 
 
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  1999-02-16 17:13:55  pierre
+  Revision 1.8  1999-02-22 02:15:20  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.7  1999/02/16 17:13:55  pierre
    + findclose added for FPC
    + findclose added for FPC
 
 
   Revision 1.6  1999/02/05 12:12:01  pierre
   Revision 1.6  1999/02/05 12:12:01  pierre

+ 14 - 9
ide/text/fpviews.pas

@@ -300,10 +300,10 @@ function  SearchFreeWindowNo: integer;
 procedure InsertOK(ADialog: PDialog);
 procedure InsertOK(ADialog: PDialog);
 procedure InsertButtons(ADialog: PDialog);
 procedure InsertButtons(ADialog: PDialog);
 
 
-procedure ErrorBox(S: string; Params: pointer);
-procedure WarningBox(S: string; Params: pointer);
-procedure InformationBox(S: string; Params: pointer);
-function  ConfirmBox(S: string; Params: pointer; CanCancel: boolean): word;
+procedure ErrorBox(const S: string; Params: pointer);
+procedure WarningBox(const S: string; Params: pointer);
+procedure InformationBox(const S: string; Params: pointer);
+function  ConfirmBox(const S: string; Params: pointer; CanCancel: boolean): word;
 
 
 function IsThereAnyEditor: boolean;
 function IsThereAnyEditor: boolean;
 function IsThereAnyWindow: boolean;
 function IsThereAnyWindow: boolean;
@@ -1911,22 +1911,22 @@ begin
   Execute := Result;
   Execute := Result;
 end;
 end;
 
 
-procedure ErrorBox(S: string; Params: pointer);
+procedure ErrorBox(const S: string; Params: pointer);
 begin
 begin
   MessageBox(S,Params,mfError+mfInsertInApp+mfOKButton);
   MessageBox(S,Params,mfError+mfInsertInApp+mfOKButton);
 end;
 end;
 
 
-procedure WarningBox(S: string; Params: pointer);
+procedure WarningBox(const S: string; Params: pointer);
 begin
 begin
   MessageBox(S,Params,mfWarning+mfInsertInApp+mfOKButton);
   MessageBox(S,Params,mfWarning+mfInsertInApp+mfOKButton);
 end;
 end;
 
 
-procedure InformationBox(S: string; Params: pointer);
+procedure InformationBox(const S: string; Params: pointer);
 begin
 begin
   MessageBox(S,Params,mfInformation+mfInsertInApp+mfOKButton);
   MessageBox(S,Params,mfInformation+mfInsertInApp+mfOKButton);
 end;
 end;
 
 
-function ConfirmBox(S: string; Params: pointer; CanCancel: boolean): word;
+function ConfirmBox(const S: string; Params: pointer; CanCancel: boolean): word;
 begin
 begin
   ConfirmBox:=MessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+integer(CanCancel)*mfCancelButton);
   ConfirmBox:=MessageBox(S,Params,mfConfirmation+mfInsertInApp+mfYesButton+mfNoButton+integer(CanCancel)*mfCancelButton);
 end;
 end;
@@ -3269,7 +3269,12 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  1999-02-19 18:43:49  peter
+  Revision 1.17  1999-02-22 02:15:22  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.16  1999/02/19 18:43:49  peter
     + open dialog supports mask list
     + open dialog supports mask list
 
 
   Revision 1.15  1999/02/17 15:04:02  pierre
   Revision 1.15  1999/02/17 15:04:02  pierre

+ 8 - 2
ide/text/weditor.pas

@@ -307,6 +307,7 @@ const
      TabChars     : set of char = [#9];
      TabChars     : set of char = [#9];
      AlphaChars    : set of char = ['A'..'Z','a'..'z','_'];
      AlphaChars    : set of char = ['A'..'Z','a'..'z','_'];
      NumberChars  : set of char = ['0'..'9'];
      NumberChars  : set of char = ['0'..'9'];
+     DefaultSaveExt : string[12]='.pas';
 
 
      UseSyntaxHighlight : function(Editor: PFileEditor): boolean = DefUseSyntaxHighlight;
      UseSyntaxHighlight : function(Editor: PFileEditor): boolean = DefUseSyntaxHighlight;
      UseTabsPattern     : function(Editor: PFileEditor): boolean = DefUseTabsPattern;
      UseTabsPattern     : function(Editor: PFileEditor): boolean = DefUseTabsPattern;
@@ -3188,7 +3189,7 @@ begin
     edSaveAs:
     edSaveAs:
       begin
       begin
    Name:=PString(Info)^;
    Name:=PString(Info)^;
-   Re:=Application^.ExecuteDialog(New(PFileDialog, Init('*.*',
+   Re:=Application^.ExecuteDialog(New(PFileDialog, Init('*'+DefaultSaveExt,
    'Save file as', '~N~ame', fdOkButton, 101)), @Name);
    'Save file as', '~N~ame', fdOkButton, 101)), @Name);
    if (Re<>cmCancel) and (Name<>PString(Info)^) then
    if (Re<>cmCancel) and (Name<>PString(Info)^) then
      if ExistsFile(Name) then
      if ExistsFile(Name) then
@@ -3242,7 +3243,12 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  1999-02-20 15:18:33  peter
+  Revision 1.22  1999-02-22 02:15:25  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.21  1999/02/20 15:18:33  peter
     + ctrl-c capture with confirm dialog
     + ctrl-c capture with confirm dialog
     + ascii table in the tools menu
     + ascii table in the tools menu
     + heapviewer
     + heapviewer

+ 55 - 42
ide/text/wini.pas

@@ -23,12 +23,12 @@ type
 
 
     PINIEntry = ^TINIEntry;
     PINIEntry = ^TINIEntry;
     TINIEntry = object(TObject)
     TINIEntry = object(TObject)
-      constructor Init(ALine: string);
+      constructor Init(const ALine: string);
       function    GetText: string;
       function    GetText: string;
       function    GetTag: string;
       function    GetTag: string;
       function    GetComment: string;
       function    GetComment: string;
       function    GetValue: string;
       function    GetValue: string;
-      procedure   SetValue(S: string);
+      procedure   SetValue(const S: string);
       destructor  Done; virtual;
       destructor  Done; virtual;
     private
     private
       Tag      : PString;
       Tag      : PString;
@@ -41,9 +41,9 @@ type
 
 
     PINISection = ^TINISection;
     PINISection = ^TINISection;
     TINISection = object(TObject)
     TINISection = object(TObject)
-      constructor Init(AName: string);
+      constructor Init(const AName: string);
       function    GetName: string;
       function    GetName: string;
-      function    AddEntry(S: string): PINIEntry;
+      function    AddEntry(const S: string): PINIEntry;
       function    SearchEntry(Tag: string): PINIEntry; virtual;
       function    SearchEntry(Tag: string): PINIEntry; virtual;
       procedure   ForEachEntry(EnumProc: pointer); virtual;
       procedure   ForEachEntry(EnumProc: pointer); virtual;
       destructor  Done; virtual;
       destructor  Done; virtual;
@@ -55,18 +55,18 @@ type
     PINIFile = ^TINIFile;
     PINIFile = ^TINIFile;
     TINIFile = object(TObject)
     TINIFile = object(TObject)
       MakeNullEntries: boolean;
       MakeNullEntries: boolean;
-      constructor Init(AFileName: string);
+      constructor Init(const AFileName: string);
       function    Read: boolean; virtual;
       function    Read: boolean; virtual;
       function    Update: boolean; virtual;
       function    Update: boolean; virtual;
       function    IsModified: boolean; virtual;
       function    IsModified: boolean; virtual;
       function    SearchSection(Section: string): PINISection; virtual;
       function    SearchSection(Section: string): PINISection; virtual;
-      function    SearchEntry(Section, Tag: string): PINIEntry; virtual;
-      procedure   ForEachEntry(Section: string; EnumProc: pointer); virtual;
-      function    GetEntry(Section, Tag, Default: string): string; virtual;
-      procedure   SetEntry(Section, Tag, Value: string); virtual;
-      function    GetIntEntry(Section, Tag: string; Default: longint): longint; virtual;
-      procedure   SetIntEntry(Section, Tag: string; Value: longint); virtual;
-      procedure   DeleteSection(Section: string); virtual;
+      function    SearchEntry(const Section, Tag: string): PINIEntry; virtual;
+      procedure   ForEachEntry(const Section: string; EnumProc: pointer); virtual;
+      function    GetEntry(const Section, Tag, Default: string): string; virtual;
+      procedure   SetEntry(const Section, Tag, Value: string); virtual;
+      function    GetIntEntry(const Section, Tag: string; Default: longint): longint; virtual;
+      procedure   SetIntEntry(const Section, Tag: string; Value: longint); virtual;
+      procedure   DeleteSection(const Section: string); virtual;
       destructor  Done; virtual;
       destructor  Done; virtual;
     private
     private
       ReadOnly: boolean;
       ReadOnly: boolean;
@@ -90,7 +90,7 @@ begin
   IntToStr:=S;
   IntToStr:=S;
 end;
 end;
 
 
-function StrToInt(S: string): longint;
+function StrToInt(const S: string): longint;
 var L: longint;
 var L: longint;
     C: integer;
     C: integer;
 begin
 begin
@@ -99,47 +99,55 @@ begin
   StrToInt:=L;
   StrToInt:=L;
 end;
 end;
 
 
-function UpcaseStr(S: string): string;
-var I: integer;
+function UpcaseStr(const S: string): string;
+var
+  i  : Sw_word;
 begin
 begin
-  for I:=1 to length(S) do
-      S[I]:=Upcase(S[I]);
-  UpcaseStr:=S;
+  for i:=1 to length(s) do
+   if s[i] in ['a'..'z'] then
+    UpcaseStr[i]:=char(byte(s[i])-32)
+   else
+    UpcaseStr[i]:=s[i];
+  UpcaseStr[0]:=s[0];
 end;
 end;
 
 
-function LTrim(S: string): string;
+function LTrim(const S: string): string;
+var
+  i : Sw_integer;
 begin
 begin
-  while copy(S,1,1)=' ' do Delete(S,1,1);
-  LTrim:=S;
+  i:=1;
+  while (i<length(S)) and (S[i]=' ') do
+   inc(i);
+  LTrim:=Copy(S,i,255);
 end;
 end;
 
 
-
-function RTrim(S: string): string;
+Function RTrim(const S:string):string;
+var
+  i : Sw_integer;
 begin
 begin
-  while copy(S,length(S),1)=' ' do Delete(S,length(S),1);
-  RTrim:=S;
+  i:=length(S);
+  while (i>0) and (S[i]=' ') do
+   dec(i);
+  RTrim:=Copy(S,1,i);
 end;
 end;
 
 
-
-function Trim(S: string): string;
+function Trim(const S: string): string;
 begin
 begin
   Trim:=RTrim(LTrim(S));
   Trim:=RTrim(LTrim(S));
 end;
 end;
 
 
-
 function GetStr(P: PString): string;
 function GetStr(P: PString): string;
 begin
 begin
   if P=nil then GetStr:='' else GetStr:=P^;
   if P=nil then GetStr:='' else GetStr:=P^;
 end;
 end;
 
 
-
 function EatIO: integer;
 function EatIO: integer;
 begin
 begin
   EatIO:=IOResult;
   EatIO:=IOResult;
 end;
 end;
 
 
 
 
-constructor TINIEntry.Init(ALine: string);
+constructor TINIEntry.Init(const ALine: string);
 begin
 begin
   inherited Init;
   inherited Init;
   Text:=NewStr(ALine);
   Text:=NewStr(ALine);
@@ -180,7 +188,7 @@ begin
 end;
 end;
 
 
 
 
-procedure TINIEntry.SetValue(S: string);
+procedure TINIEntry.SetValue(const S: string);
 begin
 begin
   if GetValue<>S then
   if GetValue<>S then
   begin
   begin
@@ -234,7 +242,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TINISection.Init(AName: string);
+constructor TINISection.Init(const AName: string);
 begin
 begin
   inherited Init;
   inherited Init;
   Name:=NewStr(AName);
   Name:=NewStr(AName);
@@ -247,7 +255,7 @@ begin
   GetName:=GetStr(Name);
   GetName:=GetStr(Name);
 end;
 end;
 
 
-function TINISection.AddEntry(S: string): PINIEntry;
+function TINISection.AddEntry(const S: string): PINIEntry;
 var E: PINIEntry;
 var E: PINIEntry;
 begin
 begin
   New(E, Init(S));
   New(E, Init(S));
@@ -293,7 +301,7 @@ begin
 end;
 end;
 
 
 
 
-constructor TINIFile.Init(AFileName: string);
+constructor TINIFile.Init(const AFileName: string);
 begin
 begin
   inherited Init;
   inherited Init;
   FileName:=NewStr(AFileName);
   FileName:=NewStr(AFileName);
@@ -413,7 +421,7 @@ begin
   SearchSection:=Sections^.FirstThat(@MatchingSection);
   SearchSection:=Sections^.FirstThat(@MatchingSection);
 end;
 end;
 
 
-function TINIFile.SearchEntry(Section, Tag: string): PINIEntry;
+function TINIFile.SearchEntry(const Section, Tag: string): PINIEntry;
 var P: PINISection;
 var P: PINISection;
     E: PINIEntry;
     E: PINIEntry;
 begin
 begin
@@ -423,7 +431,7 @@ begin
   SearchEntry:=E;
   SearchEntry:=E;
 end;
 end;
 
 
-procedure TINIFile.ForEachEntry(Section: string; EnumProc: pointer);
+procedure TINIFile.ForEachEntry(const Section: string; EnumProc: pointer);
 var P: PINISection;
 var P: PINISection;
     E: PINIEntry;
     E: PINIEntry;
     I: integer;
     I: integer;
@@ -446,7 +454,7 @@ begin
       end;
       end;
 end;
 end;
 
 
-function TINIFile.GetEntry(Section, Tag, Default: string): string;
+function TINIFile.GetEntry(const Section, Tag, Default: string): string;
 var E: PINIEntry;
 var E: PINIEntry;
     S: string;
     S: string;
 begin
 begin
@@ -456,7 +464,7 @@ begin
   GetEntry:=S;
   GetEntry:=S;
 end;
 end;
 
 
-procedure TINIFile.SetEntry(Section, Tag, Value: string);
+procedure TINIFile.SetEntry(const Section, Tag, Value: string);
 var E: PINIEntry;
 var E: PINIEntry;
     P: PINISection;
     P: PINISection;
 begin
 begin
@@ -477,7 +485,7 @@ begin
     E^.SetValue(Value);
     E^.SetValue(Value);
 end;
 end;
 
 
-function TINIFile.GetIntEntry(Section, Tag: string; Default: longint): longint;
+function TINIFile.GetIntEntry(const Section, Tag: string; Default: longint): longint;
 var L: longint;
 var L: longint;
 begin
 begin
   L:=StrToInt(GetEntry(Section,Tag,IntToStr(Default)));
   L:=StrToInt(GetEntry(Section,Tag,IntToStr(Default)));
@@ -485,12 +493,12 @@ begin
   GetIntEntry:=L;
   GetIntEntry:=L;
 end;
 end;
 
 
-procedure TINIFile.SetIntEntry(Section, Tag: string; Value: longint);
+procedure TINIFile.SetIntEntry(const Section, Tag: string; Value: longint);
 begin
 begin
   SetEntry(Section,Tag,IntToStr(Value));
   SetEntry(Section,Tag,IntToStr(Value));
 end;
 end;
 
 
-procedure TINIFile.DeleteSection(Section: string);
+procedure TINIFile.DeleteSection(const Section: string);
 var P: PINISection;
 var P: PINISection;
 begin
 begin
   P:=SearchSection(Section);
   P:=SearchSection(Section);
@@ -512,7 +520,12 @@ end;
 END.
 END.
 {
 {
   $Log$
   $Log$
-  Revision 1.4  1999-02-10 09:14:57  pierre
+  Revision 1.5  1999-02-22 02:15:26  peter
+    + default extension for save in the editor
+    + Separate Text to Find for the grep dialog
+    * fixed redir crash with tp7
+
+  Revision 1.4  1999/02/10 09:14:57  pierre
    * Value was not disposed before overwrite in TINIEntry.SetValue
    * Value was not disposed before overwrite in TINIEntry.SetValue
 
 
   Revision 1.3  1999/01/21 11:54:33  peter
   Revision 1.3  1999/01/21 11:54:33  peter