[GRASS-dev] ps.map fprintf -> G_

Hi all,

trying to change fprintf to G_message/warning/fatal_error in ps.map
module I found one complication. There is a special mapping
instruction --- VERBOSE. I think this instruction should overwrite
GRASS_VERBOSE environment variable(??). There is also need to have a
special function G_set_verbose() which allows to set a given verbosity
level after first calling of G_verbose() fn. Please look at the patch
(especially at verbose.c.diff). Thanks a lot.

Best regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

ps_map_vq.diff.gz (8.05 KB)

Hi,
nice job, thanks for the patch, but when I'm thinking about it, ...

this patch makes ps.map set it's verbosity not by the --quiet
or --verbose flags, but also according to the input configuration file.

imho, the simplest solution should be, remove the VERBOSE keyword from
ps.map. It would not harm to anythink. I doubt, some people are parsing
output from ps.map in their scripts.

If so, G_set_verbose function is the best solution.

What do others think?

Jachym

On Tue, Dec 26, 2006 at 11:16:44AM +0100, Martin Landa wrote:

Hi all,

trying to change fprintf to G_message/warning/fatal_error in ps.map
module I found one complication. There is a special mapping
instruction --- VERBOSE. I think this instruction should overwrite
GRASS_VERBOSE environment variable(??). There is also need to have a
special function G_set_verbose() which allows to set a given verbosity
level after first calling of G_verbose() fn. Please look at the patch
(especially at verbose.c.diff). Thanks a lot.

Best regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

Hi Jachym,

2007/1/3, Jachym Cepicky <jachym.cepicky@centrum.cz>:

Hi,
nice job, thanks for the patch, but when I'm thinking about it, ...

this patch makes ps.map set it's verbosity not by the --quiet
or --verbose flags, but also according to the input configuration file.

Right, this patch allows to set verbosity level by the --q/v flag or
by verbose mapping instruction.

imho, the simplest solution should be, remove the VERBOSE keyword from
ps.map. It would not harm to anythink. I doubt, some people are parsing

Not sure, it would break backward compatibility. OK, maybe the verbose
instruction should be removed later, now just printing appropriate
warning about it. There is also question about priority: the --q/v
flag should overwrite the mapping instruction or not?

output from ps.map in their scripts.

If so, G_set_verbose function is the best solution.

What do others think?

...

Jachym

Thanks for the feedback Jachym.

On Tue, Dec 26, 2006 at 11:16:44AM +0100, Martin Landa wrote:
> Hi all,
>
> trying to change fprintf to G_message/warning/fatal_error in ps.map
> module I found one complication. There is a special mapping
> instruction --- VERBOSE. I think this instruction should overwrite
> GRASS_VERBOSE environment variable(??). There is also need to have a
> special function G_set_verbose() which allows to set a given verbosity
> level after first calling of G_verbose() fn. Please look at the patch
> (especially at verbose.c.diff). Thanks a lot.
>
> Best regards, Martin
>
> --
> Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFFm97SyKt0uAjU4I8RAh4lAKCMce8cDJEO5Yf8Wra2msvgzAAfDwCfRraX
tGACE41v2F2Yv2UKt6AXuEI=
=2I9W
-----END PGP SIGNATURE-----

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

Hi,

I have prepared a new version of the patch where verbose mapping
instruction is removed. It will cause "ERROR: verbose : illegal
request" when the verbose mapping instruction is used.

Not sure if we can just remove this instruction...

Regards, Martin

2007/1/4, Martin Landa <landa.martin@gmail.com>:

Hi Jachym,

2007/1/3, Jachym Cepicky <jachym.cepicky@centrum.cz>:
> Hi,
> nice job, thanks for the patch, but when I'm thinking about it, ...
>
> this patch makes ps.map set it's verbosity not by the --quiet
> or --verbose flags, but also according to the input configuration file.

Right, this patch allows to set verbosity level by the --q/v flag or
by verbose mapping instruction.

> imho, the simplest solution should be, remove the VERBOSE keyword from
> ps.map. It would not harm to anythink. I doubt, some people are parsing

Not sure, it would break backward compatibility. OK, maybe the verbose
instruction should be removed later, now just printing appropriate
warning about it. There is also question about priority: the --q/v
flag should overwrite the mapping instruction or not?

