[GRASS-dev] [GRASS-SVN] r72590 - grass/trunk/general/g.region

Hi,

2018-04-05 12:16 GMT+02:00 <svn_grass@osgeo.org>:

Author: jachym
Date: 2018-04-05 03:16:14 -0700 (Thu, 05 Apr 2018)
New Revision: 72590

Modified:
   grass/trunk/general/g.region/local_proto.h
   grass/trunk/general/g.region/main.c
Log:
Adding -L flag to g.region for getting list of regions

1) upper-case flags should not be used
2) this functionality is already available as `g.list type=region` if
I understand well
3) I would prefer to see ticket with related discussion before
committing change into trunk

Consider reverting this change. g.list functionality is not suitable
for your need?

Thanks for clarification, Martin

Modified: grass/trunk/general/g.region/local_proto.h

--- grass/trunk/general/g.region/local_proto.h 2018-04-03 10:43:37 UTC (rev 72589)
+++ grass/trunk/general/g.region/local_proto.h 2018-04-05 10:16:14 UTC (rev 72590)
@@ -12,6 +12,7 @@
#define PRINT_NANGLE 0x100
#define PRINT_GMT 0x200
#define PRINT_WMS 0x400
+#define PRINT_WF 0x800

/* zoom.c */
int zoom(struct Cell_head *, const char *, const char *);

Modified: grass/trunk/general/g.region/main.c

--- grass/trunk/general/g.region/main.c 2018-04-03 10:43:37 UTC (rev 72589)
+++ grass/trunk/general/g.region/main.c 2018-04-05 10:16:14 UTC (rev 72590)
@@ -13,6 +13,7 @@
  * Read the file COPYING that comes with GRASS for details.
  ****************************************************************************/

+#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
@@ -39,8 +40,11 @@
     const char *value;
     const char *name;
     const char *mapset;
+ char *windows_path = G_malloc(1024);
     char **rast_ptr, **vect_ptr;
     int pix;
+ DIR *d;
+ struct dirent *dir;

     struct GModule *module;
     struct
@@ -48,7 +52,7 @@
        struct Flag
            *update, *print, *gprint, *flprint, *lprint, *eprint, *nangle,
            *center, *res_set, *dist_res, *dflt, *z, *savedefault,
