25 static int cmp(
const void *pa, 
const void *pb);
    26 static int in_array(
int *cats, 
size_t ncats, 
int cat);
    51     p->
c = (
int *)
G_calloc(
sizeof(
char) * size + 1, 
sizeof(int));
    83                                 const char *cstring, 
int type, 
int value,
    89     G_debug(4, 
"Vect_set_varray_from_cat_string(): cstring = '%s'", cstring);
    96         G_warning(
_(
"%d errors in category string"), ret);
   130                               struct cat_list *clist, 
int type, 
int value,
   133     int i, n, centr, cat;
   138     G_debug(4, 
"Vect_set_varray_from_cat_list(): field = %d", field);
   142         G_warning(
_(
"Mixed area and other type requested for vector array"));
   148     if (type & GV_AREA) {       
   151         if (n > varray->
size) { 
   152             G_warning(
_(
"Not enough space in vector array"));
   156         for (i = 1; i <= n; i++) {
   166                 varray->
c[i] = value;
   174         if (n > varray->
size) { 
   175             G_warning(
_(
"Not enough space in vector array"));
   179         for (i = 1; i <= n; i++) {
   189                 varray->
c[i] = value;
   202 static int cmp(
const void *pa, 
const void *pb)
   215 static int in_array(
int *cats, 
size_t ncats, 
int cat)
   219     p = (
int *)bsearch((
void *)&
cat, cats, ncats, 
sizeof(int), cmp);
   252     int i, n, c, centr, *cats;
   260     G_debug(4, 
"Vect_set_varray_from_db(): field = %d where = '%s'", field,
   267         G_warning(
_(
"Mixed area and other type requested for vector array"));
   276         G_warning(
_(
"Database connection not defined for layer %d"), field);
   281     if (driver == 
NULL) {
   282         G_warning(
_(
"Unable to open database <%s> by driver <%s>"),
   292         G_warning(
_(
"Unable to select record from table <%s> (key %s, where %s)"),
   297     if (type & GV_AREA) {       
   303         if (n > varray->
size) { 
   304             G_warning(
_(
"Not enough space in vector array"));
   308         for (i = 1; i <= n; i++) {
   315             for (c = 0; c < Cats->
n_cats; c++) {
   316                 if (Cats->
field[c] == field &&
   317                     in_array(cats, ncats, Cats->
cat[c])) {
   318                     varray->
c[i] = value;
   335         if (n > varray->
size) { 
   336             G_warning(
_(
"Not enough space in vector array"));
   340         for (i = 1; i <= n; i++) {
   347             for (c = 0; c < Cats->
n_cats; c++) {
   348                 if (Cats->
field[c] == field &&
   349                     in_array(cats, ncats, Cats->
cat[c])) {
   350                     varray->
c[i] = value;
 
plus_t Vect_get_num_lines(const struct Map_info *)
Fetch number of features (points, lines, boundaries, centroids) in vector map. 
int Vect_get_area_centroid(const struct Map_info *, int)
Returns centroid id for given area. 
char * table
Name of DB table. 
void Vect_destroy_cat_list(struct cat_list *)
Frees allocated cat_list memory. 
void G_free(void *)
Free allocated memory. 
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection. 
int Vect_set_varray_from_cat_string(const struct Map_info *Map, int field, const char *cstring, int type, int value, struct varray *varray)
Set values in 'varray' to 'value' from category string. 
int db_close_database_shutdown_driver(dbDriver *)
Close driver/database connection. 
struct field_info * Vect_get_field(const struct Map_info *, int)
Get information about link to database (by layer number) 
struct cat_list * Vect_new_cat_list(void)
Allocate memory for cat_list structure. 
int n_ranges
Number of ranges. 
int Vect_str_to_cat_list(const char *, struct cat_list *)
Converts string of categories and cat ranges separated by commas to cat_list. 
Layer (old: field) information. 
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself. 
int field
Category layer (field) 
int n_cats
Number of categories attached to element. 
struct varray * Vect_new_varray(int size)
Create new struct varray and allocate space for given number of items. 
int * cat
Array of categories. 
const struct driver * driver
plus_t Vect_get_num_areas(const struct Map_info *)
Get number of areas in vector map. 
int Vect_set_varray_from_cat_list(const struct Map_info *Map, int field, struct cat_list *clist, int type, int value, struct varray *varray)
Set values in 'varray' to 'value' from category list. 
char * driver
Name of DB driver ('sqlite', 'dbf', ...) 
int Vect_cat_in_cat_list(int, const struct cat_list *)
Check if category number is in list. 
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure. 
void G_warning(const char *,...) __attribute__((format(printf
int * field
Array of layers (fields) 
int Vect_set_varray_from_db(const struct Map_info *Map, int field, const char *where, int type, int value, struct varray *varray)
Set values in 'varray' to 'value' from DB (where statement) 
int Vect_read_line(const struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required) 
int db_select_int(dbDriver *, const char *, const char *, const char *, int **)
Select array of ordered integers from table/column. 
int G_debug(int, const char *,...) __attribute__((format(printf
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field. 
char * key
Name of key column (usually 'cat')