7#define LIST struct Histogram_list
9static FILE *fopen_histogram_new(
const char *);
10static int cmp(
const void *,
const void *);
11static int cmp_count(
const void *,
const void *);
51 G_warning(
_(
"Histogram for [%s in %s] missing (run r.support)"),
name,
60 while (
fgets(buf,
sizeof buf, fd)) {
90 fp = fopen_histogram_new(
name);
114 fp = fopen_histogram_new(
name);
228 for (a = 1; a < n; a++)
238 for (a = 0,
b = 1;
b < n;
b++) {
253static int cmp(
const void *
aa,
const void *
bb)
292static int cmp_count(
const void *
aa,
const void *
bb)
296 if (a->count <
b->count)
299 if (a->count >
b->count)
311static FILE *fopen_histogram_new(
const char *
name)
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
int G_remove_misc(const char *, const char *, const char *)
Remove a database misc file.
const char * G_find_file2_misc(const char *, const char *, const char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)
FILE * G_fopen_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
FILE * G_fopen_new_misc(const char *, const char *, const char *)
open a new database misc file
int Rast_rewind_cell_stats(struct Cell_stats *)
Reset/rewind cell stats.
int Rast_next_cell_stat(CELL *, long *, struct Cell_stats *)
Retrieve sorted cell stats.
int Rast_get_histogram_num(const struct Histogram *histogram)
Sorts the histogram in ascending order by counts then category.
void Rast_write_histogram(const char *name, const struct Histogram *histogram)
Writes the histogram information.
int Rast_read_histogram(const char *name, const char *mapset, struct Histogram *histogram)
read the histogram information
void Rast_free_histogram(struct Histogram *histogram)
Frees memory allocated for the histogram.
int Rast_add_histogram(CELL cat, long count, struct Histogram *histogram)
adds count to the histogram value for cat
int Rast_sort_histogram(struct Histogram *histogram)
Sorts the histogram.
void Rast_extend_histogram(CELL cat, long count, struct Histogram *histogram)
Extends histogram struct to accommodate a new value.
void Rast_write_histogram_cs(const char *name, struct Cell_stats *statf)
Writes the histogram based on cell statistics to file.
long Rast_get_histogram_count(int n, const struct Histogram *histogram)
Returns count for the nth element in the histogram.
int Rast_sort_histogram_by_count(struct Histogram *histogram)
Sorts the histogram by counts.
void Rast_make_histogram_cs(struct Cell_stats *statf, struct Histogram *histogram)
Creates histogram based on cell statistics.
int Rast_set_histogram(CELL cat, long count, struct Histogram *histogram)
sets the histogram value for cat to count
CELL Rast_get_histogram_cat(int n, const struct Histogram *histogram)
Returns cat for the nth element in the histogram.
void Rast_zero_histogram(struct Histogram *histogram)
Zero out histogram struct.
void Rast_init_histogram(struct Histogram *histogram)
initializes the histogram structure
void Rast_remove_histogram(const char *name)
Removes the histogram.