From 48657d7019844840b1b8eeafab23a56ed072585c Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 2 Jan 2012 17:13:43 +0000 Subject: [PATCH] IDE: renamed circle detection with cycle detection git-svn-id: trunk@34541 - --- designer/anchoreditor.pas | 6 +++--- designer/designer.pp | 6 +++--- ide/compileroptions.pp | 2 +- ide/lazarusidestrconsts.pas | 16 ++++++++-------- packager/addtopackagedlg.pas | 2 +- packager/packagedefs.pas | 2 +- packager/packagesystem.pas | 32 ++++++++++++++++---------------- packager/pkgmanager.pas | 10 +++++----- 8 files changed, 38 insertions(+), 38 deletions(-) diff --git a/designer/anchoreditor.pas b/designer/anchoreditor.pas index 9a527fe15a..5839f123f1 100644 --- a/designer/anchoreditor.pas +++ b/designer/anchoreditor.pas @@ -318,7 +318,7 @@ begin ReferenceControl,ReferenceSide,CheckPosition)) then begin if MessageDlg(lisCCOWarningCaption, - lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> + lisThisWillCreateACycle, mtWarning, [mbIgnore, mbCancel], 0)<> mrIgnore then begin Refresh(false); @@ -538,7 +538,7 @@ begin ReferenceControl,ReferenceSide,CheckPosition)) then begin if MessageDlg(lisCCOWarningCaption, - lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> + lisThisWillCreateACycle, mtWarning, [mbIgnore, mbCancel], 0)<> mrIgnore then begin Refresh(false); @@ -649,7 +649,7 @@ begin ReferenceControl,ReferenceSide,CheckPosition)) then begin if MessageDlg(lisCCOWarningCaption, - lisThisWillCreateACircle, mtWarning, [mbIgnore, mbCancel], 0)<> + lisThisWillCreateACycle, mtWarning, [mbIgnore, mbCancel], 0)<> mrIgnore then begin Refresh(false); diff --git a/designer/designer.pp b/designer/designer.pp index 867402febe..3c41c04163 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -1975,11 +1975,11 @@ var //DebugLn(['AddComponent ',dbgsName(NewComponentClass)]); if NewComponentClass = nil then exit; - // check circles + // check cycles if TheFormEditor.ClassDependsOnComponent(NewComponentClass, LookupRoot) then begin - IDEMessageDialog(lisInvalidCircle, - Format(lisIsAThisCircleDependencyIsNotAllowed, [dbgsName(LookupRoot), + IDEMessageDialog(lisInvalidCycle, + Format(lisIsAThisCycleDependencyIsNotAllowed, [dbgsName(LookupRoot), dbgsName(NewComponentClass), #13]), mtError,[mbOk],''); exit; diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 7d65f1e703..f0fe942608 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -3711,7 +3711,7 @@ begin if ParsedStamp[Option]<>CompilerParseStamp then begin if Parsing[Option] then begin DebugLn('TParsedCompilerOptions.GetParsedValue Circle in Options: ',EnumToStr(Option),' Unparsed="',UnparsedValues[Option],'"'); - ParsedError(Option, lisCircleInMacros); + ParsedError(Option, lisCycleInMacros); exit(''); end; Parsing[Option]:=true; diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index 89fb76f337..18c510fa62 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -3647,15 +3647,15 @@ resourcestring +'Project Inspector.'; lisPkgMangARequiredPackagesWasNotFound = 'A required packages was not ' +'found. See package graph.'; - lisPkgMangCircleInPackageDependencies = 'Circle in package dependencies'; + lisPkgMangCycleInPackageDependencies = 'Cycle in package dependencies'; lisPkgMangThePackageIsCompiledAutomaticallyAndItsOutputDirec = 'The package ' +'%s is compiled automatically and its output directory is "%s", which is ' +'in the default unit search path of the compiler. The package uses other ' +'packages which also uses the default unit search of the compiler. This ' - +'creates a circle.%sYou can fix this issue%sby removing the path from ' + +'creates a cycle.%sYou can fix this issue%sby removing the path from ' +'your compiler config (e.g. fpc.cfg)%sor by disabling the auto update of ' +'this package%sor by removing dependencies.'; - lisPkgMangThereIsACircleInTheRequiredPackages = 'There is a circle in the ' + lisPkgMangThereIsACycleInTheRequiredPackages = 'There is a cycle in the ' +'required packages. See package graph.'; lisPkgMangThereAreTwoUnitsWithTheSameName1From2From = 'There are two units ' +'with the same name:%s%s1. %s%s%s from %s%s2. %s%s%s from %s%s%s'; @@ -3926,7 +3926,7 @@ resourcestring lisA2PInvalidClassName = 'Invalid Class Name'; lisA2PTheClassNameIsNotAValidPascalIdentifier = 'The class name %s%s%s is ' +'not a valid pascal identifier.'; - lisA2PInvalidCircle = 'Invalid Circle'; + lisA2PInvalidCycle = 'Invalid Cycle'; lisA2PTheClassNameAndAncestorTypeAreTheSame = 'The class name %s%s%s and ' +'ancestor type %s%s%s are the same.'; lisA2PAmbiguousAncestorType = 'Ambiguous Ancestor Type'; @@ -4491,7 +4491,7 @@ resourcestring lisLeftGroupBoxCaption = 'Left anchoring'; lisBottomGroupBoxCaption = 'Bottom anchoring'; lisUnableToSetAnchorSideControl = 'Unable to set AnchorSide Control'; - lisThisWillCreateACircle = 'This will create a circle.'; + lisThisWillCreateACycle = 'This will create a cycle.'; lisAnchorEditorNoControlSelected = 'Anchor Editor - no control selected'; lisAnchorsOfSelectedControls = 'Anchors of selected controls'; lisDebugOptionsFrmAdditionalSearchPath = 'Additional search path'; @@ -4803,8 +4803,8 @@ resourcestring lisPWOpenRecentProject = 'Open Recent Project'; lisPWViewExampleProjects = 'View Example Projects'; lisPWConvertProject = 'Convert Delphi Project'; - lisInvalidCircle = 'Invalid circle'; - lisIsAThisCircleDependencyIsNotAllowed = '%s is a %s.%sThis circle ' + lisInvalidCycle = 'Invalid cycle'; + lisIsAThisCycleDependencyIsNotAllowed = '%s is a %s.%sThis cycle ' +'dependency is not allowed.'; lisTheComponentCanNotBeDeletedBecauseItIsNotOwnedBy = 'The component %s can ' +'not be deleted, because it is not owned by %s.'; @@ -5279,7 +5279,7 @@ resourcestring lisPEDirectories = 'Directories'; lisSelectAnotherLCLWidgetSetMacroLCLWidgetType = 'Select another LCL widget ' +'set (macro LCLWidgetType)'; - lisCircleInMacros = 'Circle in macros'; + lisCycleInMacros = 'Cycle in macros'; // Uses Unit dialog dlgAlreadyUsesAllOtherUnits = '"%s" already uses all the units in this project'; diff --git a/packager/addtopackagedlg.pas b/packager/addtopackagedlg.pas index bf0ac40d0a..50532f4e25 100644 --- a/packager/addtopackagedlg.pas +++ b/packager/addtopackagedlg.pas @@ -861,7 +861,7 @@ begin // check classname<>ancestortype if AnsiCompareText(Params.NewClassName,Params.AncestorType)=0 then begin - IDEMessageDialog(lisA2PInvalidCircle, + IDEMessageDialog(lisA2PInvalidCycle, Format(lisA2PTheClassNameAndAncestorTypeAreTheSame, ['"', Params.NewClassName, '"', '"', Params.AncestorType, '"']), mtError,[mbCancel]); diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas index cde0ceefcd..dc3ee8dd95 100644 --- a/packager/packagedefs.pas +++ b/packager/packagedefs.pas @@ -505,7 +505,7 @@ type lpfDestroying, // set during destruction lpfLoading, // set during loading lpfSkipSaving, // Used by PkgBoss to skip saving - lpfCircle // Used by the PackageGraph to mark circles + lpfCycle // Used by the PackageGraph to mark cycles ); TLazPackageFlags = set of TLazPackageFlag; diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index c8a6f46de1..ca73d72dc1 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -193,9 +193,9 @@ type function FindBrokenDependencyPath(APackage: TLazPackage; FirstDependency: TPkgDependency): TFPList; function FindAllBrokenDependencies(APackage: TLazPackage; - FirstDependency: TPkgDependency): TFPList; - function FindCircleDependencyPath(APackage: TLazPackage; - FirstDependency: TPkgDependency): TFPList; + FirstDependency: TPkgDependency): TFPList; + function FindCycleDependencyPath(APackage: TLazPackage; + FirstDependency: TPkgDependency): TFPList; function FindPkgOutputInFPCSearchPath(APackage: TLazPackage; FirstDependency: TPkgDependency): TFPList; // find a package with auto compile and output dir is in FPC default search path function FindUnsavedDependencyPath(APackage: TLazPackage; @@ -2496,10 +2496,10 @@ begin FindBroken(FirstDependency,Result); end; -function TLazPackageGraph.FindCircleDependencyPath(APackage: TLazPackage; +function TLazPackageGraph.FindCycleDependencyPath(APackage: TLazPackage; FirstDependency: TPkgDependency): TFPList; - procedure FindCircle(Dependency: TPkgDependency; var PathList: TFPList); + procedure FindCycle(Dependency: TPkgDependency; var PathList: TFPList); var RequiredPackage: TLazPackage; begin @@ -2507,22 +2507,22 @@ function TLazPackageGraph.FindCircleDependencyPath(APackage: TLazPackage; if Dependency.LoadPackageResult=lprSuccess then begin // dependency ok RequiredPackage:=Dependency.RequiredPackage; - if lpfCircle in RequiredPackage.Flags then begin - // circle detected + if lpfCycle in RequiredPackage.Flags then begin + // cycle detected PathList:=TFPList.Create; PathList.Add(RequiredPackage); exit; end; if not (lpfVisited in RequiredPackage.Flags) then begin - RequiredPackage.Flags:=RequiredPackage.Flags+[lpfVisited,lpfCircle]; - FindCircle(RequiredPackage.FirstRequiredDependency,PathList); + RequiredPackage.Flags:=RequiredPackage.Flags+[lpfVisited,lpfCycle]; + FindCycle(RequiredPackage.FirstRequiredDependency,PathList); if PathList<>nil then begin - // circle detected + // cycle detected // -> add current package to list PathList.Insert(0,RequiredPackage); exit; end; - RequiredPackage.Flags:=RequiredPackage.Flags-[lpfCircle]; + RequiredPackage.Flags:=RequiredPackage.Flags-[lpfCycle]; end; end; Dependency:=Dependency.NextRequiresDependency; @@ -2535,16 +2535,16 @@ var begin Result:=nil; if (Count=0) then exit; - // mark all packages as not visited and circle free + // mark all packages as not visited and cycle free for i:=FItems.Count-1 downto 0 do begin Pkg:=TLazPackage(FItems[i]); - Pkg.Flags:=Pkg.Flags-[lpfVisited,lpfCircle]; + Pkg.Flags:=Pkg.Flags-[lpfVisited,lpfCycle]; end; if APackage<>nil then begin APackage.Flags:=APackage.Flags+[lpfVisited]; FirstDependency:=APackage.FirstRequiredDependency; end; - FindCircle(FirstDependency,Result); + FindCycle(FirstDependency,Result); if (Result<>nil) and (APackage<>nil) then Result.Insert(0,APackage); end; @@ -2572,7 +2572,7 @@ var Dir:=ChompPathDelim(CfgCache.UnitPaths[i]); if CompareFilenames(Dir,OutputDir)=0 then begin // this package changes the units in the default FPC search path - // => a circle, because the dependencies use FPC search path too + // => a cycle, because the dependencies use FPC search path too Result:=false; PathList:=TFPList.Create; PathList.Add(Pkg); @@ -2592,7 +2592,7 @@ var if CheckPkg(RequiredPackage,PathList) then exit; CheckDependencyList(RequiredPackage.FirstRequiredDependency,PathList); if PathList<>nil then begin - // circle detected + // cycle detected // -> add current package to list PathList.Insert(0,RequiredPackage); exit; diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index 82cf5a2321..f68795d887 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -1247,12 +1247,12 @@ begin exit; end; - // check for circle dependencies - PathList:=PackageGraph.FindCircleDependencyPath(APackage,FirstDependency); + // check for cycle dependencies + PathList:=PackageGraph.FindCycleDependencyPath(APackage,FirstDependency); if PathList<>nil then begin DoShowPackageGraphPathList(PathList); - Result:=IDEMessageDialogAb(lisPkgMangCircleInPackageDependencies, - lisPkgMangThereIsACircleInTheRequiredPackages, + Result:=IDEMessageDialogAb(lisPkgMangCycleInPackageDependencies, + lisPkgMangThereIsACycleInTheRequiredPackages, mtError,Btns,ShowAbort); if not ShowAbort then Result := mrCancel; // User confirmed error, implicitly cancel the action @@ -1264,7 +1264,7 @@ begin if PathList<>nil then begin ConflictPkg:=TObject(PathList[PathList.Count-1]) as TLazPackage; DoShowPackageGraphPathList(PathList); - Result:=IDEMessageDialogAb(lisPkgMangCircleInPackageDependencies, + Result:=IDEMessageDialogAb(lisPkgMangCycleInPackageDependencies, Format(lisPkgMangThePackageIsCompiledAutomaticallyAndItsOutputDirec, [ ConflictPkg.Name, ConflictPkg.GetOutputDirectory, #13#13, #13, #13, #13]),