Debug

Debug module.

Main function is the CommandLine type which implements a simple command line for interactive seesion for the user.

This supports the following operations:
  • Left and right key moves cursor

  • Delete or backspace delete left character

  • Enter execute command

  • Up and down arrow navigates command history

Types

CommandLine* = RECORD
        line- : ARRAY MaxLineLength OF CHAR;
        history : ARRAY HistoryLength OF CHAR;
        pos-, len-, hidx : LENGTH;
        state : INTEGER;
        quit* : BOOLEAN;
    END;

Procedures

Init

Initialize CommandLine

PROCEDURE Init*(VAR cmd : CommandLine);

CommandLine.WriteChar

Write char to screen. Must be implemented

PROCEDURE (VAR this : CommandLine) WriteChar* (ch : CHAR);

CommandLine.WriteStr

Write string to screen.

PROCEDURE (VAR this : CommandLine) WriteStr* (str- : ARRAY OF CHAR);

CommandLine.Clear

Clear screen

PROCEDURE (VAR this : CommandLine) Clear*;

CommandLine.Reset

Reset ANSI attributes

PROCEDURE (VAR this : CommandLine) Reset*;

CommandLine.OnWelcome

Write welcome message to screen

PROCEDURE (VAR this : CommandLine) OnWelcome*;

CommandLine.OnPrompt

Write prompt to screen

PROCEDURE (VAR this : CommandLine) OnPrompt*;

CommandLine.OnCommand

Execute command. Return TRUE if a valid command

PROCEDURE (VAR this : CommandLine) OnCommand* (): BOOLEAN;

CommandLine.ProcessChar

Process single input char

PROCEDURE (VAR this : CommandLine) ProcessChar* (ch : CHAR);