Controlling E9Screen EPC9 Installation 94
( NOT IOBytes.SetLength( CommandFile, 0 ) ) OR
( NOT IOText.Write( CommandFile, Count, ADR( Work ) ) )
THEN
WriteError( 'Writing negative signature' );
RETURN FALSE;
END; (* IF *)
Count := Strings.Length( Text );
(* Second, we write the command text to the second (and following)
line.
*)
IF NOT IOText.Write( CommandFile, Count, ADR( Text ) ) THEN
WriteError( 'Writing to command file' );
RETURN FALSE;
END; (* IF *)
(* Third, if the signature should be positive, we now overwrite the
negative sign (i.e., "-") of the signature in the first line with
a plus (i.e., "+"), thus changing the negative signature to positive.
See above for the explanation.
*)
IF Signature >= 0 THEN
Work[0] := '+';
Count := 1;
IF
( NOT IOBytes.SetPosition( CommandFile, IOFiles.FromStart, 0 ) ) OR
( NOT IOBytes.Write( CommandFile, Count, ADR( Work ) ) )
THEN
WriteError( 'Writing positive signature' );
RETURN FALSE;
END; (* IF *)
END; (* IF *)
TermIO.WriteLn;
TermIO.WriteString( 'command : [' );
TermIO.WriteInt( Signature, 0 );
TermIO.WriteString( '] ' );
TermIO.WriteLine( Text );
INC( Signature );
IF Signature < 1 THEN Signature := 1; END;
RETURN TRUE;
END WriteToCommandFile;
PROCEDURE OpenMessageFile(): BOOLEAN;
BEGIN
IF NOT CommandFile.IsOpen THEN RETURN FALSE; END;
IF MessageFile.IsOpen THEN
Alert.String( 'Message file already open! ' );
RETURN FALSE;