From d4d9be12c6cef73781439940b593827d04f946e5 Mon Sep 17 00:00:00 2001 From: mattias Date: Tue, 1 Oct 2002 15:45:38 +0000 Subject: [PATCH] started package registration git-svn-id: trunk@3408 - --- ide/ideprocs.pp | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/ide/ideprocs.pp b/ide/ideprocs.pp index c3bf035afb..04138fc952 100644 --- a/ide/ideprocs.pp +++ b/ide/ideprocs.pp @@ -92,6 +92,9 @@ function CopyDirectoryWithMethods(const SrcDirectory, DestDirectory: string; function ProgramDirectory: string; function FindFilesCaseInsensitive(const Directory, CaseInsensitiveFilename: string; IgnoreExact: boolean): TStringList; +function FilenameIsPascalUnit(const Filename: string): boolean; +function FilenameIsPascalSource(const Filename: string): boolean; +function FilenameIsFormText(const Filename: string): boolean; // XMLConfig procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList; @@ -134,6 +137,8 @@ procedure RaiseException(const Msg: string); // miscellaneous procedure FreeThenNil(var Obj: TObject); function CompareCaret(const FirstCaret, SecondCaret: TPoint): integer; +procedure CheckList(List: TList; TestListNil, TestDoubles, TestNils: boolean); +procedure CheckEmptyListCut(List1, List2: TList); const {$IFDEF Win32} @@ -220,6 +225,31 @@ begin SysUtils.FindClose(FileInfo); end; +function FilenameIsPascalSource(const Filename: string): boolean; +var Ext: string; +begin + Ext:=lowercase(ExtractFileExt(Filename)); + Result:=((Ext='.pp') or (Ext='.pas') or (Ext='.lpr') + or (Ext='.dpr') or (Ext='.dpk')) + and (ExtractFileNameOnly(Filename)<>''); +end; + +function FilenameIsPascalUnit(const Filename: string): boolean; +var Ext: string; +begin + Ext:=lowercase(ExtractFileExt(Filename)); + Result:=((Ext='.pp') or (Ext='.pas')) + and (ExtractFileNameOnly(Filename)<>''); +end; + +function FilenameIsFormText(const Filename: string): boolean; +var Ext: string; +begin + Ext:=lowercase(ExtractFileExt(Filename)); + Result:=((Ext='.lfm') or (Ext='.dfm') or (Ext='.xfm')) + and (ExtractFileNameOnly(Filename)<>''); +end; + procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList; const Path: string); begin @@ -534,6 +564,54 @@ begin Result:=0; end; +{------------------------------------------------------------------------------- + procedure CheckList(List: TList; TestListNil, TestDoubles, TestNils: boolean); +-------------------------------------------------------------------------------} +procedure CheckList(List: TList; TestListNil, TestDoubles, TestNils: boolean); +var + Cnt: Integer; + i: Integer; + CurItem: Pointer; + j: Integer; +begin + if List=nil then begin + if TestListNil then + RaiseException('CheckList List is Nil'); + exit; + end; + Cnt:=List.Count; + if TestNils then begin + for i:=0 to Cnt-1 do + if List[i]=nil then + RaiseException('CheckList item is Nil'); + end; + if TestDoubles then begin + for i:=0 to Cnt-2 do begin + CurItem:=List[i]; + for j:=i+1 to Cnt-1 do begin + if List[j]=CurItem then + RaiseException('CheckList Double'); + end; + end; + end; +end; + +{------------------------------------------------------------------------------- + procedure CheckEmptyListCut(List1, List2: TList); +-------------------------------------------------------------------------------} +procedure CheckEmptyListCut(List1, List2: TList); +var + Cnt1: Integer; + i: Integer; +begin + if (List1=nil) or (List2=nil) then exit; + Cnt1:=List1.Count; + for i:=0 to Cnt1 do begin + if List2.IndexOf(List1[i])>=0 then + RaiseException('CheckEmptyListCut'); + end; +end; + {------------------------------------------------------------------------------- BackupFile