Gri Extras

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

13: Extra things provided with Gri

13.1: Indentation program

A Perl program called `grindent' is provided with Gri, installed in the same directory as Gri.

`ftp://ftp.phys.ocean.dal.ca/users/kelley/gri' <P>

  • `Grindent' can work as a filter, transforming standard input into standard output, as in `cat a.gri | grindent'. On a Sun openwindows system, you can therefore make the textedit tool do gri indentation on the contents of the window by adding the following line to your `~/.text_extras_menu' file:
    "Pretty-print Gri"	/local/bin/grindent
    

  • `Grindent' can work on a specified Gri command file inplace, as in `grindent cmd.gri'. Before modifying the `cmd.gri' file, it first makes a copy in `cmd.gri.BAK'.

  • `Grindent' indents code within `if' blocks, `while' blocks, and new commands. The indentation level is 4 spaces by default. The `-i' commandline option lets you change this, e.g., `grindent -i2 cmd.gri' specifies 2 spaces.

  • `Grindent' tries to line up right-trailing inline comments and continuation backslashes, to a default column of 32. The commandline option `-c' lets you change this column, e.g. `grindent -c40 cmd.gri' specifies the 40th column.

  • `Grindent' makes assignment statements have precisely 1 space before and after the equal sign.

  • `Grindent' transforms all TAB characters into single spaces.

  • `Grindent' leaves the help for new commands unaltered.

  • `Grindent' does some simple syntax checking, for things like unclosed `if' statements within `while' loops or within the whole program. When Grindent gives a warning, you will know that either the line it quotes is wrong or some line above it; use the indentation to track the error down.

13.2: gri_merge, combine PostScript files into one page

Merge separate PostScript files, created by Gri, into one page.

13.3: gri_unpage, create multiple PostScript files for multipage input

Given a multipage PostScript file, `gri_unpage' creates several new PostScript files, one for each page.

13.4: gri_curve, extract data from Gri PostScript file

`gri_curve' is a Perl script that extract information from PostScript files, in user units. It is mostly used by the author; see comments in the script.

13.5: Updating Program

A perlscript called `gri_update' is provided with Gri.

This perlscript edits Gri command files, translating old syntax into new syntax. The editing is done in-place, after copying to a file with suffix `.BAK'. `gri_update' cannot handle all incompatibilities but it will translate the things illustrated in the following before/after comparison see History.

  • `{rpn width("hello")}' -> `{rpn "hello" width}'

  • `{rpn ascent("hello")}' -> `{rpn "hello" ascent}'

  • `{rpn descent("hello")}' -> `{rpn "hello" descent}'

  • `convert columns to grid planar' -> `convert columns to grid boxcar'