next up previous
Next: Functional Design of Up: Geographic Information System Previous: GRASS Structure

Programming Interface

 

USACERL provides a series of full--featured C libraries with GRASS which are carefully documented in the GRASS Programmer's Manual [31]. There are numerous major libraries with several smaller support libraries as shown in Table 2. The existence of these GRASS libraries meant that many low-level I/O, graphics and map processing routines already existed and could be incorporated into LUCAS. The GIS, Raster Graphics, Display Graphics, and D libraries were the only ones used in the development of LUCAS.

  
Table 2: C libraries provided by GRASS

GRASS programs can specify information about the current state of GRASS by using environment variables. These are separate from UNIX environment variables and are actually stored in a file, usually $HOME/.grassrc, where $HOME designates the user's default home directory. This technique is used by the LUCAS graphical user interface (GUI) to communicate with the simulation program.

GRASS is written in traditional Kernighan and Ritchie C (K&R C) [15] for portability, but LUCAS is written in C++, which required a few adjustments to be made to the programming interface. C++ is a strongly typed language and therefore all functions must be prototyped before they are used. K&R C, on the other hand, does not impose this requirement and consequently GRASS header files are devoid of type information. Therefore, before any GRASS routines could be used in LUCAS, they first had to be prototyped. This is another reason why the availability of GRASS's source code was so crucial.

GRASS also allows for hardware-independent graphical displays, called monitors, using MIT's X-windows, Sun's OpenWindows, Silicon Graphics' IRIS, Tektronix 4105, raster file or other formats. GRASS monitors are used to collect user input regarding which impacts should be examined and to graphically display resulting maps. The GRASS library routines allow for the complex displaying of spatially explicit data without additional laborious programming.


next up previous
Next: Functional Design of Up: Geographic Information System Previous: GRASS Structure



Michael W. Berry (berry@cs.utk.edu)
Wed Aug 16 10:48:40 EDT 1995