mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-30 16:26:16 +02:00
* Improve CHM versioning, now that a compiler is added. Main chm version is in chmbase
git-svn-id: trunk@19703 -
This commit is contained in:
parent
816953990d
commit
0d562f04ff
@ -26,6 +26,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils;
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
const
|
||||||
|
CHMPackageVersion = '2.6.0'; // to be put in readme
|
||||||
|
|
||||||
type
|
type
|
||||||
{$PACKRECORDS C}
|
{$PACKRECORDS C}
|
||||||
|
@ -25,6 +25,9 @@ program chmcmd;
|
|||||||
uses
|
uses
|
||||||
Classes, Sysutils, chmfilewriter, GetOpts;
|
Classes, Sysutils, chmfilewriter, GetOpts;
|
||||||
|
|
||||||
|
Const
|
||||||
|
CHMCMDVersion = '2.6.0';
|
||||||
|
|
||||||
Procedure Usage;
|
Procedure Usage;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -41,7 +44,6 @@ begin
|
|||||||
Halt(1);
|
Halt(1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
theopts : array[1..6] of TOption;
|
theopts : array[1..6] of TOption;
|
||||||
|
|
||||||
@ -117,6 +119,7 @@ var
|
|||||||
begin
|
begin
|
||||||
ishhp:=uppercase(extractfileext(name))='.HHP';
|
ishhp:=uppercase(extractfileext(name))='.HHP';
|
||||||
Project := TChmProject.Create;
|
Project := TChmProject.Create;
|
||||||
|
Project.ReadMeMessage:='Compiled by CHMCmd '+CHMCMDVersion;
|
||||||
if ishhp then
|
if ishhp then
|
||||||
begin
|
begin
|
||||||
xmlname:=changefileext(name,'.hhp.xml');
|
xmlname:=changefileext(name,'.hhp.xml');
|
||||||
|
@ -61,7 +61,8 @@ type
|
|||||||
fAllowedExtensions: TStringList;
|
fAllowedExtensions: TStringList;
|
||||||
fTotalFileList : TAvlTree;
|
fTotalFileList : TAvlTree;
|
||||||
FSpareString : TStringIndex;
|
FSpareString : TStringIndex;
|
||||||
FBasePath : String; // location of the .hhp file. Needed to resolve relative paths
|
FBasePath : String; // location of the .hhp file. Needed to resolve relative paths
|
||||||
|
FReadmeMessage : String; // readme message
|
||||||
protected
|
protected
|
||||||
function GetData(const DataName: String; out PathInChm: String; out FileName: String; var Stream: TStream): Boolean;
|
function GetData(const DataName: String; out PathInChm: String; out FileName: String; var Stream: TStream): Boolean;
|
||||||
procedure LastFileAdded(Sender: TObject);
|
procedure LastFileAdded(Sender: TObject);
|
||||||
@ -101,6 +102,7 @@ type
|
|||||||
property OnError : TChmErrorCB read FOnError write FOnError;
|
property OnError : TChmErrorCB read FOnError write FOnError;
|
||||||
property DefaultWindow : String read FDefaultWindow write FDefaultWindow;
|
property DefaultWindow : String read FDefaultWindow write FDefaultWindow;
|
||||||
property ScanHtmlContents : Boolean read fScanHtmlContents write fScanHtmlContents;
|
property ScanHtmlContents : Boolean read fScanHtmlContents write fScanHtmlContents;
|
||||||
|
property ReadmeMessage : String read FReadmeMessage write FReadmeMessage;
|
||||||
property AllowedExtensions : TStringList read FAllowedExtensions;
|
property AllowedExtensions : TStringList read FAllowedExtensions;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1052,7 +1054,7 @@ begin
|
|||||||
Writer.HasBinaryIndex := MakeBinaryIndex;
|
Writer.HasBinaryIndex := MakeBinaryIndex;
|
||||||
Writer.IndexName := IndexFileName;
|
Writer.IndexName := IndexFileName;
|
||||||
Writer.TocName := TableOfContentsFileName;
|
Writer.TocName := TableOfContentsFileName;
|
||||||
|
Writer.ReadmeMessage := ReadmeMessage;
|
||||||
for i:=0 to files.count-1 do
|
for i:=0 to files.count-1 do
|
||||||
begin
|
begin
|
||||||
nd:=TChmContextNode(files.objects[i]);
|
nd:=TChmContextNode(files.objects[i]);
|
||||||
|
@ -78,6 +78,7 @@ Type
|
|||||||
HeaderSuffix: TITSFHeaderSuffix; //contains the offset of CONTENTSection0 from zero
|
HeaderSuffix: TITSFHeaderSuffix; //contains the offset of CONTENTSection0 from zero
|
||||||
HeaderSection0: TITSPHeaderPrefix;
|
HeaderSection0: TITSPHeaderPrefix;
|
||||||
HeaderSection1: TITSPHeader; // DirectoryListings header
|
HeaderSection1: TITSPHeader; // DirectoryListings header
|
||||||
|
FReadmeMessage : String;
|
||||||
// DirectoryListings
|
// DirectoryListings
|
||||||
// CONTENT Section 0 (section 1 is contained in section 0)
|
// CONTENT Section 0 (section 1 is contained in section 0)
|
||||||
// EOF
|
// EOF
|
||||||
@ -125,6 +126,7 @@ Type
|
|||||||
property OnLastFile: TNotifyEvent read FOnLastFile write FOnLastFile;
|
property OnLastFile: TNotifyEvent read FOnLastFile write FOnLastFile;
|
||||||
property OutStream: TStream read FOutStream;
|
property OutStream: TStream read FOutStream;
|
||||||
property TempRawStream: TStream read FTempStream write SetTempRawStream;
|
property TempRawStream: TStream read FTempStream write SetTempRawStream;
|
||||||
|
property ReadmeMessage : String read fReadmeMessage write fReadmeMessage;
|
||||||
//property LocaleID: dword read ITSFHeader.LanguageID write ITSFHeader.LanguageID;
|
//property LocaleID: dword read ITSFHeader.LanguageID write ITSFHeader.LanguageID;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -525,7 +527,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TITSFWriter.WriteREADMEFile;
|
procedure TITSFWriter.WriteREADMEFile;
|
||||||
const DISCLAIMER_STR = 'This archive was not made by the MS HTML Help Workshop(r)(tm) program.';
|
const DISCLAIMER_STR = 'This archive was not made by the MS HTML Help Workshop(r)(tm) program, but by Free Pascal''s chm package '+chmpackageversion+'.'#13#10;
|
||||||
var
|
var
|
||||||
Entry: TFileEntryRec;
|
Entry: TFileEntryRec;
|
||||||
begin
|
begin
|
||||||
@ -533,6 +535,8 @@ begin
|
|||||||
Entry.Compressed := False;
|
Entry.Compressed := False;
|
||||||
Entry.DecompressedOffset := FSection0.Position;
|
Entry.DecompressedOffset := FSection0.Position;
|
||||||
FSection0.Write(DISCLAIMER_STR, SizeOf(DISCLAIMER_STR));
|
FSection0.Write(DISCLAIMER_STR, SizeOf(DISCLAIMER_STR));
|
||||||
|
if length(FReadmeMessage)>0 then
|
||||||
|
FSection0.Write(FReadmeMessage[1], length(FReadmeMessage));
|
||||||
Entry.DecompressedSize := FSection0.Position - Entry.DecompressedOffset;
|
Entry.DecompressedSize := FSection0.Position - Entry.DecompressedOffset;
|
||||||
Entry.Path := '/';
|
Entry.Path := '/';
|
||||||
Entry.Name := '_#_README_#_'; //try to use a name that won't conflict with normal names
|
Entry.Name := '_#_README_#_'; //try to use a name that won't conflict with normal names
|
||||||
|
Loading…
Reference in New Issue
Block a user