[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Module Proposal for Standard Lib



Adding debug output to a program is a tedious task.  Module `Log' is
intended as a simple facility to emit log messages to stderr (or some
other channel).

The module is based on `Err.Mod'.  Every output procedure takes an
additional argument `msg', and produces an ouput line of the form
"msg: text".  All format arguments for procedures (like in `Err.Int'
or `Err.Real') have been removed, likewise the procedures `RealFix'
and `LongRealFix'.

Additional procedures:
  `Log.Msg': writes just the message text
  `Log.Ptr': writes the value of the pointer argument as hex number
  `Log.Adr': writes the address of the argument as hex number
  `Log.Type': writes the argument's type name (undefined if argument is
    not a record pointer)

Module interface (see attached sources for details):

  MODULE Log;

  IMPORT
    TextRider;

  VAR
    writer-: TextRider.Writer;

  PROCEDURE Adr (msg: ARRAY OF CHAR; VAR x: ARRAY OF BYTE);
  PROCEDURE Bool (msg: ARRAY OF CHAR; bool: BOOLEAN);
  PROCEDURE Char (msg: ARRAY OF CHAR; ch: CHAR);
  PROCEDURE ClearError;
  PROCEDURE Done (): BOOLEAN;
  PROCEDURE Flush;
  PROCEDURE Hex (msg: ARRAY OF CHAR; lint: LONGINT);
  PROCEDURE Int (msg: ARRAY OF CHAR; int: INTEGER);
  PROCEDURE Ln (msg: ARRAY OF CHAR);
  PROCEDURE LongInt (msg: ARRAY OF CHAR; lint: LONGINT);
  PROCEDURE LongReal (msg: ARRAY OF CHAR; lreal: LONGREAL);
  PROCEDURE LongRealEng (lreal: LONGREAL);
  PROCEDURE Msg (msg: ARRAY OF CHAR);
  PROCEDURE Ptr (msg: ARRAY OF CHAR; ptr: PTR);
  PROCEDURE Real (msg: ARRAY OF CHAR; real: REAL);
  PROCEDURE RealEng (real: REAL);
  PROCEDURE Set (msg: ARRAY OF CHAR; s: SET);
  PROCEDURE SetWriter (w: TextRider.Writer);
  PROCEDURE ShortInt (msg: ARRAY OF CHAR; sint: SHORTINT);
  PROCEDURE String (msg: ARRAY OF CHAR; s: ARRAY OF CHAR);
  PROCEDURE Type (msg: ARRAY OF CHAR; ptr: PTR);

  END Log.

I intend to include this module in the next release as an addition to
the standard I/O modules `In', `Out', and `Err'.

-- mva



begin 640 Log.Mod.gz
M'XL("$V?V34"`TQO9RY-;V0`Q5AK;]I(%/U<?L555"D0L32DW;8!]8-#G`2)
MEXQIE"^K#/:`K1H/FAE"LK]^SXSM\$@@J7;15E4UG<>YY]S'>"[EDP\?VV&#
M7"EK71%6'ZA>^TSU\_-OG^JGG^IU.CMMG-8;7^K$@E\\)?=Q3A\_G%1*W?[E
MJ.-21TR;I?()T3">S1-.B9A.XW1*$Q;$2:R?2`M2.N2`+Q'^M,3\2<;32%.Y
M53%VOE,W#B+&$WI@*3G&2(GL5C^*%<U$N``L1A/).2DQT4LF>9.>Q(("G)`\
MC)66\7BAL4T32\-/0IIS\>3)XF!RD8(!Z8B3YG*F2$SL?ZY[([KF*9<LH<%B
MG,0!=>*`IXH34S0W,RKB(8TS('/DRK`8YBSH2@"9Z5BD3>(QUB4]<*GP?SHK
MC.2(51+2HI29-N0EB;DY6`'C)TJ87IVMO>Z`E<Z0XM1B1V(.21$0(7(9)PF-
M.2T4GRR2JH7`;KIM^S?]D4].[XYN'<]S>OY=$[MU)+#*'WB&9>(7`QK")$L1
M.3&Q$%W7:]W@C'/1[K3].\B@J[;?<X=#NNI[Y-#`\?QV:]1Q/!J,O$%_Z-:0
M#MP0XQ9ACYLG-E3P9,@UBQ-52+]#=!7X)2%%[($CR@&/'\".48`,>CN`%H4E
M`JEHE&(W/#B78BK9K$GQA%*AJ[24,;(&*?HBM/;\*KQ5:J=!K4I?O_U)7:84
M.0^(:(O-QC(.IQAV'3H]JW\^K])HZ$`_*L1`E-K=0=_S,1S>#7VW6Z6A#EL1
M2U.>J"KY_%%[,7(3PZ<Y5\U2Z:?C8;<E)O]HK';4;NU4$XLH-YL:^&MX2[-L
MHFX2U<X@KG.$%G(#'BXD5R#43F,=LR3^&]L@.!)P+;,J41./.K=8^.)^C68M
MJ]]C"K()@+50>,@T,S'-S&9(`4L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