added symlink test and unit types

git-svn-id: trunk@3726 -
This commit is contained in:
mattias 2002-12-23 10:12:40 +00:00
parent 847131452a
commit 4e54229b87
4 changed files with 81 additions and 5 deletions

View File

@ -2134,10 +2134,12 @@ function TFindDeclarationTool.FindBaseTypeOfNode(Params: TFindDeclarationParams;
RaiseExceptionFmt(ctsBaseTypeOfNotFound,[GetIdentifier(Params.Identifier)]); RaiseExceptionFmt(ctsBaseTypeOfNotFound,[GetIdentifier(Params.Identifier)]);
end; end;
var OldInput: TFindDeclarationInput; var
OldInput: TFindDeclarationInput;
ClassIdentNode, DummyNode: TCodeTreeNode; ClassIdentNode, DummyNode: TCodeTreeNode;
NodeStack: TCodeTreeNodeStack; NodeStack: TCodeTreeNodeStack;
OldPos: integer; OldPos: integer;
TypeFound: boolean;
procedure RaiseForwardNotResolved; procedure RaiseForwardNotResolved;
begin begin
@ -2237,7 +2239,24 @@ begin
if Params.ContextNode.Desc=ctnProcedureHead then if Params.ContextNode.Desc=ctnProcedureHead then
// skip search in proc parameters // skip search in proc parameters
Params.ContextNode:=Params.ContextNode.Parent; Params.ContextNode:=Params.ContextNode.Parent;
if FindIdentifierInContext(Params) then begin TypeFound:=FindIdentifierInContext(Params);
if TypeFound and (Params.NewNode.Desc in [ctnUnit,ctnLibrary,ctnPackage])
then begin
// unitname.typename
MoveCursorToNodeStart(Result.Node);
ReadNextAtom; // read unitname
ReadNextAtomIsChar('.');
ReadNextAtom; // read type identifier
Params.Load(OldInput);
Params.SetIdentifier(Self,@Src[CurPos.StartPos],
@CheckSrcIdentifier);
Params.Flags:=[fdfExceptionOnNotFound]
+(fdfGlobals*OldInput.Flags)
+[fdfIgnoreUsedUnits];
Params.ContextNode:=Params.NewCodeTool.FindInterfaceNode;
TypeFound:=Params.NewCodeTool.FindIdentifierInContext(Params);
end;
if TypeFound then begin
if Params.NewNode.Desc in [ctnTypeDefinition] then begin if Params.NewNode.Desc in [ctnTypeDefinition] then begin
if NodeExistsInStack(@NodeStack,Params.NewNode) then begin if NodeExistsInStack(@NodeStack,Params.NewNode) then begin
// circle detected // circle detected

View File

@ -46,10 +46,12 @@ uses
// file attributes and states // file attributes and states
function FilenameIsAbsolute(TheFilename: string):boolean; function FilenameIsAbsolute(TheFilename: string):boolean;
procedure CheckIfFileIsExecutable(const AFilename: string); procedure CheckIfFileIsExecutable(const AFilename: string);
procedure CheckIfFileIsSymlink(const AFilename: string);
function FileIsReadable(const AFilename: string): boolean; function FileIsReadable(const AFilename: string): boolean;
function FileIsWritable(const AFilename: string): boolean; function FileIsWritable(const AFilename: string): boolean;
function FileIsText(const AFilename: string): boolean; function FileIsText(const AFilename: string): boolean;
function FileIsExecutable(const AFilename: string): boolean; function FileIsExecutable(const AFilename: string): boolean;
function FileIsSymlink(const AFilename: string): boolean;
function GetFileDescription(const AFilename: string): string; function GetFileDescription(const AFilename: string): string;
// directories // directories
@ -106,6 +108,9 @@ end.
{ {
$Log$ $Log$
Revision 1.8 2002/12/23 10:12:40 mattias
added symlink test and unit types
Revision 1.7 2002/12/17 19:49:34 mattias Revision 1.7 2002/12/17 19:49:34 mattias
finished publish project finished publish project

View File

@ -290,6 +290,51 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------
procedure CheckIfFileIsSymlink(const AFilename: string);
------------------------------------------------------------------------------}
procedure CheckIfFileIsSymlink(const AFilename: string);
{$IFNDEF win32}
var
AText: string;
{$ENDIF}
begin
// to get good error messages consider the OS
if not FileExists(AFilename) then begin
raise Exception.Create('file "'+AFilename+'" does not exist');
end;
{$IFNDEF win32}
if {$IFDEF Ver1_0}Linux{$ELSE}Unix{$ENDIF}.ReadLink(AFilename)='' then begin
AText:='"'+AFilename+'"';
case LinuxError of
sys_eacces: AText:='read access denied for '+AText;
sys_enoent: AText:='a directory component in '+AText
+' does not exist or is a dangling symlink';
sys_enotdir: AText:='a directory component in '+Atext+' is not a directory';
sys_enomem: AText:='insufficient memory';
sys_eloop: AText:=AText+' has a circular symbolic link';
else
AText:=AText+' is not a symbolic link';
end;
raise Exception.Create(AText);
end;
{$ENDIF}
end;
{------------------------------------------------------------------------------
function FileIsSymlink(const AFilename: string): boolean;
------------------------------------------------------------------------------}
function FileIsSymlink(const AFilename: string): boolean;
begin
try
CheckIfFileIsSymlink(AFilename);
Result:=true;
except
Result:=false;
end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
function FileIsReadable(const AFilename: string): boolean; function FileIsReadable(const AFilename: string): boolean;
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
@ -462,8 +507,6 @@ begin
raise Exception.Create(AText); raise Exception.Create(AText);
end; end;
{$ENDIF} {$ENDIF}
// ToDo: windows and xxxbsd
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -631,6 +674,9 @@ end;
{ {
$Log$ $Log$
Revision 1.7 2002/12/23 10:12:40 mattias
added symlink test and unit types
Revision 1.6 2002/12/17 19:49:34 mattias Revision 1.6 2002/12/17 19:49:34 mattias
finished publish project finished publish project

View File

@ -156,13 +156,16 @@ procedure GTKAPIWidgetClient_Realize(Widget: PGTKWidget); cdecl;
var var
Attributes: TGdkWindowAttr; Attributes: TGdkWindowAttr;
AttributesMask: gint; AttributesMask: gint;
{$IFNDEF WinAPIChilds}
Client: PGTKAPIWidgetClient; Client: PGTKAPIWidgetClient;
{$ENDIF}
begin begin
// Assert(False, 'Trace:[GTKAPIWidgetClient_Realize]'); // Assert(False, 'Trace:[GTKAPIWidgetClient_Realize]');
gtk_widget_set_flags(Widget, GTK_REALIZED); gtk_widget_set_flags(Widget, GTK_REALIZED);
{$IFNDEF WinAPIChilds}
Client := PGTKAPIWidgetClient(Widget); Client := PGTKAPIWidgetClient(Widget);
{$ENDIF}
with Attributes do with Attributes do
begin begin
@ -774,6 +777,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.40 2002/12/23 10:12:40 mattias
added symlink test and unit types
Revision 1.39 2002/12/22 22:42:55 mattias Revision 1.39 2002/12/22 22:42:55 mattias
custom controls now support child wincontrols custom controls now support child wincontrols