> output from ps.map in their scripts.
>
> If so, G_set_verbose function is the best solution.
>
> What do others think?

...

> Jachym

Thanks for the feedback Jachym.

>
> On Tue, Dec 26, 2006 at 11:16:44AM +0100, Martin Landa wrote:
> > Hi all,
> >
> > trying to change fprintf to G_message/warning/fatal_error in ps.map
> > module I found one complication. There is a special mapping
> > instruction --- VERBOSE. I think this instruction should overwrite
> > GRASS_VERBOSE environment variable(??). There is also need to have a
> > special function G_set_verbose() which allows to set a given verbosity
> > level after first calling of G_verbose() fn. Please look at the patch
> > (especially at verbose.c.diff). Thanks a lot.
> >
> > Best regards, Martin
> >
> > --
> > Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
>
> > _______________________________________________
> > grass-dev mailing list
> > grass-dev@grass.itc.it
> > http://grass.itc.it/mailman/listinfo/grass-dev
>
> --
> Jachym Cepicky
> e-mail: jachym.cepicky@centrum.cz
> URL: http://les-ejk.cz
> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
> -----------------------------------------
> OFFICE:
> Department of Geoinformation Technologies
> Zemedelska 3
> 613 00, Brno
> Czech Republick
> e-mail: xcepicky@node.mendelu.cz
> URL: http://mapserver.mendelu.cz
> Tel.: +420 545 134 514
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (GNU/Linux)
>
> iD8DBQFFm97SyKt0uAjU4I8RAh4lAKCMce8cDJEO5Yf8Wra2msvgzAAfDwCfRraX
> tGACE41v2F2Yv2UKt6AXuEI=
> =2I9W
> -----END PGP SIGNATURE-----
>

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

and the patch ... :wink:

2007/1/7, Martin Landa <landa.martin@gmail.com>:

Hi,

I have prepared a new version of the patch where verbose mapping
instruction is removed. It will cause "ERROR: verbose : illegal
request" when the verbose mapping instruction is used.

Not sure if we can just remove this instruction...

Regards, Martin

2007/1/4, Martin Landa <landa.martin@gmail.com>:
> Hi Jachym,
>
> 2007/1/3, Jachym Cepicky <jachym.cepicky@centrum.cz>:
> > Hi,
> > nice job, thanks for the patch, but when I'm thinking about it, ...
> >
> > this patch makes ps.map set it's verbosity not by the --quiet
> > or --verbose flags, but also according to the input configuration file.
>
> Right, this patch allows to set verbosity level by the --q/v flag or
> by verbose mapping instruction.
>
> > imho, the simplest solution should be, remove the VERBOSE keyword from
> > ps.map. It would not harm to anythink. I doubt, some people are parsing
>
> Not sure, it would break backward compatibility. OK, maybe the verbose
> instruction should be removed later, now just printing appropriate
> warning about it. There is also question about priority: the --q/v
> flag should overwrite the mapping instruction or not?
>
> > output from ps.map in their scripts.
> >
> > If so, G_set_verbose function is the best solution.
> >
> > What do others think?
>
> ...
>
> > Jachym
>
> Thanks for the feedback Jachym.
>
> >
> > On Tue, Dec 26, 2006 at 11:16:44AM +0100, Martin Landa wrote:
> > > Hi all,
> > >
> > > trying to change fprintf to G_message/warning/fatal_error in ps.map
> > > module I found one complication. There is a special mapping
> > > instruction --- VERBOSE. I think this instruction should overwrite
> > > GRASS_VERBOSE environment variable(??). There is also need to have a
> > > special function G_set_verbose() which allows to set a given verbosity
> > > level after first calling of G_verbose() fn. Please look at the patch
> > > (especially at verbose.c.diff). Thanks a lot.
> > >
> > > Best regards, Martin
> > >
> > > --
> > > Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
> >
> > > _______________________________________________
> > > grass-dev mailing list
> > > grass-dev@grass.itc.it
> > > http://grass.itc.it/mailman/listinfo/grass-dev
> >
> > --
> > Jachym Cepicky
> > e-mail: jachym.cepicky@centrum.cz
> > URL: http://les-ejk.cz
> > GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
> > -----------------------------------------
> > OFFICE:
> > Department of Geoinformation Technologies
> > Zemedelska 3
> > 613 00, Brno
> > Czech Republick
> > e-mail: xcepicky@node.mendelu.cz
> > URL: http://mapserver.mendelu.cz
> > Tel.: +420 545 134 514
> >
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.3 (GNU/Linux)
> >
> > iD8DBQFFm97SyKt0uAjU4I8RAh4lAKCMce8cDJEO5Yf8Wra2msvgzAAfDwCfRraX
> > tGACE41v2F2Yv2UKt6AXuEI=
> > =2I9W
> > -----END PGP SIGNATURE-----
> >
>
> --
> Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
>

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

