From c503b408b74dd712616b9882112cbeae9776a8a1 Mon Sep 17 00:00:00 2001 From: barbieri Date: Tue, 19 Jun 2012 19:53:02 +0000 Subject: [PATCH] log: separate termpty logging from the rest. Make raster the-crying-baby stop complain about log. Now we can have only termpty logging, with a short format, by using: {{{ export EINA_LOG_FILE_DISABLE=1 export EINA_LOG_LEVELS=termpty:4 terminology }}} git-svn-id: http://svn.enlightenment.org/svn/e/trunk/terminology@72503 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/bin/termio.c | 4 ++++ src/bin/termpty.c | 35 ++++++++++++++++++++++++++++++++++- src/bin/termpty.h | 3 +++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/src/bin/termio.c b/src/bin/termio.c index e27e4e3..aea9e44 100644 --- a/src/bin/termio.c +++ b/src/bin/termio.c @@ -986,6 +986,8 @@ _smart_del(Evas_Object *obj) sd->imf = NULL; ecore_imf_shutdown(); + termpty_shutdown(); + _parent_sc.del(obj); evas_object_smart_data_set(obj, NULL); } @@ -1146,6 +1148,8 @@ termio_add(Evas_Object *parent, Config *config, const char *cmd, int w, int h) _termio_config_set(obj, config); + termpty_init(); + sd->pty = termpty_new(cmd, w, h, config->scrollback); sd->pty->cb.change.func = _smart_pty_change; sd->pty->cb.change.data = obj; diff --git a/src/bin/termpty.c b/src/bin/termpty.c index 2184b6c..1e434e9 100644 --- a/src/bin/termpty.c +++ b/src/bin/termpty.c @@ -10,6 +10,39 @@ #include #include +/* specific log domain to help debug only terminal code parser */ +static int _termpty_log_dom = -1; + +#undef CRITICAL +#undef ERR +#undef WRN +#undef INF +#undef DBG + +#define CRITICAL(...) EINA_LOG_DOM_CRIT(_termpty_log_dom, __VA_ARGS__) +#define ERR(...) EINA_LOG_DOM_ERR(_termpty_log_dom, __VA_ARGS__) +#define WRN(...) EINA_LOG_DOM_WARN(_termpty_log_dom, __VA_ARGS__) +#define INF(...) EINA_LOG_DOM_INFO(_termpty_log_dom, __VA_ARGS__) +#define DBG(...) EINA_LOG_DOM_DBG(_termpty_log_dom, __VA_ARGS__) + +void +termpty_init(void) +{ + if (_termpty_log_dom >= 0) return; + + _termpty_log_dom = eina_log_domain_register("termpty", NULL); + if (_termpty_log_dom < 0) + EINA_LOG_CRIT("could not create log domain 'termpty'."); +} + +void +termpty_shutdown(void) +{ + if (_termpty_log_dom < 0) return; + eina_log_domain_unregister(_termpty_log_dom); + _termpty_log_dom = -1; +} + static void _text_clear(Termpty *ty, Termcell *cells, int count, int val, Eina_Bool inherit_att) { @@ -143,7 +176,7 @@ _text_scroll_rev_test(Termpty *ty) /* translates VT100 ACS escape codes to Unicode values. * Based on rxvt-unicode screen.C table. */ -static int vt100_to_unicode[62] = { +static const int vt100_to_unicode[62] = { 0x2191, 0x2193, 0x2192, 0x2190, 0x2588, 0x259a, 0x2603, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/bin/termpty.h b/src/bin/termpty.h index e97dd1e..01d86a2 100644 --- a/src/bin/termpty.h +++ b/src/bin/termpty.h @@ -99,6 +99,9 @@ struct _Termsave Termcell cell[1]; }; +void termpty_init(void); +void termpty_shutdown(void); + Termpty *termpty_new(const char *cmd, int w, int h, int backscroll); void termpty_free(Termpty *ty); Termcell *termpty_cellrow_get(Termpty *ty, int y, int *wret); -- 2.7.4