Programming Gri

1: Introduction
2: Simple example
3: Fancy example
4: Running Gri
5: Programming Gri
6: General Issues
7: X-Y Plots
8: Contour Plots
9: Image Plots
10: Examples
11: Handling Data
12: Gri Commands
13: Gri Extras
14: Evolution of Gri
15: Installing Gri
16: Gri Bugs
17: System Tools
18: Acknowledgments
19: License
20: Newsgroup

21: Concept Index

5.12: Debugging Gri Programs

Here are some hints for debugging Gri programs:

  • If no data appear on an xy plot, insert `show columns statistics' or `show columns' after the `read columns' command. It may be that you have fixed your axes, and that the axes frame does not include the data.

  • If you get an error message, rerun your Gri program using the `-trace' command-line option, to see which line is causing the problem. This often reveals logic errors (e.g. in (`if' statements). You may also turn tracing on or off at any point in your Gri program by setting the built-in variable `..trace..' to 1 or 0. Many Gri users have the Gri command aliased to be in trace mode by default.

  • If Gri complains of a syntax error, consult the printed manual, one of the online manuals, or the online help facility see Online Help.

  • Check the version number (printed at startup) to see if a new version of Gri has been installed. Check the manual for known incompatabilities see Incompatibilities. You should always have a `expecting version .n.' command in your program, with `.n.' set to the version of Gri that you are most familiar with. This will warn of any incompatabilites since the named version.

  • Sprinkle `show' commands throughout your program, to see what's happening. Even when you are sure your program works, it is a good idea to embed `show' statements so are they executed if the `-debug' flag is set:
    if ..debug..
      show "X=" .x. "and label is `\label'"
    end if
    

  • If your your `draw' commands don't draw anything, check to see whether you've fooled yourself by enforcing an improper scaling; remove explict scaling (`set x axis ...'), clipping `set clip', data selection windows (`set input data window x|y') and missing values (`set missing value'). Another trick is to read only a portion of the data set (`read columns 10 x y') and then print out all the values (`show columns').

If you determine that the bug is in Gri, not in your program, please report the bug, so that other users will not have the same hassle; see Bugs.