mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:29:21 +02:00
------------------------------------------------------------------------
r40619 | pierre | 2018-12-23 16:17:49 +0000 (Sun, 23 Dec 2018) | 8 lines * in lexbase and yaccbase units, use DirectorySeparator instead of '\' in functions path, root and addext. * in plex and pyacc programs, for unix, try to find installed yyparse.cod using path of paramstr(0). ------------------------------------------------------------------------ --- Merging r40619 into '.': U utils/tply/pyacc.pas U utils/tply/plex.pas U utils/tply/yaccbase.pas U utils/tply/lexbase.pas U utils/tply/pyacc.y --- Recording mergeinfo for merge of r40619 into '.': U . git-svn-id: branches/fixes_3_2@40627 -
This commit is contained in:
parent
de6e6c1443
commit
7bcb8e911c
@ -969,7 +969,7 @@ function path(filename : String) : String;
|
|||||||
var i : Integer;
|
var i : Integer;
|
||||||
begin
|
begin
|
||||||
i := length(filename);
|
i := length(filename);
|
||||||
while (i>0) and (filename[i]<>'\') and (filename[i]<>':') do
|
while (i>0) and (filename[i]<>DirectorySeparator) and (filename[i]<>':') do
|
||||||
dec(i);
|
dec(i);
|
||||||
path := copy(filename, 1, i);
|
path := copy(filename, 1, i);
|
||||||
end(*path*);
|
end(*path*);
|
||||||
@ -985,10 +985,10 @@ function root(filename : String) : String;
|
|||||||
root := copy(filename, 1, i-1);
|
root := copy(filename, 1, i-1);
|
||||||
exit
|
exit
|
||||||
end;
|
end;
|
||||||
'\': exit;
|
DirectorySeparator : exit;
|
||||||
else
|
else
|
||||||
end;
|
end;
|
||||||
end(*addExt*);
|
end(*root*);
|
||||||
function addExt(filename, ext : String) : String;
|
function addExt(filename, ext : String) : String;
|
||||||
(* implemented with goto for maximum efficiency *)
|
(* implemented with goto for maximum efficiency *)
|
||||||
label x;
|
label x;
|
||||||
@ -999,7 +999,7 @@ function addExt(filename, ext : String) : String;
|
|||||||
for i := length(filename) downto 1 do
|
for i := length(filename) downto 1 do
|
||||||
case filename[i] of
|
case filename[i] of
|
||||||
'.' : exit;
|
'.' : exit;
|
||||||
'\': goto x;
|
DirectorySeparator: goto x;
|
||||||
else
|
else
|
||||||
end;
|
end;
|
||||||
x : addExt := filename+'.'+ext
|
x : addExt := filename+'.'+ext
|
||||||
|
@ -597,6 +597,10 @@ var i : Integer;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef Unix}
|
{$ifdef Unix}
|
||||||
|
codfilepath1:=path(paramstr(0));
|
||||||
|
if (codfilepath1<>'') then
|
||||||
|
codfilepath1:=codfilepath1+'../lib/fpc/lexyacc/'
|
||||||
|
else
|
||||||
codfilepath1:='/usr/local/lib/fpc/lexyacc/';
|
codfilepath1:='/usr/local/lib/fpc/lexyacc/';
|
||||||
codfilepath2:='/usr/lib/fpc/lexyacc/';
|
codfilepath2:='/usr/lib/fpc/lexyacc/';
|
||||||
{$else}
|
{$else}
|
||||||
|
@ -2375,6 +2375,10 @@ var i : Integer;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef Unix}
|
{$ifdef Unix}
|
||||||
|
codfilepath1:=path(paramstr(0));
|
||||||
|
if (codfilepath1<>'') then
|
||||||
|
codfilepath1:=codfilepath1+'../lib/fpc/lexyacc/'
|
||||||
|
else
|
||||||
codfilepath1:='/usr/local/lib/fpc/lexyacc/';
|
codfilepath1:='/usr/local/lib/fpc/lexyacc/';
|
||||||
codfilepath2:='/usr/lib/fpc/lexyacc/';
|
codfilepath2:='/usr/lib/fpc/lexyacc/';
|
||||||
{$else}
|
{$else}
|
||||||
|
@ -711,6 +711,10 @@ var i : Integer;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
{$ifdef Unix}
|
{$ifdef Unix}
|
||||||
|
codfilepath1:=path(paramstr(0));
|
||||||
|
if (codfilepath1<>'') then
|
||||||
|
codfilepath1:=codfilepath1+'../lib/fpc/lexyacc/'
|
||||||
|
else
|
||||||
codfilepath1:='/usr/local/lib/fpc/lexyacc/';
|
codfilepath1:='/usr/local/lib/fpc/lexyacc/';
|
||||||
codfilepath2:='/usr/lib/fpc/lexyacc/';
|
codfilepath2:='/usr/lib/fpc/lexyacc/';
|
||||||
{$else}
|
{$else}
|
||||||
|
@ -640,7 +640,7 @@ function path(filename : String) : String;
|
|||||||
var i : Integer;
|
var i : Integer;
|
||||||
begin
|
begin
|
||||||
i := length(filename);
|
i := length(filename);
|
||||||
while (i>0) and (filename[i]<>'\') and (filename[i]<>':') do
|
while (i>0) and (filename[i]<>DirectorySeparator) and (filename[i]<>':') do
|
||||||
dec(i);
|
dec(i);
|
||||||
path := copy(filename, 1, i);
|
path := copy(filename, 1, i);
|
||||||
end(*path*);
|
end(*path*);
|
||||||
@ -656,10 +656,10 @@ function root(filename : String) : String;
|
|||||||
root := copy(filename, 1, i-1);
|
root := copy(filename, 1, i-1);
|
||||||
exit
|
exit
|
||||||
end;
|
end;
|
||||||
'\': exit;
|
DirectorySeparator: exit;
|
||||||
else
|
else
|
||||||
end;
|
end;
|
||||||
end(*addExt*);
|
end(*root*);
|
||||||
function addExt(filename, ext : String) : String;
|
function addExt(filename, ext : String) : String;
|
||||||
(* implemented with goto for maximum efficiency *)
|
(* implemented with goto for maximum efficiency *)
|
||||||
label x;
|
label x;
|
||||||
@ -670,7 +670,7 @@ function addExt(filename, ext : String) : String;
|
|||||||
for i := length(filename) downto 1 do
|
for i := length(filename) downto 1 do
|
||||||
case filename[i] of
|
case filename[i] of
|
||||||
'.' : exit;
|
'.' : exit;
|
||||||
'\': goto x;
|
DirectorySeparator : goto x;
|
||||||
else
|
else
|
||||||
end;
|
end;
|
||||||
x : addExt := filename+'.'+ext
|
x : addExt := filename+'.'+ext
|
||||||
|
Loading…
Reference in New Issue
Block a user