mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-07 09:47:34 +02:00
* Fix filename allocator for operators
git-svn-id: trunk@40937 -
This commit is contained in:
parent
d3c8ca53f7
commit
1b31c90bba
@ -317,12 +317,14 @@ begin
|
|||||||
FExtension := AExtension;
|
FExtension := AExtension;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLongNameFileAllocator.GetFilename(AElement: TPasElement;
|
function TLongNameFileAllocator.GetFilename(AElement: TPasElement; ASubindex: Integer): String;
|
||||||
ASubindex: Integer): String;
|
|
||||||
var
|
var
|
||||||
s: String;
|
n,s: String;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Result:='';
|
||||||
if AElement.ClassType = TPasPackage then
|
if AElement.ClassType = TPasPackage then
|
||||||
Result := 'index'
|
Result := 'index'
|
||||||
else if AElement.ClassType = TPasModule then
|
else if AElement.ClassType = TPasModule then
|
||||||
@ -331,53 +333,30 @@ begin
|
|||||||
begin
|
begin
|
||||||
if AElement is TPasOperator then
|
if AElement is TPasOperator then
|
||||||
begin
|
begin
|
||||||
Result := LowerCase(AElement.Parent.PathName) + '.op-';
|
if Assigned(AElement.Parent) then
|
||||||
s := Copy(AElement.Name, Pos(' ', AElement.Name) + 1, Length(AElement.Name));
|
result:=LowerCase(AElement.Parent.PathName);
|
||||||
s := Copy(s, 1, Pos('(', s) - 1);
|
With TPasOperator(aElement) do
|
||||||
if s = ':=' then
|
Result:= Result + 'op-'+OperatorTypeToOperatorName(OperatorType);
|
||||||
s := 'assign'
|
|
||||||
else if s = '+' then
|
|
||||||
s := 'add'
|
|
||||||
else if s = '-' then
|
|
||||||
s := 'sub'
|
|
||||||
else if s = '*' then
|
|
||||||
s := 'mul'
|
|
||||||
else if s = '/' then
|
|
||||||
s := 'div'
|
|
||||||
else if s = '**' then
|
|
||||||
s := 'power'
|
|
||||||
else if s = '=' then
|
|
||||||
s := 'equal'
|
|
||||||
else if s = '<>' then
|
|
||||||
s := 'unequal'
|
|
||||||
else if s = '<' then
|
|
||||||
s := 'less'
|
|
||||||
else if s = '<=' then
|
|
||||||
s := 'lessequal'
|
|
||||||
else if s = '>' then
|
|
||||||
s := 'greater'
|
|
||||||
else if s = '>=' then
|
|
||||||
s := 'greaterthan'
|
|
||||||
else if s = '><' then
|
|
||||||
s := 'symmetricdifference';
|
|
||||||
Result := Result + s + '-';
|
|
||||||
s := '';
|
s := '';
|
||||||
|
N:=LowerCase(aElement.Name); // Should not contain any weird chars.
|
||||||
|
Delete(N,1,Pos('(',N));
|
||||||
i := 1;
|
i := 1;
|
||||||
while AElement.Name[i] <> '(' do
|
Repeat
|
||||||
Inc(i);
|
I:=Pos(',',N);
|
||||||
Inc(i);
|
if I=0 then
|
||||||
while AElement.Name[i] <> ')' do
|
I:=Pos(')',N);
|
||||||
begin
|
if I>1 then
|
||||||
if AElement.Name[i] = ',' then
|
begin
|
||||||
begin
|
if (S<>'') then
|
||||||
s := s + '-';
|
S:=S+'-';
|
||||||
Inc(i);
|
S:=S+Copy(N,1,I-1);
|
||||||
end else
|
end;
|
||||||
s := s + AElement.Name[i];
|
Delete(N,1,I);
|
||||||
Inc(i);
|
until I=0;
|
||||||
end;
|
// First char is maybe :
|
||||||
Result := Result + LowerCase(s) + '-' + LowerCase(Copy(AElement.Name,
|
if (N<>'') and (N[1]=':') then
|
||||||
Pos('):', AElement.Name) + 3, Length(AElement.Name)));
|
Delete(N,1,1);
|
||||||
|
Result:=Result + '-'+ s + '-' + N;
|
||||||
end else
|
end else
|
||||||
Result := LowerCase(AElement.PathName);
|
Result := LowerCase(AElement.PathName);
|
||||||
// searching for TPasModule - it is on the 2nd level
|
// searching for TPasModule - it is on the 2nd level
|
||||||
@ -396,7 +375,9 @@ begin
|
|||||||
|
|
||||||
if ASubindex > 0 then
|
if ASubindex > 0 then
|
||||||
Result := Result + '-' + IntToStr(ASubindex);
|
Result := Result + '-' + IntToStr(ASubindex);
|
||||||
|
|
||||||
Result := Result + Extension;
|
Result := Result + Extension;
|
||||||
|
// Writeln('Result filename : ',Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TLongNameFileAllocator.GetRelativePathToTop(AElement: TPasElement): String;
|
function TLongNameFileAllocator.GetRelativePathToTop(AElement: TPasElement): String;
|
||||||
|
Loading…
Reference in New Issue
Block a user