aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/curses/ui.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/ui/curses/ui.c b/ui/curses/ui.c
index 950f109..9d253a3 100644
--- a/ui/curses/ui.c
+++ b/ui/curses/ui.c
@@ -1,6 +1,26 @@
+// index
+// [section] includes
+// [section] macros & enums
+// [section] globals
+// [section] gfx functions
+// [section] tui functions
+// [section] process page functions
+// [section] world page functions
+// [section] ipc page functions
+// [section] log page functions
+// [section] main print functions
+// [section] event functions
+// [section] main functions
+
+// ----------------------------------------------------------------------------
+// [section] includes
+// ----------------------------------------------------------------------------
#include <curses.h>
#include <locale.h>
+// ----------------------------------------------------------------------------
+// [section] macros & enums
+// ----------------------------------------------------------------------------
#define LOG_LINE_COUNT 1024
#define PANE_AND_MARGIN_WIDTH (PANE_WIDTH + 2)
#define PANE_WIDTH 27
@@ -42,7 +62,9 @@ enum {
PAIR_WARN = 12,
};
-// GFX globals
+// ----------------------------------------------------------------------------
+// [section] globals
+// ----------------------------------------------------------------------------
uint64_t g_gfx_vsiz; // zoom level
uint64_t *g_gfx_inst; // instruction channel
uint64_t *g_gfx_mall; // allocated state channel
@@ -52,7 +74,6 @@ uint64_t *g_gfx_mb1s; // selected organism's memory block #2 channel
uint64_t *g_gfx_ipas; // selected organism's IP channel
uint64_t *g_gfx_spas; // selected organism's SP channel
-// UI globals
bool g_exit;
bool g_running;
unsigned g_core;
@@ -90,7 +111,7 @@ const wchar_t *g_zoomed_symbols = (
);
// ----------------------------------------------------------------------------
-// GFX functions
+// [section] gfx functions
// ----------------------------------------------------------------------------
void gfx_init(uint64_t vsiz) {
assert(vsiz);
@@ -312,7 +333,7 @@ void gfx_render(const struct Core *core, uint64_t pos, uint64_t zoom, uint64_t p
}
// ----------------------------------------------------------------------------
-// TUI functions
+// [section] tui functions
// ----------------------------------------------------------------------------
void tui_line_buff_free(void) {
if (g_line_buff) {
@@ -431,7 +452,7 @@ void tui_print_core(int l) {
}
// ----------------------------------------------------------------------------
-// Process page functions
+// [section] process page functions
// ----------------------------------------------------------------------------
int tui_proc_pair(uint64_t pix) {
if (pix == g_proc_selected) {
@@ -591,7 +612,7 @@ void tui_print_process(int l) {
}
// ----------------------------------------------------------------------------
-// World page functions
+// [section] world page functions
// ----------------------------------------------------------------------------
void tui_world_resize(void) {
assert(g_wrld_zoom);
@@ -745,7 +766,7 @@ void tui_print_world(int l) {
}
// ----------------------------------------------------------------------------
-// IPC page functions
+// [section] ipc page functions
// ----------------------------------------------------------------------------
void tui_print_ipc_field(int l, uint64_t i, int color) {
uint8_t iinst = g_cores[g_core].iviv[i];
@@ -801,7 +822,7 @@ void tui_print_ipc(int l) {
}
// ----------------------------------------------------------------------------
-// Log page functions
+// [section] log page functions
// ----------------------------------------------------------------------------
void tui_info_impl(const char *format, ...) {
assert(format);
@@ -877,7 +898,7 @@ void tui_print_log(int l) {
}
// ----------------------------------------------------------------------------
-// Main print function
+// [section] main print functions
// ----------------------------------------------------------------------------
void tui_print(void) {
int l = 1;
@@ -931,7 +952,7 @@ void tui_print(void) {
}
// ----------------------------------------------------------------------------
-// Control function
+// [section] event functions
// ----------------------------------------------------------------------------
void ev_vscroll(int ev) {
switch (g_page) {
@@ -1295,7 +1316,7 @@ void ev_handle(void) {
}
// ----------------------------------------------------------------------------
-// Main functions
+// [section] main functions
// ----------------------------------------------------------------------------
void init(void) {
setlocale(LC_ALL, "");