/usr/src/castle-game-engine-5.2.0/base/castlewarnings.pas is in castle-game-engine-src 5.2.0-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | {
Copyright 2007-2014 Michalis Kamburelis.
This file is part of "Castle Game Engine".
"Castle Game Engine" is free software; see the file COPYING.txt,
included in this distribution, for details about the copyright.
"Castle Game Engine" is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----------------------------------------------------------------------------
}
{ Reporting warnings (OnWarning). }
unit CastleWarnings;
interface
type
{ Types of warnings. }
TWarningType = (
{ Something failed (like URL not available), but still the data
is semantically correct. For data formats that have a precise specification
(like VRML/X3D or Collada), this means that the file satisfies the specification,
but there is a minor problem (like one of the referred URLs is not available). }
wtMinor,
{ The data is invalid. For data formats that have a precise specification
(like VRML/X3D or Collada), this means that the file is incorrect
with respect to this specification. We can handle it,
but other (less forgiving but still correct) software may reject it.
It's strongly suggested to report this to the author of the file,
as the file should really be corrected. }
wtMajor);
{ Assign this to OnWarning to report warnings using WarningWrite, and log them too.
For Windows programs with no console available,
WarningWrite will make a message box,
in all other cases the warning just goes to ErrOutput.
The warning is also logged using CastleLog. }
procedure OnWarningWrite(const AType: TWarningType; const Category, S: string);
{ Assign this to OnWarning to only log warnings using CastleLog. }
procedure OnWarningLog(const AType: TWarningType; const Category, S: string);
type
TWarningProc = procedure (const AType: TWarningType; const Category, S: string);
var
{ Reporting warnings. Used by other units to report
warnings about various data (images, sound files, 3D models),
indicating that data is invalid in some way but we can continue.
You can assign any procedure here. You can ignore, or report this warning
in any way. If you want to be really strict about the data correctness,
you can also raise an exception (or raise it only when type is wtMajor).
The default behavior is to ignore possible warnings
(as there is no safe cross-platform default place where they can be reported).
Actually, you can initialize CastleLog to see warnings in the log.
You can also assign your own callback to OnWarning to record and show
warnings in any way. }
OnWarning: TWarningProc = @OnWarningLog;
implementation
uses CastleUtils, SysUtils, CastleLog;
procedure OnWarningWrite(const AType: TWarningType; const Category, S: string);
begin
if Log then
WritelnLog('Warning: ' + Category, S);
WarningWrite(ApplicationName + ': ' + Category + ' warning: ' + S);
end;
procedure OnWarningLog(const AType: TWarningType; const Category, S: string);
begin
if Log then
WritelnLog('Warning: ' + Category, S);
end;
end.
|