33     char str1[100], str2[100], 
buf[200], 
buf2[200], 
xname[GNAME_MAX],
 
   37         sprintf(buf, 
"%s/%s", G3D_DIRECTORY, xname);
 
   38         sprintf(buf2, 
"%s@%s", G3D_CATS_ELEMENT, xmapset);      
 
   41         sprintf(buf, 
"%s/%s", G3D_DIRECTORY, name);
 
   42         sprintf(buf2, 
"%s", G3D_CATS_ELEMENT);
 
   49     fprintf(fd, 
"# %ld categories\n", (
long)cats->num);
 
   52     fprintf(fd, 
"%s\n", cats->title != 
NULL ? cats->title : 
"");
 
   55     fprintf(fd, 
"%s\n", cats->fmt != 
NULL ? cats->fmt : 
"");
 
   56     fprintf(fd, 
"%.2f %.2f %.2f %.2f\n",
 
   57             cats->m1, cats->a1, cats->m2, cats->a2);
 
   62         if ((cats->fmt && cats->fmt[0]) || (descr && descr[0])) {
 
   66                 fprintf(fd, 
"%s:%s\n", str1, descr != 
NULL ? descr : 
"");
 
   73                 fprintf(fd, 
"%s:%s:%s\n", str1, str2,
 
   74                         descr != 
NULL ? descr : 
"");
 
   85 read_cats(
const char *
name, 
const char *mapset, 
struct Categories *pcats)
 
   96         sprintf(buff, 
"%s/%s", G3D_DIRECTORY, xname);
 
   97         sprintf(buf2, 
"%s@%s", G3D_CATS_ELEMENT, xmapset);      
 
  100         sprintf(buff, 
"%s/%s", G3D_DIRECTORY, name);
 
  101         sprintf(buf2, 
"%s", G3D_CATS_ELEMENT);
 
  108     if (
G_getl(buff, 
sizeof(buff), fd) == 0)
 
  111     if (sscanf(buff, 
"# %ld", &num) == 1)
 
  113     else if (sscanf(buff, 
"%ld", &num) == 1)
 
  117     if (
G_getl(buff, 
sizeof(buff), fd) == 0)
 
  127         float m1, a1, m2, a2;
 
  129         if (
G_getl(fmt, 
sizeof(fmt), fd) == 0)
 
  132         if (
G_getl(buff, 
sizeof(buff), fd) == 0)
 
  134         if (sscanf(buff, 
"%f %f %f %f", &m1, &a1, &m2, &a2) != 4)
 
  140     for (cat = 0;; cat++) {
 
  143         if (
G_getl(buff, 
sizeof(buff), fd) == 0)
 
  150             if (sscanf(buff, 
"%1s", label) != 1)
 
  157             if (sscanf(buff, 
"%lf:%lf:%[^\n]", &val1, &val2, label) == 3)
 
  159             else if (sscanf(buff, 
"%d:%[^\n]", &cat, label) >= 1)
 
  161             else if (sscanf(buff, 
"%lf:%[^\n]", &val1, label) >= 1)
 
  193 G3d_readCats(
const char *name, 
const char *mapset, 
struct Categories *pcats)
 
  198     switch (read_cats(name, mapset, pcats)) {
 
  209     G_warning(
"category support for [%s] in mapset [%s] %s",
 
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
 
int G_set_raster_cat(void *rast1, void *rast2, char *label, struct Categories *pcats, RASTER_MAP_TYPE data_type)
Adds the label for range rast1 through rast2 in category structure pcats. 
 
int G_set_raster_cats_fmt(const char *fmt, double m1, double a1, double m2, double a2, struct Categories *pcats)
Same as existing G_set_cats_fmt() 
 
int G_set_cat(CELL num, char *label, struct Categories *pcats)
set a category label 
 
int G_trim_decimal(char *buf)
Removes trailing zeros from decimal number. 
 
int G_init_raster_cats(const char *title, struct Categories *pcats)
Same as existing G_init_raster_cats() only ncats argument is missign. ncats has no meaning in new Cat...
 
int G_strip(char *buf)
Removes all leading and trailing white space from string. 
 
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
 
int G_quant_nof_rules(const struct Quant *q)
 
int G_getl(char *buf, int n, FILE *fd)
gets a line of text from a file 
 
FILE * G_fopen_new(const char *element, const char *name)
Open a new database file. 
 
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
 
char * G_get_ith_d_raster_cat(const struct Categories *pcats, int i, DCELL *rast1, DCELL *rast2)
Returns i-th description and i-th data range from the list of category descriptions with correspondin...
 
FILE * G_fopen_old(const char *element, const char *name, const char *mapset)
Open a database file for reading. 
 
int G3d_writeCats(const char *name, struct Categories *cats)
Writes the categories stored in the cats structure into the categories file for map name in the curre...
 
int G__name_is_fully_qualified(const char *fullname, char *name, char *mapset)
Check if map name is fully qualified (map @ mapset)