added ipdefine.inc

git-svn-id: trunk@3976 -
This commit is contained in:
mattias 2003-03-27 19:16:39 +00:00
parent 2d20c163ab
commit a2a80bb473
6 changed files with 36 additions and 17 deletions

View File

@ -2751,6 +2751,14 @@ begin
'Define HL_LAZARUS','HL_LAZARUS','',da_DefineRecurse)); 'Define HL_LAZARUS','HL_LAZARUS','',da_DefineRecurse));
DirTempl.AddChild(SubDirTempl); DirTempl.AddChild(SubDirTempl);
// components/turbopower_ipro
SubDirTempl:=TDefineTemplate.Create('TurboPower InternetPro',
'TurboPower InternetPro components',
'','turbopower_ipro',da_Directory);
SubDirTempl.AddChild(TDefineTemplate.Create('IP_LAZARUS',
'Define IP_LAZARUS','IP_LAZARUS','',da_DefineRecurse));
DirTempl.AddChild(SubDirTempl);
// components/custom // components/custom
SubDirTempl:=TDefineTemplate.Create('Custom Components', SubDirTempl:=TDefineTemplate.Create('Custom Components',
ctsCustomComponentsDirectory, ctsCustomComponentsDirectory,

View File

@ -904,7 +904,8 @@ begin
writeln(DebugPrefix,'TFindDeclarationTool.FindDeclaration A CursorPos=',CursorPos.X,',',CursorPos.Y); writeln(DebugPrefix,'TFindDeclarationTool.FindDeclaration A CursorPos=',CursorPos.X,',',CursorPos.Y);
{$ENDIF} {$ENDIF}
BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos, BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos,
[{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}]); [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}],
false);
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
writeln(DebugPrefix,'TFindDeclarationTool.FindDeclaration C CleanCursorPos=',CleanCursorPos); writeln(DebugPrefix,'TFindDeclarationTool.FindDeclaration C CleanCursorPos=',CleanCursorPos);
{$ENDIF} {$ENDIF}

View File

@ -715,7 +715,7 @@ begin
writeln('TIdentCompletionTool.GatherIdentifiers A CursorPos=',CursorPos.X,',',CursorPos.Y); writeln('TIdentCompletionTool.GatherIdentifiers A CursorPos=',CursorPos.X,',',CursorPos.Y);
{$ENDIF} {$ENDIF}
BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos, BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos,
[{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}]); [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}],true);
// find node at position // find node at position
CursorNode:=FindDeepestExpandedNodeAtPos(CleanCursorPos,true); CursorNode:=FindDeepestExpandedNodeAtPos(CleanCursorPos,true);

View File

@ -323,7 +323,7 @@ begin
{$IFDEF CTDEBUG} {$IFDEF CTDEBUG}
writeln('TMethodJumpingCodeTool.FindJumpPoint A CursorPos=',CursorPos.X,',',CursorPos.Y); writeln('TMethodJumpingCodeTool.FindJumpPoint A CursorPos=',CursorPos.X,',',CursorPos.Y);
{$ENDIF} {$ENDIF}
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true);
GetLineInfo(CleanCursorPos,LineStart,LineEnd,FirstAtomStart,LastAtomEnd); GetLineInfo(CleanCursorPos,LineStart,LineEnd,FirstAtomStart,LastAtomEnd);
if CleanCursorPos<FirstAtomStart then CleanCursorPos:=FirstAtomStart; if CleanCursorPos<FirstAtomStart then CleanCursorPos:=FirstAtomStart;
if CleanCursorPos>=LastAtomEnd then CleanCursorPos:=LastAtomEnd-1; if CleanCursorPos>=LastAtomEnd then CleanCursorPos:=LastAtomEnd-1;

View File

