mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-27 05:32:28 +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);
|
||||
{ Programs have the name program to don't conflict with dup id's }
|
||||
if _is_unit then
|
||||
modulename:=stringdup(Upper(n))
|
||||
modulename:=stringdup(GetUnitAlias(Upper(n)))
|
||||
else
|
||||
modulename:=stringdup('PROGRAM');
|
||||
mainsource:=stringdup(s);
|
||||
@ -1340,7 +1340,10 @@ end;
|
||||
end.
|
||||
{
|
||||
$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
|
||||
|
||||
Revision 1.104 1999/09/27 23:40:12 peter
|
||||
|
@ -25,7 +25,7 @@ unit options;
|
||||
interface
|
||||
|
||||
uses
|
||||
verbose;
|
||||
globtype,verbose;
|
||||
|
||||
type
|
||||
POption=^TOption;
|
||||
@ -37,7 +37,7 @@ type
|
||||
ParaIncludePath,
|
||||
ParaUnitPath,
|
||||
ParaObjectPath,
|
||||
ParaLibraryPath : string;
|
||||
ParaLibraryPath : TSearchPathString;
|
||||
Constructor Init;
|
||||
Destructor Done;
|
||||
procedure WriteLogo;
|
||||
@ -64,9 +64,9 @@ uses
|
||||
{$else Delphi}
|
||||
dos,
|
||||
{$endif Delphi}
|
||||
globtype,version,systems,
|
||||
version,systems,
|
||||
cobjects,globals,
|
||||
scanner,link,messages
|
||||
symtable,scanner,link,messages
|
||||
{$ifdef BrowserLog}
|
||||
,browlog
|
||||
{$endif BrowserLog}
|
||||
@ -679,6 +679,10 @@ begin
|
||||
'U' : begin
|
||||
for j:=1 to length(more) do
|
||||
case more[j] of
|
||||
'a' : begin
|
||||
AddUnitAlias(Copy(More,j+1,255));
|
||||
break;
|
||||
end;
|
||||
'n' : initglobalswitches:=initglobalswitches-[cs_check_unit_name];
|
||||
'p' : begin
|
||||
Message2(option_obsolete_switch_use_new,'-Up','-Fu');
|
||||
@ -1245,7 +1249,10 @@ end;
|
||||
end.
|
||||
{
|
||||
$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
|
||||
|
||||
Revision 1.29 1999/10/30 17:35:26 peter
|
||||
|
@ -365,6 +365,22 @@ unit symtable;
|
||||
'lower_or_equal','as','is','in','sym_diff',
|
||||
'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
|
||||
@ -2218,6 +2234,47 @@ implementation
|
||||
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
|
||||
****************************************************************************}
|
||||
@ -2322,6 +2379,8 @@ implementation
|
||||
{ create error syms and def }
|
||||
generrorsym:=new(perrorsym,init);
|
||||
generrordef:=new(perrordef,init);
|
||||
{ unit aliases }
|
||||
unitaliases:=new(pdictionary,init);
|
||||
end;
|
||||
|
||||
|
||||
@ -2329,11 +2388,7 @@ implementation
|
||||
begin
|
||||
dispose(generrorsym,done);
|
||||
dispose(generrordef,done);
|
||||
{ unload all symtables
|
||||
done with loaded_units
|
||||
dispose_global:=true;
|
||||
while assigned(symtablestack) do
|
||||
dellexlevel; }
|
||||
dispose(unitaliases,done);
|
||||
{$ifndef Delphi}
|
||||
{$ifdef TP}
|
||||
{ close the stream }
|
||||
@ -2346,7 +2401,10 @@ implementation
|
||||
end.
|
||||
{
|
||||
$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
|
||||
* better and generic check if a node can be used for assigning
|
||||
* export fixes
|
||||
|
Loading…
Reference in New Issue
Block a user