'Debug' support multiple arguments

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Killswitch
Enthusiast
Enthusiast
Posts: 731
Joined: Wed Apr 21, 2004 7:12 pm

'Debug' support multiple arguments

Post by Killswitch »

Simple request really, nothing that important:

Allow:

Code: Select all

Debug 1
Debug "abc"
Debug 18.9
to be:

Code: Select all

Debug 1, "abc", 18.9
~I see one problem with your reasoning: the fact is thats not a chicken~
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

not a bad idea.

I suggest something like the formatting of print-lines in C64-Basic:

the comma is a tabulator, for direct following is the ";"

Code: Select all

Debug "A = "; a, "B = ";b
will debug the variables directly behind the text, but set the second text on the next tabstop.
oh... and have a nice day.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

Sorry, but IMHO both ideas are not good.

; is for comments and should always be ONLY for comments (expect if you use it in strings).

"Debug 1, "abc", 18.9 " is also a bad idea, because Debug expects 2 Params:

Code: Select all

Debug TextOrNumber, DebugLEvel
So the compiler cannot decide if param 2, 3, 4, etc. must be debugged or should be the debug-level.



A better idea would be to invent a new command: MultiDebug
MultiDebug should ignore the debug-level (and debug always!) then and should have this syntax:

Code: Select all

MultiDebug 1, "abc", 18.9
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

> ; is for comments and should always be ONLY for comments
that's right, it was only an example how it was used on the C64.

if there will be an seperator for the output, it maybe worth thinking about different separators for formatted output.

the debug-level parameter is a point, I just forgot that, because I never used it and never seen it been used....


> A better idea would be to invent a new command: MultiDebug
not at all. I think an additional command would be complete nonsense.
oh... and have a nice day.
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Would this work..

You can always open a console and instead of using debug commands use printn() instead.

Wrap the printn() commands with a compilerif endif and turn the whole thing into a macro so that all you have to put in your code is something like

newdebug("print me")

you would get tabulated output and when you want to compile the finished program just set it so the compilerif doesn't produce any code and your done.
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

> the debug-level parameter is a point, I just forgot that
I never used it, and trotzdem have I dran gedacht :lol:

> an additional command would be complete nonsense
You know that there were new debug commands? StepOver, etc.? OK, if you think they are complete nonsense...
I don't think that this will be bad in aany way.

> Would this work..
No, this woulnd't work. Why? If there is an error like an IMA (invalid memory access), then the whole program is terminated. So you console will be closed. Your Debug output is futsch then.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
Derek
Addict
Addict
Posts: 2354
Joined: Wed Apr 07, 2004 12:51 am
Location: England

Post by Derek »

Does the normal debugger survive an ima then, probably yes.

Oh well, it was just an idea for a way to get proportional output anyway. :wink:
AND51
Addict
Addict
Posts: 1040
Joined: Sun Oct 15, 2006 8:56 pm
Location: Germany
Contact:

Post by AND51 »

In 99.999999999999% cases I use the integrated debugger. It disappers very often when there is an IMA, Div 0, etc...
So I've got no chance to get the debug output when there is an error.
PB 4.30

Code: Select all

onErrorGoto(?Fred)
User avatar
Kaeru Gaman
Addict
Addict
Posts: 4826
Joined: Sun Mar 19, 2006 1:57 pm
Location: Germany

Post by Kaeru Gaman »

I agree, a "debugger" should be an extra-program.
I also often use integrated debugging, especially DrawText() on a screen...

it's just....
meanwhile the debugger could be extended, and additional possibilities for the output together with charset-settings would be a good point imho...
oh... and have a nice day.
Post Reply