vte r2216 - in trunk: . src
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: vte r2216 - in trunk: . src
- Date: Fri, 28 Nov 2008 22:24:09 +0000 (UTC)
Author: chpe
Date: Fri Nov 28 22:24:09 2008
New Revision: 2216
URL: http://svn.gnome.org/viewvc/vte?rev=2216&view=rev
Log:
* src/debug.c: (_vte_debug_init), (_vte_debug_on):
* src/debug.h:
* src/interpret.c: (main):
* src/pty.c: (main):
* src/reaper.c: (main):
* src/trie.c: (main):
* src/vte.c: (vte_terminal_new), (vte_terminal_class_init): Use
g_parse_debug_string to parse the debug flags.
Modified:
trunk/ChangeLog
trunk/src/debug.c
trunk/src/debug.h
trunk/src/interpret.c
trunk/src/pty.c
trunk/src/reaper.c
trunk/src/trie.c
trunk/src/vte.c
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c (original)
+++ trunk/src/debug.c Fri Nov 28 22:24:09 2008
@@ -16,91 +16,48 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "../config.h"
+#include <config.h>
+
#include <glib.h>
#include "debug.h"
static VteDebugFlags _vte_debug_flags = 0;
void
-_vte_debug_parse_string(const char *string)
+_vte_debug_init(void)
{
- char **flags = NULL;
- int i;
- _vte_debug_flags = 0;
- flags = g_strsplit(string ? string : "", ",", 0);
- if (flags != NULL) {
- for (i = 0; flags[i] != NULL; i++) {
- if (g_ascii_strcasecmp(flags[i], "ALL") == 0) {
- _vte_debug_flags |= 0xffffffff;
- } else
- if (g_ascii_strcasecmp(flags[i], "MISC") == 0) {
- _vte_debug_flags |= VTE_DEBUG_MISC;
- } else
- if (g_ascii_strcasecmp(flags[i], "IO") == 0) {
- _vte_debug_flags |= VTE_DEBUG_IO;
- } else
- if (g_ascii_strcasecmp(flags[i], "ADJ") == 0) {
- _vte_debug_flags |= VTE_DEBUG_ADJ;
- } else
- if (g_ascii_strcasecmp(flags[i], "UPDATES") == 0) {
- _vte_debug_flags |= VTE_DEBUG_UPDATES;
- } else
- if (g_ascii_strcasecmp(flags[i], "EVENTS") == 0) {
- _vte_debug_flags |= VTE_DEBUG_EVENTS;
- } else
- if (g_ascii_strcasecmp(flags[i], "PARSE") == 0) {
- _vte_debug_flags |= VTE_DEBUG_PARSE;
- } else
- if (g_ascii_strcasecmp(flags[i], "SIGNALS") == 0) {
- _vte_debug_flags |= VTE_DEBUG_SIGNALS;
- } else
- if (g_ascii_strcasecmp(flags[i], "SELECTION") == 0) {
- _vte_debug_flags |= VTE_DEBUG_SELECTION;
- } else
- if (g_ascii_strcasecmp(flags[i], "SUBSTITUTION") == 0) {
- _vte_debug_flags |= VTE_DEBUG_SUBSTITUTION;
- } else
- if (g_ascii_strcasecmp(flags[i], "RING") == 0) {
- _vte_debug_flags |= VTE_DEBUG_RING;
- } else
- if (g_ascii_strcasecmp(flags[i], "PTY") == 0) {
- _vte_debug_flags |= VTE_DEBUG_PTY;
- } else
- if (g_ascii_strcasecmp(flags[i], "CURSOR") == 0) {
- _vte_debug_flags |= VTE_DEBUG_CURSOR;
- } else
- if (g_ascii_strcasecmp(flags[i], "KEYBOARD") == 0) {
- _vte_debug_flags |= VTE_DEBUG_KEYBOARD;
- } else
- if (g_ascii_strcasecmp(flags[i], "LIFECYCLE") == 0) {
- _vte_debug_flags |= VTE_DEBUG_LIFECYCLE;
- } else
- if (g_ascii_strcasecmp(flags[i], "TRIE") == 0) {
- _vte_debug_flags |= VTE_DEBUG_TRIE;
- } else
- if (g_ascii_strcasecmp(flags[i], "WORK") == 0) {
- _vte_debug_flags |= VTE_DEBUG_WORK;
- } else
- if (g_ascii_strcasecmp(flags[i], "CELLS") == 0) {
- _vte_debug_flags |= VTE_DEBUG_CELLS;
- } else
- if (g_ascii_strcasecmp(flags[i], "TIMEOUT") == 0) {
- _vte_debug_flags |= VTE_DEBUG_TIMEOUT;
- } else
- if (g_ascii_strcasecmp(flags[i], "DRAW") == 0) {
- _vte_debug_flags |= VTE_DEBUG_DRAW;
- } else
- if (g_ascii_strcasecmp(flags[i], "ALLY") == 0) {
- _vte_debug_flags |= VTE_DEBUG_ALLY;
- }
- }
- g_strfreev(flags);
- }
+#ifdef VTE_DEBUG
+ const GDebugKey keys[] = {
+ { "misc", VTE_DEBUG_MISC },
+ { "io", VTE_DEBUG_IO },
+ { "adj", VTE_DEBUG_ADJ },
+ { "updates", VTE_DEBUG_UPDATES },
+ { "events", VTE_DEBUG_EVENTS },
+ { "parse", VTE_DEBUG_PARSE },
+ { "signals", VTE_DEBUG_SIGNALS },
+ { "selection", VTE_DEBUG_SELECTION },
+ { "substitution", VTE_DEBUG_SUBSTITUTION },
+ { "ring", VTE_DEBUG_RING },
+ { "pty", VTE_DEBUG_PTY },
+ { "cursor", VTE_DEBUG_CURSOR },
+ { "keyboard", VTE_DEBUG_KEYBOARD },
+ { "lifecycle", VTE_DEBUG_LIFECYCLE },
+ { "trie", VTE_DEBUG_TRIE },
+ { "work", VTE_DEBUG_WORK },
+ { "cells", VTE_DEBUG_CELLS },
+ { "timeout", VTE_DEBUG_TIMEOUT },
+ { "draw", VTE_DEBUG_DRAW },
+ { "ally", VTE_DEBUG_ALLY }
+ };
+
+ _vte_debug_flags = g_parse_debug_string (g_getenv("VTE_DEBUG_FLAGS"),
+ keys, G_N_ELEMENTS (keys));
+ _vte_debug_print(0xFFFFFFFF, "VTE debug flags = %x\n", _vte_debug_flags);
+#endif /* VTE_DEBUG */
}
gboolean
_vte_debug_on(VteDebugFlags flags)
{
- return (_vte_debug_flags & flags) == flags;
+ return (_vte_debug_flags & flags) != 0;
}
Modified: trunk/src/debug.h
==============================================================================
--- trunk/src/debug.h (original)
+++ trunk/src/debug.h Fri Nov 28 22:24:09 2008
@@ -49,7 +49,7 @@
VTE_DEBUG_ADJ = 1 << 19
} VteDebugFlags;
-void _vte_debug_parse_string(const char *string);
+void _vte_debug_init(void);
gboolean _vte_debug_on(VteDebugFlags flags) G_GNUC_CONST;
#ifdef VTE_DEBUG
Modified: trunk/src/interpret.c
==============================================================================
--- trunk/src/interpret.c (original)
+++ trunk/src/interpret.c Fri Nov 28 22:24:09 2008
@@ -51,7 +51,7 @@
GQuark quark;
GValueArray *values;
- _vte_debug_parse_string(getenv("VTE_DEBUG_FLAGS"));
+ _vte_debug_init();
if (argc < 2) {
g_print("usage: %s terminal [file]\n", argv[0]);
Modified: trunk/src/pty.c
==============================================================================
--- trunk/src/pty.c (original)
+++ trunk/src/pty.c Fri Nov 28 22:24:09 2008
@@ -1109,7 +1109,7 @@
char c;
int ret;
signal(SIGCHLD, sigchld_handler);
- _vte_debug_parse_string(getenv("VTE_DEBUG_FLAGS"));
+ _vte_debug_init();
fd = _vte_pty_open(&child, NULL,
(argc > 1) ? argv[1] : NULL,
(argc > 1) ? argv + 1 : NULL,
Modified: trunk/src/reaper.c
==============================================================================
--- trunk/src/reaper.c (original)
+++ trunk/src/reaper.c Fri Nov 28 22:24:09 2008
@@ -269,7 +269,7 @@
VteReaper *reaper;
pid_t p, q;
- _vte_debug_parse_string(getenv("VTE_DEBUG_FLAGS"));
+ _vte_debug_init();
g_type_init();
context = g_main_context_default();
Modified: trunk/src/trie.c
==============================================================================
--- trunk/src/trie.c (original)
+++ trunk/src/trie.c Fri Nov 28 22:24:09 2008
@@ -861,7 +861,7 @@
const gunichar *consumed;
gsize buflen;
- _vte_debug_parse_string(getenv("VTE_DEBUG_FLAGS"));
+ _vte_debug_init();
g_type_init();
trie = _vte_trie_new();
Modified: trunk/src/vte.c
==============================================================================
--- trunk/src/vte.c (original)
+++ trunk/src/vte.c Fri Nov 28 22:24:09 2008
@@ -2480,10 +2480,7 @@
GtkWidget *
vte_terminal_new(void)
{
- /* we don't parse VTE_DEBUG_FLAGS until class init ... */
- GType type = vte_terminal_get_type ();
- _vte_debug_print(VTE_DEBUG_LIFECYCLE, "vte_terminal_new()\n");
- return g_object_new(type, NULL);
+ return g_object_new(VTE_TYPE_TERMINAL, NULL);
}
/* Set up a palette entry with a more-or-less match for the requested color. */
@@ -11065,11 +11062,7 @@
#ifdef VTE_DEBUG
{
- const gchar *env = g_getenv("VTE_DEBUG_FLAGS");
- /* Turn on debugging if we were asked to. */
- if (env != NULL) {
- _vte_debug_parse_string(env);
- }
+ _vte_debug_init();
_vte_debug_print(VTE_DEBUG_LIFECYCLE,
"vte_terminal_class_init()\n");
/* print out the legend */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]