If we only had a preprocessor...

If you create a debug library, it should contain all the functions
from print.jal. I think there is no way to use a generic device
definition for each function. And I would recoment to add a debug
number, so you can enable/disable groups of statements.

Joep

2010/9/7 mattschinkel <[email protected]>:
> I was thinking a debug library may be useful. let me know what you
> think.
>
> Basically, I currently have 100 lines or so of "print" library in my
> networking samples. These lines are all over the place.
>
> print_string(serial_sw_data, icmp_str1)
> -- some code
> print_string(serial_sw_data, icmp_str1)
>
> The problem is that it is difficult/messy to turn on and off this
> debugging. I could write:
>
> if NETWORKING_DEBUG = TRUE then
>   print_string(serial_sw_data, icmp_str1)
> end if
> -- some code
> if NETWORKING_DEBUG = TRUE then
>   print_string(serial_sw_data, icmp_str1)
> end if
>
> but as you can see, that could get messy.
>
> So, I was wondering if we could have a debug library that would
> basically copy API of the print lib, but would have a main constant to
> turn it on/off. In my example below, if you change DEBUG = FALSE, it
> will not print anything.
>
> include print
> const DEBUG = TRUE
> include debug
>
> debug_print_string(serial_sw_data, icmp_str1)
> -- some code
> debug_print_string(serial_sw_data, icmp_str1)
>
> Also, we could possibly have more then one debug library. debug_lvl1,
> debug_lvl2, etc.
>
> Matt.
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/jallib?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to