|
@@ -72,14 +72,36 @@ begin
|
|
WriteFile(H, S[1], Length(S), BytesWritten, nil);
|
|
WriteFile(H, S[1], Length(S), BytesWritten, nil);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure WriteStdOut(const S: String);
|
|
|
|
|
|
+procedure WriteStdOut(const S: String; const Warning: Boolean = False);
|
|
|
|
+var
|
|
|
|
+ CSBI: TConsoleScreenBufferInfo;
|
|
begin
|
|
begin
|
|
- WriteToStdHandle(StdOutHandle, AnsiString(S));
|
|
|
|
|
|
+ if Warning then begin
|
|
|
|
+ GetConsoleScreenBufferInfo(StdErrHandle, CSBI);
|
|
|
|
+ SetConsoleTextAttribute(StdErrHandle, FOREGROUND_INTENSITY or FOREGROUND_RED or FOREGROUND_GREEN);
|
|
|
|
+ end;
|
|
|
|
+ try
|
|
|
|
+ WriteToStdHandle(StdOutHandle, AnsiString(S));
|
|
|
|
+ finally
|
|
|
|
+ if Warning then
|
|
|
|
+ SetConsoleTextAttribute(StdErrHandle, CSBI.wAttributes);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure WriteStdErr(const S: String);
|
|
|
|
|
|
+procedure WriteStdErr(const S: String; const Error: Boolean = False);
|
|
|
|
+var
|
|
|
|
+ CSBI: TConsoleScreenBufferInfo;
|
|
begin
|
|
begin
|
|
- WriteToStdHandle(StdErrHandle, AnsiString(S));
|
|
|
|
|
|
+ if Error then begin
|
|
|
|
+ GetConsoleScreenBufferInfo(StdErrHandle, CSBI);
|
|
|
|
+ SetConsoleTextAttribute(StdErrHandle, FOREGROUND_INTENSITY or FOREGROUND_RED);
|
|
|
|
+ end;
|
|
|
|
+ try
|
|
|
|
+ WriteToStdHandle(StdErrHandle, AnsiString(S));
|
|
|
|
+ finally
|
|
|
|
+ if Error then
|
|
|
|
+ SetConsoleTextAttribute(StdErrHandle, CSBI.wAttributes);
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
|
|
|
|
function GetCursorPos: TPoint;
|
|
function GetCursorPos: TPoint;
|
|
@@ -222,7 +244,7 @@ begin
|
|
end;
|
|
end;
|
|
iscbNotifyStatus:
|
|
iscbNotifyStatus:
|
|
if not Quiet then
|
|
if not Quiet then
|
|
- WriteStdOut(Data.StatusMsg)
|
|
|
|
|
|
+ WriteStdOut(Data.StatusMsg, Data.Warning)
|
|
else if ShowProgress then
|
|
else if ShowProgress then
|
|
PrintProgress(Trim(Data.StatusMsg));
|
|
PrintProgress(Trim(Data.StatusMsg));
|
|
iscbNotifySuccess: begin
|
|
iscbNotifySuccess: begin
|
|
@@ -250,7 +272,7 @@ begin
|
|
else if ScriptFilename <> '' then
|
|
else if ScriptFilename <> '' then
|
|
S := S + ' in ' + ScriptFilename;
|
|
S := S + ' in ' + ScriptFilename;
|
|
S := S + ': ' + Data.ErrorMsg;
|
|
S := S + ': ' + Data.ErrorMsg;
|
|
- WriteStdErr(S);
|
|
|
|
|
|
+ WriteStdErr(S, True);
|
|
end;
|
|
end;
|
|
iscbNotifyIdle:
|
|
iscbNotifyIdle:
|
|
if ShowProgress and (Data.CompressProgress <> 0) then begin
|
|
if ShowProgress and (Data.CompressProgress <> 0) then begin
|
|
@@ -411,7 +433,7 @@ begin
|
|
else if GetParam(S, 'S') then begin
|
|
else if GetParam(S, 'S') then begin
|
|
if Pos('=', S) = 0 then begin
|
|
if Pos('=', S) = 0 then begin
|
|
ShowBanner;
|
|
ShowBanner;
|
|
- WriteStdErr('Invalid option: ' + S);
|
|
|
|
|
|
+ WriteStdErr('Invalid option: ' + S, True);
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
SignTools.Add(S);
|
|
SignTools.Add(S);
|
|
@@ -443,7 +465,7 @@ begin
|
|
end
|
|
end
|
|
else begin
|
|
else begin
|
|
ShowBanner;
|
|
ShowBanner;
|
|
- WriteStdErr('Unknown option: ' + S);
|
|
|
|
|
|
+ WriteStdErr('Unknown option: ' + S, True);
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
end
|
|
end
|
|
@@ -451,7 +473,7 @@ begin
|
|
{ Not a switch; must be the script filename }
|
|
{ Not a switch; must be the script filename }
|
|
if ScriptFilename <> '' then begin
|
|
if ScriptFilename <> '' then begin
|
|
ShowBanner;
|
|
ShowBanner;
|
|
- WriteStdErr('You may not specify more than one script filename.');
|
|
|
|
|
|
+ WriteStdErr('You may not specify more than one script filename.', True);
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
ScriptFilename := S;
|
|
ScriptFilename := S;
|
|
@@ -528,7 +550,7 @@ begin
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
if Ver.BinVersion < $05000500 then begin
|
|
if Ver.BinVersion < $05000500 then begin
|
|
{ 5.0.5 or later is required since we use TCompileScriptParamsEx }
|
|
{ 5.0.5 or later is required since we use TCompileScriptParamsEx }
|
|
- WriteStdErr('Incompatible compiler engine version.');
|
|
|
|
|
|
+ WriteStdErr('Incompatible compiler engine version.', True);
|
|
Halt(1);
|
|
Halt(1);
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -592,12 +614,12 @@ begin
|
|
isceNoError: ;
|
|
isceNoError: ;
|
|
isceCompileFailure: begin
|
|
isceCompileFailure: begin
|
|
ExitCode := 2;
|
|
ExitCode := 2;
|
|
- WriteStdErr('Compile aborted.');
|
|
|
|
|
|
+ WriteStdErr('Compile aborted.', True);
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
ExitCode := 1;
|
|
ExitCode := 1;
|
|
WriteStdErr(Format('Internal error: ISDllCompileScript returned ' +
|
|
WriteStdErr(Format('Internal error: ISDllCompileScript returned ' +
|
|
- 'unexpected result (%d).', [Res]));
|
|
|
|
|
|
+ 'unexpected result (%d).', [Res]), True);
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|
|
FreeScriptLines;
|
|
FreeScriptLines;
|
|
@@ -619,7 +641,7 @@ begin
|
|
except
|
|
except
|
|
{ Show a friendlier exception message. (By default, Delphi prints out
|
|
{ Show a friendlier exception message. (By default, Delphi prints out
|
|
the exception class and address.) }
|
|
the exception class and address.) }
|
|
- WriteStdErr(GetExceptMessage);
|
|
|
|
|
|
+ WriteStdErr(GetExceptMessage, True);
|
|
Halt(2);
|
|
Halt(2);
|
|
end;
|
|
end;
|
|
finally
|
|
finally
|