ETHZ_Logo RAMSES_Logo_Right   RAMSES   RAMSES_Logo_Left Systems Ecology  
Start    search button      Modules:   A-Z   Function   Layer        QuickRefs:   DM   AuxLib   AuxLibE   SciLib   EasyMW   MW   ISIS   RMSLib

DEFINITION MODULE DebugHelper;

  (*******************************************************************

    Module  DebugHelper     (Version 1.0)

      Copyright (c) 1997-2006 by Andreas Fischlin and ETH Zurich.

    Purpose   Helps generally to debug programs.

    Remarks   Requires the Dialog Machine.


    Programming

      o Design
        Andreas Fischlin          07/03/1997

      o Implementation
        Andreas Fischlin          07/03/1997


    ETH Zurich
    Systems Ecology
    CHN E 35.1
    Universitaetstrasse 16
    8092 Zurich
    SWITZERLAND

    URLs:
        <mailto:RAMSES@env.ethz.ch>
        <http://www.sysecol.ethz.ch>
        <http://www.sysecol.ethz.ch/SimSoftware/RAMSES>


    Last revision of definition:  07/03/1997  AF

  *******************************************************************)


  VAR
    debugLev: INTEGER;  (* READ ONLY, actually remains always positive *)

  (*
    Typically you use debugLev in an importing module to
    control the appearance of error messages used to trace
    program behavior.  See also procedure Tell.

    can internally be increased or decreased by a hidden keybaord
    short-cut.  It is:

      Command ^ Shift ^ Capslock ^ "H"   to   Increase (Higher)
      Command ^ Shift ^ Capslock ^ "L"   to   Decrease (Lower)

    The level > 0 is considered to be a debug mode "On".  As soon as the
    level reaches 0, the debug mode is considered to be "Off".
    A sound feedback if file "On and Off.R" is accessible will be
    given accordingly.  The hidden keyboard shortcuts won't allow you to
    decrease the value beyond zero.

  *)

    msg,s1,s2,s3: ARRAY [0..255] OF CHAR;
      (* for free use to construct messages *)


  PROCEDURE AppendS(VAR msg: ARRAY OF CHAR; s: ARRAY OF CHAR);
  PROCEDURE AppendBool(VAR msg: ARRAY OF CHAR; b: BOOLEAN);
  PROCEDURE AppendInt(VAR msg: ARRAY OF CHAR; x: LONGINT);
  PROCEDURE AppendReal(VAR msg: ARRAY OF CHAR; dec: CARDINAL; x: LONGREAL);

  PROCEDURE Tell (onDebugLev: INTEGER; msg: ARRAY OF CHAR);
    (* If current debugLev < ABS(onDebugLev), no message appears. If
     current debugLev >= ABS(onDebugLev) a message is produced.
     Depending on the sign of onDebugLev you may select between
     Inform level (negative sign) and Warn level (positive sign)
     messages. The former display a larger message, the latter let
     you call the debugger.  onDebugLev = 0 is interpreted as
     onDebugLev -1.
    *)



  (* **************************************************************

                       FOR YOUR CONVENIENCE ONLY

     To use this module, simply paste at the end of your
     import list the following lines:


  (*. for degugging only .*)
  FROM DebugHelper IMPORT msg, AppendS,
    AppendBool, AppendInt, AppendReal, Tell;

      or

  (*. for degugging only .*)
  FROM DebugHelper IMPORT msg, s1, s2, s3, debugLev,
    AppendS, AppendBool, AppendInt, AppendReal, Tell;



     ************************************************************** *)

END DebugHelper.

  Contact RAMSES@env.ethz.ch Last updated: 25-Jul-2011 [Top of page]