lazres: replaced writeln with debugln

git-svn-id: trunk@16289 -
This commit is contained in:
mattias 2008-08-29 08:49:32 +00:00
parent 6c4b878988
commit e4c52efe93

View File

@ -35,7 +35,7 @@ program LazRes;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
uses Classes, SysUtils, FileUtil, LResources; uses Classes, SysUtils, FileUtil, LCLProc, LResources;
function StreamIsFormInTextFormat(Stream: TMemoryStream): boolean; function StreamIsFormInTextFormat(Stream: TMemoryStream): boolean;
const const
@ -75,7 +75,7 @@ begin
Stream.Position:=0; Stream.Position:=0;
except except
on E: Exception do begin on E: Exception do begin
writeln('ERROR: unable to convert Delphi form to text: '+E.Message); debugln('ERROR: unable to convert Delphi form to text: '+E.Message);
end; end;
end; end;
end; end;
@ -89,9 +89,9 @@ var
S: String; S: String;
begin begin
if ParamCount<2 then begin if ParamCount<2 then begin
writeln('Usage: ',ExtractFileName(ParamStrUTF8(0)) debugln('Usage: ',ExtractFileName(ParamStrUTF8(0))
,' resourcefilename filename1 [filename2 ... filenameN]'); ,' resourcefilename filename1 [filename2 ... filenameN]');
writeln(' ',ExtractFileName(ParamStrUTF8(0)) debugln(' ',ExtractFileName(ParamStrUTF8(0))
,' resourcefilename @filelist'); ,' resourcefilename @filelist');
exit; exit;
end; end;
@ -104,7 +104,7 @@ begin
S := ExpandFileNameUTF8(S); S := ExpandFileNameUTF8(S);
if not FileExistsUTF8(S) then if not FileExistsUTF8(S) then
begin begin
writeln('ERROR: file list not found: ', S); debugln('ERROR: file list not found: ',S);
exit; exit;
end; end;
FileList.LoadFromFile(UTF8ToSys(S)); FileList.LoadFromFile(UTF8ToSys(S));
@ -118,12 +118,12 @@ begin
S := FileList[a]; S := FileList[a];
if not FileExistsUTF8(S) if not FileExistsUTF8(S)
then begin then begin
writeln('ERROR: file not found: ', S); debugln('ERROR: file not found: ', S);
exit; exit;
end; end;
if ExpandFileNameUTF8(S) = FullResourceFilename if ExpandFileNameUTF8(S) = FullResourceFilename
then begin then begin
writeln('ERROR: resourcefilename = file', a); debugln(['ERROR: resourcefilename = file', a]);
exit; exit;
end; end;
end; end;
@ -131,14 +131,14 @@ begin
try try
ResFileStream:=TFileStream.Create(UTF8ToSys(ResourceFilename),fmCreate); ResFileStream:=TFileStream.Create(UTF8ToSys(ResourceFilename),fmCreate);
except except
writeln('ERROR: unable to create file ''', ResourceFilename, ''''); debugln('ERROR: unable to create file ''', ResourceFilename, '''');
halt(1); halt(1);
end; end;
ResMemStream:=TMemoryStream.Create; ResMemStream:=TMemoryStream.Create;
try try
for a:=0 to FileList.Count-1 do begin for a:=0 to FileList.Count-1 do begin
BinFilename:=FileList[a]; BinFilename:=FileList[a];
write(BinFilename); dbgout(BinFilename);
try try
BinFileStream:=TFileStream.Create(UTF8ToSys(BinFilename),fmOpenRead); BinFileStream:=TFileStream.Create(UTF8ToSys(BinFilename),fmOpenRead);
BinMemStream:=TMemoryStream.Create; BinMemStream:=TMemoryStream.Create;
@ -152,10 +152,10 @@ begin
ConvertFormToText(BinMemStream); ConvertFormToText(BinMemStream);
ResourceName:=FindLFMClassName(BinMemStream); ResourceName:=FindLFMClassName(BinMemStream);
if ResourceName='' then begin if ResourceName='' then begin
writeln(' ERROR: no resourcename'); debugln(' ERROR: no resourcename');
halt(2); halt(2);
end; end;
write(' ResourceName=''', ResourceName, ''' Type=''', ResourceType, ''''); dbgout(' ResourceName=''', ResourceName, ''' Type=''', ResourceType, '''');
LFMtoLRSstream(BinMemStream,ResMemStream); LFMtoLRSstream(BinMemStream,ResMemStream);
end end
else begin else begin
@ -164,10 +164,10 @@ begin
ResourceName:=copy(ResourceName,1 ResourceName:=copy(ResourceName,1
,length(ResourceName)-length(BinExt)); ,length(ResourceName)-length(BinExt));
if ResourceName='' then begin if ResourceName='' then begin
writeln(' ERROR: no resourcename'); debugln(' ERROR: no resourcename');
halt(2); halt(2);
end; end;
write(' ResourceName=''', ResourceName, ''' Type=''', ResourceType+''''); dbgout(' ResourceName=''', ResourceName, ''' Type=''', ResourceType+'''');
BinaryToLazarusResourceCode(BinMemStream,ResMemStream BinaryToLazarusResourceCode(BinMemStream,ResMemStream
,ResourceName,ResourceType); ,ResourceName,ResourceType);
end; end;
@ -176,10 +176,10 @@ begin
BinMemStream.Free; BinMemStream.Free;
end; end;
except except
writeln(' ERROR: unable to read file ''', BinFilename, ''''); debugln(' ERROR: unable to read file ''', BinFilename, '''');
halt(3); halt(3);
end; end;
writeln(''); debugln('');
end; end;
ResMemStream.Position:=0; ResMemStream.Position:=0;
ResFileStream.CopyFrom(ResMemStream,ResMemStream.Size); ResFileStream.CopyFrom(ResMemStream,ResMemStream.Size);