MODULE FoxA2Interface;
IMPORT Streams, Basic := FoxBasic, WMUtilities, TextUtilities, WMGraphics;
TYPE
Writer* = OBJECT (Basic.Writer)
VAR
alertCount, commentCount, keywordCount : LONGINT;
PROCEDURE &InitA2Writer(w: Streams.Writer);
BEGIN
InitBasicWriter(w); alertCount := 0; commentCount := 0; keywordCount := 0;
IF w IS TextUtilities.TextWriter THEN
w(TextUtilities.TextWriter).SetFontName("Courier");
END;
END InitA2Writer;
PROCEDURE SetFontStyle*(style: SET);
BEGIN
IF w IS TextUtilities.TextWriter THEN
w(TextUtilities.TextWriter).SetFontStyle(style);
END;
END SetFontStyle;
PROCEDURE SetStyle;
BEGIN
IF w IS TextUtilities.TextWriter THEN
IF alertCount > 0 THEN w(TextUtilities.TextWriter).SetFontColor(WMGraphics.Red);
ELSIF commentCount > 0 THEN w(TextUtilities.TextWriter).SetFontColor(LONGINT(0999999FFH));
ELSE w(TextUtilities.TextWriter).SetFontColor(WMGraphics.Black);
END;
IF keywordCount > 0 THEN w(TextUtilities.TextWriter).SetFontStyle({WMGraphics.FontBold});
ELSE w(TextUtilities.TextWriter).SetFontStyle({});
END;
END;
END SetStyle;
PROCEDURE BeginAlert*;
BEGIN INC(alertCount); SetStyle
END BeginAlert;
PROCEDURE EndAlert*;
BEGIN DEC(alertCount); SetStyle
END EndAlert;
PROCEDURE BeginComment*;
BEGIN INC(commentCount); SetStyle;
END BeginComment;
PROCEDURE EndComment*;
BEGIN DEC(commentCount); SetStyle
END EndComment;
PROCEDURE BeginKeyword*;
BEGIN INC(keywordCount);SetStyle;
END BeginKeyword;
PROCEDURE EndKeyword*;
BEGIN DEC(keywordCount); SetStyle;
END EndKeyword;
PROCEDURE AlertString*(CONST s: ARRAY OF CHAR);
BEGIN
BeginAlert; w.String(s); EndAlert;
END AlertString;
END Writer;
PROCEDURE DebugWriterFactory(CONST title: ARRAY OF CHAR): Streams.Writer;
VAR writer: WMUtilities.WindowWriter;
BEGIN
NEW(writer,title,600,400,FALSE); RETURN writer
END DebugWriterFactory;
PROCEDURE WriterFactory(w: Streams.Writer): Basic.Writer;
VAR writer: Writer;
BEGIN
NEW(writer,w);
RETURN writer
END WriterFactory;
PROCEDURE Install*;
BEGIN
Basic.InstallWriterFactory(WriterFactory, DebugWriterFactory);
END Install;
END FoxA2Interface.
FSTools.DeleteFiles FoxA2Interface.Obw ~~