codetools: fixed compilation of some examples

git-svn-id: trunk@22936 -
This commit is contained in:
mattias 2009-12-03 10:28:17 +00:00
parent 9df47277cd
commit 646abd53bf
6 changed files with 26 additions and 40 deletions

View File

@ -1,16 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="5"/>
<Version Value="7"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="AddClass"/>
</General>
@ -52,13 +51,10 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<Version Value="8"/>
<SearchPaths>
<OtherUnitFiles Value="scanexamples/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -28,8 +28,8 @@ program AddClass;
{$mode objfpc}{$H+}
uses
Classes, SysUtils, CodeCache, CodeToolManager, SimpleUnit1, FileProcs,
BasicCodeTools, SourceChanger, CodeToolsConfig, CodeCompletionTool, CodeTree;
Classes, SysUtils, CodeCache, CodeToolManager, FileProcs,
BasicCodeTools, SourceChanger, CodeTree;
var
Filename: string;

View File

@ -1,12 +1,13 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="6"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
<Title Value="addeventmethod"/>
</General>
@ -48,13 +49,11 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<Version Value="8"/>
<SearchPaths>
<OtherUnitFiles Value="scanexamples/"/>
<LCLWidgetType Value="nogui"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -29,7 +29,7 @@ program AddEventMethod;
uses
Classes, SysUtils, CodeCache, CodeToolManager, SimpleUnit1, FileProcs,
CodeToolsConfig, CodeCompletionTool, ExtCtrls;
CodeToolsConfig, CodeCompletionTool, ExtCtrls, Interfaces;
const
ConfigFilename = 'codetools.config';

View File

@ -1,12 +1,13 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<PathDelim Value="/"/>
<Version Value="5"/>
<Version Value="7"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<PublishOptions>
@ -39,13 +40,10 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
<Version Value="8"/>
<SearchPaths>
<OtherUnitFiles Value="scanexamples/"/>
</SearchPaths>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -34,7 +34,6 @@ uses
var
Code: TCodeBuffer;
Filename: String;
FAB: TFullyAutomaticBeautifier;
Y: LongInt;
X: LongInt;
p: integer;
@ -59,21 +58,15 @@ begin
if Code=nil then
raise Exception.Create('unable to read '+Filename);
FAB:=TFullyAutomaticBeautifier.Create;
try
Code.LineColToPosition(Y,X,p);
if p<1 then begin
writeln('ERROR: invalid position: X=',X,' Y=',Y,' in ',Code.Filename);
exit;
end;
if FAB.GetIndent(Code.Source,p,true,Indentation) then begin
writeln('Indent=',Indentation.Indent);
end else begin
writeln('Error: GetIndent failed');
end;
finally
FAB.Free;
Code.LineColToPosition(Y,X,p);
if p<1 then begin
writeln('ERROR: invalid position: X=',X,' Y=',Y,' in ',Code.Filename);
exit;
end;
if CodeToolBoss.Indenter.GetIndent(Code.Source,p,true,true,Indentation) then begin
writeln('Indent=',Indentation.Indent);
end else begin
writeln('Error: GetIndent failed');
end;
end.