[GRASS-dev] Re: fprintf in raster modules converted to G_message
Brad Douglas
rez at touchofmadness.com
Sun Dec 10 09:04:11 EST 2006
On Sat, 2006-12-09 at 17:11 +0200, Maris Nartiss wrote:
> Hi,
>
> last night I was cleaning up GRASS translation and found GRASS error
> messages very inconsistent.
> I.e. "Map not found" can be as "[%s] - map not found", "Map '%s' not
> found", "Map <%s> not found", "Map <%s@%s> not found" etc.
> It would be realy nice to set up some common error messages for usage
> in code like:
> G_err_rnf(map,mapset) -> "Raster map <%s@%s> was not found." etc. for
> most common error messages like "Raster not found", "Vector not
> found", "Could not write to raster" etc.
> It would make translators life more easy and improve usability - one
> type of error, one message in all places for that error.
I've thought about this, too, but have other priorities. :(
The best idea I can come up with is a sparse series of macros for the
most common messages:
#define MSG_RASTER_OPEN_FILE "Unable to find raster [%s]"
#define MSG_RASTER_OPEN_FILE_MAPSET "Unable to find raster <%s@%s>"
#define MSG_RASTER_WRITE_FILE "Unable to write to raster [%s]"
...
This is the madness to my method:
MSG -> to be used with messaging functions (G_warning()/G_fatal_error())
RASTER -> operating on
OPEN -> operation
WRITE -> another operation
FILE -> argument
MAPSET -> argument
Everything after the operation are arguments for "easy" recognition of
what to pass in.
Then use the message functions:
G_fatal_error (MSG_RASTER_OPEN_FILE, raster_map);
Okay, we now have a standard set of messages, but now locale macros need
to be dealt with. There's a few ways to deal with it, but none of them
seem trivial to me.
I can see this quickly becoming unwieldy, too. Others may have better
ideas.
> Just my 0.002 cents (equals 0.002 dollars by Verizon)
> Maris.
Apparently, 5th grade math isn't a requirement for management. ;-)
--
Brad Douglas <rez touchofmadness com> KB8UYR/6
Address: 37.493,-121.924 / WGS84 National Map Corps #TNMC-3785
More information about the grass-dev
mailing list