Protect:
PROC [instance: Instance, inner:
PROC [Instance]]
RETURNS [
BOOL] = {
ENABLE {
RuntimeError.Uncaught => {
info: UncaughtInfo = NEW[UncaughtInfoRep ¬ [signal: signal, parameters: parameters]];
instance.sequencer.procs.feedback[instance, $Uncaught, fatal, NIL];
GO TO fail;
};
ImagerError.Warning => {ipErrorProc[instance, error, TRUE]; RESUME};
ImagerError.Error => {ipErrorProc[instance, error, FALSE]; GO TO fail};
};
inner[instance];
RETURN [FALSE];
EXITS fail => RETURN [TRUE];
};
ipErrorProc:
PROC [instance: Instance, error: ImagerError.ErrorDesc, warning:
BOOL] = {
I don't think this gets used, because Interpress catches the Imager signals. - MFP
ros: STREAM = IO.ROS[];
key: ATOM ¬ $ImagerError;
severity: DecomposerRegistry.Severity ¬ error;
IF warning THEN {key ¬ $ImagerWarning; severity ¬ warning};
IF error.code # ok THEN IO.PutF1[ros, "[code: %g] ", [integer[error.code.ORD]] ];
IO.PutRope[ros, error.explanation];
Feedback[instance, key, severity, IO.RopeFromROS[ros]];
};
ipLogProc:
PROC [instance: Instance, class:
INT, code: ImagerError.ErrorCode, explanation:
ROPE, propList: Prop.PropList] = {
out: STREAM = IO.ROS[];
key:
ATOM ~
SELECT class
FROM
>= InterpressInterpreter.classComment => $InterpressComment,
>= InterpressInterpreter.classAppearanceWarning => $ImagerWarning,
>= InterpressInterpreter.classAppearanceError => $ImagerError,
>= InterpressInterpreter.classMasterWarning => $InterpressWarning,
>= InterpressInterpreter.classMasterError => $InterpressError,
ENDCASE => $InterpressError;
severity: DecomposerRegistry.Severity ~
SELECT class
FROM
>= InterpressInterpreter.classComment => $comment,
>= InterpressInterpreter.classAppearanceWarning => $warning,
>= InterpressInterpreter.classAppearanceError => $warning,
>= InterpressInterpreter.classMasterWarning => $warning,
>= InterpressInterpreter.classMasterError => $error,
ENDCASE => $error;
IF class # 0 THEN IO.PutF1[out, "[class: %g] ", [integer[class]] ];
IF code # ok THEN IO.PutF[out, "[code: %g(%g)] ", [atom[ImagerError.AtomFromErrorCode[code]]], [integer[code.ORD]] ];
IO.PutRope[out, explanation];
Feedback[instance, key, severity, IO.RopeFromROS[out]];
};
Feedback:
PROC [instance: DecomposerRegistry.InstanceData, key:
ATOM, severity: DecomposerRegistry.Severity, info:
REF] ~ {
WITH instance.private
SELECT
FROM
tm: TaggedMaster => {
This records the fact that some feedback happened; this is used to inhibit the prescan cache when feedback (such as font substitution) happened early on, so that the messages won't get lost.
IF Prop.Get[tm.propList, $GeneratedFeedback] =
NIL
THEN {
tm.propList ¬ Prop.Put[tm.propList, $GeneratedFeedback, $TRUE];
};
};
ENDCASE;
instance.sequencer.procs.feedback[instance, key, severity, info];
};