53 error =
GBS_global_string(
"Can't set type of nonexistent changekey \"%s\"", field_name);
75 GB_export_errorf(
"Cannot create field '%s' (no type information available)", field_name);
78 gb_entry =
GB_search(gb_item, field_name, type);
104 else error =
GBS_global_string(
"Cannot add '%s' to your key list (illegal character '%c')", name, *c);
124 else if (*elem_type != type) error =
GBS_global_string(
"Key '%s' exists, but has different type", name);
169 unsigned long i = strtoul(data, &end, 10);
172 if (end == data || end[0] != 0) {
176 double d = strtod(data, &end);
177 if (end == data || end[0] != 0) {
182 i = d>0 ? (
int)(d+0.5) : (
int)(d-0.5);
188 char *trimmed_data =
GBS_trim(data);
203 float f = strtof(data, &end);
206 if (end == data || end[0] != 0) {
211 char *trimmed_data =
GBS_trim(data);
235 bool need_convert =
true;
241 if (source_type == target_type) need_convert =
false;
245 error =
"Please select field to convert";
253 if (!error && need_convert) {
269 gbfield =
GB_create(gbspec, name, target_type);
274 switch (target_type) {
289 error =
"Conversion is not possible";
300 if (error && gbspec) {
306 if (!error && rounded>0) {
307 GB_warningf(
"%zi values were rounded (loss of precision)", rounded);
static GB_ERROR write_int_converted(GBDATA *gbfield, const char *data, bool trimmed, size_t *rounded)
GB_ERROR GBT_add_alignment_changekeys(GBDATA *gb_main, const char *ali)
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
GBDATA * GBT_searchOrCreate_itemfield_according_to_changekey(GBDATA *gb_item, const char *field_name, const char *change_key_path)
GB_ERROR GB_end_transaction(GBDATA *gbd, GB_ERROR error)
char * ARB_strdup(const char *str)
char * GB_read_as_string(GBDATA *gbd)
const char * GBS_global_string(const char *templat,...)
GB_ERROR GBT_add_new_changekey_to_keypath(GBDATA *gb_main, const char *name, GB_TYPES type, const char *keypath)
GB_ERROR GBT_add_new_gene_changekey(GBDATA *gb_main, const char *name, GB_TYPES type)
GBDATA * GB_get_father(GBDATA *gbd)
GB_ERROR GB_push_transaction(GBDATA *gbd)
#define NO_FIELD_SELECTED
GB_ERROR GB_delete(GBDATA *&source)
GB_TYPES GBT_get_type_of_changekey(GBDATA *gb_main, const char *field_name, const char *change_key_path)
GB_ERROR GB_await_error()
NOT4PERL long * GBT_read_int(GBDATA *gb_container, const char *fieldpath)
GBDATA * GB_create_container(GBDATA *father, const char *key)
void GB_warningf(const char *templat,...)
GBDATA * GB_create(GBDATA *father, const char *key, GB_TYPES type)
const char * GB_first_non_key_char(const char *str)
GB_ERROR GBT_convert_changekey(GBDATA *gb_main, const char *name, GB_TYPES target_type)
GB_ERROR GBT_add_new_changekey(GBDATA *gb_main, const char *name, int type)
GB_ERROR GBT_add_new_experiment_changekey(GBDATA *gb_main, const char *name, GB_TYPES type)
char * GBS_trim(const char *str)
static void error(const char *msg)
GBDATA * GB_get_root(GBDATA *gbd)
GB_ERROR GB_write_float(GBDATA *gbd, float f)
#define CHANGE_KEY_PATH_GENES
GB_ERROR GBT_write_int_converted(GBDATA *gb_int_writable, const char *data, size_t *rounded)
GB_ERROR GB_write_int(GBDATA *gbd, long i)
GB_ERROR GB_export_errorf(const char *templat,...)
static GB_ERROR gbt_set_type_of_changekey(GBDATA *gb_main, const char *field_name, GB_TYPES type, const char *change_key_path)
GBDATA * GBT_get_changekey(GBDATA *gb_main, const char *key, const char *change_key_path)
GB_ERROR GBT_write_string(GBDATA *gb_container, const char *fieldpath, const char *content)
GBDATA * GBT_first_species(GBDATA *gb_main)
GB_ERROR GBT_add_new_species_changekey(GBDATA *gb_main, const char *name, GB_TYPES type)
#define CHANGE_KEY_PATH_EXPERIMENTS
GBDATA * GB_find_string(GBDATA *gbd, const char *key, const char *str, GB_CASE case_sens, GB_SEARCH_TYPE gbs)
GBDATA * GBT_next_species(GBDATA *gb_species)
static GB_ERROR write_float_converted(GBDATA *gbfield, const char *data, bool trimmed)
GB_ERROR GBT_write_int(GBDATA *gb_container, const char *fieldpath, long content)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
GB_CSTR GBT_get_name_or_description(GBDATA *gb_item)
GB_ERROR GBT_write_float_converted(GBDATA *gb_float_writable, const char *data)
GBDATA * GB_entry(GBDATA *father, const char *key)
char * GBS_global_string_copy(const char *templat,...)