>>>>> Glynn Clements <[EMAIL PROTECTED]> writes:

[...]

 >>> build output already. Also, NULL/non-NULL pointers are
 >>> conventionally as much of a logic value as zero/non-zero integers.

 >> ... The thing I cannot get used in C...

 > What thing? That C doesn't have a distinct boolean type?

        That C allows a pointer anywhere an integer is allowed.

        I always read an `anytype *' variable as a ``reference to
        object'', or even simply ``object''.  It thus somewhat strange
        to read ``if reference, then...''

[...]

 >> The code doesn't ever fall back to `MASK' if `MASK_OVERRIDE' is
 >> defined.  If `MASK_OVERRIDE' doesn't point to a valid raster (e. g.,
 >> if it's an empty string), the mask is ignored.

 > Okay; I misread the part where it was saving the mapset.

 > AFAICT, it shouldn't be necessary to handle the mapset
 > explicitly. The lower level functions should all accept a qualified
 > name, i.e.:

 > G__open_cell_old("[EMAIL PROTECTED]", "")

 > So you should be able to simply test for existence with
 > G_find_cell2(), and store the (possibly qualified) name.

        I've tried to trace the calls made by the functions I've
        modified, but haven't found enough evidence that this usage
        pattern is allowed.  Could you please confirm that every
        function to be called with the `MASK_OVERRIDE's value in the
        modified code can be used this way?

 > Ideally, I'd like to remove the mapset argument from the core libgis
 > functions in 7.x. It will involve modifying almost every single
 > module, but it will make writing new modules and maintaining existing
 > modules simpler.

        I'm in favour of such a change.

 > The only code which really needs to split a qualified name is in low
 > level functions which actually open files, plus anything which
 > creates a derived name (i.e. [EMAIL PROTECTED] -> [EMAIL PROTECTED] not 
 > [EMAIL PROTECTED]).

        What are the functions to:

        * for any valid (possibly qualified) reference for an object
          (raster, vector, etc.) existing in one of the mapsets
          comprising the mapset search path, return a corresponding
          qualified object name;

        * like the above, but returning the name and the mapset
          separately?

        Since the code of both the functions I've modified looks
        painfully similar, may I ask for a function to return the
        (qualified?) name of the (existing?) mask?  Which file should I
        put it in?

        (There're some modules which could use this function as well.)

 >> However, I doubt if it's a reasonable behaviour.  It seems to be
 >> usual in the Unix world to ignore the environment variable's value
 >> if it's an empty string.  Using a non-existing raster (say, `.') is
 >> probably a better idea.

 > Good point. It's a nuisance for a shell script to distinguish between
 > a variable being unset and being set to the empty string. We should
 > really choose a specific "none" value rather than just silently
 > ignoring a reference to a non-existent map. If $MASK_OVERRIDE is set
 > but the map doesn't exist, it should at least produce a warning.

        For now I'm considering using any name starting with `.' to
        specify ``none''.  The documentation should probably state that
        `MASK_OVERRIDE=.' is the preferred way to off the mask.

        Unless there're other suggestions, I'd code it to check for
        `name[0] == '.'' and return early with a ``no mask found''
        condition.

_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to