summaryrefslogtreecommitdiff
path: root/packages/chm
diff options
context:
space:
mode:
authormarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-07-15 08:58:54 +0000
committermarco <marco@3ad0048d-3df7-0310-abae-a5850022a9f2>2010-07-15 08:58:54 +0000
commit616003a6d0c5d6b8d85c731a25c274f9b485344f (patch)
treee901e5226973b6e77e58a66c6dbbabb56e636a04 /packages/chm
parent4d40eb61d7da9862cc85f6934c73fa39e7bef348 (diff)
downloadfpc-616003a6d0c5d6b8d85c731a25c274f9b485344f.tar.gz
* more little fixes from initial testing. Mostly errormessages and .hhp defaults.
chmls -n switch git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15578 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/chm')
-rw-r--r--packages/chm/src/chmcmd.lpr29
-rw-r--r--packages/chm/src/chmfilewriter.pas4
-rw-r--r--packages/chm/src/chmls.lpr14
3 files changed, 37 insertions, 10 deletions
diff --git a/packages/chm/src/chmcmd.lpr b/packages/chm/src/chmcmd.lpr
index caf7c53f66..a3ca1b26ad 100644
--- a/packages/chm/src/chmcmd.lpr
+++ b/packages/chm/src/chmcmd.lpr
@@ -121,23 +121,40 @@ begin
begin
xmlname:=changefileext(name,'.hhp.xml');
Project.OnError:=@OnError;
- Project.LoadFromHHP(name,false) ; // we need a param for this second param later
- project.ScanHtmlContents:=htmlscan<>scanforcedno; // .hhp default SCAN
- if GenerateXMLForHHP then
- begin
- Writeln('Generating XML ',xmlname,'.');
- Project.SaveToFile(xmlname);
+ try
+ Project.LoadFromHHP(name,false) ; // we need a param for this second param later
+ except
+ on e:exception do
+ begin
+ Writeln('This HHP CHM project seems corrupt, please check it ',name);
+ halt(1);
+ end;
end;
+ project.ScanHtmlContents:=htmlscan<>scanforcedno; // .hhp default SCAN
end
else
begin
+ try
project.ScanHtmlContents:=htmlscan=scanforce; // .hhp default SCAN
Project.LoadFromFile(name);
+ except
+ on e:exception do
+ begin
+ Writeln('This XML CHM project seems corrupt, please check it ',name);
+ halt(1);
+ end;
+ end;
end;
OutStream := TFileStream.Create(Project.OutputFileName, fmCreate, fmOpenWrite);
Project.WriteChm(OutStream);
+ if ishhp and GenerateXMLForHHP then
+ begin
+ Writeln('Generating XML ',xmlname,'.');
+ Project.SaveToFile(xmlname);
+ end;
OutStream.Free;
Project.Free;
+
end;
var
diff --git a/packages/chm/src/chmfilewriter.pas b/packages/chm/src/chmfilewriter.pas
index d0f94d9631..99be1df2d5 100644
--- a/packages/chm/src/chmfilewriter.pas
+++ b/packages/chm/src/chmfilewriter.pas
@@ -272,6 +272,7 @@ begin
OPTERROR_LOG_FILE : ;
OPTFLAT : ;
OPTFULL_TEXT_SEARCH_STOP_LIST: ;
+ OPTFULL_TEXT_SEARCH : MakeSearchable:=optvalupper='YES';
OPTIGNORE : ;
OPTINDEX_FILE : Indexfilename:=optval;
OPTLANGUAGE : ;
@@ -390,6 +391,9 @@ var i,j : integer;
node: TCHMContextNode;
keyupper : string;
begin
+ { Defaults other than global }
+ MakeBinaryIndex:=True;
+
{$ifdef hhp_debug}
writeln('alias entry:',key,'=',value);
{$endif}
diff --git a/packages/chm/src/chmls.lpr b/packages/chm/src/chmls.lpr
index b46813daa3..e289912e49 100644
--- a/packages/chm/src/chmls.lpr
+++ b/packages/chm/src/chmls.lpr
@@ -35,8 +35,9 @@ type
{ TJunkObject }
TJunkObject = class
- Section : Integer;
- count : integer;
+ Section : Integer;
+ count : integer;
+ donotpage: boolean;
procedure OnFileEntry(Name: String; Offset, UncompressedSize, ASection: Integer);
end;
@@ -56,6 +57,7 @@ begin
writeln(stderr);
writeln(stderr,'Switches : ');
writeln(stderr,' -h, --help : this screen');
+ writeln(stderr,' -n : do not page list output');
writeln(stderr);
writeln(stderr,'Where command is one of the following or if omitted, equal to LIST.');
writeln(stderr,' list <filename> [section number] ');
@@ -103,7 +105,7 @@ procedure TJunkObject.OnFileEntry(Name: String; Offset, UncompressedSize,
begin
Inc(Count);
if (Section > -1) and (ASection <> Section) then Exit;
- if (Count = 1) or (Count mod 40 = 0) then
+ if (Count = 1) or ((Count mod 40 = 0) and not donotpage) then
WriteLn(StdErr, '<Section> <Offset> <UnCompSize> <Name>');
Write(' ');
Write(ASection);
@@ -115,6 +117,8 @@ begin
WriteLn(Name);
end;
+var donotpage:boolean=false;
+
procedure ListChm(Const Name:string;Section:Integer);
var
ITS: TITSFReader;
@@ -132,6 +136,7 @@ begin
JunkObject := TJunkObject.Create;
JunkObject.Section:=Section;
JunkObject.Count:=0;
+ JunkObject.DoNotPage:=DoNotPage;
ITS:= TITSFReader.Create(Stream, True);
ITS.GetCompleteFileList(@JunkObject.OnFileEntry);
@@ -217,7 +222,7 @@ begin
Writeln(stderr,'chmls, a CHM utility. (c) 2010 Free Pascal core.');
Writeln(Stderr);
repeat
- c:=getlongopts('h',@theopts[1],optionindex);
+ c:=getlongopts('hn',@theopts[1],optionindex);
case c of
#0 : begin
case optionindex-1 of
@@ -227,6 +232,7 @@ begin
end;
end;
end;
+ 'n' : donotpage:=true;
'?','h' :
begin
writeln('unknown option',optopt);