subverting IDL builtin variables !FORMYOWNPURPOSES [message #75258] |
Fri, 18 February 2011 16:41 |
MarioIncandenza
Messages: 231 Registered: February 2005
|
Senior Member |
|
|
This is a terrible idea, but I'll feel better about doing it one of
the Hard Ways once I've committed this awful cheat to posterity.
The package has ~100 subroutines, and each subroutine has various
types of output. All of this output ends up in logs, but now that the
whole creature is built, it's time to set different levels of
verbosity. My simple scheme is like this:
DEBUG=0; put nothing in the log except fatal errors;
DEBUG=1; include warnings and limited diagnostics;
DEBUG=2; include full diagnostics, performance-related
information, the kitchen sink.
Now, I can think of three ways to do this:
1) Pass a VERBOSITY keyword from the top level through all of the
subroutines. I'm not going to change 100 headers to add this (though I
am going to change ~200 PRINT statements to IF(VERBOSITY gt XX) THEN
PRINT).
2) Create a common block for the VERBOSITY level. I've never done
this, but it seems like the right solution for this problem.
3) Put the VERBOSITY into a !VARIABLE that isn't being used for
anything else. There are plenty to choose from, especially since this
package doesn't actually generate any graphics, etc.
Solution #3 is so easy... so wrong... so easy. Oh well.
Have a great weekend, everybody.
|
|
|