2016-02-21 17:44:23 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* 20.02.2016
|
|
|
|
*
|
|
|
|
* GUI system for 4coder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
2016-02-27 07:44:17 +00:00
|
|
|
internal void
|
|
|
|
init_query_set(Query_Set *set){
|
|
|
|
Query_Slot *slot = set->slots;
|
|
|
|
set->free_slot = slot;
|
|
|
|
set->used_slot = 0;
|
2019-02-26 23:17:53 +00:00
|
|
|
for (i32 i = 0; i+1 < ArrayCount(set->slots); ++i, ++slot){
|
2016-02-27 07:44:17 +00:00
|
|
|
slot->next = slot + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
internal Query_Slot*
|
|
|
|
alloc_query_slot(Query_Set *set){
|
|
|
|
Query_Slot *slot = set->free_slot;
|
|
|
|
if (slot != 0){
|
|
|
|
set->free_slot = slot->next;
|
|
|
|
slot->next = set->used_slot;
|
|
|
|
set->used_slot = slot;
|
|
|
|
}
|
|
|
|
return(slot);
|
|
|
|
}
|
|
|
|
|
|
|
|
internal void
|
|
|
|
free_query_slot(Query_Set *set, Query_Bar *match_bar){
|
|
|
|
Query_Slot *slot = 0, *prev = 0;
|
|
|
|
|
|
|
|
for (slot = set->used_slot; slot != 0; slot = slot->next){
|
|
|
|
if (slot->query_bar == match_bar) break;
|
|
|
|
prev = slot;
|
|
|
|
}
|
2016-04-02 19:35:33 +00:00
|
|
|
|
2016-02-27 07:44:17 +00:00
|
|
|
if (slot){
|
|
|
|
if (prev){
|
|
|
|
prev->next = slot->next;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
set->used_slot = slot->next;
|
|
|
|
}
|
|
|
|
slot->next = set->free_slot;
|
|
|
|
set->free_slot = slot;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-21 17:44:23 +00:00
|
|
|
// BOTTOM
|
|
|
|
|