[GRASS-dev] lib fn to convert int color number to RGB values?
Moritz Lennert
mlennert at club.worldonline.be
Wed Jan 30 07:33:16 EST 2008
On 30/01/08 07:15, Ivan Shmakov wrote:
>>>>>> Glynn Clements <glynn at gclements.plus.com> writes:
>
> [...]
>
> >> Is a new D_number_to_RGB(int color, unsigned char &r,&g,&b) fn
> >> needed in lib/display/tran_colr.c?
>
> > Yes. E.g.:
>
> > int D_color_number_to_RGB(int color, int &r, int &g, int &b)
> > {
>
> That looks a lot like C++. Surely it will work with C89?
>
> > const struct color_rgb *c;
>
> > if (color <= 0)
> > return 0;
>
> BTW, is it a GRASS convention to use 0 to indicate failure?
> Standard C library functions tend to use -1 for failure, while
> using non-negative values to indicate success.
The SUBMITTING file in the source code says:
8. Exit status is defined as EXIT_SUCCESS or EXIT_FAILURE, e.g.
{
...
if (G_parser (argc, argv))
exit (EXIT_FAILURE);
...
exit (EXIT_SUCCESS);
}
AFAIU, these are defined in stlib as being respectively 0 and 1.
Moritz
More information about the grass-dev
mailing list