41 using namespace QUERY;
43 #define MAX_QUERY_LIST_LEN 100000
45 #define AWAR_COLORIZE "tmp/dbquery_all/colorize"
48 free(reinterpret_cast<char*>(info));
59 if (hitInfoLen == 0) hitInfoLen = strlen(hitInfo);
61 char *dupInfo = strdup(hitInfo);
64 strcpy(dupInfo+hitInfoLen-5,
"[...]");
66 info = strdup(dupInfo);
70 info = strdup(hitInfo);
87 return reinterpret_cast<const char*
>(
info);
96 string reason =
string(
"kept because ")+currentHitReason;
97 const char *hitinfo =
getHitInfo(gb_item, query);
98 if (hitinfo) reason =
string(hitinfo)+
" ("+reason+
')';
121 : selector(selector_),
124 expect_hit_in_ref_list(
false),
135 result_pos_fig(
NULp),
137 do_query_pos_fig(
NULp),
138 config_pos_fig(
NULp),
139 do_mark_pos_fig(
NULp),
140 do_unmark_pos_fig(
NULp),
141 do_delete_pos_fig(
NULp),
142 do_set_pos_fig(
NULp),
143 open_parser_pos_fig(
NULp),
144 do_refresh_pos_fig(
NULp),
145 popup_info_window(
NULp),
146 info_box_pos_fig(
NULp)
212 dbq_assert(order[o] == (order[o]&QUERY_SORT_CRITERIA_MASK));
240 order[n++] = order[o];
261 (old_criteria != new_criteria ||
279 int empty_or_same = 0;
286 unsigned long new_sort_mask = 0;
287 for (
int o = MAX_CRITERIA-(empty_or_same>0 ? 1 : 2); o >= 0; o--) {
305 first_key(strdup(fk))
319 double double1 = strtod(str1, const_cast<char**>(&end1));
320 double double2 = strtod(str2, const_cast<char**>(&end2));
322 bool conv1 = !end1[0] && str1[0];
323 bool conv2 = !end2[0] && str2[0];
325 bool both_converted = conv1 && conv2;
328 if (both_converted) {
332 bool conv_partial1 = end1>str1;
333 bool conv_partial2 = end2>str2;
335 if (conv_partial1 && conv_partial2) {
341 else cmp = strcmp(str1, str2);
346 static int compare_hits(
const void *cl_item1,
const void *cl_item2,
void *cl_param) {
357 for (
int o = 0; o<MAX_CRITERIA && cmp == 0; o++) {
379 long L1 = have1 ? *have1 : 0;
381 long L2 = have2 ? *have2 : 0;
390 float f1 = have1 ? *have1 : 0;
392 float f2 = have2 ? *have2 : 0;
403 cmp = (field1 && field2)
432 cmp = strcmp(id1, id2);
460 int *len = (
int*)cl_len;
461 int klen = strlen(key);
463 if (klen>*len) *len = klen;
466 #if defined(ASSERTION_USED)
477 bool is_pseudo = key[0] ==
'[';
495 GBDATA **sorted = ARB_alloc<GBDATA*>(count);
507 if (
IS_QUERIED(gb_item, query)) sorted[s++] = gb_item;
517 bool show_value = !is_pseudo;
533 if (name_len == -1) {
561 if (!info) info =
"<no hit info>";
576 if (count>MAX_QUERY_LIST_LEN) {
607 else if ((mark&8) == 0) {
654 !error && gb_item_container;
686 if (!queried_only ||
IS_QUERIED(gb_species, query)) {
690 if (keyas && strlen(keyas)) {
693 for (t = strtok(keyas,
" "); t; t = strtok(
NULp,
" ")) {
718 gb_item = gb_next_item;
734 typedef std::stack<GBDATA*> ParentStack;
737 mutable ParentStack parent;
752 QueryKey(detect_key_type(field_name)),
753 key(strdup(field_name)),
776 gb_key = get_first_field(target_item.
get_item());
807 if (!parent.empty()) {
810 const char *rslash = strrchr(parent_path,
'/');
811 for (
int nest = parent.size()-1; rslash && nest; --nest) {
812 rslash = strrchr(rslash-1,
'/');
822 bool accept_or_iterate()
const {
826 if (ktype ==
GB_DB) {
841 return accept_or_iterate();
848 if (!parent.empty()) {
849 gb_key = parent.top();
860 return accept_or_iterate();
865 parent = ParentStack();
892 if (strcmp(awarvalue,
"and") == 0)
return AND;
893 if (strcmp(awarvalue,
"or") == 0)
return OR;
918 if (!first_qe) first_qe = qe;
919 else first_qe->
append(qe);
940 if (strlen(first_query) == 0) {
957 error =
"Please select an explicit field or specify a search string (for first expression)";
970 printf(
"query: search identical %s in field %s%s\n",
977 gb_item_container && !
error;
993 GBDATA *gb_key = query_key.get_first_field(gb_item);
997 if (data && data[0]) {
999 bool this_hit =
false;
1002 for (
char *t = strtok(data,
" "); t; t = strtok(
NULp,
" ")) {
1025 this_hit = !this_hit;
1026 if (this_hit) hit_reason =
"<no matching entry>";
1031 SET_QUERIED(gb_item, query, hit_reason.c_str(), hit_reason.length());
1049 fputs(
"query: !(", stdout); qexpr->dump();
1056 fputs(
") => query: ", stdout); qexpr->dump();
fputc(
'\n', stdout);
1060 else {
fputs(
"query: ", stdout); qexpr->dump();
fputc(
'\n', stdout); }
1066 gb_item_container && !
error;
1085 hit_reason =
"<marked>";
1090 target_item.
aimTo(gb_item);
1091 hit = qexpr->
matches(target_item, hit_reason);
1101 SET_QUERIED(gb_item, query, hit_reason.c_str(), hit_reason.length());
1115 if (error) progress.
done();
1119 if (!error) error = qexpr->
getError();
1140 error =
"Query mode 'that are marked' does not apply here.\nEither select 'that match the query' or 'that don't match the q.'";
1144 AW_advice(
"'Move to hitlist' now depends on the values selected for\n"
1145 " * 'Search/Add/Keep species' and\n"
1146 " * 'that match/don't match the query'\n"
1147 "in the search tool.",
1150 "next_neighbours.hlp");
1157 gb_species && !error;
1168 if (displayed) seenInDB++;
1171 string hit_reason =
GBS_global_string(hit_description, displayed ? displayed :
"<no near neighbour>");
1174 SET_QUERIED(gb_species, query, hit_reason.c_str(), hit_reason.length());
1181 if (seenInDB < inHitlist) {
1196 if (strlen(key) == 0) {
1197 error =
"Please select a key (in the first query expression)";
1200 error =
"You have to select an explicit key (in the first query expression)";
1211 switch (selector.
type) {
1239 error =
"No items exist";
1242 error =
"'that are marked' is not applicable here";
1264 for (s=strtok(data,
",; \t.");
s; s = strtok(
NULp,
",; \t.")) {
1267 const char *oldInfo =
NULp;
1271 const char *prevInfo =
getHitInfo(gb_old, query);
1273 oldInfo = firstInfo;
1275 else if (!strstr(prevInfo, firstInfo)) {
1280 oldInfo = firstInfo;
1321 SET_QUERIED(gb_item, query, tokenize ?
"<entry with unique words>" :
"<unique entry>");
1331 AW_advice(
"'Find equal entries' now depends on the values selected for\n"
1332 " * 'that match/don't match the query'\n"
1333 "in the search tool.",
1336 "search_duplicates.hlp");
1364 if (!strlen(command)) error =
"Please enter a command";
1373 if (!use_tag || !strlen(tag)) {
1384 !error && gb_item_container;
1399 char *parsed =
NULp;
1417 if (strcmp(parsed, str) != 0) {
1418 if (gb_new && parsed[0] == 0) {
1423 gb_new =
GB_search(gb_item, key, key_type);
1428 if (!error && safe_conversion) {
1435 if (strcmp(resulting, parsed) != 0) {
1437 "resulted in '%s'\n"
1438 "(mark checkbox to accept conversion errors)",
1452 char *errCopy = strdup(error);
1470 if (error) progress.
done();
1482 char *brk = strchr(str,
'#');
1486 if (!strcmp(str,
"ali_*/data")) {
1498 if (kv != str) free(kv);
1514 bool changed =
false;
1517 !error && gb_item_container;
1526 if (!error) changed =
true;
1544 !error && gb_item_container;
1584 if (my_color == color_group) {
1588 case UNMARK: marked = 0;
break;
1589 case MARK: marked = 1;
break;
1590 case INVERT: marked = !marked;
break;
1614 #define AWAR_COLOR_LOADSAVE_NAME "tmp/colorset/name"
1630 for (
size_t i = 0; i<foundSets.
size(); ++i) {
1631 sel->
insert(foundSets[i], foundSets[i]);
1661 colordefs.put(color_def);
1667 if (colordefs.empty()) {
1675 bool changed =
false;
1678 !error && gb_item_container;
1686 if (!error) changed =
true;
1699 error = ta.
close(error);
1707 bool changed =
false;
1711 for (
size_t d = 0; d<colordefs.
size() && !
error; ++d) {
1712 const char *def = colordefs[d];
1713 const char *equal = strchr(def,
'=');
1718 const char *
id = def;
1725 int color_group = atoi(equal+1);
1726 if (color_group>0) {
1728 if (!error) changed =
true;
1738 if (ignores>0 && !error) {
1757 if (name[0] == 0) error =
"Please enter a name for the colorset.";
1786 if (!error && colordefs.
empty()) error =
"oops.. empty colorset";
1797 error = ta.
close(error);
1816 if (!aw_loadsave[type]) {
1818 AW_window_simple *aws =
new AW_window_simple;
1825 aws->load_xfig(
"query/color_loadsave.fig");
1829 aws->create_button(
"CLOSE",
"CLOSE",
"C");
1833 aws->create_button(
"HELP",
"HELP",
"H");
1847 aws->create_button(
"reset",
"Reset",
"R");
1856 aw_loadsave[
type] = aws;
1859 return aw_loadsave[
type];
1866 enum { COLORIZE_INVALID, COLORIZE_LISTED, COLORIZE_MARKED } mode = COLORIZE_INVALID;
1870 AW_window_simple *aws =
new AW_window_simple;
1876 mode = COLORIZE_LISTED;
1880 mode = COLORIZE_MARKED;
1885 const char *what = mode == COLORIZE_LISTED ?
"listed" :
"marked";
1891 aws->init(aw_root, macro_name, window_name);
1897 aws->load_xfig(
"query/colorize.fig");
1899 aws->auto_space(10, 10);
1903 aws->create_button(
"CLOSE",
"CLOSE",
"C");
1906 aws->callback(
makeHelpCallback(mode == COLORIZE_LISTED ?
"set_color_of_listed.hlp" :
"colorize.hlp"));
1907 aws->create_button(
"HELP",
"HELP",
"H");
1909 aws->at(
"colorize");
1913 if (mode == COLORIZE_LISTED) aws->callback(makeWindowCallback(
colorize_queried_cb, query));
1922 aws->insert_default_option(
"No color group",
"none", 0);
1923 for (color_group = 1; color_group <=
AW_COLOR_GROUPS; ++color_group) {
1925 aws->insert_option(name,
"", color_group);
1928 aws->update_option_menu();
1935 aws->at(
"loadsave");
1937 aws->create_autosize_button(
"LOADSAVE_COLORED",
"Load/Save",
"L");
1939 if (mode == COLORIZE_MARKED) {
1972 cdef.
add(typeawar,
"type");
1983 AW_window_simple *aws =
new AW_window_simple;
1989 aws->init(aw_root, macro_name, window_name);
1995 aws->load_xfig(
"query/modify_fields.fig");
1999 aws->create_button(
"CLOSE",
"CLOSE",
"C");
2003 aws->create_button(
"HELP",
"HELP",
"H");
2005 aws->at(
"helptags");
2007 aws->create_button(
"HELP_TAGS",
"Help tags",
"H");
2014 aws->at(
"usetag"); aws->create_toggle (query->
awar_use_tag);
2015 aws->at(
"deftag"); aws->create_input_field(query->
awar_deftag);
2016 aws->at(
"tag"); aws->create_input_field(query->
awar_tag);
2026 aws->create_button(
"GO",
"GO",
"G");
2031 const char *sellst =
NULp;
2046 error =
"No default selection list for query-type";
2072 if (value[0] == 0) freenull(value);
2074 size_t value_len = value ? strlen(value) : 0;
2082 !error && gb_item_container;
2093 if (gb_field) error =
GB_delete(gb_field);
2101 const char *new_content = value;
2102 SmartCharPtr content;
2106 if (!old) error =
"field has incompatible type";
2108 size_t old_len = strlen(old);
2111 buf.
ncat(old, old_len);
2112 buf.
ncat(value, value_len);
2115 new_content = &*content;
2121 if (!allow_loss && !error) {
2125 if (strcmp(new_content, result) != 0) {
2126 error =
GBS_global_string(
"value modified by type conversion\n('%s' -> '%s')", new_content, result);
2147 AW_window_simple *aws =
new AW_window_simple;
2149 aws->load_xfig(
"query/write_fields.fig");
2153 aws->create_button(
"CLOSE",
"CLOSE",
"C");
2157 aws->create_button(
"HELP",
"HELP",
"H");
2165 aws->label(
"Allow lossy conversion?");
2170 aws->create_button(
"SET_SINGLE_FIELD_OF_LISTED",
"WRITE");
2174 aws->create_button(
"APPEND_SINGLE_FIELD_OF_LISTED",
"APPEND");
2186 aw_message(
"Please select a field for which you want to set the protection");
2203 !error && gb_item_container;
2227 AW_window_simple *aws =
new AW_window_simple;
2229 aws->load_xfig(
"query/set_protection.fig");
2233 aws->create_button(
"CLOSE",
"CLOSE",
"C");
2237 aws->create_button(
"HELP",
"HELP",
"H");
2242 aws->insert_toggle(
"0 temporary",
"0", 0);
2243 aws->insert_toggle(
"1 checked",
"1", 1);
2244 aws->insert_toggle(
"2",
"2", 2);
2245 aws->insert_toggle(
"3",
"3", 3);
2246 aws->insert_toggle(
"4 normal",
"4", 4);
2247 aws->insert_toggle(
"5 ",
"5", 5);
2248 aws->insert_toggle(
"6 the truth",
"5", 6);
2249 aws->update_toggle_field();
2255 aws->create_autosize_button(
"SET_PROTECTION_OF_FIELD_OF_LISTED",
"Assign\nprotection\nto field\nof listed");
2286 template<
typename CB>
2294 if (!awar_tree_name)
2345 if (queryKeeper.
isNull()) {
2349 queryKeeper->
keep(q);
2384 sprintf(buffer,
"tmp/dbquery_%s/key_%i", query_id, key_id);
2385 query->
awar_keys[key_id] = strdup(buffer);
2389 sprintf(buffer,
"tmp/dbquery_%s/query_%i", query_id, key_id);
2393 sprintf(buffer,
"tmp/dbquery_%s/not_%i", query_id, key_id);
2394 query->
awar_not[key_id] = strdup(buffer);
2397 sprintf(buffer,
"tmp/dbquery_%s/operator_%i", query_id, key_id);
2404 sprintf(buffer,
"tmp/dbquery_%s/ere", query_id);
2408 sprintf(buffer,
"tmp/dbquery_%s/where", query_id);
2412 sprintf(buffer,
"tmp/dbquery_%s/count", query_id);
2416 sprintf(buffer,
"tmp/dbquery_%s/sort", query_id);
2421 sprintf(buffer,
"tmp/dbquery_%s/by", query_id);
2422 query->
awar_by = strdup(buffer);
2455 #define KEY_Y_OFFSET 32
2457 int xpos_calc[3] = { -1, -1, -1 };
2479 if (xpos_calc[0] == -1) aws->
get_at_position(&xpos_calc[0], &ypos_dummy);
2487 if (xpos_calc[1] == -1) aws->
get_at_position(&xpos_calc[1], &ypos_dummy);
2489 aws->
at(xpos_calc[1], ypos+key*KEY_Y_OFFSET);
2490 aws->create_toggle(query->
awar_not[key],
"#equal.xpm",
"#notEqual.xpm");
2492 if (xpos_calc[2] == -1) aws->
get_at_position(&xpos_calc[2], &ypos_dummy);
2534 aws->
label(
"Hits:");
2586 aws->
create_button(
"MARK_LISTED_UNMARK_REST",
"Mark Listed\nUnmark Rest",
"M");
2592 aws->
create_button(
"UNMARK_LISTED_MARK_REST",
"Unmark Listed\nMark Rest",
"U");
2613 aws->
create_button(macro_id,
"Write to Fields\nof Listed",
"S");
2618 Items[0] = toupper(Items[0]);
2632 sprintf(buffer,
"Modify Fields of Listed %s", Items);
query_rel_menu_entry(aws,
"mod_fields_of_listed", query_id, buffer,
"F",
"mod_field_list.hlp",
AWM_ALL, makeCreateWindowCallback(
create_modify_fields_window, query));
2637 aws->
create_button(
"MODIFY_FIELDS_OF_LISTED",
"MODIFY FIELDS\nOF LISTED",
"F");
2641 sprintf(buffer,
"Set Protection of Fields of Listed %s", Items);
query_rel_menu_entry(aws,
"s_prot_of_listed", query_id, buffer,
"P",
"set_protection.hlp",
AWM_ALL, makeCreateWindowCallback(
create_set_protection_window, query));
2643 sprintf(buffer,
"Mark Listed %s, don't Change Rest", Items);
query_rel_menu_entry(aws,
"mark_listed", query_id, buffer,
"M",
"mark.hlp",
AWM_ALL, makeWindowCallback(
mark_queried_cb, query, 1|8));
2644 sprintf(buffer,
"Mark Listed %s, Unmark Rest", Items);
query_rel_menu_entry(aws,
"mark_listed_unmark_rest", query_id, buffer,
"L",
"mark.hlp",
AWM_ALL, makeWindowCallback(
mark_queried_cb, query, 1 ));
2645 sprintf(buffer,
"Unmark Listed %s, don't Change Rest", Items);
query_rel_menu_entry(aws,
"unmark_listed", query_id, buffer,
"U",
"mark.hlp",
AWM_ALL, makeWindowCallback(
mark_queried_cb, query, 0|8));
2646 sprintf(buffer,
"Unmark Listed %s, Mark Rest", Items);
query_rel_menu_entry(aws,
"unmark_listed_mark_rest", query_id, buffer,
"R",
"mark.hlp",
AWM_ALL, makeWindowCallback(
mark_queried_cb, query, 0 ));
2650 sprintf(buffer,
"Set Color of Listed %s", Items);
query_rel_menu_entry(aws,
"set_color_of_listed", query_id, buffer,
"C",
"set_color_of_listed.hlp",
AWM_ALL, makeCreateWindowCallback(
create_colorize_queried_window, query));
2656 aws->
insert_menu_topic(
"search_equal_fields_and_listed_in_I",
"Search entries existing in both DBs and listed in the source DB hitlist",
"S",
2658 aws->
insert_menu_topic(
"search_equal_words_and_listed_in_I",
"Search words existing in entries of both DBs and listed in the source DB hitlist",
"w",
2662 aws->
insert_menu_topic(
"search_equal_field_in_both_db",
"Search entries existing in both DBs",
"S",
2664 aws->
insert_menu_topic(
"search_equal_word_in_both_db",
"Search words existing in entries of both DBs",
"w",
2683 void TEST_nullcmp() {
2684 const char *whatever =
"bla";
2694 #endif // UNIT_TESTS
GB_ERROR GB_begin_transaction(GBDATA *gbd)
static void mark_colored_cb(AW_window *aww, BoundItemSel *cmd, mark_mode mode)
void insert_option(AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color=NULp)
static GB_ERROR clear_all_colors(BoundItemSel *bsel, AW_root *aw_root)
#define MAX_QUERY_LIST_LEN
const char * get_items_name() const
void get_at_position(int *x, int *y) const
#define PSEUDO_FIELD_ALL_FIELDS_REC
static void toggle_flag_cb(AW_window *aww, DbQuery *query)
void insert_toggle(AW_label toggle_label, const char *mnemonic, const char *var_value)
GB_ERROR GB_commit_transaction(GBDATA *gbd)
void set_tree_awar_name(const char *tree_awar_name)
bool GB_TYPE_readable_as_string(GB_TYPES type)
void button_length(int length)
void add(const char *awar_name, const char *config_name)
const char * getHitInfo(const char *item_id, DbQuery *query)
ItemSelector * parent_selector
GBDATA * GBT_colorset_root(GBDATA *gb_main, const char *itemsname)
void d_callback(const WindowCallback &cb)
static QUERY_RESULT_ORDER find_display_determining_sort_order(QUERY_RESULT_ORDER *order)
GBDATA * GB_child(GBDATA *father)
GB_ERROR GB_incur_error()
static void destroyKeptQueries()
long GBS_write_hash(GB_HASH *hs, const char *key, long val)
return string(buffer, length)
const char * config_pos_fig
void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback &wcb)
void GB_atclose_callback(GBDATA *gbd, const DatabaseCallback &atClose)
static GB_ERROR restore_colorset_representation(BoundItemSel *bsel, CharPtrArray &colordefs)
static void keepQuery(GBDATA *gbmain, DbQuery *q)
void DbQuery_update_list(DbQuery *query)
void insert_default(const char *displayed, const AW_scalar &value)
GB_ERROR GB_add_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
#define DOWNCAST_REFERENCE(totype, expr)
static void iterate(GBDATA *gbd)
const char * ARB_keep_string(char *str)
void GB_sort(void **array, size_t first, size_t behind_last, gb_compare_function compare, void *client_data)
bool GB_readable_as_string(GBDATA *gbd)
#define PSEUDO_FIELD_ALL_FIELDS
GBDATA * query_get_gb_main(DbQuery *query)
GB_ERROR GB_end_transaction(GBDATA *gbd, GB_ERROR error)
static void set_protection_of_queried_cb(AW_window *, DbQuery *query)
static void detectMaxNameLength(const char *key, long, void *cl_len)
static void create_colorset_representation(BoundItemSel *bsel, AW_root *aw_root, StrArray &colordefs, GB_ERROR &error)
void copy_selection_list_2_query_box(DbQuery *query, AW_selection_list *srclist, const char *hit_description)
const char * where_pos_fig
void AWT_insert_config_manager(AW_window *aww, AW_default default_file_, const char *id, const StoreConfigCallback &store_cb, const RestoreConfigCallback &load_or_reset_cb, const char *macro_id, const AWT_predefined_config *predef)
void GB_end_transaction_show_error(GBDATA *gbd, GB_ERROR error, void(*error_handler)(GB_ERROR))
char * GB_read_as_string(GBDATA *gbd)
void CLEAR_QUERIED(GBDATA *gb_species, DbQuery *query)
static GB_HASH * create_ref_hash(const DbQuery *query, const char *key, bool split_words)
GBDATA *(* get_parent)(GBDATA *gb_item)
bool iterate() const OVERRIDE
GBDATA * get_first_field(GBDATA *gb_item) const
size_t GBS_shorten_repeated_data(char *data)
#define QUERY_EXPRESSIONS
DbQuery * create_query_box(AW_window *aws, query_spec *awtqs, const char *query_id)
GBDATA * GBT_find_or_create_colorset(GBDATA *gb_colorset_root, const char *name)
const char * GBS_global_string(const char *templat,...)
static int query_count_items(DbQuery *query, QUERY_RANGE range, QUERY_MODES mode)
const char * result_pos_fig
void AW_advice(const char *message, AW_Advice_Type type, const char *title, const char *corresponding_help)
Show a message box with an advice for the user.
GB_HASH * GBS_create_dynaval_hash(long estimated_elements, GB_CASE case_sens, void(*freefun)(long))
GBDATA * get_colorset_root(BoundItemSel *bsel)
void AW_POPDOWN(AW_window *window)
void unquery_all(void *dummy, DbQuery *query)
void GBS_free_hash(GB_HASH *hs)
static void result_sort_order_changed_cb(AW_root *aw_root, DbQuery *query)
bool isNull() const
test if SmartPtr is NULp
static SmartPtr< QueryKeeper > queryKeeper
char * awar_acceptConvError
char * awar_keys[QUERY_EXPRESSIONS]
static void modify_fields_of_queried_cb(AW_window *, DbQuery *query)
query_operator awarvalue2query_operator(const char *awarvalue)
long count_queried_items(DbQuery *query, QUERY_RANGE range)
const char * open_parser_pos_fig
ItemQueryKey(GBDATA *gb_main, const char *field_name)
void setNull()
set SmartPtr to NULp
const char * get_tree_name() const
char buffer[MESSAGE_BUFFERSIZE]
GBDATA * GB_get_father(GBDATA *gbd)
void update_option_menu()
GB_ERROR GB_push_transaction(GBDATA *gbd)
bool SLOW_is_pseudo_key(const char *key)
int ARB_strNULLcmp(const char *s1, const char *s2)
bool speciesOrOrganism(QUERY_ITEM_TYPE type)
#define NO_FIELD_SELECTED
void update_toggle_field()
GB_ERROR GB_incur_error_if(bool error_may_occur)
static void loadsave_colorset_cb(AW_window *aws, BoundItemSel *bsel, loadsave_mode mode)
AW_awar * add_callback(const RootCallback &cb)
GB_ERROR GB_delete(GBDATA *&source)
void insert(const char *displayed, const AW_scalar &value)
char * GBS_modify_tagged_string_with_ACI(const char *s, const char *dt, const char *tag, const char *aci, GBL_call_env &env)
void create_itemfield_selection_button(AW_window *aws, const FieldSelDef &selDef, const char *at)
TargetItem(const DbQuery &query)
NOT4PERL float * GBT_read_float(GBDATA *gb_container, const char *fieldpath)
void GB_raise_user_flag(GBDATA *gbd, unsigned char user_bit)
static AW_window * create_writeFieldOfListed_window(AW_root *aw_root, DbQuery *query)
static void colorset_changed_cb(GBDATA *, const color_save_data *csd, GB_CB_TYPE cbt)
const char * read_char_pntr() const
char * get_target_data(const QueryTarget &target, GB_ERROR &error) const OVERRIDE
bool GB_user_flag(GBDATA *gbd, unsigned char user_bit)
QUERY_RESULT_ORDER order[MAX_CRITERIA]
GB_ERROR GB_export_error(const char *error)
char * awar_setprotection
GB_ERROR GB_await_error()
static void first_searchkey_changed_cb(AW_root *, DbQuery *query)
NOT4PERL long * GBT_read_int(GBDATA *gb_container, const char *fieldpath)
WindowCallback makeHelpCallback(const char *helpfile)
GB_TYPES GB_read_type(GBDATA *gbd)
void create_toggle_field(const char *awar_name, AW_label label, AW_orientation orientation=AW_VERTICAL)
static AW_window * create_colorize_queried_window(AW_root *aw_root, DbQuery *query)
GB_HASH * hit_description
GB_CSTR GB_read_key_pntr(GBDATA *gbd)
bool expect_hit_in_ref_list
GB_HASH * to_hash(bool case_sens)
#define PSEUDO_FIELD_ANY_FIELD
GBDATA * get_item() const
long GB_number_of_subentries(GBDATA *gbd)
bool is_pseudo_key(const char *key)
const char * GB_first_non_key_char(const char *str)
ItemSelector & get_queried_itemtype(DbQuery *query)
void GBS_hash_do_const_loop(const GB_HASH *hs, gb_hash_const_loop_type func, void *client_data)
int GBT_get_color_group(GBDATA *gb_item)
const char * change_key_path
void init_itemType_specific_window(AW_root *aw_root, class AW_window_simple *aws, const ItemSelector &itemType, const char *id, const char *title_format, bool plural=false)
GBDATA *(* get_selected_item)(GBDATA *gb_main, AW_root *aw_root)
void aimTo(GBDATA *gb_next_item)
string keptHitReason(const string ¤tHitReason, GBDATA *gb_item, DbQuery *query)
int numeric_string_cmp(const char *str1, const char *str2)
AW_selection_list * hitlist
static AW_window * create_set_protection_window(AW_root *aw_root, DbQuery *query)
GBDATA * get_ACI_item() const OVERRIDE
const char * qbox_pos_fig
void help_text(const char *id)
static char const * macro_name
GBDATA *(* get_first_item_container)(GBDATA *, AW_root *, QUERY_RANGE)
static void error(const char *msg)
GBDATA *(* get_next_item_container)(GBDATA *, QUERY_RANGE)
GB_ERROR GB_abort_transaction(GBDATA *gbd)
void reset() const OVERRIDE
void(* trigger_display_refresh)()
void restore_at_from(const AW_at_storage &stored)
static void new_selection_made_cb(AW_root *aw_root, const char *awar_selection, DbQuery *query)
static void colorize_marked_cb(AW_window *aww, BoundItemSel *cmd)
char * awar_operator[QUERY_EXPRESSIONS]
GBQUARK GB_find_or_create_quark(GBDATA *gbd, const char *key)
static void delete_queried_species_cb(AW_window *, DbQuery *query)
void label(const char *label)
size_t GBS_hash_elements(const GB_HASH *hs)
char * read_as_string() const
GB_ERROR GBT_save_colorset(GBDATA *gb_colorset, CharPtrArray &colorsetDefs)
#define MAX_SHOWN_DATA_SIZE
static void colorize_queried_cb(AW_window *, DbQuery *query)
GB_ERROR GBT_load_colorset(GBDATA *gb_colorset, ConstStrArray &colorsetDefs)
const char * count_pos_fig
GBDATA * GB_find_sub_by_quark(GBDATA *father, GBQUARK key_quark, GBDATA *after, size_t skip_over)
static AW_window * create_colorize_window(AW_root *aw_root, GBDATA *gb_main, DbQuery *query, ItemSelector *sel)
static void free_hit_description(long info)
#define AWAR_COLOR_LOADSAVE_NAME
const char * prepare_and_get_selected_itemfield(AW_root *awr, const char *awar_name, GBDATA *gb_main, const ItemSelector &itemtype, FailIfField failIf)
int GB_read_flag(GBDATA *gbd)
char *(* generate_item_id)(GBDATA *gb_main, GBDATA *gb_item)
char * read_string() const
static void create_query_independent_awars(AW_root *aw_root, AW_default aw_def)
GB_ERROR GB_write_security_write(GBDATA *gbd, unsigned long level)
static WindowCallback simple(void(*root_cb)(AW_root *, T), T t)
AW_awar * awar(const char *awar)
GB_ERROR GB_pop_transaction(GBDATA *gbd)
GB_TYPES GBT_get_type_of_changekey(GBDATA *gb_main, const char *field_name, const char *change_key_path)
AW_selection_list * colorsets
bool expect_hit_in_ref_list
GBDATA *(* get_first_item)(GBDATA *, QUERY_RANGE)
void search_duplicated_field_content(AW_window *dummy, DbQuery *query, bool tokenize)
char * awar_parspredefined
static void clear_all_colors_cb(AW_window *aww, BoundItemSel *bsel)
void append(QueryExpr *&tail)
static AW_at_storage * make(AW_window *aww, AW_at_storage_type type)
AW_selection_list * awt_create_selection_list_with_input_field(AW_window *aww, const char *awar_name, const char *at_box, const char *at_field)
void insert_default_option(AW_label choice_label, const char *mnemonic, const char *var_value, const char *name_of_color=NULp)
char * awar_not[QUERY_EXPRESSIONS]
static void query_rel_menu_entry(AW_window *aws, const char *id, const char *query_id, const char *label, const char *mnemonic, const char *helpText, AW_active Mask, const CB &cb)
GBDATA * GBT_searchOrCreate_itemfield_according_to_changekey(GBDATA *gb_item, const char *field_name, const char *change_key_path)
GBDATA *(* get_next_item)(GBDATA *, QUERY_RANGE)
SmartPtr< QueryExpr > buildQueryExpr()
static void remove_keydependent_sort_criteria(QUERY_RESULT_ORDER *order)
bool aw_ask_sure(const char *unique_id, const char *msg)
void(* update_item_awars)(GBDATA *gb_main, AW_root *aw_root, const char *item_name)
static void split_sort_mask(unsigned long sort_mask, QUERY_RESULT_ORDER *order)
TokLPtr tokenize(const std::string &description, TokLPtr tokenLP)
void create_input_field(const char *awar_name, int columns=0)
const char * get_name() const OVERRIDE
fputs(TRACE_PREFIX, stderr)
static void setup_modify_fields_config(AWT_config_definition &cdef, const DbQuery *query)
AW_window * create_colorize_items_window(AW_root *aw_root, GBDATA *gb_main, ItemSelector &sel)
void ncat(const char *from, size_t count)
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
TYPE * ARB_calloc(size_t nelem)
void auto_space(int xspace, int yspace)
static void query_box_setup_config(AWT_config_definition &cdef, DbQuery *query)
popup_info_window_cb popup_info_window
GB_ERROR close(GB_ERROR error)
void GB_write_flag(GBDATA *gbd, long flag)
void SET_QUERIED(GBDATA *gb_species, DbQuery *query, const char *hitInfo, size_t hitInfoLen=0)
#define QUERY_SORT_CRITERIA_MASK
const char * do_mark_pos_fig
bool IS_QUERIED(GBDATA *gb_item, const query_spec *aqs)
Itemfield_Selection * create_itemfield_selection_list(AW_window *aws, const FieldSelDef &selDef, const char *at)
GB_ERROR GB_failedTo_error(const char *do_something, const char *special, GB_ERROR error)
bool matches(const QueryTarget &target, std::string &hit_reason) const
AW_selection_list * create_selection_list(const char *awar_name, int columns, int rows)
char * AW_get_color_group_name(AW_root *awr, int color_group)
#define QUERY_SORT_CRITERIA_BITS
GBDATA * GBT_first_species(GBDATA *gb_main)
char * GBT_read_as_string(GBDATA *gb_container, const char *fieldpath)
GB_ERROR GB_write_security_delete(GBDATA *gbd, unsigned long level)
GB_CSTR GB_concat_path_in_ARBLIB(const char *relative_path_left, const char *anypath_right)
static void update_colorset_selection_list(const color_save_data *csd)
const char * query_pos_fig
const char * GB_get_db_path(GBDATA *gbd)
void aw_message(const char *msg)
const char * do_query_pos_fig
AW_option_menu_struct * create_option_menu(const char *awar_name)
GBDATA * GBT_find_colorset(GBDATA *gb_colorset_root, const char *name)
void GB_clear_user_flag(GBDATA *gbd, unsigned char user_bit)
GBDATA * GB_find_string(GBDATA *gbd, const char *key, const char *str, GB_CASE case_sens, GB_SEARCH_TYPE gbs)
query_key_type get_key_type() const
Keeper< DbQuery * > QueryKeeper
static int compare_hits(const void *cl_item1, const void *cl_item2, void *cl_param)
GBDATA * GBT_next_species(GBDATA *gb_species)
GBDATA *(* find_item_by_id)(GBDATA *gb_main, const char *id)
GB_ERROR getError(int count=0) const
GB_ERROR write_string(const char *aw_string)
char * GBT_get_default_alignment(GBDATA *gb_main)
#define GB_USERFLAG_QUERY
static void predef_prg(AW_root *aw_root, DbQuery *query)
NOT4PERL char * GB_command_interpreter_in_env(const char *str, const char *commands, const GBL_call_env &callEnv)
GBDATA * GB_nextChild(GBDATA *child)
bool keep_criteria(QUERY_RESULT_ORDER old_criteria, QUERY_RESULT_ORDER new_criteria)
void GBT_get_colorset_names(ConstStrArray &colorsetNames, GBDATA *gb_colorset_root)
long GBT_get_species_count(GBDATA *gb_main)
static void perform_query_cb(AW_window *, DbQuery *query, EXT_QUERY_TYPES ext_query)
GB_ERROR load(const char *filemask, bool append) const
GB_transaction ta(gb_var)
void callback(const WindowCallback &cb)
void setError(GB_ERROR error_) const
hits_sort_params(DbQuery *q, const char *fk)
ItemSelector & get_queried_itemtype() const
bool is_queried(GBDATA *gb_item) const
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
GB_ERROR GBT_set_color_group(GBDATA *gb_item, int color_group)
GBDATA * GB_search(GBDATA *gbd, const char *fieldpath, GB_TYPES create)
GB_CSTR GBT_get_name_or_description(GBDATA *gb_item)
static AW_window * create_modify_fields_window(AW_root *aw_root, DbQuery *query)
const char * do_set_pos_fig
static int info[maxsites+1]
const char * GBT_read_char_pntr(GBDATA *gb_container, const char *fieldpath)
bool is_queried(GBDATA *gb_item) const
static void set_field_of_queried_cb(AW_window *, DbQuery *query, bool append)
char * awar_queries[QUERY_EXPRESSIONS]
#define TEST_EXPECT_EQUAL(expr, want)
GB_ERROR write_int(long aw_int)
const MutableBoundItemSel BoundItemSel
static AW_window * create_loadsave_colored_window(AW_root *aw_root, color_save_data *csd)
long GBS_read_hash(const GB_HASH *hs, const char *key)
void inc_and_check_user_abort(GB_ERROR &error)
static void mark_queried_cb(AW_window *, DbQuery *query, int mark)
#define PSEUDO_FIELD_ANY_FIELD_REC
const char * do_delete_pos_fig
void aw_message_if(GB_ERROR error)
CONSTEXPR long FIELD_FILTER_STRING_READABLE
const char * do_unmark_pos_fig
char * GBS_global_string_copy(const char *templat,...)
const char * do_refresh_pos_fig
CONSTEXPR long FIELD_UNFILTERED
GB_HASH * GBS_create_hash(long estimated_elements, GB_CASE case_sens)
void create_button(const char *macro_name, AW_label label, const char *mnemonic=NULp, const char *color=NULp)
const char * get_itemfield_type_awarname(const char *itemfield_awarname)
GBDATA * GBT_get_species_data(GBDATA *gb_main)
GB_ERROR GB_write_autoconv_string(GBDATA *gbd, const char *val)
GB_write_int const char s