vte r2241 - in trunk: . src
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: vte r2241 - in trunk: . src
- Date: Mon, 1 Dec 2008 02:20:33 +0000 (UTC)
Author: behdad
Date: Mon Dec 1 02:20:33 2008
New Revision: 2241
URL: http://svn.gnome.org/viewvc/vte?rev=2241&view=rev
Log:
2008-11-30 Behdad Esfahbod <behdad gnome org>
* src/Makefile.am:
* src/vte-private.h:
* src/vte.c (vte_terminal_process_incoming):
* src/vteseq.c (display_control_sequence),
(_vte_terminal_handle_sequence):
* src/vteseq.h:
Move _vte_terminal_handle_sequence() into vteseq.c
Removed:
trunk/src/vteseq.h
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/vte-private.h
trunk/src/vte.c
trunk/src/vteseq.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Dec 1 02:20:33 2008
@@ -71,7 +71,6 @@
vteregex.c \
vteregex.h \
vteseq.c \
- vteseq.h \
vteseq-list.h \
vteskel.c \
vteskel.h \
Modified: trunk/src/vte-private.h
==============================================================================
--- trunk/src/vte-private.h (original)
+++ trunk/src/vte-private.h Mon Dec 1 02:20:33 2008
@@ -453,6 +453,12 @@
void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...) G_GNUC_PRINTF(2,3);
+/* vteseq.c: */
+gboolean _vte_terminal_handle_sequence(VteTerminal *terminal,
+ const char *match_s,
+ GQuark match,
+ GValueArray *params);
+
G_END_DECLS
#endif
Modified: trunk/src/vte.c
==============================================================================
--- trunk/src/vte.c (original)
+++ trunk/src/vte.c Mon Dec 1 02:20:33 2008
@@ -48,7 +48,6 @@
#include "vteint.h"
#include "vteregex.h"
#include "vtetc.h"
-#include "vteseq.h"
#ifdef HAVE_LOCALE_H
#include <locale.h>
@@ -3231,72 +3230,6 @@
return line_wrapped;
}
-static void
-display_control_sequence(const char *name, GValueArray *params)
-{
-#ifdef VTE_DEBUG
- /* Display the control sequence with its parameters, to
- * help me debug this thing. I don't have all of the
- * sequences implemented yet. */
- guint i;
- long l;
- const char *s;
- const gunichar *w;
- GValue *value;
- g_printerr("%s(", name);
- if (params != NULL) {
- for (i = 0; i < params->n_values; i++) {
- value = g_value_array_get_nth(params, i);
- if (i > 0) {
- g_printerr(", ");
- }
- if (G_VALUE_HOLDS_LONG(value)) {
- l = g_value_get_long(value);
- g_printerr("%ld", l);
- } else
- if (G_VALUE_HOLDS_STRING(value)) {
- s = g_value_get_string(value);
- g_printerr("\"%s\"", s);
- } else
- if (G_VALUE_HOLDS_POINTER(value)) {
- w = g_value_get_pointer(value);
- g_printerr("\"%ls\"", (const wchar_t*) w);
- }
- }
- }
- g_printerr(")\n");
-#endif
-}
-
-/* Handle a terminal control sequence and its parameters. */
-static gboolean
-vte_terminal_handle_sequence(VteTerminal *terminal,
- const char *match_s,
- GQuark match,
- GValueArray *params)
-{
- VteTerminalSequenceHandler handler;
- gboolean ret;
-
- _VTE_DEBUG_IF(VTE_DEBUG_PARSE)
- display_control_sequence(match_s, params);
-
- /* Find the handler for this control sequence. */
- handler = _vte_sequence_get_handler (match_s);
-
- if (handler != NULL) {
- /* Let the handler handle it. */
- ret = handler(terminal, match_s, match, params);
- } else {
- _vte_debug_print (VTE_DEBUG_MISC,
- "No handler for control sequence `%s' defined.\n",
- match_s);
- ret = FALSE;
- }
-
- return ret;
-}
-
/* Catch a VteReaper child-exited signal, and if it matches the one we're
* looking for, emit one of our own. */
static void
@@ -3880,10 +3813,10 @@
if ((match != NULL) && (match[0] != '\0')) {
/* Call the right sequence handler for the requested
* behavior. */
- vte_terminal_handle_sequence(terminal,
- match,
- quark,
- params);
+ _vte_terminal_handle_sequence(terminal,
+ match,
+ quark,
+ params);
/* Skip over the proper number of unicode chars. */
start = (next - wbuf);
modified = TRUE;
Modified: trunk/src/vteseq.c
==============================================================================
--- trunk/src/vteseq.c (original)
+++ trunk/src/vteseq.c Mon Dec 1 02:20:33 2008
@@ -28,11 +28,17 @@
#include "vte.h"
#include "vte-private.h"
-#include "vteseq.h"
#include "vtetc.h"
+/* A function which can handle a terminal control sequence. Returns TRUE only
+ * if something happened (usually a signal emission) to which the controlling
+ * application must have an immediate opportunity to respond. */
+typedef gboolean (*VteTerminalSequenceHandler)(VteTerminal *terminal,
+ const char *match,
+ GQuark match_quark,
+ GValueArray *params);
/* Prototype all handlers... */
#define VTE_SEQUENCE_HANDLER(name) \
@@ -3898,7 +3904,7 @@
#undef VTE_SEQUENCE_HANDLER
-VteTerminalSequenceHandler
+static VteTerminalSequenceHandler
_vte_sequence_get_handler (const char *code)
{
int len = strlen (code);
@@ -3915,3 +3921,69 @@
return seqhandler ? seqhandler->handler : NULL;
}
}
+
+static void
+display_control_sequence(const char *name, GValueArray *params)
+{
+#ifdef VTE_DEBUG
+ /* Display the control sequence with its parameters, to
+ * help me debug this thing. I don't have all of the
+ * sequences implemented yet. */
+ guint i;
+ long l;
+ const char *s;
+ const gunichar *w;
+ GValue *value;
+ g_printerr("%s(", name);
+ if (params != NULL) {
+ for (i = 0; i < params->n_values; i++) {
+ value = g_value_array_get_nth(params, i);
+ if (i > 0) {
+ g_printerr(", ");
+ }
+ if (G_VALUE_HOLDS_LONG(value)) {
+ l = g_value_get_long(value);
+ g_printerr("%ld", l);
+ } else
+ if (G_VALUE_HOLDS_STRING(value)) {
+ s = g_value_get_string(value);
+ g_printerr("\"%s\"", s);
+ } else
+ if (G_VALUE_HOLDS_POINTER(value)) {
+ w = g_value_get_pointer(value);
+ g_printerr("\"%ls\"", (const wchar_t*) w);
+ }
+ }
+ }
+ g_printerr(")\n");
+#endif
+}
+
+/* Handle a terminal control sequence and its parameters. */
+gboolean
+_vte_terminal_handle_sequence(VteTerminal *terminal,
+ const char *match_s,
+ GQuark match,
+ GValueArray *params)
+{
+ VteTerminalSequenceHandler handler;
+ gboolean ret;
+
+ _VTE_DEBUG_IF(VTE_DEBUG_PARSE)
+ display_control_sequence(match_s, params);
+
+ /* Find the handler for this control sequence. */
+ handler = _vte_sequence_get_handler (match_s);
+
+ if (handler != NULL) {
+ /* Let the handler handle it. */
+ ret = handler(terminal, match_s, match, params);
+ } else {
+ _vte_debug_print (VTE_DEBUG_MISC,
+ "No handler for control sequence `%s' defined.\n",
+ match_s);
+ ret = FALSE;
+ }
+
+ return ret;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]