2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-30 22:05:11 +00:00

sensors_feature_data and sensors_chip_feature are now the exact

same structure, so we can get rid of the former for simpler code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4830 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2007-09-23 11:59:51 +00:00
parent 60b50b6cb9
commit 08a686e3cc
6 changed files with 76 additions and 82 deletions

View File

@@ -89,7 +89,7 @@ sensors_for_all_config_chips(const sensors_chip_name *name,
/* Look up a resource in the intern chip list, and return a pointer to it. /* Look up a resource in the intern chip list, and return a pointer to it.
Do not modify the struct the return value points to! Returns NULL if Do not modify the struct the return value points to! Returns NULL if
not found.*/ not found.*/
const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip,
int feature) int feature)
{ {
int i; int i;
@@ -107,17 +107,17 @@ const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *c
/* Look up a resource in the intern chip list, and return a pointer to it. /* Look up a resource in the intern chip list, and return a pointer to it.
Do not modify the struct the return value points to! Returns NULL if Do not modify the struct the return value points to! Returns NULL if
not found.*/ not found.*/
static const sensors_chip_feature * static const sensors_feature_data *
sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature) sensors_lookup_feature_name(const sensors_chip_name *chip, const char *feature)
{ {
int i, j; int i, j;
const sensors_chip_feature *features; const sensors_feature_data *features;
for (i = 0; i < sensors_proc_chips_count; i++) for (i = 0; i < sensors_proc_chips_count; i++)
if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) { if (sensors_match_chip(&sensors_proc_chips[i].chip, chip)) {
features = sensors_proc_chips[i].feature; features = sensors_proc_chips[i].feature;
for (j = 0; j < sensors_proc_chips[i].feature_count; j++) for (j = 0; j < sensors_proc_chips[i].feature_count; j++)
if (!strcmp(features[j].data.name, feature)) if (!strcmp(features[j].name, feature))
return features + j; return features + j;
} }
return NULL; return NULL;
@@ -145,7 +145,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature)
{ {
char *label; char *label;
const sensors_chip *chip; const sensors_chip *chip;
const sensors_chip_feature *featureptr; const sensors_feature_data *featureptr;
char buf[128], path[PATH_MAX]; char buf[128], path[PATH_MAX];
FILE *f; FILE *f;
int i; int i;
@@ -157,14 +157,14 @@ char *sensors_get_label(const sensors_chip_name *name, int feature)
for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));)
for (i = 0; i < chip->labels_count; i++) for (i = 0; i < chip->labels_count; i++)
if (!strcmp(featureptr->data.name, chip->labels[i].name)) { if (!strcmp(featureptr->name, chip->labels[i].name)) {
label = strdup(chip->labels[i].value); label = strdup(chip->labels[i].value);
goto sensors_get_label_exit; goto sensors_get_label_exit;
} }
/* No user specified label, check for a _label sysfs file */ /* No user specified label, check for a _label sysfs file */
snprintf(path, PATH_MAX, "%s/%s_label", name->path, snprintf(path, PATH_MAX, "%s/%s_label", name->path,
featureptr->data.name); featureptr->name);
if ((f = fopen(path, "r"))) { if ((f = fopen(path, "r"))) {
i = fread(buf, 1, sizeof(buf) - 1, f); i = fread(buf, 1, sizeof(buf) - 1, f);
@@ -178,7 +178,7 @@ char *sensors_get_label(const sensors_chip_name *name, int feature)
} }
/* No label, return the feature name instead */ /* No label, return the feature name instead */
label = strdup(featureptr->data.name); label = strdup(featureptr->name);
sensors_get_label_exit: sensors_get_label_exit:
if (!label) if (!label)
@@ -191,21 +191,21 @@ sensors_get_label_exit:
1 if it should be ignored, 0 if not. This function takes 1 if it should be ignored, 0 if not. This function takes
mappings into account. */ mappings into account. */
static int sensors_get_ignored(const sensors_chip_name *name, static int sensors_get_ignored(const sensors_chip_name *name,
const sensors_chip_feature *feature) const sensors_feature_data *feature)
{ {
const sensors_chip *chip; const sensors_chip *chip;
const char *main_feature_name; const char *main_feature_name;
int i; int i;
if (feature->data.mapping == SENSORS_NO_MAPPING) if (feature->mapping == SENSORS_NO_MAPPING)
main_feature_name = NULL; main_feature_name = NULL;
else else
main_feature_name = sensors_lookup_feature_nr(name, main_feature_name = sensors_lookup_feature_nr(name,
feature->data.mapping)->data.name; feature->mapping)->name;
for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));) for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));)
for (i = 0; i < chip->ignores_count; i++) for (i = 0; i < chip->ignores_count; i++)
if (!strcmp(feature->data.name, chip->ignores[i].name) || if (!strcmp(feature->name, chip->ignores[i].name) ||
(main_feature_name && (main_feature_name &&
!strcmp(main_feature_name, chip->ignores[i].name))) !strcmp(main_feature_name, chip->ignores[i].name)))
return 1; return 1;
@@ -218,8 +218,8 @@ static int sensors_get_ignored(const sensors_chip_name *name,
int sensors_get_value(const sensors_chip_name *name, int feature, int sensors_get_value(const sensors_chip_name *name, int feature,
double *result) double *result)
{ {
const sensors_chip_feature *main_feature; const sensors_feature_data *main_feature;
const sensors_chip_feature *alt_feature; const sensors_feature_data *alt_feature;
const sensors_chip *chip; const sensors_chip *chip;
const sensors_expr *expr = NULL; const sensors_expr *expr = NULL;
double val; double val;
@@ -231,21 +231,21 @@ int sensors_get_value(const sensors_chip_name *name, int feature,
if (!(main_feature = sensors_lookup_feature_nr(name, feature))) if (!(main_feature = sensors_lookup_feature_nr(name, feature)))
return -SENSORS_ERR_NO_ENTRY; return -SENSORS_ERR_NO_ENTRY;
if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING) if (main_feature->flags & SENSORS_COMPUTE_MAPPING)
alt_feature = sensors_lookup_feature_nr(name, alt_feature = sensors_lookup_feature_nr(name,
main_feature->data.mapping); main_feature->mapping);
else else
alt_feature = NULL; alt_feature = NULL;
if (!(main_feature->data.flags & SENSORS_MODE_R)) if (!(main_feature->flags & SENSORS_MODE_R))
return -SENSORS_ERR_ACCESS_R; return -SENSORS_ERR_ACCESS_R;
for (chip = NULL; for (chip = NULL;
!expr && (chip = sensors_for_all_config_chips(name, chip));) !expr && (chip = sensors_for_all_config_chips(name, chip));)
for (i = 0; !final_expr && (i < chip->computes_count); i++) { for (i = 0; !final_expr && (i < chip->computes_count); i++) {
if (!strcmp(main_feature->data.name, chip->computes[i].name)) { if (!strcmp(main_feature->name, chip->computes[i].name)) {
expr = chip->computes[i].from_proc; expr = chip->computes[i].from_proc;
final_expr = 1; final_expr = 1;
} else if (alt_feature && !strcmp(alt_feature->data.name, } else if (alt_feature && !strcmp(alt_feature->name,
chip->computes[i].name)) { chip->computes[i].name)) {
expr = chip->computes[i].from_proc; expr = chip->computes[i].from_proc;
} }
@@ -265,8 +265,8 @@ int sensors_get_value(const sensors_chip_name *name, int feature,
int sensors_set_value(const sensors_chip_name *name, int feature, int sensors_set_value(const sensors_chip_name *name, int feature,
double value) double value)
{ {
const sensors_chip_feature *main_feature; const sensors_feature_data *main_feature;
const sensors_chip_feature *alt_feature; const sensors_feature_data *alt_feature;
const sensors_chip *chip; const sensors_chip *chip;
const sensors_expr *expr = NULL; const sensors_expr *expr = NULL;
int i, res; int i, res;
@@ -278,21 +278,21 @@ int sensors_set_value(const sensors_chip_name *name, int feature,
if (!(main_feature = sensors_lookup_feature_nr(name, feature))) if (!(main_feature = sensors_lookup_feature_nr(name, feature)))
return -SENSORS_ERR_NO_ENTRY; return -SENSORS_ERR_NO_ENTRY;
if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING) if (main_feature->flags & SENSORS_COMPUTE_MAPPING)
alt_feature = sensors_lookup_feature_nr(name, alt_feature = sensors_lookup_feature_nr(name,
main_feature->data.mapping); main_feature->mapping);
else else
alt_feature = NULL; alt_feature = NULL;
if (!(main_feature->data.flags & SENSORS_MODE_W)) if (!(main_feature->flags & SENSORS_MODE_W))
return -SENSORS_ERR_ACCESS_W; return -SENSORS_ERR_ACCESS_W;
for (chip = NULL; for (chip = NULL;
!expr && (chip = sensors_for_all_config_chips(name, chip));) !expr && (chip = sensors_for_all_config_chips(name, chip));)
for (i = 0; !final_expr && (i < chip->computes_count); i++) for (i = 0; !final_expr && (i < chip->computes_count); i++)
if (!strcmp(main_feature->data.name, chip->computes[i].name)) { if (!strcmp(main_feature->name, chip->computes[i].name)) {
expr = chip->computes->to_proc; expr = chip->computes->to_proc;
final_expr = 1; final_expr = 1;
} else if (alt_feature && !strcmp(alt_feature->data.name, } else if (alt_feature && !strcmp(alt_feature->name,
chip->computes[i].name)) { chip->computes[i].name)) {
expr = chip->computes[i].to_proc; expr = chip->computes[i].to_proc;
} }
@@ -347,7 +347,7 @@ const char *sensors_get_adapter_name(const sensors_bus_id *bus)
const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *name, const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *name,
int *nr) int *nr)
{ {
sensors_chip_feature *feature_list; sensors_feature_data *feature_list;
int i; int i;
for (i = 0; i < sensors_proc_chips_count; i++) for (i = 0; i < sensors_proc_chips_count; i++)
@@ -358,7 +358,7 @@ const sensors_feature_data *sensors_get_all_features(const sensors_chip_name *na
(*nr)++; (*nr)++;
if (*nr == sensors_proc_chips[i].feature_count) if (*nr == sensors_proc_chips[i].feature_count)
return NULL; return NULL;
return &feature_list[(*nr)++].data; return &feature_list[(*nr)++];
} }
return NULL; return NULL;
} }
@@ -370,7 +370,7 @@ int sensors_eval_expr(const sensors_chip_name *name,
{ {
double res1, res2; double res1, res2;
int res; int res;
const sensors_chip_feature *feature; const sensors_feature_data *feature;
if (expr->kind == sensors_kind_val) { if (expr->kind == sensors_kind_val) {
*result = expr->data.val; *result = expr->data.val;
@@ -384,7 +384,7 @@ int sensors_eval_expr(const sensors_chip_name *name,
if (!(feature = sensors_lookup_feature_name(name, if (!(feature = sensors_lookup_feature_name(name,
expr->data.var))) expr->data.var)))
return SENSORS_ERR_NO_ENTRY; return SENSORS_ERR_NO_ENTRY;
if (!(res = sensors_get_value(name, feature->data.number, result))) if (!(res = sensors_get_value(name, feature->number, result)))
return res; return res;
return 0; return 0;
} }
@@ -432,7 +432,7 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name)
double value; double value;
int i, j; int i, j;
int err = 0, res; int err = 0, res;
const sensors_chip_feature *feature; const sensors_feature_data *feature;
int *feature_list = NULL; int *feature_list = NULL;
int feature_count = 0; int feature_count = 0;
int feature_max = 0; int feature_max = 0;
@@ -448,7 +448,7 @@ static int sensors_do_this_chip_sets(const sensors_chip_name *name)
err = SENSORS_ERR_NO_ENTRY; err = SENSORS_ERR_NO_ENTRY;
continue; continue;
} }
feature_nr = feature->data.number; feature_nr = feature->number;
/* Check whether we already set this feature */ /* Check whether we already set this feature */
for (j = 0; j < feature_count; j++) for (j = 0; j < feature_count; j++)

View File

@@ -26,7 +26,7 @@
/* Look up a resource in the intern chip list, and return a pointer to it. /* Look up a resource in the intern chip list, and return a pointer to it.
Do not modify the struct the return value points to! Returns NULL if Do not modify the struct the return value points to! Returns NULL if
not found. */ not found. */
const sensors_chip_feature *sensors_lookup_feature_nr(const sensors_chip_name *chip, const sensors_feature_data *sensors_lookup_feature_nr(const sensors_chip_name *chip,
int feature); int feature);
/* Check whether the chip name is an 'absolute' name, which can only match /* Check whether the chip name is an 'absolute' name, which can only match

View File

@@ -120,26 +120,10 @@ typedef struct sensors_bus {
int lineno; int lineno;
} sensors_bus; } sensors_bus;
/* Internal data about a single chip feature.
name is the string name used to refer to this feature (both in config
files and through user functions);
number is the internal feature number, used in many functions to refer
to this feature
mapping is either SENSORS_NO_MAPPING if this is feature is the
main element of category; or it is the number of a feature with which
this feature is logically grouped (a group could be fan, fan_max and
fan_div)
flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable),
SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the
computation rules of the main feature). */
typedef struct sensors_chip_feature {
sensors_feature_data data;
} sensors_chip_feature;
/* Internal data about all features of a type of chip */ /* Internal data about all features of a type of chip */
typedef struct sensors_chip_features { typedef struct sensors_chip_features {
struct sensors_chip_name chip; struct sensors_chip_name chip;
struct sensors_chip_feature *feature; struct sensors_feature_data *feature;
int feature_count; int feature_count;
} sensors_chip_features; } sensors_chip_features;

View File

@@ -57,7 +57,7 @@ static void free_chip_features(sensors_chip_features *features)
int i; int i;
for (i = 0; i < features->feature_count; i++) for (i = 0; i < features->feature_count; i++)
free(features->feature[i].data.name); free(features->feature[i].name);
free(features->feature); free(features->feature);
} }

View File

@@ -163,8 +163,18 @@ typedef enum sensors_feature_type {
SENSORS_FEATURE_UNKNOWN = INT_MAX, SENSORS_FEATURE_UNKNOWN = INT_MAX,
} sensors_feature_type; } sensors_feature_type;
/* This structure is used when you want to get all features of a specific /* Data about a single chip feature:
chip. */ name is the string name used to refer to this feature (in config files)
number is the internal feature number, used in many functions to refer
to this feature
type is the feature or subfeature type
mapping is either SENSORS_NO_MAPPING if this is feature is the
main element of category; or it is the number of a feature with which
this subfeature is logically grouped (a group could be fan, fan_min
and fan_div)
flags is a bitfield, its value is a combination of SENSORS_MODE_R (readable),
SENSORS_MODE_W (writable) and SENSORS_COMPUTE_MAPPING (affected by the
computation rules of the main feature) */
typedef struct sensors_feature_data { typedef struct sensors_feature_data {
char *name; char *name;
int number; int number;

View File

@@ -161,8 +161,8 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
int i, type, fnum = 0; int i, type, fnum = 0;
struct sysfs_attribute *attr; struct sysfs_attribute *attr;
struct dlist *attrs; struct dlist *attrs;
sensors_chip_feature *features; sensors_feature_data *features;
sensors_chip_feature *dyn_features; sensors_feature_data *dyn_features;
attrs = sysfs_get_device_attributes(sysdir); attrs = sysfs_get_device_attributes(sysdir);
@@ -172,7 +172,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
/* We use a large sparse table at first to store all found features, /* We use a large sparse table at first to store all found features,
so that we can store them sorted at type and index and then later so that we can store them sorted at type and index and then later
create a dense sorted table. */ create a dense sorted table. */
features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_chip_feature)); features = calloc(ALL_POSSIBLE_FEATURES, sizeof(sensors_feature_data));
if (!features) if (!features)
sensors_fatal_error(__FUNCTION__, "Out of memory"); sensors_fatal_error(__FUNCTION__, "Out of memory");
@@ -217,7 +217,7 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
(type & 0x0F); (type & 0x0F);
} }
if (features[i].data.name) { if (features[i].name) {
fprintf(stderr, "libsensors error, trying to add dupli" fprintf(stderr, "libsensors error, trying to add dupli"
"cate feature: %s to dynamic feature table\n", "cate feature: %s to dynamic feature table\n",
name); name);
@@ -225,29 +225,29 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
} }
/* fill in the feature members */ /* fill in the feature members */
features[i].data.type = type; features[i].type = type;
/* check for _input extension and remove */ /* check for _input extension and remove */
nr = strlen(name); nr = strlen(name);
if (nr > 6 && !strcmp(name + nr - 6, "_input")) if (nr > 6 && !strcmp(name + nr - 6, "_input"))
features[i].data.name = strndup(name, nr - 6); features[i].name = strndup(name, nr - 6);
else else
features[i].data.name = strdup(name); features[i].name = strdup(name);
if ((type & 0x00FF) == 0) { if ((type & 0x00FF) == 0) {
/* main feature */ /* main feature */
features[i].data.mapping = SENSORS_NO_MAPPING; features[i].mapping = SENSORS_NO_MAPPING;
} else { } else {
/* sub feature */ /* sub feature */
/* The mapping is set below after numbering */ /* The mapping is set below after numbering */
if (!(type & 0x10)) if (!(type & 0x10))
features[i].data.flags |= SENSORS_COMPUTE_MAPPING; features[i].flags |= SENSORS_COMPUTE_MAPPING;
} }
if (attr->method & SYSFS_METHOD_SHOW) if (attr->method & SYSFS_METHOD_SHOW)
features[i].data.flags |= SENSORS_MODE_R; features[i].flags |= SENSORS_MODE_R;
if (attr->method & SYSFS_METHOD_STORE) if (attr->method & SYSFS_METHOD_STORE)
features[i].data.flags |= SENSORS_MODE_W; features[i].flags |= SENSORS_MODE_W;
fnum++; fnum++;
} }
@@ -257,14 +257,14 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
goto exit_free; goto exit_free;
} }
dyn_features = calloc(fnum, sizeof(sensors_chip_feature)); dyn_features = calloc(fnum, sizeof(sensors_feature_data));
if (dyn_features == NULL) { if (dyn_features == NULL) {
sensors_fatal_error(__FUNCTION__, "Out of memory"); sensors_fatal_error(__FUNCTION__, "Out of memory");
} }
fnum = 0; fnum = 0;
for (i = 0; i < ALL_POSSIBLE_FEATURES; i++) { for (i = 0; i < ALL_POSSIBLE_FEATURES; i++) {
if (features[i].data.name) { if (features[i].name) {
dyn_features[fnum] = features[i]; dyn_features[fnum] = features[i];
fnum++; fnum++;
} }
@@ -275,14 +275,14 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
for (i = 0; i < fnum; i++) { for (i = 0; i < fnum; i++) {
int j; int j;
dyn_features[i].data.number = i; dyn_features[i].number = i;
if (dyn_features[i].data.mapping == SENSORS_NO_MAPPING) { if (dyn_features[i].mapping == SENSORS_NO_MAPPING) {
/* Main feature, set the mapping field of all its /* Main feature, set the mapping field of all its
subfeatures */ subfeatures */
for (j = i + 1; j < fnum && for (j = i + 1; j < fnum &&
dyn_features[j].data.mapping != SENSORS_NO_MAPPING; dyn_features[j].mapping != SENSORS_NO_MAPPING;
j++) j++)
dyn_features[j].data.mapping = i; dyn_features[j].mapping = i;
} }
} }
@@ -513,7 +513,7 @@ exit0:
int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature, int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature,
double *value) double *value)
{ {
const sensors_chip_feature *the_feature; const sensors_feature_data *the_feature;
char n[NAME_MAX]; char n[NAME_MAX];
FILE *f; FILE *f;
const char *suffix = ""; const char *suffix = "";
@@ -522,19 +522,19 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature,
return -SENSORS_ERR_NO_ENTRY; return -SENSORS_ERR_NO_ENTRY;
/* REVISIT: this is a ugly hack */ /* REVISIT: this is a ugly hack */
if (the_feature->data.type == SENSORS_FEATURE_IN if (the_feature->type == SENSORS_FEATURE_IN
|| the_feature->data.type == SENSORS_FEATURE_FAN || the_feature->type == SENSORS_FEATURE_FAN
|| the_feature->data.type == SENSORS_FEATURE_TEMP) || the_feature->type == SENSORS_FEATURE_TEMP)
suffix = "_input"; suffix = "_input";
snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->name,
suffix); suffix);
if ((f = fopen(n, "r"))) { if ((f = fopen(n, "r"))) {
int res = fscanf(f, "%lf", value); int res = fscanf(f, "%lf", value);
fclose(f); fclose(f);
if (res != 1) if (res != 1)
return -SENSORS_ERR_PROC; return -SENSORS_ERR_PROC;
*value /= get_type_scaling(the_feature->data.type); *value /= get_type_scaling(the_feature->type);
} else } else
return -SENSORS_ERR_PROC; return -SENSORS_ERR_PROC;
@@ -544,7 +544,7 @@ int sensors_read_sysfs_attr(const sensors_chip_name *name, int feature,
int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature, int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature,
double value) double value)
{ {
const sensors_chip_feature *the_feature; const sensors_feature_data *the_feature;
char n[NAME_MAX]; char n[NAME_MAX];
FILE *f; FILE *f;
const char *suffix = ""; const char *suffix = "";
@@ -553,15 +553,15 @@ int sensors_write_sysfs_attr(const sensors_chip_name *name, int feature,
return -SENSORS_ERR_NO_ENTRY; return -SENSORS_ERR_NO_ENTRY;
/* REVISIT: this is a ugly hack */ /* REVISIT: this is a ugly hack */
if (the_feature->data.type == SENSORS_FEATURE_IN if (the_feature->type == SENSORS_FEATURE_IN
|| the_feature->data.type == SENSORS_FEATURE_FAN || the_feature->type == SENSORS_FEATURE_FAN
|| the_feature->data.type == SENSORS_FEATURE_TEMP) || the_feature->type == SENSORS_FEATURE_TEMP)
suffix = "_input"; suffix = "_input";
snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->data.name, snprintf(n, NAME_MAX, "%s/%s%s", name->path, the_feature->name,
suffix); suffix);
if ((f = fopen(n, "w"))) { if ((f = fopen(n, "w"))) {
value *= get_type_scaling(the_feature->data.type); value *= get_type_scaling(the_feature->type);
fprintf(f, "%d", (int) value); fprintf(f, "%d", (int) value);
fclose(f); fclose(f);
} else } else