mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-21 01:03:02 +02:00
Merged revision(s) 31988, 31991-31993, 32136, 32308-32309, 32312, 32318 from branches/svenbarth/packages:
Correctly parse the directives DenyPackageUnit and WeakPackageUnit ppu.pas: + add flags uf_packagedeny and uf_packageweak scandir.pas: + new procedure do_moduleflagswitch() which parses a ON/OFF/+/- argument and sets or clears a flag in the current module + new procedure dir_denypackageunit which handles DenyPackageUnit * implement dir_weakpackageunit (and move to the correct location ;) ) * InitScannerDirectives: add dir_denypackageunit handler ........ Respect DenyPackageUnit flag. pmodules.pas, proc_package: * check all contained units that are not already part of a package for their uf_package_deny flag and report an error for each that has it set ........ Do not check whether all units are used as by definition all units of a package are considered as used. pmodules.pas, proc_package: - remove call to current_module.allunitsused ........ Check whether a unit has been implicitely imported in a package. A unit is considered as implicitely imported if it is not part of a required package nor part of the units listed in the contains section. This note is useful (Delphi even provides a dialog in that case) as a package with implicitely imported units /might/ become incompatible with other packages (e.g. if another package includes that unit uses that package and includes that unit explicitely; of course that is the same as if both package included it explicitely, but with the hint one knows where to look). pmodules.pas, proc_package: * while walking the loaded units also check whether any of them not contained in a package was part of the contained units which are the same as the current module's used units ........ Generate CRC for package files pcp.pas, tpcpfile: + new field do_crc which controls CRC generation + override putdata() method to generate CRC when data is written * resetfile: enable do_crc by default ........fppu.pas, tppumodule: * loadfrompackage: mention if a unit is loaded from a package ........ fpkg.pas, tcontainedunit: + new fields offset and size for the PPU data stored inside the PCP fpcp.pas, tpcppackage: * readcontainedunits & addunit: correctly initialize offset and size to 0 ........ Store the modified PPU files directly inside the PCP and thus get finally rid of the .ppl.ppu files. entfile.pas: + new entry type ibpputable pkgutil.pas: * adjust RewritePPU to work on a stream as output instead of a filename fpcp.pas, tpcppackage: + new method writepputable() which writes the offsets and sizes of all contained units (not part of CRC!) + new method writeppudata() which rewrites all contained PPUs directly into the PCP after the ibend entry (Note: the data is written 16 Byte aligned to ease viewing of the PCP and its contained PPUs in a hex editor) + new method readpputable() which reads the offsets and sizes of all contained units + new method getmodulestream() which returns a substream for a contained module * loadpcp: also call readpputable() * writepcp: first write an empty pputable, then finish writing all data that requires the put*/write* methods of the pcpfile, then use writeppudata() to write all PPUs and finally write the correct pputable at the original location fppu.pas, tppumodule: * loadfrompackage: don't read the PPU from a file if it is contained in a package, but using the new tpcppackage.getmodulestream() and tppumodule.openppustream() methods pmodules.pas, proc_package: * don't rewrite the PPUs here pcp.pas: * increase CurrentPCPVersion ........ Fix cycling ........ git-svn-id: trunk@33514 -
This commit is contained in:
parent
fca1a74244
commit
7d8d0340b9
@ -38,6 +38,7 @@ const
|
|||||||
subentryid = 2;
|
subentryid = 2;
|
||||||
{special}
|
{special}
|
||||||
iberror = 0;
|
iberror = 0;
|
||||||
|
ibpputable = 243;
|
||||||
ibstartrequireds = 244;
|
ibstartrequireds = 244;
|
||||||
ibendrequireds = 245;
|
ibendrequireds = 245;
|
||||||
ibstartcontained = 246;
|
ibstartcontained = 246;
|
||||||
|
@ -26,7 +26,7 @@ unit fpcp;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
cclasses,
|
cclasses,cstreams,
|
||||||
globtype,
|
globtype,
|
||||||
pcp,finput,fpkg;
|
pcp,finput,fpkg;
|
||||||
|
|
||||||
@ -43,14 +43,18 @@ interface
|
|||||||
procedure writecontainernames;
|
procedure writecontainernames;
|
||||||
procedure writecontainedunits;
|
procedure writecontainedunits;
|
||||||
procedure writerequiredpackages;
|
procedure writerequiredpackages;
|
||||||
|
procedure writepputable;
|
||||||
|
procedure writeppudata;
|
||||||
procedure readcontainernames;
|
procedure readcontainernames;
|
||||||
procedure readcontainedunits;
|
procedure readcontainedunits;
|
||||||
procedure readrequiredpackages;
|
procedure readrequiredpackages;
|
||||||
|
procedure readpputable;
|
||||||
public
|
public
|
||||||
constructor create(const pn:string);
|
constructor create(const pn:string);
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
procedure loadpcp;
|
procedure loadpcp;
|
||||||
procedure savepcp;
|
procedure savepcp;
|
||||||
|
function getmodulestream(module:tmodulebase):tcstream;
|
||||||
procedure initmoduleinfo(module:tmodulebase);
|
procedure initmoduleinfo(module:tmodulebase);
|
||||||
procedure addunit(module:tmodulebase);
|
procedure addunit(module:tmodulebase);
|
||||||
end;
|
end;
|
||||||
@ -62,7 +66,7 @@ implementation
|
|||||||
cfileutl,cutils,
|
cfileutl,cutils,
|
||||||
systems,globals,version,
|
systems,globals,version,
|
||||||
verbose,
|
verbose,
|
||||||
entfile,fppu,ppu;
|
entfile,fppu,ppu,pkgutil;
|
||||||
|
|
||||||
{ tpcppackage }
|
{ tpcppackage }
|
||||||
|
|
||||||
@ -265,6 +269,59 @@ implementation
|
|||||||
pcpfile.writeentry(ibendrequireds);
|
pcpfile.writeentry(ibendrequireds);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure tpcppackage.writepputable;
|
||||||
|
var
|
||||||
|
module : pcontainedunit;
|
||||||
|
i : longint;
|
||||||
|
begin
|
||||||
|
{ no need to write the count again; it's the same as for the contained units }
|
||||||
|
for i:=0 to containedmodules.count-1 do
|
||||||
|
begin
|
||||||
|
module:=pcontainedunit(containedmodules[i]);
|
||||||
|
pcpfile.putlongint(module^.offset);
|
||||||
|
pcpfile.putlongint(module^.size);
|
||||||
|
end;
|
||||||
|
pcpfile.writeentry(ibpputable);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure tpcppackage.writeppudata;
|
||||||
|
const
|
||||||
|
align: array[0..15] of byte = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
|
||||||
|
var
|
||||||
|
i,j,
|
||||||
|
pos,
|
||||||
|
rem : longint;
|
||||||
|
module : pcontainedunit;
|
||||||
|
stream : TCStream;
|
||||||
|
begin
|
||||||
|
pcpfile.flush;
|
||||||
|
|
||||||
|
for i:=0 to containedmodules.count-1 do
|
||||||
|
begin
|
||||||
|
module:=pcontainedunit(containedmodules[i]);
|
||||||
|
|
||||||
|
pos:=pcpfile.position;
|
||||||
|
{ align to 16 byte so that it can be nicely viewed in hex editors;
|
||||||
|
maybe we could also use 512 byte alignment instead }
|
||||||
|
rem:=$f-(pos and $f);
|
||||||
|
pcpfile.stream.write(align[0],rem+1);
|
||||||
|
pcpfile.flush;
|
||||||
|
module^.offset:=pcpfile.position;
|
||||||
|
|
||||||
|
{ retrieve substream for the current position }
|
||||||
|
stream:=pcpfile.substream(module^.offset,-1);
|
||||||
|
rewriteppu(module^.module.ppufilename,stream);
|
||||||
|
module^.size:=stream.position;
|
||||||
|
stream.free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
pos:=pcpfile.position;
|
||||||
|
{ align to 16 byte so that it can be nicely viewed in hex editors;
|
||||||
|
maybe we could also use 512 byte alignment instead }
|
||||||
|
rem:=$f-(pos and $f);
|
||||||
|
pcpfile.stream.write(align[0],rem+1);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure tpcppackage.readcontainernames;
|
procedure tpcppackage.readcontainernames;
|
||||||
begin
|
begin
|
||||||
if pcpfile.readentry<>ibpackagefiles then
|
if pcpfile.readentry<>ibpackagefiles then
|
||||||
@ -297,10 +354,12 @@ implementation
|
|||||||
for i:=0 to cnt-1 do
|
for i:=0 to cnt-1 do
|
||||||
begin
|
begin
|
||||||
name:=pcpfile.getstring;
|
name:=pcpfile.getstring;
|
||||||
path:=ChangeFileExt(pcpfile.getstring,'.ppl.ppu');
|
path:=pcpfile.getstring;
|
||||||
new(p);
|
new(p);
|
||||||
p^.module:=nil;
|
p^.module:=nil;
|
||||||
p^.ppufile:=path;
|
p^.ppufile:=path;
|
||||||
|
p^.offset:=0;
|
||||||
|
p^.size:=0;
|
||||||
containedmodules.add(name,p);
|
containedmodules.add(name,p);
|
||||||
message1(package_u_contained_unit,name);
|
message1(package_u_contained_unit,name);
|
||||||
end;
|
end;
|
||||||
@ -330,6 +389,24 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure tpcppackage.readpputable;
|
||||||
|
var
|
||||||
|
module : pcontainedunit;
|
||||||
|
i : longint;
|
||||||
|
begin
|
||||||
|
if pcpfile.readentry<>ibpputable then
|
||||||
|
begin
|
||||||
|
message(package_f_pcp_read_error);
|
||||||
|
internalerror(2015103001);
|
||||||
|
end;
|
||||||
|
for i:=0 to containedmodules.count-1 do
|
||||||
|
begin
|
||||||
|
module:=pcontainedunit(containedmodules[i]);
|
||||||
|
module^.offset:=pcpfile.getlongint;
|
||||||
|
module^.size:=pcpfile.getlongint;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
constructor tpcppackage.create(const pn: string);
|
constructor tpcppackage.create(const pn: string);
|
||||||
begin
|
begin
|
||||||
inherited create(pn);
|
inherited create(pn);
|
||||||
@ -371,9 +448,14 @@ implementation
|
|||||||
readrequiredpackages;
|
readrequiredpackages;
|
||||||
|
|
||||||
readcontainedunits;
|
readcontainedunits;
|
||||||
|
|
||||||
|
readpputable;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure tpcppackage.savepcp;
|
procedure tpcppackage.savepcp;
|
||||||
|
var
|
||||||
|
tablepos,
|
||||||
|
oldpos : longint;
|
||||||
begin
|
begin
|
||||||
{ create new ppufile }
|
{ create new ppufile }
|
||||||
pcpfile:=tpcpfile.create(pcpfilename);
|
pcpfile:=tpcpfile.create(pcpfilename);
|
||||||
@ -389,7 +471,16 @@ implementation
|
|||||||
|
|
||||||
writecontainedunits;
|
writecontainedunits;
|
||||||
|
|
||||||
//writeppus;
|
{ the offsets and the contents of the ppus are not crc'd }
|
||||||
|
pcpfile.do_crc:=false;
|
||||||
|
|
||||||
|
pcpfile.flush;
|
||||||
|
tablepos:=pcpfile.position;
|
||||||
|
|
||||||
|
{ this will write a table with empty entries }
|
||||||
|
writepputable;
|
||||||
|
|
||||||
|
pcpfile.do_crc:=true;
|
||||||
|
|
||||||
{ the last entry ibend is written automatically }
|
{ the last entry ibend is written automatically }
|
||||||
|
|
||||||
@ -406,6 +497,18 @@ implementation
|
|||||||
pcpfile.header.requiredlistsize:=requiredpackages.count;
|
pcpfile.header.requiredlistsize:=requiredpackages.count;
|
||||||
pcpfile.writeheader;
|
pcpfile.writeheader;
|
||||||
|
|
||||||
|
{ write the ppu table which will also fill the offsets/sizes }
|
||||||
|
writeppudata;
|
||||||
|
|
||||||
|
pcpfile.flush;
|
||||||
|
oldpos:=pcpfile.position;
|
||||||
|
|
||||||
|
{ now write the filled PPU table at the previously stored position }
|
||||||
|
pcpfile.position:=tablepos;
|
||||||
|
writepputable;
|
||||||
|
|
||||||
|
pcpfile.position:=oldpos;
|
||||||
|
|
||||||
{ save crc in current module also }
|
{ save crc in current module also }
|
||||||
//crc:=pcpfile.crc;
|
//crc:=pcpfile.crc;
|
||||||
|
|
||||||
@ -414,6 +517,23 @@ implementation
|
|||||||
pcpfile:=nil;
|
pcpfile:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function tpcppackage.getmodulestream(module:tmodulebase):tcstream;
|
||||||
|
var
|
||||||
|
i : longint;
|
||||||
|
contained : pcontainedunit;
|
||||||
|
begin
|
||||||
|
for i:=0 to containedmodules.count-1 do
|
||||||
|
begin
|
||||||
|
contained:=pcontainedunit(containedmodules[i]);
|
||||||
|
if contained^.module=module then
|
||||||
|
begin
|
||||||
|
result:=pcpfile.substream(contained^.offset,contained^.size);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
result:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure tpcppackage.initmoduleinfo(module: tmodulebase);
|
procedure tpcppackage.initmoduleinfo(module: tmodulebase);
|
||||||
begin
|
begin
|
||||||
pplfilename:=extractfilename(module.sharedlibfilename);
|
pplfilename:=extractfilename(module.sharedlibfilename);
|
||||||
@ -426,6 +546,8 @@ implementation
|
|||||||
new(containedunit);
|
new(containedunit);
|
||||||
containedunit^.module:=module;
|
containedunit^.module:=module;
|
||||||
containedunit^.ppufile:=extractfilename(module.ppufilename);
|
containedunit^.ppufile:=extractfilename(module.ppufilename);
|
||||||
|
containedunit^.offset:=0;
|
||||||
|
containedunit^.size:=0;
|
||||||
containedmodules.add(module.modulename^,containedunit);
|
containedmodules.add(module.modulename^,containedunit);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@ interface
|
|||||||
tcontainedunit=record
|
tcontainedunit=record
|
||||||
module:tmodulebase;
|
module:tmodulebase;
|
||||||
ppufile:tpathstr;
|
ppufile:tpathstr;
|
||||||
|
offset:longint;
|
||||||
|
size:longint;
|
||||||
end;
|
end;
|
||||||
pcontainedunit=^tcontainedunit;
|
pcontainedunit=^tcontainedunit;
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ uses
|
|||||||
aasmbase,ogbase,
|
aasmbase,ogbase,
|
||||||
parser,
|
parser,
|
||||||
comphook,
|
comphook,
|
||||||
entfile,fpkg;
|
entfile,fpkg,fpcp;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -517,7 +517,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function tppumodule.loadfrompackage: boolean;
|
function tppumodule.loadfrompackage: boolean;
|
||||||
var
|
(*var
|
||||||
singlepathstring,
|
singlepathstring,
|
||||||
filename : TCmdStr;
|
filename : TCmdStr;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ var
|
|||||||
if Found then
|
if Found then
|
||||||
Begin
|
Begin
|
||||||
SetFileName(hs,false);
|
SetFileName(hs,false);
|
||||||
Found:=openppufile;
|
//Found:=OpenPPU;
|
||||||
End;
|
End;
|
||||||
PPUSearchPath:=Found;
|
PPUSearchPath:=Found;
|
||||||
end;
|
end;
|
||||||
@ -560,12 +560,13 @@ var
|
|||||||
hp:=TCmdStrListItem(hp.next);
|
hp:=TCmdStrListItem(hp.next);
|
||||||
end;
|
end;
|
||||||
SearchPathList:=found;
|
SearchPathList:=found;
|
||||||
end;
|
end;*)
|
||||||
|
|
||||||
var
|
var
|
||||||
pkg : ppackageentry;
|
pkg : ppackageentry;
|
||||||
pkgunit : pcontainedunit;
|
pkgunit : pcontainedunit;
|
||||||
i,idx : longint;
|
i,idx : longint;
|
||||||
|
strm : TCStream;
|
||||||
begin
|
begin
|
||||||
result:=false;
|
result:=false;
|
||||||
for i:=0 to packagelist.count-1 do
|
for i:=0 to packagelist.count-1 do
|
||||||
@ -580,10 +581,17 @@ var
|
|||||||
pkgunit:=pcontainedunit(pkg^.package.containedmodules[idx]);
|
pkgunit:=pcontainedunit(pkg^.package.containedmodules[idx]);
|
||||||
if not assigned(pkgunit^.module) then
|
if not assigned(pkgunit^.module) then
|
||||||
pkgunit^.module:=self;
|
pkgunit^.module:=self;
|
||||||
filename:=pkgunit^.ppufile;
|
{ ToDo: check whether we really don't need this anymore }
|
||||||
|
{filename:=pkgunit^.ppufile;
|
||||||
if not SearchPathList(unitsearchpath) then
|
if not SearchPathList(unitsearchpath) then
|
||||||
|
exit};
|
||||||
|
strm:=tpcppackage(pkg^.package).getmodulestream(self);
|
||||||
|
if not assigned(strm) then
|
||||||
|
internalerror(2015103002);
|
||||||
|
if not openppustream(strm) then
|
||||||
exit;
|
exit;
|
||||||
package:=pkg^.package;
|
package:=pkg^.package;
|
||||||
|
Message2(unit_u_loading_from_package,modulename^,pkg^.package.packagename^);
|
||||||
|
|
||||||
{ now load the unit and all used units }
|
{ now load the unit and all used units }
|
||||||
load_interface;
|
load_interface;
|
||||||
|
@ -29,7 +29,7 @@ interface
|
|||||||
cstreams,entfile;
|
cstreams,entfile;
|
||||||
|
|
||||||
const
|
const
|
||||||
CurrentPCPVersion=2;
|
CurrentPCPVersion=3;
|
||||||
|
|
||||||
{ unit flags }
|
{ unit flags }
|
||||||
//uf_init = $000001; { unit has initialization section }
|
//uf_init = $000001; { unit has initialization section }
|
||||||
@ -59,6 +59,7 @@ interface
|
|||||||
header : tpcpheader;
|
header : tpcpheader;
|
||||||
{ crc for the entire package }
|
{ crc for the entire package }
|
||||||
crc : cardinal;
|
crc : cardinal;
|
||||||
|
do_crc : boolean;
|
||||||
protected
|
protected
|
||||||
function getheadersize:longint;override;
|
function getheadersize:longint;override;
|
||||||
function getheaderaddr:pentryheader;override;
|
function getheaderaddr:pentryheader;override;
|
||||||
@ -68,10 +69,14 @@ interface
|
|||||||
public
|
public
|
||||||
procedure writeheader;override;
|
procedure writeheader;override;
|
||||||
function checkpcpid:boolean;
|
function checkpcpid:boolean;
|
||||||
|
procedure putdata(const b;len:integer);override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
fpccrc;
|
||||||
|
|
||||||
{ tpcpfile }
|
{ tpcpfile }
|
||||||
|
|
||||||
function tpcpfile.getheadersize: longint;
|
function tpcpfile.getheadersize: longint;
|
||||||
@ -142,6 +147,7 @@ implementation
|
|||||||
procedure tpcpfile.resetfile;
|
procedure tpcpfile.resetfile;
|
||||||
begin
|
begin
|
||||||
crc:=0;
|
crc:=0;
|
||||||
|
do_crc:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -184,5 +190,15 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tpcpfile.putdata(const b;len:integer);
|
||||||
|
begin
|
||||||
|
if do_crc then
|
||||||
|
begin
|
||||||
|
crc:=UpdateCrc32(crc,b,len);
|
||||||
|
end;
|
||||||
|
inherited putdata(b, len);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ unit pkgutil;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
fmodule,fpkg,link;
|
fmodule,fpkg,link,cstreams;
|
||||||
|
|
||||||
procedure createimportlibfromexternals;
|
procedure createimportlibfromexternals;
|
||||||
Function RewritePPU(const PPUFn,PPLFn:String):Boolean;
|
Function RewritePPU(const PPUFn:String;OutStream:TCStream):Boolean;
|
||||||
procedure export_unit(u:tmodule);
|
procedure export_unit(u:tmodule);
|
||||||
procedure load_packages;
|
procedure load_packages;
|
||||||
procedure add_package(const name:string;ignoreduplicates:boolean);
|
procedure add_package(const name:string;ignoreduplicates:boolean);
|
||||||
@ -195,7 +195,7 @@ implementation
|
|||||||
varexport(make_mangledname('THREADVARLIST',u.globalsymtable,''));
|
varexport(make_mangledname('THREADVARLIST',u.globalsymtable,''));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function RewritePPU(const PPUFn,PPLFn:String):Boolean;
|
Function RewritePPU(const PPUFn:String;OutStream:TCStream):Boolean;
|
||||||
Var
|
Var
|
||||||
MakeStatic : Boolean;
|
MakeStatic : Boolean;
|
||||||
Var
|
Var
|
||||||
@ -261,11 +261,8 @@ implementation
|
|||||||
MakeStatic:=true;
|
MakeStatic:=true;
|
||||||
end;
|
end;
|
||||||
{ Create the new ppu }
|
{ Create the new ppu }
|
||||||
if PPUFn=PPLFn then
|
outppu:=tppufile.create(PPUFn);
|
||||||
outppu:=tppufile.create('ppumove.$$$')
|
outppu.createstream(OutStream);
|
||||||
else
|
|
||||||
outppu:=tppufile.create(PPLFn);
|
|
||||||
outppu.createfile;
|
|
||||||
{ Create new header, with the new flags }
|
{ Create new header, with the new flags }
|
||||||
outppu.header:=inppu.header;
|
outppu.header:=inppu.header;
|
||||||
outppu.header.common.flags:=outppu.header.common.flags or uf_in_library;
|
outppu.header.common.flags:=outppu.header.common.flags or uf_in_library;
|
||||||
@ -379,17 +376,6 @@ implementation
|
|||||||
outppu.writeheader;
|
outppu.writeheader;
|
||||||
outppu.free;
|
outppu.free;
|
||||||
inppu.free;
|
inppu.free;
|
||||||
{ rename }
|
|
||||||
if PPUFn=PPLFn then
|
|
||||||
begin
|
|
||||||
{$push}{$I-}
|
|
||||||
assign(f,PPUFn);
|
|
||||||
erase(f);
|
|
||||||
assign(f,'ppumove.$$$');
|
|
||||||
rename(f,PPUFn);
|
|
||||||
{$pop}
|
|
||||||
if ioresult<>0 then;
|
|
||||||
end;
|
|
||||||
Result:=True;
|
Result:=True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1534,6 +1534,27 @@ type
|
|||||||
{ All units are read, now give them a number }
|
{ All units are read, now give them a number }
|
||||||
current_module.updatemaps;
|
current_module.updatemaps;
|
||||||
|
|
||||||
|
hp:=tmodule(loaded_units.first);
|
||||||
|
while assigned(hp) do
|
||||||
|
begin
|
||||||
|
if (hp<>current_module) and not assigned(hp.package) then
|
||||||
|
begin
|
||||||
|
if (hp.flags and uf_package_deny) <> 0 then
|
||||||
|
message1(package_e_unit_deny_package,hp.realmodulename^);
|
||||||
|
{ part of the package's used, aka contained units? }
|
||||||
|
uu:=tused_unit(current_module.used_units.first);
|
||||||
|
while assigned(uu) do
|
||||||
|
begin
|
||||||
|
if uu.u=hp then
|
||||||
|
break;
|
||||||
|
uu:=tused_unit(uu.next);
|
||||||
|
end;
|
||||||
|
if not assigned(uu) then
|
||||||
|
message2(package_n_implicit_unit_import,hp.realmodulename^,current_module.realmodulename^);
|
||||||
|
end;
|
||||||
|
hp:=tmodule(hp.next);
|
||||||
|
end;
|
||||||
|
|
||||||
{Insert the name of the main program into the symbol table.}
|
{Insert the name of the main program into the symbol table.}
|
||||||
if current_module.realmodulename^<>'' then
|
if current_module.realmodulename^<>'' then
|
||||||
tabstractunitsymtable(current_module.localsymtable).insertunit(cunitsym.create(current_module.realmodulename^,current_module));
|
tabstractunitsymtable(current_module.localsymtable).insertunit(cunitsym.create(current_module.realmodulename^,current_module));
|
||||||
@ -1574,7 +1595,7 @@ type
|
|||||||
tstoredsymtable(current_module.localsymtable).allprivatesused;
|
tstoredsymtable(current_module.localsymtable).allprivatesused;
|
||||||
tstoredsymtable(current_module.localsymtable).check_forwards;
|
tstoredsymtable(current_module.localsymtable).check_forwards;
|
||||||
|
|
||||||
current_module.allunitsused;
|
{ Note: all contained units are considered as used }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if target_info.system in systems_windows then
|
if target_info.system in systems_windows then
|
||||||
@ -1693,15 +1714,6 @@ type
|
|||||||
|
|
||||||
pkg.initmoduleinfo(current_module);
|
pkg.initmoduleinfo(current_module);
|
||||||
|
|
||||||
{ finally rewrite all units included into the package }
|
|
||||||
uu:=tused_unit(usedunits.first);
|
|
||||||
while assigned(uu) do
|
|
||||||
begin
|
|
||||||
if not assigned(uu.u.package) then
|
|
||||||
RewritePPU(uu.u.ppufilename,uu.u.ppufilename);
|
|
||||||
uu:=tused_unit(uu.next);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ create the executable when we are at level 1 }
|
{ create the executable when we are at level 1 }
|
||||||
if (compile_level=1) then
|
if (compile_level=1) then
|
||||||
begin
|
begin
|
||||||
|
@ -76,6 +76,8 @@ const
|
|||||||
uf_i8086_far_data = $4000000; { this unit uses an i8086 memory model with far data (i.e. compact or large) }
|
uf_i8086_far_data = $4000000; { this unit uses an i8086 memory model with far data (i.e. compact or large) }
|
||||||
uf_i8086_huge_data = $8000000; { this unit uses an i8086 memory model with huge data (i.e. huge) }
|
uf_i8086_huge_data = $8000000; { this unit uses an i8086 memory model with huge data (i.e. huge) }
|
||||||
uf_i8086_cs_equals_ds = $10000000; { this unit uses an i8086 memory model with CS=DS (i.e. tiny) }
|
uf_i8086_cs_equals_ds = $10000000; { this unit uses an i8086 memory model with CS=DS (i.e. tiny) }
|
||||||
|
uf_package_deny = $20000000; { this unit must not be part of a package }
|
||||||
|
uf_package_weak = $40000000; { this unit may be completely contained in a package }
|
||||||
|
|
||||||
type
|
type
|
||||||
{ bestreal is defined based on the target architecture }
|
{ bestreal is defined based on the target architecture }
|
||||||
|
@ -118,6 +118,18 @@ unit scandir;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure do_moduleflagswitch(flag:cardinal);
|
||||||
|
var
|
||||||
|
state : char;
|
||||||
|
begin
|
||||||
|
state:=current_scanner.readstate;
|
||||||
|
if state='-' then
|
||||||
|
current_module.flags:=current_module.flags and not flag
|
||||||
|
else
|
||||||
|
current_module.flags:=current_module.flags or flag;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure do_message(w:integer);
|
procedure do_message(w:integer);
|
||||||
begin
|
begin
|
||||||
current_scanner.skipspace;
|
current_scanner.skipspace;
|
||||||
@ -367,6 +379,11 @@ unit scandir;
|
|||||||
do_delphiswitch('D');
|
do_delphiswitch('D');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure dir_denypackageunit;
|
||||||
|
begin
|
||||||
|
do_moduleflagswitch(uf_package_deny);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure dir_description;
|
procedure dir_description;
|
||||||
begin
|
begin
|
||||||
if not (target_info.system in systems_all_windows+[system_i386_os2,system_i386_emx,
|
if not (target_info.system in systems_all_windows+[system_i386_os2,system_i386_emx,
|
||||||
@ -1565,6 +1582,11 @@ unit scandir;
|
|||||||
do_setverbose('W');
|
do_setverbose('W');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure dir_weakpackageunit;
|
||||||
|
begin
|
||||||
|
do_moduleflagswitch(uf_package_weak);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure dir_writeableconst;
|
procedure dir_writeableconst;
|
||||||
begin
|
begin
|
||||||
do_delphiswitch('J');
|
do_delphiswitch('J');
|
||||||
@ -1663,10 +1685,6 @@ unit scandir;
|
|||||||
do_localswitch(cs_hugeptr_comparison_normalization);
|
do_localswitch(cs_hugeptr_comparison_normalization);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure dir_weakpackageunit;
|
|
||||||
begin
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure dir_codealign;
|
procedure dir_codealign;
|
||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
@ -1755,6 +1773,7 @@ unit scandir;
|
|||||||
AddDirective('COPYRIGHT',directive_all, @dir_copyright);
|
AddDirective('COPYRIGHT',directive_all, @dir_copyright);
|
||||||
AddDirective('D',directive_all, @dir_description);
|
AddDirective('D',directive_all, @dir_description);
|
||||||
AddDirective('DEBUGINFO',directive_all, @dir_debuginfo);
|
AddDirective('DEBUGINFO',directive_all, @dir_debuginfo);
|
||||||
|
AddDirective('DENYPACKAGEUNIT',directive_all,@dir_denypackageunit);
|
||||||
AddDirective('DESCRIPTION',directive_all, @dir_description);
|
AddDirective('DESCRIPTION',directive_all, @dir_description);
|
||||||
AddDirective('ENDREGION',directive_all, @dir_endregion);
|
AddDirective('ENDREGION',directive_all, @dir_endregion);
|
||||||
AddDirective('ERROR',directive_all, @dir_error);
|
AddDirective('ERROR',directive_all, @dir_error);
|
||||||
|
Loading…
Reference in New Issue
Block a user