[GRASS-dev] [GRASS GIS] #2136: Create standard options for map or file base name (prefix)
GRASS GIS
trac at osgeo.org
Fri Jun 27 03:39:20 PDT 2014
#2136: Create standard options for map or file base name (prefix)
-----------------------------------------+----------------------------------
Reporter: wenzeslaus | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Parser | Version: svn-releasebranch64
Keywords: base name, prefix, basename | Platform: All
Cpu: All |
-----------------------------------------+----------------------------------
Comment(by zarch):
Replying to [comment:17 zarch]:
> Maybe we can define a GBASENAME_SEP variable in gis.h containing
> the default separator, and as suggested by hco, in the future
> add the possibility to set an environmental variable to customize
> the character or the sequence of characters that will be consider
> as basename separator.
OK, I wrote the following functions that you can be found
[https://github.com/zarch/grass_basename here]:
- G_get_numb_of_decimals, return the number of decimal in a string;
- G_double_to_str, return a formatted string substituting . with _ in
double number;
- G_get_basename_sep, return the basename separator using the default
or the one find in the GRASS_BASENAME_SEP variable;
- G_join_basename_strings, takes an array of strings and return a
joined string using the basename separator;
- G_get_format_name, takes a basename string and a double number and
return a formatted string;
I'm using ``malloc`` and ``free`` instead of ``G_malloc`` and ``G_free``
just to make it easier to test outside GRASS
Do you have any comments?
Should I create a directory in trunk/lib/basename containing
[https://github.com/zarch/grass_basename/blob/master/basename.c
basename.c] and put the
[https://github.com/zarch/grass_basename/blob/master/basename.h
basename.h] in trunk/include/defs?
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2136#comment:19>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list