Chapters: 1: Introduction 2: Simple example 3: Invocation 4: Finer Control 5: X-Y Plots 6: Contour Plots 7: Image Plots 8: Examples 9: Gri Commands 10: Programming 11: Environment 12: Emacs Mode 13: History 14: Installation 15: Gri Bugs 16: Test Suite 17: Gri in Press 18: Acknowledgments 19: License Indices: Concepts Commands Variables |
10.11.2: How Gri parses commandsWhenever Gri reads a command line, it compares it with its list of commands. This list is searched in this order: (1) the universal `gri.cmd' file (see Invoking Gri), (2) your resource file (see Resource File), if it exists, and then (3) your command file itself. Gri stops searching when it finds a Gri command that matches the command line. "Matching" means that the command line is identical in all words in a Gri command, scanning from the left, until it encounters a word containing
When Gri finds a command that matches your command line, it assumes that this is the intended command, and searches no further. This means that you must be careful not to have your command hidden by other commands. For example, if your resource file contained these lines, Gri would never execute the second new command, because calls to it match the first command. To avoid this, you may either reverse the order of the definitions, so that Gri will find the proper routine, or rename one of the routines.
Gri searches the `gri.cmd' file first, so any new command that you create that clashes with built-in commands will be ignored by Gri (see Invoking Gri). Gri will warn you of this, and proceed, ignoring your newer definition. To get around this, you can use capital letters to begin the words of your new command. By convention, Gri never uses capital letters in this way, so a clash is impossible (except with any similar command you might have defined previously, such as in your `~/.grirc' file).
|