diff --git a/components/codetools/codetoolscfgscript.pas b/components/codetools/codetoolscfgscript.pas index 66b7a14cea..abea5961f3 100644 --- a/components/codetools/codetoolscfgscript.pas +++ b/components/codetools/codetoolscfgscript.pas @@ -54,7 +54,7 @@ interface uses Classes, SysUtils, BasicCodeTools, AVL_Tree, KeywordFuncLists, FileProcs, - typinfo, CodeToolsStrConsts; + CodeToolsStrConsts; type TCTCSValueType = ( @@ -975,17 +975,17 @@ end; function dbgs(const t: TCTCfgScriptStackItemType): string; begin - Result:=GetEnumName(typeinfo(t),ord(t)); + str(t,Result); end; function dbgs(const t: TCTCSValueType): string; begin - Result:=GetEnumName(typeinfo(t),ord(t)); + str(t,Result); end; function dbgs(const t: TCTCfgScriptOperator): string; begin - Result:=GetEnumName(typeinfo(t),ord(t)); + str(t,Result); end; function dbgs(const V: PCTCfgScriptVariable): string; diff --git a/components/codetools/finddeclarationtool.pas b/components/codetools/finddeclarationtool.pas index 8a6d54b7dc..48141e349c 100644 --- a/components/codetools/finddeclarationtool.pas +++ b/components/codetools/finddeclarationtool.pas @@ -178,29 +178,6 @@ const fdfDefaultForExpressions = [fdfSearchInParentNodes, fdfSearchInAncestors, fdfExceptionOnNotFound]; - // for nicer output - FindDeclarationFlagNames: array[TFindDeclarationFlag] of string = ( - 'fdfSearchInAncestors', - 'fdfSearchInParentNodes', - 'fdfIgnoreCurContextNode', - 'fdfIgnoreUsedUnits', - 'fdfSearchForward', - 'fdfExceptionOnNotFound', - 'fdfExceptionOnPredefinedIdent', - 'fdfIgnoreClassVisibility', - 'fdfIgnoreMissingParams', - 'fdfOnlyCompatibleProc', - 'fdfIgnoreOverloadedProcs', - 'fdfFindVariable', - 'fdfFunctionResult', - 'fdfEnumIdentifier', - 'fdfFindChilds', - 'fdfSkipClassForward', - 'fdfCollect', - 'fdfTopLvlResolving', - 'fdfDoNotCache' - ); - type // flags/states for result TFoundDeclarationFlag = ( @@ -208,11 +185,6 @@ type ); TFoundDeclarationFlags = set of TFoundDeclarationFlag; -const - FoundDeclarationFlagNames: array[TFoundDeclarationFlag] of string = ( - 'fodDoNotCache' - ); - //---------------------------------------------------------------------------- type TFindDeclarationParams = class; @@ -899,7 +871,9 @@ function dbgsFC(const Context: TFindContext): string; function PredefinedIdentToExprTypeDesc(Identifier: PChar): TExpressionTypeDesc; function dbgs(const Flags: TFindDeclarationFlags): string; overload; +function dbgs(const Flag: TFindDeclarationFlag): string; overload; function dbgs(const Flags: TFoundDeclarationFlags): string; overload; +function dbgs(const Flag: TFoundDeclarationFlag): string; overload; implementation @@ -914,11 +888,16 @@ begin if Flag in Flags then begin if Result<>'' then Result:=Result+', '; - Result:=Result+FindDeclarationFlagNames[Flag]; + Result:=Result+dbgs(Flag); end; end; end; +function dbgs(const Flag: TFindDeclarationFlag): string; +begin + str(Flag,Result); +end; + function dbgs( const Flags: TFoundDeclarationFlags): string; var Flag: TFoundDeclarationFlag; @@ -928,11 +907,16 @@ begin if Flag in Flags then begin if Result<>'' then Result:=Result+', '; - Result:=Result+FoundDeclarationFlagNames[Flag]; + Result:=Result+dbgs(Flag); end; end; end; +function dbgs(const Flag: TFoundDeclarationFlag): string; +begin + str(Flag,Result); +end; + function ListOfPFindContextToStr(const ListOfPFindContext: TFPList): string; var Context: TFindContext; diff --git a/components/codetools/linkscanner.pas b/components/codetools/linkscanner.pas index 9c5d982937..de7b412684 100644 --- a/components/codetools/linkscanner.pas +++ b/components/codetools/linkscanner.pas @@ -582,23 +582,6 @@ var PSourceLinkMemManager: TPSourceLinkMemManager; PSourceChangeStepMemManager: TPSourceChangeStepMemManager; -const - LinkScannerRangeNames: array[TLinkScannerRange] of string = ( - 'lsrNone', - 'lsrInit', - 'lsrSourceType', - 'lsrSourceName', - 'lsrInterfaceStart', - 'lsrMainUsesSectionStart', - 'lsrMainUsesSectionEnd', - 'lsrImplementationStart', - 'lsrImplementationUsesSectionStart', - 'lsrImplementationUsesSectionEnd', - 'lsrInitializationStart', - 'lsrFinalizationStart', - 'lsrEnd' - ); - procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList); function IndexOfCodeInUniqueList(ACode: Pointer; UniqueSortedCodeList: TList): integer; @@ -655,7 +638,7 @@ end; function dbgs(r: TLinkScannerRange): string; overload; begin - Result:=LinkScannerRangeNames[r]; + str(r,Result); end; procedure AddCodeToUniqueList(ACode: Pointer; UniqueSortedCodeList: TFPList); diff --git a/components/codetools/pascalparsertool.pas b/components/codetools/pascalparsertool.pas index a7a7ff12fd..aee982d461 100644 --- a/components/codetools/pascalparsertool.pas +++ b/components/codetools/pascalparsertool.pas @@ -265,42 +265,9 @@ type procedure CalcMemSize(Stats: TCTMemStats); override; end; -const - ProcHeadAttributeNames: array[TProcHeadAttribute] of string = ( - // extract attributes: - 'phpWithStart', - 'phpWithoutClassKeyword', - 'phpAddClassName', - 'phpWithoutClassName', - 'phpWithoutName', - 'phpWithoutParamList', - 'phpWithVarModifiers', - 'phpWithParameterNames', - 'phpWithoutParamTypes', - 'phpWithHasDefaultValues', - 'phpWithDefaultValues', - 'phpWithResultType', - 'phpWithOfObject', - 'phpWithCallingSpecs', - 'phpWithProcModifiers', - 'phpWithComments', - 'phpInUpperCase', - 'phpCommentsToSpace', - 'phpWithoutBrackets', - 'phpWithoutSemicolon', - 'phpDoNotAddSemicolon', - // search attributes: - 'phpIgnoreForwards', - 'phpIgnoreProcsWithBody', - 'phpIgnoreMethods', - 'phpOnlyWithClassname', - 'phpFindCleanPosition', - // parse attributes: - 'phpCreateNodes' - ); - function ProcHeadAttributesToStr(Attr: TProcHeadAttributes): string; function dbgs(Attr: TProcHeadAttributes): string; overload; +function dbgs(Attr: TProcHeadAttribute): string; overload; implementation @@ -318,7 +285,7 @@ begin for a:=Low(TProcHeadAttribute) to High(TProcHeadAttribute) do begin if a in Attr then begin if Result<>'' then Result:=Result+','; - Result:=Result+ProcHeadAttributeNames[a]; + Result:=Result+dbgs(a); end; end; end; @@ -328,6 +295,11 @@ begin Result:=ProcHeadAttributesToStr(Attr); end; +function dbgs(Attr: TProcHeadAttribute): string; +begin + str(Attr,Result); +end; + { TPascalParserTool } constructor TPascalParserTool.Create; diff --git a/components/codetools/sourcechanger.pas b/components/codetools/sourcechanger.pas index 4cb4486359..0a3098f20c 100644 --- a/components/codetools/sourcechanger.pas +++ b/components/codetools/sourcechanger.pas @@ -43,7 +43,7 @@ interface uses Classes, SysUtils, FileProcs, CodeToolsStrConsts, CodeCache, BasicCodeTools, - typinfo, LinkScanner, AVL_Tree, CodeBeautifier, KeywordFuncLists; + LinkScanner, AVL_Tree, CodeBeautifier, KeywordFuncLists; type // Insert policy types for class parts (properties, variables, method defs) @@ -394,7 +394,7 @@ end; function dbgs(g: TGapTyp): string; begin - Result:=GetEnumName(typeinfo(g),ord(g)); + str(g,Result); end; function CompareSourceChangeCacheEntry(NodeData1, NodeData2: pointer): integer;