- *bbox, *gmt_style, *wms_style;
+ *bbox, *gmt_style, *wms_style, *list;
     } flag;
     struct
     {
@@ -165,6 +169,11 @@
     flag.update->description = _("Do not update the current region");
     flag.update->guisection = _("Effects");

+ flag.list = G_define_flag();
+ flag.list->key = 'L';
+ flag.list->description = _("List available regions");
+ flag.list->guisection = _("Print");
+
     /* parameters */

     parm.region = G_define_standard_option(G_OPT_M_REGION);
@@ -362,7 +371,7 @@
     G_option_required(flag.dflt, flag.savedefault, flag.print, flag.lprint,
                       flag.eprint, flag.center, flag.gmt_style, flag.wms_style,
                       flag.dist_res, flag.nangle, flag. z, flag.bbox, flag.gprint,
- flag.res_set, flag.update, parm.region, parm.raster,
+ flag.res_set, flag.update, flag.list, parm.region, parm.raster,
                       parm.raster3d, parm.vect, parm.north, parm.south, parm.east,
                       parm.west, parm.top, parm.bottom, parm.rows, parm.cols,
                       parm.res, parm.res3, parm.nsres, parm.ewres, parm.tbres,
@@ -850,6 +859,21 @@
     if (print_flag)
        print_window(&window, print_flag, flat_flag);

+ if (flag.list->answer) {
+ mapset = G_mapset_path();
+ sprintf(windows_path, "%s/%s", mapset, "windows");
+ d = opendir(windows_path);
+
+ if (d) {
+ while ((dir = readdir(d)) != NULL) {
+ if (dir->d_type == DT_REG) {
+ printf("%s\n", dir->d_name);
+ }
+ }
+ closedir(d);
+ }
+ }
+
     exit(EXIT_SUCCESS);
}

_______________________________________________
grass-commit mailing list
grass-commit@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-commit

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Hi,

sorry for too rush approach, you can certainly revert the commit

Jachym

čt 5. 4. 2018 v 13:01 odesílatel Martin Landa <landa.martin@gmail.com> napsal:

Hi,

2018-04-05 12:16 GMT+02:00 <svn_grass@osgeo.org>:

Author: jachym
Date: 2018-04-05 03:16:14 -0700 (Thu, 05 Apr 2018)
New Revision: 72590

Modified:
grass/trunk/general/g.region/local_proto.h
grass/trunk/general/g.region/main.c
Log:
Adding -L flag to g.region for getting list of regions

  1. upper-case flags should not be used
  2. this functionality is already available as g.list type=region if
    I understand well
  3. I would prefer to see ticket with related discussion before
    committing change into trunk

Consider reverting this change. g.list functionality is not suitable
for your need?

Thanks for clarification, Martin

Modified: grass/trunk/general/g.region/local_proto.h

— grass/trunk/general/g.region/local_proto.h 2018-04-03 10:43:37 UTC (rev 72589)
+++ grass/trunk/general/g.region/local_proto.h 2018-04-05 10:16:14 UTC (rev 72590)
@@ -12,6 +12,7 @@
#define PRINT_NANGLE 0x100
#define PRINT_GMT 0x200
#define PRINT_WMS 0x400
+#define PRINT_WF 0x800

/* zoom.c */
int zoom(struct Cell_head *, const char *, const char *);

Modified: grass/trunk/general/g.region/main.c

— grass/trunk/general/g.region/main.c 2018-04-03 10:43:37 UTC (rev 72589)
+++ grass/trunk/general/g.region/main.c 2018-04-05 10:16:14 UTC (rev 72590)
@@ -13,6 +13,7 @@

  • Read the file COPYING that comes with GRASS for details.
    ****************************************************************************/

+#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
@@ -39,8 +40,11 @@
const char *value;
const char *name;
const char *mapset;

  • char *windows_path = G_malloc(1024);
    char **rast_ptr, **vect_ptr;
    int pix;
  • DIR *d;
  • struct dirent *dir;

struct GModule *module;
struct
@@ -48,7 +52,7 @@
struct Flag
*update, *print, *gprint, *flprint, *lprint, *eprint, *nangle,
*center, *res_set, *dist_res, *dflt, *z, *savedefault,

  • *bbox, *gmt_style, *wms_style;
  • *bbox, *gmt_style, *wms_style, *list;
    } flag;
    struct
    {
    @@ -165,6 +169,11 @@
    flag.update->description = _(“Do not update the current region”);
    flag.update->guisection = _(“Effects”);

  • flag.list = G_define_flag();

  • flag.list->key = ‘L’;

  • flag.list->description = _(“List available regions”);

  • flag.list->guisection = _(“Print”);

/* parameters */

parm.region = G_define_standard_option(G_OPT_M_REGION);
@@ -362,7 +371,7 @@
G_option_required(flag.dflt, flag.savedefault, flag.print, flag.lprint,
flag.eprint, flag.center, flag.gmt_style, flag.wms_style,
flag.dist_res, flag.nangle, flag. z, flag.bbox, flag.gprint,

  • flag.res_set, flag.update, parm.region, parm.raster,
  • flag.res_set, flag.update, flag.list, parm.region, parm.raster,
    parm.raster3d, parm.vect, parm.north, parm.south, parm.east,
    parm.west, parm.top, parm.bottom, parm.rows, parm.cols,
    parm.res, parm.res3, parm.nsres, parm.ewres, parm.tbres,
    @@ -850,6 +859,21 @@
    if (print_flag)
    print_window(&window, print_flag, flat_flag);

  • if (flag.list->answer) {

  • mapset = G_mapset_path();

  • sprintf(windows_path, “%s/%s”, mapset, “windows”);

  • d = opendir(windows_path);

  • if (d) {

  • while ((dir = readdir(d)) != NULL) {

  • if (dir->d_type == DT_REG) {

  • printf(“%s\n”, dir->d_name);

  • }

  • }

  • closedir(d);

  • }

  • }

exit(EXIT_SUCCESS);
}


grass-commit mailing list
grass-commit@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-commit


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Thu, Apr 5, 2018 at 1:09 PM, Jachym Cepicky <jachym.cepicky@gmail.com> wrote:

Hi,

sorry for too rush approach, you can certainly revert the commit

I agree with Martin, the commit does not make sense, and you should revert the commit yourself.

Thanks,

Markus M

Jachym

čt 5. 4. 2018 v 13:01 odesílatel Martin Landa <landa.martin@gmail.com> napsal:

Hi,

2018-04-05 12:16 GMT+02:00 <svn_grass@osgeo.org>:

Author: jachym
Date: 2018-04-05 03:16:14 -0700 (Thu, 05 Apr 2018)
New Revision: 72590

Modified:
grass/trunk/general/g.region/local_proto.h
grass/trunk/general/g.region/main.c
Log:
Adding -L flag to g.region for getting list of regions

  1. upper-case flags should not be used
  2. this functionality is already available as g.list type=region if
    I understand well
  3. I would prefer to see ticket with related discussion before
    committing change into trunk

Consider reverting this change. g.list functionality is not suitable
for your need?

Thanks for clarification, Martin

Modified: grass/trunk/general/g.region/local_proto.h

— grass/trunk/general/g.region/local_proto.h 2018-04-03 10:43:37 UTC (rev 72589)
+++ grass/trunk/general/g.region/local_proto.h 2018-04-05 10:16:14 UTC (rev 72590)
@@ -12,6 +12,7 @@
#define PRINT_NANGLE 0x100
#define PRINT_GMT 0x200
#define PRINT_WMS 0x400
+#define PRINT_WF 0x800

/* zoom.c */
int zoom(struct Cell_head *, const char *, const char *);

Modified: grass/trunk/general/g.region/main.c

— grass/trunk/general/g.region/main.c 2018-04-03 10:43:37 UTC (rev 72589)
+++ grass/trunk/general/g.region/main.c 2018-04-05 10:16:14 UTC (rev 72590)
@@ -13,6 +13,7 @@

  • Read the file COPYING that comes with GRASS for details.
    ****************************************************************************/

+#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
@@ -39,8 +40,11 @@
const char *value;
const char *name;
const char *mapset;

  • char *windows_path = G_malloc(1024);
    char **rast_ptr, **vect_ptr;
    int pix;
  • DIR *d;
  • struct dirent *dir;

struct GModule *module;
struct
@@ -48,7 +52,7 @@
struct Flag
*update, *print, *gprint, *flprint, *lprint, *eprint, *nangle,
*center, *res_set, *dist_res, *dflt, *z, *savedefault,

  • *bbox, *gmt_style, *wms_style;
  • *bbox, *gmt_style, *wms_style, *list;
    } flag;
    struct
    {
    @@ -165,6 +169,11 @@
    flag.update->description = _(“Do not update the current region”);
    flag.update->guisection = _(“Effects”);

  • flag.list = G_define_flag();

  • flag.list->key = ‘L’;

  • flag.list->description = _(“List available regions”);

  • flag.list->guisection = _(“Print”);

/* parameters */

parm.region = G_define_standard_option(G_OPT_M_REGION);
@@ -362,7 +371,7 @@
G_option_required(flag.dflt, flag.savedefault, flag.print, flag.lprint,
flag.eprint, flag.center, flag.gmt_style, flag.wms_style,
flag.dist_res, flag.nangle, flag. z, flag.bbox, flag.gprint,

  • flag.res_set, flag.update, parm.region, parm.raster,
  • flag.res_set, flag.update, flag.list, parm.region, parm.raster,
    parm.raster3d, parm.vect, parm.north, parm.south, parm.east,
    parm.west, parm.top, parm.bottom, parm.rows, parm.cols,
    parm.res, parm.res3, parm.nsres, parm.ewres, parm.tbres,
    @@ -850,6 +859,21 @@
    if (print_flag)
    print_window(&window, print_flag, flat_flag);

  • if (flag.list->answer) {

  • mapset = G_mapset_path();

  • sprintf(windows_path, “%s/%s”, mapset, “windows”);

  • d = opendir(windows_path);

  • if (d) {

  • while ((dir = readdir(d)) != NULL) {

  • if (dir->d_type == DT_REG) {

  • printf(“%s\n”, dir->d_name);

  • }

  • }

  • closedir(d);

  • }

  • }

exit(EXIT_SUCCESS);
}


grass-commit mailing list
grass-commit@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-commit


Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa


grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Hi Jachym,

2018-04-05 22:57 GMT+02:00 Markus Metz <markus.metz.giswork@gmail.com>:

I agree with Martin, the commit does not make sense, and you should revert
the commit yourself.

agreed with MarkusM, could you revert it please. Thanks, Martin

committing change into trunk

Consider reverting this change. g.list functionality is not suitable
for your need?

Thanks for clarification, Martin

>
> Modified: grass/trunk/general/g.region/local_proto.h
> ===================================================================
> --- grass/trunk/general/g.region/local_proto.h 2018-04-03 10:43:37 UTC
> (rev 72589)
> +++ grass/trunk/general/g.region/local_proto.h 2018-04-05 10:16:14 UTC
> (rev 72590)
> @@ -12,6 +12,7 @@
> #define PRINT_NANGLE 0x100
> #define PRINT_GMT 0x200
> #define PRINT_WMS 0x400
> +#define PRINT_WF 0x800
>
> /* zoom.c */
> int zoom(struct Cell_head *, const char *, const char *);
>
> Modified: grass/trunk/general/g.region/main.c
> ===================================================================
> --- grass/trunk/general/g.region/main.c 2018-04-03 10:43:37 UTC (rev
> 72589)
> +++ grass/trunk/general/g.region/main.c 2018-04-05 10:16:14 UTC (rev
> 72590)
> @@ -13,6 +13,7 @@
> * Read the file COPYING that comes with GRASS for
> details.
>
> ****************************************************************************/
>
> +#include <dirent.h>
> #include <string.h>
> #include <stdlib.h>
> #include <math.h>
> @@ -39,8 +40,11 @@
> const char *value;
> const char *name;
> const char *mapset;
> + char *windows_path = G_malloc(1024);
> char **rast_ptr, **vect_ptr;
> int pix;
> + DIR *d;
> + struct dirent *dir;
>
> struct GModule *module;
> struct
> @@ -48,7 +52,7 @@
> struct Flag
> *update, *print, *gprint, *flprint, *lprint, *eprint,
> *nangle,
> *center, *res_set, *dist_res, *dflt, *z, *savedefault,
> - *bbox, *gmt_style, *wms_style;
> + *bbox, *gmt_style, *wms_style, *list;
> } flag;
> struct
> {
> @@ -165,6 +169,11 @@
> flag.update->description = _("Do not update the current region");
> flag.update->guisection = _("Effects");
>
> + flag.list = G_define_flag();
> + flag.list->key = 'L';
> + flag.list->description = _("List available regions");
> + flag.list->guisection = _("Print");
> +
> /* parameters */
>
> parm.region = G_define_standard_option(G_OPT_M_REGION);
> @@ -362,7 +371,7 @@
> G_option_required(flag.dflt, flag.savedefault, flag.print,
> flag.lprint,
> flag.eprint, flag.center, flag.gmt_style,
> flag.wms_style,
> flag.dist_res, flag.nangle, flag. z, flag.bbox,
> flag.gprint,
> - flag.res_set, flag.update, parm.region,
> parm.raster,
> + flag.res_set, flag.update, flag.list,
> parm.region, parm.raster,
> parm.raster3d, parm.vect, parm.north,
> parm.south, parm.east,
> parm.west, parm.top, parm.bottom, parm.rows,
> parm.cols,
> parm.res, parm.res3, parm.nsres, parm.ewres,
> parm.tbres,
> @@ -850,6 +859,21 @@
> if (print_flag)
> print_window(&window, print_flag, flat_flag);
>
> + if (flag.list->answer) {
> + mapset = G_mapset_path();
> + sprintf(windows_path, "%s/%s", mapset, "windows");
> + d = opendir(windows_path);
> +
> + if (d) {
> + while ((dir = readdir(d)) != NULL) {
> + if (dir->d_type == DT_REG) {
> + printf("%s\n", dir->d_name);
> + }
> + }
> + closedir(d);
> + }
> + }
> +
> exit(EXIT_SUCCESS);
> }
>
>
> _______________________________________________
> grass-commit mailing list
> grass-commit@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-commit

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

Jachym Cepicky wrote

Hi,

sorry for too rush approach, you can certainly revert the commit

the commit seems to break winGRASS compilation:

https://wingrass.fsv.cvut.cz/grass75/x86_64/logs/log-r72590-111/error.log
[...]
https://wingrass.fsv.cvut.cz/grass75/x86_64/logs/log-r72596-111/error.log

-----
best regards
Helmut
--
Sent from: http://osgeo-org.1560.x6.nabble.com/Grass-Dev-f3991897.html

Hi,

2018-04-08 11:34 GMT+02:00 Helmut Kudrnovsky <hellik@web.de>:

sorry for too rush approach, you can certainly revert the commit

the commit seems to break winGRASS compilation:

https://wingrass.fsv.cvut.cz/grass75/x86_64/logs/log-r72590-111/error.log
[...]
https://wingrass.fsv.cvut.cz/grass75/x86_64/logs/log-r72596-111/error.log

unfortunately Jachym is not responding, so I took liberty to revert it
(r72610). Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa