Gri: adding new commands

Examples 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 | ## 10.12: Using new commands to speed Gri programming New commands can speed your Gri programming. In the following example, note how the syntax is checked withing the new command, to ensure that things are correct. Also note that the filenames contain periods and slashes, so they will be broken up into several words by Gri; to prevent this, they are enclosed in double quotes.
    show "Plot locations of depth measurements."

    `draw depths from \file'
    Draw depth data stored in indicated file.
    Note that if the filename contains periods
    or slashes, you'll have to enclose it in
    double quotes, as in the second example:
      draw depths from file upper_cove
      draw depths from file ../old_data/upper_cove
    {
      if {rpn \.words. 4 !=}
        show "FATAL ERROR in `\.proper_usage.':"
        show "  Require 4 words, but got \.words. words."
        quit
      end if
      set symbol size 0.025
      show "Depths from file \.word3."
      open \.word3.
      read columns * x y
      close
      draw symbol plus
    }

    if !..publication..
      draw time stamp
    end if
    set page landscape
    set y margin 4
    set y axis 44.30 44.38 0.05 0.01
    set y size 10
    set x margin 4
    set x axis 64.35 64.23 -0.05 -0.01
    resize x for maps
    set x name "Longitude / $\circ$W"
    set y name "Latitude / $\circ$N"
    draw axes

    show "--- first map ---"
    draw depths from "../digitized/final/1"
    draw depths from "../digitized/final/2"
    draw depths from "../digitized/final/3"
    draw depths from "../digitized/final/4"
    draw depths from "../digitized/final/5"
    draw depths from "../digitized/final/6"
    draw depths from "../digitized/final/beach1"

    show "--- second (insert) map ---"
    draw depths from "../digitized/final/insert1"
    draw depths from "../digitized/final/insert2"
    draw depths from "../digitized/final/insert3"
    draw depths from "../digitized/final/insert4"
    draw depths from "../digitized/final/insert5"
    draw depths from "../digitized/final/insert6"
    draw depths from "../digitized/final/insert7"
    draw depths from "../digitized/final/insert_beach1"
    quit