Simple Debugger

version 1/080105 by Michael Hilborn

  • Home page
  • Beginning
  • Previous
  • Next



  • Section 2 - Phrases

    [The phrase "initialize debugger" permits the author to enable debugging from with the source.]
    To initialize debugger, activating general debugging and/or activating object-debugging:
        if activating general debugging, set general debugging "on";
        if activating object-debugging, set debugging for all objects "on".

    [A simple phrase to use while writing our game (rather than typing "if the general debugging flag is true/false" all the time.]
    To decide whether we're debugging:
        if the general debugging flag is true, decide yes;
        decide no.

    [Here we define a phrase for activating the debugging properties of every single THING in the game.]
    To set debugging for all objects (parameter - text):
        if the parameter is "on" begin;
            now everything is being debugged;
            say "Every 'thing' is now being debugged. Type 'debug things off' to turn this feature off.";
        otherwise;
            now everything is not being debugged;
            say "Every 'thing' is no longer being debugged.";
        end if.

    [And here we define a phrase to activate and deactivate general debugging.]
    To set general debugging (parameter - text):
        if the parameter is "on" begin;
            now the general debugging flag is true;
            say "General debugging on. Type 'debug off' to turn it off.";
        otherwise;
            now the general debugging flag is false;
            say "General debugging off.";
        end if.

    [Finally, we create a phrase to activate and deactivate everything.]
    To set ultra debugging (parameter - text):
        if the parameter is "on" begin;
            set debugging for all objects "on";
            set general debugging "on";
        otherwise;
            set debugging for all objects "off";
            set general debugging "off";
        end if.