(attachments)

ps_map-vq-2.diff.gz (8.02 KB)

hi,
On Sun, Jan 07, 2007 at 08:07:30AM +0100, Martin Landa wrote:

Hi,

I have prepared a new version of the patch where verbose mapping
instruction is removed. It will cause "ERROR: verbose : illegal
request" when the verbose mapping instruction is used.

On this place, I would vote for just a warning, so

+ /* Please, remove before GRASS 7 released */
  if (KEY("verbose"))
  {
- if (sscanf(data, "%d", &verbose) != 1) verbose = 2;
+ G_warning(_("verbose instruction was removed. Please use --verbose instead"));
      continue;
  }

Otherwise, tha patch looks good to me

Thank you

Jachym

Not sure if we can just remove this instruction...

Regards, Martin

2007/1/4, Martin Landa <landa.martin@gmail.com>:
>Hi Jachym,
>
>2007/1/3, Jachym Cepicky <jachym.cepicky@centrum.cz>:
>> Hi,
>> nice job, thanks for the patch, but when I'm thinking about it, ...
>>
>> this patch makes ps.map set it's verbosity not by the --quiet
>> or --verbose flags, but also according to the input configuration file.
>
>Right, this patch allows to set verbosity level by the --q/v flag or
>by verbose mapping instruction.
>
>> imho, the simplest solution should be, remove the VERBOSE keyword from
>> ps.map. It would not harm to anythink. I doubt, some people are parsing
>
>Not sure, it would break backward compatibility. OK, maybe the verbose
>instruction should be removed later, now just printing appropriate
>warning about it. There is also question about priority: the --q/v
>flag should overwrite the mapping instruction or not?
>
>> output from ps.map in their scripts.
>>
>> If so, G_set_verbose function is the best solution.
>>
>> What do others think?
>
>...
>
>> Jachym
>
>Thanks for the feedback Jachym.
>
>>
>> On Tue, Dec 26, 2006 at 11:16:44AM +0100, Martin Landa wrote:
>> > Hi all,
>> >
>> > trying to change fprintf to G_message/warning/fatal_error in ps.map
>> > module I found one complication. There is a special mapping
>> > instruction --- VERBOSE. I think this instruction should overwrite
>> > GRASS_VERBOSE environment variable(??). There is also need to have a
>> > special function G_set_verbose() which allows to set a given verbosity
>> > level after first calling of G_verbose() fn. Please look at the patch
>> > (especially at verbose.c.diff). Thanks a lot.
>> >
>> > Best regards, Martin
>> >
>> > --
>> > Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa
>*
>>
>>
>> > _______________________________________________
>> > grass-dev mailing list
>> > grass-dev@grass.itc.it
>> > http://grass.itc.it/mailman/listinfo/grass-dev
>>
>> --
>> Jachym Cepicky
>> e-mail: jachym.cepicky@centrum.cz
>> URL: http://les-ejk.cz
>> GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
>> -----------------------------------------
>> OFFICE:
>> Department of Geoinformation Technologies
>> Zemedelska 3
>> 613 00, Brno
>> Czech Republick
>> e-mail: xcepicky@node.mendelu.cz
>> URL: http://mapserver.mendelu.cz
>> Tel.: +420 545 134 514
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.3 (GNU/Linux)
>>
>> iD8DBQFFm97SyKt0uAjU4I8RAh4lAKCMce8cDJEO5Yf8Wra2msvgzAAfDwCfRraX
>> tGACE41v2F2Yv2UKt6AXuEI=
>> =2I9W
>> -----END PGP SIGNATURE-----
>>
>>
>>
>
>
>--
>Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *
>

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

Hi,

2007/1/7, Jachym Cepicky <jachym.cepicky@centrum.cz>:

