DebugVar (Variable mit Namen debuggen)
Verfasst: 06.10.2010 18:36
Code: Alles auswählen
Macro DQ ; Ein Anführungszeichen
"
EndMacro
Macro DebugVar (Value, Typ=#PB_Interger) ; Variablenwert debuggen
CompilerSelect (Typ) ; Je nach Typ verschieden Debuggen ...
CompilerCase #PB_Byte ; Binärdaten
Debug Str(#PB_Compiler_Line) + ": " + DQ#Value = DQ + Bin(Value)
CompilerCase #PB_Integer ; Normale Zahl
Debug Str(#PB_Compiler_Line) + ": " + DQ#Value = DQ + Str(Value)
CompilerCase #PB_Quad ; Hexadezimal
Debug Str(#PB_Compiler_Line) + ": " + DQ#Value = DQ + Hex(Value)
CompilerCase #PB_Float ; Fließkommazahl
Debug Str(#PB_Compiler_Line) + ": " + DQ#Value = DQ + StrF(Value, 3)
CompilerCase #PB_Double ; Fließkommazahl
Debug Str(#PB_Compiler_Line) + ": " + DQ#Value = DQ + StrD(Value)
CompilerCase #PB_String ; String
Debug Str(#PB_Compiler_Line) + ": " + DQ#Value = DQ + Value)
CompilerEndSelect
EndMacro
; Beispiel:
A = 5
DebugVar (A)
; Beispiel 2:
Dim B.i(10)
DebugVar (ArraySize(B()))
Am besten noch "DebugVar" als Schlüsselwort definieren, wegen der Optik.
Edit: Habe mal Integer als default genommen, ist schon logischer