소스 검색

libgis: rename env-related G used in the modules to G_
G__env_name -> G_get_env_name
G__create_alt_env -> G_create_alt_env
G__switch_env -> G_switch_env
G__mapset_name -> G_get_mapset_name
G_get_list_of_mapsets -> G__get_list_of_mapsets
G_create_alt_search_path -> G_create_alt_search_path
G__switch_search_path -> G_switch_search_path
G_reset_mapsets -> G__reset_mapsets
G_available_mapsets -> G_get_available_mapsets
update modules
(merge https://trac.osgeo.org/grass/changeset/60508 from trunk)


git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@60603 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 11 년 전
부모
커밋
4527ac8ebf

+ 1 - 1
display/d.mon/list.c

@@ -18,7 +18,7 @@ void list_mon(char ***list, int *n)
     *list = NULL;
     *n    = 0;
     tokens = NULL;
-    for (i = 0; (name = G__env_name(i)); i++) {
+    for (i = 0; (name = G_get_env_name(i)); i++) {
 	if (strncmp(env_prefix, name, env_prefix_len) == 0) {
 	    tokens = G_tokenize(name, "_");
 	    if (G_number_of_tokens(tokens) != 3 ||

+ 1 - 1
display/d.mon/stop.c

@@ -79,7 +79,7 @@ void clean_env(const char *name)
     env_prefix_len = strlen(env_prefix);
     
     tokens = NULL;
-    for (i = 0; (env = G__env_name(i)); i++) {
+    for (i = 0; (env = G_get_env_name(i)); i++) {
 	if (strncmp(env_prefix, env, env_prefix_len) != 0)
 	    continue;
 	

+ 1 - 1
general/g.gisenv/main.c

@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
 	else
 	    quote = !isatty(fileno(stdout));
 	
-	for (n = 0; (name = G__env_name(n)); n++) {
+	for (n = 0; (name = G_get_env_name(n)); n++) {
 	    value = (char *)G__getenv(name);
 	    if (value) {
 		if (!quote)

+ 1 - 1
general/g.mapset/main.c

@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
 	G__setenv("LOCATION_NAME", location_new);
 	G__setenv("GISDBASE", gisdbase_new);
 
-	ms = G_available_mapsets();
+	ms = G_get_available_mapsets();
 
 	for (nmapsets = 0; ms[nmapsets]; nmapsets++) {
 	    if (G__mapset_permissions(ms[nmapsets]) > 0) {

+ 1 - 1
general/g.mapsets/get_maps.c

@@ -11,7 +11,7 @@ char** get_available_mapsets(int *nmapsets)
     char **ms, **mapset_name;
     int i, n;
 
-    ms = G_available_mapsets();
+    ms = G_get_available_mapsets();
     for (n = 0; ms[n]; n++);
 
     mapset_name = (char **)G_malloc(n * sizeof(char *));

+ 2 - 2
general/g.mapsets/list.c

@@ -33,10 +33,10 @@ void list_accessible_mapsets(const char* fs)
     const char *name;
     
     G_message(_("Accessible mapsets:"));
-    for (n = 0; (name = G__mapset_name(n)); n++) {
+    for (n = 0; (name = G_get_mapset_name(n)); n++) {
         /* match each mapset to its numeric equivalent */
         fprintf(stdout, "%s", name);
-        if (G__mapset_name(n+1)) {
+        if (G_get_mapset_name(n+1)) {
             if (strcmp(fs, "newline") == 0)
                 fprintf(stdout, "\n");
             else if (strcmp(fs, "space") == 0)

+ 2 - 2
general/g.mapsets/main.c

@@ -193,7 +193,7 @@ int main(int argc, char *argv[])
         }
 
         /* read existing mapsets from SEARCH_PATH */
-        for (n = 0; (oldname = G__mapset_name(n)); n++)
+        for (n = 0; (oldname = G_get_mapset_name(n)); n++)
             append_mapset(&path, oldname);
 
         /* fetch and add new mapsets from param list */
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
         }
         
         /* read existing mapsets from SEARCH_PATH */
-        for (n = 0; (oldname = G__mapset_name(n)); n++) {
+        for (n = 0; (oldname = G_get_mapset_name(n)); n++) {
             found = FALSE;
             
             for (ptr = opt.mapset->answers; *ptr && !found; ptr++)

+ 1 - 1
general/g.mlist/main.c

@@ -248,7 +248,7 @@ static void make_list(FILE *fp, const struct list *elem, const char *mapset,
 
     if (!mapset || !*mapset) {
 	int n;
-	for (n = 0; mapset = G__mapset_name(n), mapset; n++)
+	for (n = 0; mapset = G_get_mapset_name(n), mapset; n++)
 	    make_list(fp, elem, mapset, separator, add_type, add_mapset,
 		      n == 0);
 	return;

+ 1 - 1
imagery/i.find/main.c

@@ -111,7 +111,7 @@ static int find(FILE * fd, char *element)
     fwrite(&len1, sizeof(len1), 1L, fd);
     fwrite(&len2, sizeof(len2), 1L, fd);
 
-    for (n = 0; ((mapset = G__mapset_name(n)) != NULL); n++) {
+    for (n = 0; ((mapset = G_get_mapset_name(n)) != NULL); n++) {
 	int len;
 	char dir[1024];
 	struct dirent *dp;

+ 8 - 8
imagery/i.ortho.photo/i.ortho.elev/main.c

@@ -121,15 +121,15 @@ int main(int argc, char *argv[])
     }
 
 
-    G__create_alt_env();
+    G_create_alt_env();
     G__setenv("LOCATION_NAME", location);
 
     stat = G__mapset_permissions(mapset);
     if (stat > 0) {
 	G__setenv("MAPSET", mapset);
-	G__create_alt_search_path();
-	G__switch_env();
-	G__switch_search_path();
+	G_create_alt_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 0;
 
 	select_target_env();
@@ -181,8 +181,8 @@ int main(int argc, char *argv[])
 int select_current_env(void)
 {
     if (which_env != 0) {
-	G__switch_env();
-	G__switch_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 0;
     }
 
@@ -192,8 +192,8 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env != 1) {
-	G__switch_env();
-	G__switch_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 1;
     }
 

+ 4 - 4
imagery/i.ortho.photo/i.ortho.rectify/env.c

@@ -6,11 +6,11 @@ static int which_env = -1;	/* 0 = cur, 1 = target */
 int select_current_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 0;
     }
     if (which_env != 0) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 0;
     }
 
@@ -20,11 +20,11 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 1;
     }
     if (which_env != 1) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 1;
     }
 

+ 8 - 8
imagery/i.points/target.c

@@ -24,14 +24,14 @@ int get_target(void)
 	sprintf(buf, "Target location [%s] not found\n", location);
 	goto error;
     }
-    G__create_alt_env();
+    G_create_alt_env();
     G__setenv("LOCATION_NAME", location);
     stat = G__mapset_permissions(mapset);
     if (stat > 0) {
 	G__setenv("MAPSET", mapset);
-	G__create_alt_search_path();
-	G__switch_env();
-	G__switch_search_path();
+	G_create_alt_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 0;
 	return 1;
     }
@@ -46,8 +46,8 @@ int get_target(void)
 int select_current_env(void)
 {
     if (which_env != 0) {
-	G__switch_env();
-	G__switch_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 0;
     }
 
@@ -57,8 +57,8 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env != 1) {
-	G__switch_env();
-	G__switch_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 1;
     }
 

+ 4 - 4
imagery/i.rectify/env.c

@@ -5,11 +5,11 @@ static int which_env = -1;	/* 0 = cur, 1 = target */
 int select_current_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 0;
     }
     if (which_env != 0) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 0;
     }
 
@@ -19,11 +19,11 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 1;
     }
     if (which_env != 1) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 1;
     }
 

+ 6 - 6
imagery/i.vpoints/target.c

@@ -25,14 +25,14 @@ int get_target(void)
 	sprintf(buf, "Target location [%s] not found\n", location);
 	goto error;
     }
-    G__create_alt_env();
+    G_create_alt_env();
     G__setenv("LOCATION_NAME", location);
     stat = G__mapset_permissions(mapset);
     if (stat > 0) {
 	G__setenv("MAPSET", mapset);
-	G__create_alt_search_path();
-	G__switch_env();
-	G__switch_search_path();
+	G_create_alt_search_path();
+	G_switch_env();
+	G_switch_search_path();
 	which_env = 0;
 	return 1;
     }
@@ -49,7 +49,7 @@ int get_target(void)
 int select_current_env(void)
 {
     if (which_env != 0) {
-	G__switch_env();
+	G_switch_env();
 	G__switch_search_path();
 	which_env = 0;
     }
@@ -60,7 +60,7 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env != 1) {
-	G__switch_env();
+	G_switch_env();
 	G__switch_search_path();
 	which_env = 1;
     }

+ 9 - 9
include/defs/gis.h

@@ -209,12 +209,12 @@ void G__setenv2(const char *, const char *, int);
 void G_unsetenv(const char *);
 void G_unsetenv2(const char *, int);
 void G__write_env(void);
-const char *G__env_name(int);
+const char *G_get_env_name(int);
 void G__read_env(void);
 void G_set_gisrc_mode(int);
 int G_get_gisrc_mode(void);
-void G__create_alt_env(void);
-void G__switch_env(void);
+void G_create_alt_env(void);
+void G_switch_env(void);
 
 /* error.c */
 int G_info_format(void);
@@ -429,12 +429,12 @@ int G__mapset_permissions(const char *);
 int G__mapset_permissions2(const char *, const char *, const char *);
 
 /* mapset_nme.c */
-const char *G__mapset_name(int);
-void G_get_list_of_mapsets(void);
-void G__create_alt_search_path(void);
-void G__switch_search_path(void);
-void G_reset_mapsets(void);
-char **G_available_mapsets(void);
+const char *G_get_mapset_name(int);
+void G__get_list_of_mapsets(void);
+void G_create_alt_search_path(void);
+void G_switch_search_path(void);
+void G__reset_mapsets(void);
+char **G_get_available_mapsets(void);
 void G_add_mapset_to_search_path(const char *);
 int G_is_mapset_in_search_path(const char *);
 

+ 5 - 5
lib/gis/env.c

@@ -3,7 +3,7 @@
 
   \brief GIS library - environment routines
   
-  (C) 2001-2009, 2011 by the GRASS Development Team
+  (C) 2001-2014 by the GRASS Development Team
   
   This program is free software under the GNU General Public License
   (>=v2).  Read the file COPYING that comes with GRASS for details.
@@ -458,7 +458,7 @@ void G__write_env(void)
 
   \code
    for (n = 0; ; n++)
-      if ((name = G__env_name(n)) == NULL)
+      if ((name = G_get_env_name(n)) == NULL)
         break;
   \endcode
 
@@ -467,7 +467,7 @@ void G__write_env(void)
   \return pointer to variable name
   \return NULL not found
 */
-const char *G__env_name(int n)
+const char *G_get_env_name(int n)
 {
     int i;
 
@@ -490,7 +490,7 @@ void G__read_env(void)
 /*!
   \brief Set up alternative environment variables
 */
-void G__create_alt_env(void)
+void G_create_alt_env(void)
 {
     int i;
 
@@ -511,7 +511,7 @@ void G__create_alt_env(void)
 /*!
   \brief Switch environments
 */
-void G__switch_env(void)
+void G_switch_env(void)
 {
     struct env tmp;
 

+ 1 - 1
lib/gis/find_file.c

@@ -67,7 +67,7 @@ static const char *find_file(int misc, const char *dir,
 	int cnt = 0;
 	const char *pselmapset = NULL;
 
-	for (n = 0; (pmapset = G__mapset_name(n)); n++) {
+	for (n = 0; (pmapset = G_get_mapset_name(n)); n++) {
 	    if (misc)
 		G_file_name_misc(path, dir, element, pname, pmapset);
 	    else

+ 1 - 1
lib/gis/gisinit.c

@@ -134,7 +134,7 @@ void G_init_all(void)
     G_init_debug();
     G_verbose();
     G_init_tempfile();
-    G_get_list_of_mapsets();
+    G__get_list_of_mapsets();
     G__home();
     G__machine_name();
     G_whoami();

+ 1 - 1
lib/gis/list.c

@@ -73,7 +73,7 @@ void G_list_element(const char *element,
      * otherwise just list the specified mapset
      */
     if (mapset == 0 || *mapset == 0)
-	for (n = 0; (mapset = G__mapset_name(n)); n++)
+	for (n = 0; (mapset = G_get_mapset_name(n)); n++)
 	    count += list_element(more, element, desc, mapset, lister);
     else
 	count += list_element(more, element, desc, mapset, lister);

+ 2 - 2
lib/gis/make_mapset.c

@@ -71,7 +71,7 @@ int G_make_mapset(const char *gisdbase_name, const char *location_name,
         perror("G_make_mapset");
 	return -1;
     }
-    G__create_alt_env();
+    G_create_alt_env();
 
     /* Get PERMANENT default window */
     G__setenv("GISDBASE", gisdbase_name);
@@ -86,7 +86,7 @@ int G_make_mapset(const char *gisdbase_name, const char *location_name,
     G__put_window(&default_window, "", "WIND");
 
     /* And switch back to original environment */
-    G__switch_env();
+    G_switch_env();
 
     return 0;
 }

+ 16 - 13
lib/gis/mapset_nme.c

@@ -1,9 +1,9 @@
 /*!
-   \file mapset_nme.c
+   \file lib/gis/mapset_nme.c
 
    \brief GIS library - Mapset name, search path routines.
 
-   (C) 1999-2008 The GRASS development team
+   (C) 1999-2014 The GRASS development team
 
    This program is free software under the GNU General Public License
    (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -39,9 +39,9 @@ static void new_mapset(const char *);
    \return mapset name
    \return NULL if mapset not found
  */
-const char *G__mapset_name(int n)
+const char *G_get_mapset_name(int n)
 {
-    G_get_list_of_mapsets();
+    G__get_list_of_mapsets();
 
     if (n < 0 || n >= st->path.count)
 	return NULL;
@@ -49,7 +49,10 @@ const char *G__mapset_name(int n)
     return st->path.names[n];
 }
 
-void G_get_list_of_mapsets(void)
+/*!
+  \brief Fill list of mapsets from search path (internal use only)
+*/
+void G__get_list_of_mapsets(void)
 {
     FILE *fp;
     const char *cur;
@@ -82,7 +85,7 @@ void G_get_list_of_mapsets(void)
     }
 }
 
-static void new_mapset(const char *name)
+void new_mapset(const char *name)
 {
     if (st->path.count >= st->path.size) {
 	st->path.size += 10;
@@ -97,7 +100,7 @@ static void new_mapset(const char *name)
 
    \return 0
  */
-void G__create_alt_search_path(void)
+void G_create_alt_search_path(void)
 {
     st->path2.count = st->path.count;
     st->path2.names = st->path.names;
@@ -110,7 +113,7 @@ void G__create_alt_search_path(void)
 
    \return 0
  */
-void G__switch_search_path(void)
+void G_switch_search_path(void)
 {
     int count;
     char **names;
@@ -138,11 +141,11 @@ void G_reset_mapsets(void)
 /*!
    \brief Get list of available mapsets for current location
 
-   List is updated by each call to this function
+   List is updated by each call to this function.
 
-   \return pointer to zero terminated array of available mapsets.
+   \return pointer to zero terminated array of available mapsets
  */
-char **G_available_mapsets(void)
+char **G_get_available_mapsets(void)
 {
     char **mapsets = NULL;
     int alloc = 50;
@@ -186,12 +189,12 @@ char **G_available_mapsets(void)
 }
 
 /*!
-   \brief Add mapset to the list of mapsets in search path.
+   \brief Add mapset to the list of mapsets in search path
 
    Mapset is add in memory only, not to the SEARCH_PATH file!
    List is check first if already exists.
 
-   \param mapset mapset name
+   \param mapset mapset name to be added to the search path
  */
 void G_add_mapset_to_search_path(const char *mapset)
 {

+ 6 - 6
raster/r.in.gdal/main.c

@@ -612,7 +612,7 @@ int main(int argc, char *argv[])
 		char target_mapset[GMAPSET_MAX];
 		
 		/* does the target location exist? */
-		G__create_alt_env();
+		G_create_alt_env();
 		G__setenv("LOCATION_NAME", parm.target->answer);
 		sprintf(target_mapset, "PERMANENT");	/* must exist */
 
@@ -620,7 +620,7 @@ int main(int argc, char *argv[])
 		    /* create target location later */
 		    create_target = 1;
 		}
-		G__switch_env();
+		G_switch_env();
 	    }
 
 	    if (parm.target->answer && !create_target) {
@@ -693,14 +693,14 @@ int main(int argc, char *argv[])
 		    
 		    G_adjust_Cell_head(&gcpcellhd, 1, 1);
 
-		    G__create_alt_env();
+		    G_create_alt_env();
 		    if (0 != G_make_location(parm.target->answer, &gcpcellhd,
 					     proj_info, proj_units)) {
 			G_fatal_error(_("Unable to create new location <%s>"),
 				      parm.target->answer);
 		    }
 		    /* switch back to import location */
-		    G__switch_env();
+		    G_switch_env();
 
 		    G_message(_("Location <%s> created"), parm.target->answer);
 		    /* set the group's target */
@@ -785,7 +785,7 @@ static void SetupReprojector(const char *pszSrcWKT, const char *pszDstLoc,
     /* -------------------------------------------------------------------- */
 
     /* Change to user defined target location for GCPs transformation */
-    G__create_alt_env();
+    G_create_alt_env();
     G__setenv("LOCATION_NAME", (char *)pszDstLoc);
     sprintf(target_mapset, "PERMANENT");	/* to find PROJ_INFO */
 
@@ -810,7 +810,7 @@ static void SetupReprojector(const char *pszSrcWKT, const char *pszDstLoc,
     }				/* permission check */
 
     /* And switch back to original location */
-    G__switch_env();
+    G_switch_env();
 }
 
 

+ 1 - 1
raster/r.out.mpeg/main.c

@@ -386,7 +386,7 @@ static void mlist(const char *element, const char *wildarg, const char *outfile)
     int n;
     const char *mapset;
 
-    for (n = 0; (mapset = G__mapset_name(n)); n++) {
+    for (n = 0; (mapset = G_get_mapset_name(n)); n++) {
 	char type_arg[GNAME_MAX];
 	char pattern_arg[GNAME_MAX];
 	char mapset_arg[GMAPSET_MAX];

+ 4 - 4
raster/r.proj/main.c

@@ -275,7 +275,7 @@ int main(int argc, char **argv)
 	G_fatal_error(_("Unable to get projection key values of output raster map"));
 
     /* Change the location           */
-    G__create_alt_env();
+    G_create_alt_env();
     G__setenv("GISDBASE", indbase->answer ? indbase->answer : G_gisdbase());
     G__setenv("LOCATION_NAME", inlocation->answer);
 
@@ -413,7 +413,7 @@ int main(int argc, char **argv)
 
     /* And switch back to original location */
 
-    G__switch_env();
+    G_switch_env();
 
     /* Adjust borders of output map */
 
@@ -470,14 +470,14 @@ int main(int argc, char **argv)
     G_message(" ");
 
     /* open and read the relevant parts of the input map and close it */
-    G__switch_env();
+    G_switch_env();
     Rast_set_input_window(&incellhd);
     fdi = Rast_open_old(inmap->answer, setname);
     cell_type = Rast_get_map_type(fdi);
     ibuffer = readcell(fdi, memory->answer);
     Rast_close(fdi);
 
-    G__switch_env();
+    G_switch_env();
     Rast_set_output_window(&outcellhd);
 
     if (strcmp(interpol->answer, "nearest") == 0) {

+ 2 - 2
raster/r.proj/readcell.c

@@ -49,9 +49,9 @@ struct cache *readcell(int fdi, const char *size)
 
     if (nblocks < nx * ny) {
 	/* Temporary file must be created in output location */
-	G__switch_env();
+	G_switch_env();
 	c->fname = G_tempfile();
-	G__switch_env();
+	G_switch_env();
 	c->fd = open(c->fname, O_RDWR | O_CREAT | O_EXCL, 0600);
 	if (c->fd < 0)
 	    G_fatal_error(_("Unable to open temporary file"));

+ 2 - 2
vector/v.in.lidar/main.c

@@ -358,9 +358,9 @@ int main(int argc, char *argv[])
 
 	/*  TODO: */
 	G_warning("Import into new location not yet implemented");
-	/* at this point the module should be using G__create_alt_env()
+	/* at this point the module should be using G_create_alt_env()
 	    to change context to the newly created location; once done
-	    it should switch back with G__switch_env(). See r.in.gdal */
+	    it should switch back with G_switch_env(). See r.in.gdal */
     }
     else {
 	int err = 0;

+ 4 - 4
vector/v.proj/setenv.c

@@ -4,11 +4,11 @@ static int which_env = -1;	/* 0 = cur, 1 = target */
 int select_current_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 0;
     }
     if (which_env != 0) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 0;
     }
 
@@ -18,11 +18,11 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 1;
     }
     if (which_env != 1) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 1;
     }
 

+ 4 - 4
vector/v.rectify/env.c

@@ -8,11 +8,11 @@ static int which_env = -1;	/* 0 = cur, 1 = target */
 int select_current_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 0;
     }
     if (which_env != 0) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 0;
     }
 
@@ -22,11 +22,11 @@ int select_current_env(void)
 int select_target_env(void)
 {
     if (which_env < 0) {
-	G__create_alt_env();
+	G_create_alt_env();
 	which_env = 1;
     }
     if (which_env != 1) {
-	G__switch_env();
+	G_switch_env();
 	which_env = 1;
     }