mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 10:29:17 +02:00
+ -Ua<oldname>=<newname> unit alias support
This commit is contained in:
parent
7b5bae5ded
commit
1610a9d709
@ -1160,7 +1160,7 @@ end;
|
|||||||
FSplit(s,p,n,e);
|
FSplit(s,p,n,e);
|
||||||
{ Programs have the name program to don't conflict with dup id's }
|
{ Programs have the name program to don't conflict with dup id's }
|
||||||
if _is_unit then
|
if _is_unit then
|
||||||
modulename:=stringdup(Upper(n))
|
modulename:=stringdup(GetUnitAlias(Upper(n)))
|
||||||
else
|
else
|
||||||
modulename:=stringdup('PROGRAM');
|
modulename:=stringdup('PROGRAM');
|
||||||
mainsource:=stringdup(s);
|
mainsource:=stringdup(s);
|
||||||
@ -1340,7 +1340,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.105 1999-10-28 13:14:00 pierre
|
Revision 1.106 1999-11-04 10:54:02 peter
|
||||||
|
+ -Ua<oldname>=<newname> unit alias support
|
||||||
|
|
||||||
|
Revision 1.105 1999/10/28 13:14:00 pierre
|
||||||
* allow doubles in TLinkContainer needed for double libraries
|
* allow doubles in TLinkContainer needed for double libraries
|
||||||
|
|
||||||
Revision 1.104 1999/09/27 23:40:12 peter
|
Revision 1.104 1999/09/27 23:40:12 peter
|
||||||
|
@ -25,7 +25,7 @@ unit options;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
verbose;
|
globtype,verbose;
|
||||||
|
|
||||||
type
|
type
|
||||||
POption=^TOption;
|
POption=^TOption;
|
||||||
@ -37,7 +37,7 @@ type
|
|||||||
ParaIncludePath,
|
ParaIncludePath,
|
||||||
ParaUnitPath,
|
ParaUnitPath,
|
||||||
ParaObjectPath,
|
ParaObjectPath,
|
||||||
ParaLibraryPath : string;
|
ParaLibraryPath : TSearchPathString;
|
||||||
Constructor Init;
|
Constructor Init;
|
||||||
Destructor Done;
|
Destructor Done;
|
||||||
procedure WriteLogo;
|
procedure WriteLogo;
|
||||||
@ -64,9 +64,9 @@ uses
|
|||||||
{$else Delphi}
|
{$else Delphi}
|
||||||
dos,
|
dos,
|
||||||
{$endif Delphi}
|
{$endif Delphi}
|
||||||
globtype,version,systems,
|
version,systems,
|
||||||
cobjects,globals,
|
cobjects,globals,
|
||||||
scanner,link,messages
|
symtable,scanner,link,messages
|
||||||
{$ifdef BrowserLog}
|
{$ifdef BrowserLog}
|
||||||
,browlog
|
,browlog
|
||||||
{$endif BrowserLog}
|
{$endif BrowserLog}
|
||||||
@ -679,6 +679,10 @@ begin
|
|||||||
'U' : begin
|
'U' : begin
|
||||||
for j:=1 to length(more) do
|
for j:=1 to length(more) do
|
||||||
case more[j] of
|
case more[j] of
|
||||||
|
'a' : begin
|
||||||
|
AddUnitAlias(Copy(More,j+1,255));
|
||||||
|
break;
|
||||||
|
end;
|
||||||
'n' : initglobalswitches:=initglobalswitches-[cs_check_unit_name];
|
'n' : initglobalswitches:=initglobalswitches-[cs_check_unit_name];
|
||||||
'p' : begin
|
'p' : begin
|
||||||
Message2(option_obsolete_switch_use_new,'-Up','-Fu');
|
Message2(option_obsolete_switch_use_new,'-Up','-Fu');
|
||||||
@ -1245,7 +1249,10 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.30 1999-11-03 23:43:09 peter
|
Revision 1.31 1999-11-04 10:54:03 peter
|
||||||
|
+ -Ua<oldname>=<newname> unit alias support
|
||||||
|
|
||||||
|
Revision 1.30 1999/11/03 23:43:09 peter
|
||||||
* default units/rtl paths
|
* default units/rtl paths
|
||||||
|
|
||||||
Revision 1.29 1999/10/30 17:35:26 peter
|
Revision 1.29 1999/10/30 17:35:26 peter
|
||||||
|
@ -365,6 +365,22 @@ unit symtable;
|
|||||||
'lower_or_equal','as','is','in','sym_diff',
|
'lower_or_equal','as','is','in','sym_diff',
|
||||||
'starstar','assign');
|
'starstar','assign');
|
||||||
|
|
||||||
|
{*** Unit aliases ***}
|
||||||
|
|
||||||
|
type
|
||||||
|
punit_alias = ^tunit_alias;
|
||||||
|
tunit_alias = object(tnamedindexobject)
|
||||||
|
newname : pstring;
|
||||||
|
constructor init(const n:string);
|
||||||
|
destructor done;virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
unitaliases : pdictionary;
|
||||||
|
|
||||||
|
procedure addunitalias(const n:string);
|
||||||
|
function getunitalias(const n:string):string;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Functions
|
Functions
|
||||||
@ -2218,6 +2234,47 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
{****************************************************************************
|
||||||
|
TUNIT_ALIAS
|
||||||
|
****************************************************************************}
|
||||||
|
|
||||||
|
constructor tunit_alias.init(const n:string);
|
||||||
|
var
|
||||||
|
i : longint;
|
||||||
|
begin
|
||||||
|
i:=pos('=',n);
|
||||||
|
if i=0 then
|
||||||
|
fail;
|
||||||
|
inherited initname(Copy(n,1,i-1));
|
||||||
|
newname:=stringdup(Copy(n,i+1,255));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
destructor tunit_alias.done;
|
||||||
|
begin
|
||||||
|
stringdispose(newname);
|
||||||
|
inherited done;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure addunitalias(const n:string);
|
||||||
|
begin
|
||||||
|
unitaliases^.insert(new(punit_alias,init(Upper(n))));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function getunitalias(const n:string):string;
|
||||||
|
var
|
||||||
|
p : punit_alias;
|
||||||
|
begin
|
||||||
|
p:=punit_alias(unitaliases^.search(Upper(n)));
|
||||||
|
if assigned(p) then
|
||||||
|
getunitalias:=punit_alias(p)^.newname^
|
||||||
|
else
|
||||||
|
getunitalias:=n;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
Symtable Stack
|
Symtable Stack
|
||||||
****************************************************************************}
|
****************************************************************************}
|
||||||
@ -2322,6 +2379,8 @@ implementation
|
|||||||
{ create error syms and def }
|
{ create error syms and def }
|
||||||
generrorsym:=new(perrorsym,init);
|
generrorsym:=new(perrorsym,init);
|
||||||
generrordef:=new(perrordef,init);
|
generrordef:=new(perrordef,init);
|
||||||
|
{ unit aliases }
|
||||||
|
unitaliases:=new(pdictionary,init);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -2329,11 +2388,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
dispose(generrorsym,done);
|
dispose(generrorsym,done);
|
||||||
dispose(generrordef,done);
|
dispose(generrordef,done);
|
||||||
{ unload all symtables
|
dispose(unitaliases,done);
|
||||||
done with loaded_units
|
|
||||||
dispose_global:=true;
|
|
||||||
while assigned(symtablestack) do
|
|
||||||
dellexlevel; }
|
|
||||||
{$ifndef Delphi}
|
{$ifndef Delphi}
|
||||||
{$ifdef TP}
|
{$ifdef TP}
|
||||||
{ close the stream }
|
{ close the stream }
|
||||||
@ -2346,7 +2401,10 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.54 1999-10-26 12:30:46 peter
|
Revision 1.55 1999-11-04 10:54:02 peter
|
||||||
|
+ -Ua<oldname>=<newname> unit alias support
|
||||||
|
|
||||||
|
Revision 1.54 1999/10/26 12:30:46 peter
|
||||||
* const parameter is now checked
|
* const parameter is now checked
|
||||||
* better and generic check if a node can be used for assigning
|
* better and generic check if a node can be used for assigning
|
||||||
* export fixes
|
* export fixes
|
||||||
|
Loading…
Reference in New Issue
Block a user