On this place, I would vote for just a warning, so

+ /* Please, remove before GRASS 7 released */
  if (KEY("verbose"))
  {
- if (sscanf(data, "%d", &verbose) != 1) verbose = 2;
+ G_warning(_("verbose instruction was removed. Please use --verbose instead"));
      continue;
  }

Otherwise, tha patch looks good to me

done & committed to CVS.

Thanks, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

On 08/01/07 08:26, Martin Landa wrote:

Hi,

2007/1/7, Jachym Cepicky <jachym.cepicky@centrum.cz>:

On this place, I would vote for just a warning, so

+ /* Please, remove before GRASS 7 released */
  if (KEY("verbose"))
  {
- if (sscanf(data, "%d", &verbose) != 1) verbose = 2;
+ G_warning(_("verbose instruction was removed. Please use --verbose instead"));
      continue;
  }

Otherwise, tha patch looks good to me

done & committed to CVS.

Just in case you missed this (from bottom of http://grass.itc.it/pipermail/grass5/2007-January/028390.html):

Hamish wrote:

pps- ps.map verbose command IS used in the wild, so don't break scripts by
removing it altogether. Note it is multi-leveled, so it should keep at least 3
levels of verbosity triggered by --q,<>,--v, i.e. standard messages should use
G_message(), but very verbose messages should hide G_message() in if(verbose >=
G_max_verbose()) or whatever. I am in favour of separating mapping commands
from program control, and letting the parser deal with the latter.

Moritz

Hi,

2007/1/8, Moritz Lennert <mlennert@club.worldonline.be>:

Hamish wrote:
> pps- ps.map verbose command IS used in the wild, so don't break scripts by
> removing it altogether. Note it is multi-leveled, so it should keep at least 3
> levels of verbosity triggered by --q,<>,--v, i.e. standard messages should use
> G_message(), but very verbose messages should hide G_message() in if(verbose >=
> G_max_verbose()) or whatever. I am in favour of separating mapping commands
> from program control, and letting the parser deal with the latter.

I am not sure if I understand well. It is true that verbose mapping
instruction is multi-leveled (0|1|2). But in practice there was only
one condition: if (verbose > 1) fprintf ();. It would be good to
distinguish between standard and verbose messages as Hamish suggested.
I am not sure what messages are "standard" and "very verbose".

In the first patch verbose instruction overwrote the --v/q flags [1],
now verbose instruction was removed and added a warning about that. So
should I apply rather the first approach (including G_set_verbose) ?

Martin

[1] http://grass.itc.it/pipermail/grass-dev/2006-December/028272.html
--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *

On 08/01/07 15:50, Martin Landa wrote:

Hi,

2007/1/8, Moritz Lennert <mlennert@club.worldonline.be>:

Hamish wrote:
> pps- ps.map verbose command IS used in the wild, so don't break scripts by
> removing it altogether. Note it is multi-leveled, so it should keep at least 3
> levels of verbosity triggered by --q,<>,--v, i.e. standard messages should use
> G_message(), but very verbose messages should hide G_message() in if(verbose >=
> G_max_verbose()) or whatever. I am in favour of separating mapping commands
> from program control, and letting the parser deal with the latter.

I am not sure if I understand well. It is true that verbose mapping
instruction is multi-leveled (0|1|2). But in practice there was only
one condition: if (verbose > 1) fprintf ();. It would be good to
distinguish between standard and verbose messages as Hamish suggested.
I am not sure what messages are "standard" and "very verbose".

In the first patch verbose instruction overwrote the --v/q flags [1],
now verbose instruction was removed and added a warning about that. So
should I apply rather the first approach (including G_set_verbose) ?

I don't no about the different levels, but I think Hamish' main message was that you should not break existing scripts by removing the verbose command within ps.map.

Moritz

Hi,

2007/1/11, Moritz Lennert <mlennert@club.worldonline.be>:

[snip]

I don't no about the different levels, but I think Hamish' main message
was that you should not break existing scripts by removing the verbose
command within ps.map.

OK, now fixed in CVS. Verbose mapping instruction can overwrite the
GRASS_VERBOSE environment variable.

Regards, Martin

--
Martin Landa <landa.martin@gmail.com> * http://gama.fsv.cvut.cz/~landa *