[GRASSLIST:5757] Re: r.mapcalc...compiling confusion

Glynn Clements glynn.clements at virgin.net
Fri Mar 7 22:32:04 EST 2003


Matt Doggett wrote:

> So, my question is, why would the component r.mapcalc be compiled
> differently and behave differently depending on whether I do a "global"
> make vs. a component-only gmake5???  It doesn't make sense that the
> component method would yield different results.

Because the r.mapcalc program which is actually installed is generated
from the code in src/raster/r.mapcalc3 (which is a complete re-write),
not the code in src/raster/r.mapcalc.

I suppose that you could simulate the old behaviour with a script:

	#!/bin/sh
	while ( echo -n 'mapcalc> ' ; read line ) ; do
		echo -n "$line" | r.mapcalc
	done

Arguably the interactive mode should be re-written to behave like the
old r.mapcalc. When I wrote r.mapcalc3, I wasn't aware of that
particular behaviour.

As it stands, the interactive behaviour (when stdin is a tty) is only
slightly different to the non-interactive behaviour (when stdin is a
file). Specifically, when stdin is a tty, a prompt is displayed, and
(optionally) readline is used; other than that, there is no
difference.

The non-interactive behaviour is intentional; evaluating all
expressions concurrently is more efficient than evaluating them
sequentially, as each input map only has to be read once.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-user mailing list