@ -99,7 +99,10 @@ type
TTreeRange = (trInterface, trAll, trTillCursor); TTreeRange = (trInterface, trAll, trTillCursor);
TBuildTreeFlag = (btSetIgnoreErrorPos,btKeepIgnoreErrorPos); TBuildTreeFlag = (
btSetIgnoreErrorPos,
btKeepIgnoreErrorPos
);
TBuildTreeFlags = set of TBuildTreeFlag; TBuildTreeFlags = set of TBuildTreeFlag;
TPascalParserTool = class(TMultiKeyWordListCodeTool) TPascalParserTool = class(TMultiKeyWordListCodeTool)
@ -203,7 +206,7 @@ type
procedure BuildTree(OnlyInterfaceNeeded: boolean); virtual; procedure BuildTree(OnlyInterfaceNeeded: boolean); virtual;
procedure BuildTreeAndGetCleanPos(TreeRange: TTreeRange; procedure BuildTreeAndGetCleanPos(TreeRange: TTreeRange;
const CursorPos: TCodeXYPosition; var CleanCursorPos: integer; const CursorPos: TCodeXYPosition; var CleanCursorPos: integer;
BuildTreeFlags: TBuildTreeFlags); BuildTreeFlags: TBuildTreeFlags; ExceptionOnCursorPosOut: boolean);
procedure BuildSubTreeForClass(ClassNode: TCodeTreeNode); virtual; procedure BuildSubTreeForClass(ClassNode: TCodeTreeNode); virtual;
procedure BuildSubTreeForBeginBlock(BeginNode: TCodeTreeNode); virtual; procedure BuildSubTreeForBeginBlock(BeginNode: TCodeTreeNode); virtual;
procedure BuildSubTreeForProcHead(ProcNode: TCodeTreeNode); virtual; procedure BuildSubTreeForProcHead(ProcNode: TCodeTreeNode); virtual;
@ -3938,7 +3941,8 @@ end;
procedure TPascalParserTool.BuildTreeAndGetCleanPos( procedure TPascalParserTool.BuildTreeAndGetCleanPos(
TreeRange: TTreeRange; const CursorPos: TCodeXYPosition; TreeRange: TTreeRange; const CursorPos: TCodeXYPosition;
var CleanCursorPos: integer; BuildTreeFlags: TBuildTreeFlags); var CleanCursorPos: integer; BuildTreeFlags: TBuildTreeFlags;
ExceptionOnCursorPosOut: boolean);
var var
Dummy: integer; Dummy: integer;
IgnorePos: TCodePosition; IgnorePos: TCodePosition;
@ -3954,7 +3958,6 @@ begin
end end
else if (btKeepIgnoreErrorPos in BuildTreeFlags) then else if (btKeepIgnoreErrorPos in BuildTreeFlags) then
ClearIgnoreErrorAfter; ClearIgnoreErrorAfter;
if (TreeRange=trTillCursor) and (not UpdateNeeded(true)) then begin if (TreeRange=trTillCursor) and (not UpdateNeeded(true)) then begin
// interface tree is valid // interface tree is valid
// -> if there was an error, raise it again // -> if there was an error, raise it again
@ -3969,7 +3972,10 @@ begin
BuildSubTree(CleanCursorPos); BuildSubTree(CleanCursorPos);
exit; exit;
end; end;
// cursor is not in partially parsed code -> parse complete code
end; end;
// parse code
BuildTree(TreeRange=trInterface); BuildTree(TreeRange=trInterface);
if (not IgnoreErrorAfterValid) and (not EndOfSourceFound) then if (not IgnoreErrorAfterValid) and (not EndOfSourceFound) then
SaveRaiseException(ctsEndOfSourceNotFound); SaveRaiseException(ctsEndOfSourceNotFound);
@ -3979,7 +3985,10 @@ begin
BuildSubTree(CleanCursorPos); BuildSubTree(CleanCursorPos);
exit; exit;
end; end;
RaiseException(ctsCursorPosOutsideOfCode); if (Dummy=-2) or ExceptionOnCursorPosOut then
RaiseException(ctsCursorPosOutsideOfCode);
// cursor outside of clean code
CleanCursorPos:=-1;
end; end;
function TPascalParserTool.FindTypeNodeOfDefinition( function TPascalParserTool.FindTypeNodeOfDefinition(
@ -4437,7 +4446,8 @@ procedure TPascalParserTool.BuildSubTree(CleanCursorPos: integer);
var var
ANode: TCodeTreeNode; ANode: TCodeTreeNode;
begin begin
ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); ANode:=FindDeepestNodeAtPos(CleanCursorPos,false);
if ANode=nil then exit;
case ANode.Desc of case ANode.Desc of
ctnClass,ctnClassInterface: ctnClass,ctnClassInterface:
BuildSubTreeForClass(ANode); BuildSubTreeForClass(ANode);

View File

@ -1264,7 +1264,7 @@ begin
StartPos:=CursorPos; StartPos:=CursorPos;
EndPos:=CursorPos; EndPos:=CursorPos;
Result:=true; Result:=true;
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true);
//writeln('TStandardCodeTool.GetStringConstBounds A ',CleanCursorPos,' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"'); //writeln('TStandardCodeTool.GetStringConstBounds A ',CleanCursorPos,' "',copy(Src,CleanCursorPos-5,5),'" | "',copy(Src,CleanCursorPos,5),'"');
GetCleanPosInfo(-1,CleanCursorPos,ResolveComments,SameArea); GetCleanPosInfo(-1,CleanCursorPos,ResolveComments,SameArea);
//writeln('TStandardCodeTool.GetStringConstBounds B ',SameArea.StartPos,'-',SameArea.EndPos,' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"'); //writeln('TStandardCodeTool.GetStringConstBounds B ',SameArea.StartPos,'-',SameArea.EndPos,' "',copy(Src,SameArea.StartPos,SameArea.EndPos-SameArea.StartPos),'"');
@ -1430,7 +1430,7 @@ var
begin begin
Result:=false; Result:=false;
//writeln('TStandardCodeTool.GatherResourceStringSections A '); //writeln('TStandardCodeTool.GatherResourceStringSections A ');
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true);
CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true); CursorNode:=FindDeepestNodeAtPos(CleanCursorPos,true);
PositionList.Clear; PositionList.Clear;
ANode:=CursorNode; ANode:=CursorNode;
@ -1470,7 +1470,7 @@ begin
Result:=false; Result:=false;
if ResStrIdentifier='' then exit; if ResStrIdentifier='' then exit;
// parse source and find clean positions // parse source and find clean positions
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true);
// find resource string section // find resource string section
ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); ANode:=FindDeepestNodeAtPos(CleanCursorPos,true);
if (ANode=nil) then exit; if (ANode=nil) then exit;
@ -1499,7 +1499,7 @@ begin
Result:=false; Result:=false;
if MaxLen<=0 then exit; if MaxLen<=0 then exit;
// parse source and find clean positions // parse source and find clean positions
BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[]); BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[],true);
Dummy:=CaretToCleanPos(EndCursorPos, EndPos); Dummy:=CaretToCleanPos(EndCursorPos, EndPos);
if (Dummy<>0) and (Dummy<>-1) then exit; if (Dummy<>0) and (Dummy<>-1) then exit;
// read string constants and extract identifier characters // read string constants and extract identifier characters
@ -1635,7 +1635,7 @@ var
begin begin
Result:=false; Result:=false;
// parse source and find clean positions // parse source and find clean positions
BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[]); BuildTreeAndGetCleanPos(trAll,StartCursorPos,StartPos,[],true);
Dummy:=CaretToCleanPos(EndCursorPos, EndPos); Dummy:=CaretToCleanPos(EndCursorPos, EndPos);
if (Dummy<>0) and (Dummy<>-1) then exit; if (Dummy<>0) and (Dummy<>-1) then exit;
// read string constants and convert it // read string constants and convert it
@ -1693,7 +1693,7 @@ begin
Result:=false; Result:=false;
if PositionList=nil then exit; if PositionList=nil then exit;
// parse source and find clean positions // parse source and find clean positions
BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[]); BuildTreeAndGetCleanPos(trAll,CursorPos,CleanCursorPos,[],true);
// find resource string section // find resource string section
ANode:=FindDeepestNodeAtPos(CleanCursorPos,true); ANode:=FindDeepestNodeAtPos(CleanCursorPos,true);
if (ANode=nil) then exit; if (ANode=nil) then exit;
@ -1725,7 +1725,7 @@ begin
if SourceChangeCache=nil then exit; if SourceChangeCache=nil then exit;
SourceChangeCache.MainScanner:=Scanner; SourceChangeCache.MainScanner:=Scanner;
// parse source and find clean positions // parse source and find clean positions
BuildTreeAndGetCleanPos(trAll,SectionPos,CleanSectionPos,[]); BuildTreeAndGetCleanPos(trAll,SectionPos,CleanSectionPos,[],true);
// find resource string section // find resource string section
SectionNode:=FindDeepestNodeAtPos(CleanSectionPos,true); SectionNode:=FindDeepestNodeAtPos(CleanSectionPos,true);
if (SectionNode=nil) then exit; if (SectionNode=nil) then exit;
@ -2096,7 +2096,7 @@ begin
Result:=false; Result:=false;
try try
BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos, BuildTreeAndGetCleanPos(trTillCursor,CursorPos,CleanCursorPos,
[{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}]); [{$IFDEF IgnoreErrorAfterCursor}btSetIgnoreErrorPos{$ENDIF}],true);
LinkIndex:=Scanner.LinkIndexAtCleanPos(CleanCursorPos); LinkIndex:=Scanner.LinkIndexAtCleanPos(CleanCursorPos);
LinkIndex:=Scanner.FindParentLink(LinkIndex); LinkIndex:=Scanner.FindParentLink(LinkIndex);
if LinkIndex<0 then if LinkIndex<0 then