fixed parsing procedure specifier public

git-svn-id: trunk@9344 -
This commit is contained in:
mattias 2006-05-23 21:42:52 +00:00
parent 26c4d62fe5
commit 07fec2d11b
4 changed files with 49 additions and 25 deletions

View File

@ -1613,13 +1613,16 @@ begin
UpperSrc:=UpperCaseStr(Src);
SrcLen:=length(Src);
FForceUpdateNeeded:=true;
if DeleteNodes then DoDeleteNodes;
DirtySrc.Free;
DirtySrc:=nil;
end else begin
if LastErrorPhase=CodeToolPhaseScan then
RaiseLastError;
end;
// delete nodes
if DeleteNodes then DoDeleteNodes;
// init parsing values
CurPos:=StartAtomPosition;
LastAtoms.Clear;

View File

@ -412,7 +412,7 @@ type
// FPC templates
function CreateFPCTemplate(const CompilerPath, CompilerOptions,
TestPascalFile: string;
var UnitSearchPath, TargetOS,
out UnitSearchPath, TargetOS,
TargetProcessor: string;
Owner: TObject): TDefineTemplate;
function CreateFPCSrcTemplate(const FPCSrcDir, UnitSearchPath, PPUExt,
@ -2619,7 +2619,7 @@ end;
function TDefinePool.CreateFPCTemplate(
const CompilerPath, CompilerOptions, TestPascalFile: string;
var UnitSearchPath, TargetOS, TargetProcessor: string;
out UnitSearchPath, TargetOS, TargetProcessor: string;
Owner: TObject): TDefineTemplate;
// create symbol definitions for the freepascal compiler
// To get reliable values the compiler itself is asked for
@ -2780,7 +2780,7 @@ begin
//DebugLn('TDefinePool.CreateFPCTemplate OutputLine="',OutputLine,'"');
TheProcess.Free;
end;
//DebugLn('TDefinePool.CreateFPCTemplate First done');
//DebugLn('TDefinePool.CreateFPCTemplate First done UnitSearchPath="',UnitSearchPath,'"');
// ask for target operating system -> ask compiler with switch -iTO
CmdLine:=CompilerPath;
@ -3205,6 +3205,7 @@ var
if CurMask[1]<>'.' then
CurMask:='.'+CurMask;
CurMask:='*'+CurMask;
//DebugLn('FindStandardPPUSources UnitSearchPath="',UnitSearchPath,'"');
while PathStart<=length(UnitSearchPath) do begin
while (PathStart<=length(UnitSearchPath))
and (UnitSearchPath[PathStart]=#13) do

View File

@ -1396,7 +1396,7 @@ begin
ReadNextAtom;
ReadConstant(true,false,[]);
end else if UpAtomIs('EXTERNAL') or UpAtomIs('PUBLIC') then begin
HasForwardModifier:=true;
HasForwardModifier:=UpAtomIs('EXTERNAL');
ReadNextAtom;
if CurPos.Flag<>cafSemicolon then begin
if not UpAtomIs('NAME') then

View File

@ -759,6 +759,7 @@ type
// methods for codetools
procedure InitCodeToolBoss;
procedure RescanCompilerDefines(OnlyIfCompilerChanged: boolean);
procedure GetFPCCompilerParamsForEnvironmentTest(out Params: string);
procedure UpdateEnglishErrorMsgFilename;
procedure ActivateCodeToolAbortableMode;
function BeginCodeTools: boolean; override;
@ -10272,6 +10273,7 @@ var CompilerUnitSearchPath, CompilerUnitLinks: string;
AFilename: string;
UnitLinksChanged: boolean;
TargetOS, TargetProcessor: string;
CompilerParameters: string;
begin
FOpenEditorsOnCodeToolChange:=false;
@ -10319,7 +10321,9 @@ begin
// start the compiler and ask for his settings
TargetOS:='';
TargetProcessor:='';
ADefTempl:=CreateFPCTemplate(EnvironmentOptions.CompilerFilename,'',
GetFPCCompilerParamsForEnvironmentTest(CompilerParameters);
ADefTempl:=CreateFPCTemplate(EnvironmentOptions.CompilerFilename,
CompilerParameters,
CreateCompilerTestPascalFilename,CompilerUnitSearchPath,
TargetOS,TargetProcessor,CodeToolsOpts);
AddTemplate(ADefTempl,false,
@ -10399,16 +10403,8 @@ var
TargetOS, TargetProcessor: string;
UnitLinksValid: boolean;
i: Integer;
CurTargetOS: String;
CurTargetCPU: String;
begin
CurOptions:='';
CurTargetOS:=GetTargetOS(false);
if CurTargetOS<>'' then
CurOptions:=AddCmdLineParameter(CurOptions,'-T'+CurTargetOS);
CurTargetCPU:=GetTargetCPU(false);
if CurTargetCPU<>'' then
CurOptions:=AddCmdLineParameter(CurOptions,'-P'+CurTargetCPU);
GetFPCCompilerParamsForEnvironmentTest(CurOptions);
{$IFDEF VerboseFPCSrcScan}
writeln('TMainIDE.RescanCompilerDefines A ',CurOptions,
' OnlyIfCompilerChanged=',OnlyIfCompilerChanged,
@ -10427,12 +10423,13 @@ begin
and (CurDefinesCompilerOptions=CurOptions) then
exit;
{$IFDEF VerboseFPCSrcScan}
writeln('TMainIDE.RescanCompilerDefines B rebuilding FPC templates');
debugln('TMainIDE.RescanCompilerDefines B rebuilding FPC templates');
{$ENDIF}
CompilerTemplate:=CodeToolBoss.DefinePool.CreateFPCTemplate(
EnvironmentOptions.CompilerFilename,CurOptions,
CreateCompilerTestPascalFilename,CompilerUnitSearchPath,
TargetOS,TargetProcessor,CodeToolsOpts);
//DebugLn('TMainIDE.RescanCompilerDefines CompilerUnitSearchPath="',CompilerUnitSearchPath,'"');
if CompilerTemplate<>nil then begin
CurDefinesCompilerFilename:=EnvironmentOptions.CompilerFilename;
@ -10444,22 +10441,24 @@ begin
i:=InputHistories.FPCConfigCache.FindItem(CurOptions);
if i<0 then begin
UnitLinksValid:=false;
end else begin
if CompareFilenames(InputHistories.FPCConfigCache.Items[i].FPCSrcDir,
EnvironmentOptions.FPCSourceDirectory)<>0 then
begin
UnitLinksValid:=false;
end;
end;
end
else if CompareFilenames(InputHistories.FPCConfigCache.Items[i].FPCSrcDir,
EnvironmentOptions.FPCSourceDirectory)<>0
then
UnitLinksValid:=false;
end;
{$IFDEF VerboseFPCSrcScan}
writeln('TMainIDE.RescanCompilerDefines B rescanning FPC sources UnitLinksValid=',UnitLinksValid);
debugln('TMainIDE.RescanCompilerDefines B rescanning FPC sources UnitLinksValid=',UnitLinksValid);
{$ENDIF}
// create compiler macros to simulate the Makefiles of the FPC sources
CompilerUnitLinks:='';
if UnitLinksValid then
CompilerUnitLinks:=InputHistories.FPCConfigCache.GetUnitLinks(CurOptions);
if System.Pos('system ',CompilerUnitLinks)<1 then begin
UnitLinksValid:=false;
end;
FPCSrcTemplate:=CodeToolBoss.DefinePool.CreateFPCSrcTemplate(
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'FPCSrcDir'],
CompilerUnitSearchPath,
@ -10467,8 +10466,15 @@ begin
TargetOS,TargetProcessor,
UnitLinksValid, CompilerUnitLinks, CodeToolsOpts);
{$IFDEF VerboseFPCSrcScan}
writeln('TMainIDE.RescanCompilerDefines C UnitLinks=',copy(CompilerUnitLinks,1,100));
debugln('TMainIDE.RescanCompilerDefines C UnitLinks=',copy(CompilerUnitLinks,1,100));
{$ENDIF}
if System.Pos('system ',CompilerUnitLinks)<1 then begin
MessageDlg('Error',
'The system.ppu was not found in the FPC directories. '
+'Make sure fpc is installed correctly and the fpc.cfg points to the right directory.',
mtError,[mbOk],0);
end;
if FPCSrcTemplate<>nil then begin
CodeToolBoss.DefineTree.RemoveRootDefineTemplateByName(
FPCSrcTemplate.Name);
@ -10491,6 +10497,20 @@ begin
end;
end;
procedure TMainIDE.GetFPCCompilerParamsForEnvironmentTest(out Params: string);
var
CurTargetOS: string;
CurTargetCPU: string;
begin
Params:='';
CurTargetOS:=GetTargetOS(false);
if CurTargetOS<>'' then
Params:=AddCmdLineParameter(Params,'-T'+CurTargetOS);
CurTargetCPU:=GetTargetCPU(false);
if CurTargetCPU<>'' then
Params:=AddCmdLineParameter(Params,'-P'+CurTargetCPU);
end;
procedure TMainIDE.UpdateEnglishErrorMsgFilename;
begin
if EnvironmentOptions.LazarusDirectory<>'' then