vte r2262 - in trunk: . src
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: vte r2262 - in trunk: . src
- Date: Mon, 1 Dec 2008 09:05:56 +0000 (UTC)
Author: behdad
Date: Mon Dec 1 09:05:56 2008
New Revision: 2262
URL: http://svn.gnome.org/viewvc/vte?rev=2262&view=rev
Log:
2008-12-01 Behdad Esfahbod <behdad gnome org>
* src/vteseq.c (display_control_sequence),
(_vte_terminal_handle_sequence):
Some cleanup of the gcc label vtable code before I rip it out.
Modified:
trunk/ChangeLog
trunk/src/vteseq.c
Modified: trunk/src/vteseq.c
==============================================================================
--- trunk/src/vteseq.c (original)
+++ trunk/src/vteseq.c Mon Dec 1 09:05:56 2008
@@ -36,6 +36,41 @@
+static void
+display_control_sequence(const char *name, GValueArray *params)
+{
+#ifdef VTE_DEBUG
+ 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
+}
+
+
/* A couple are duplicated from vte.c, to keep them static... */
/* Find the character an the given position in the backscroll buffer. */
@@ -516,51 +551,91 @@
* Sequence handling boilerplate
*/
-#if __GNUC__ >= 4
-#define USE_GCC_LABELS 1
-#endif
-
#define VTE_SEQUENCE_HANDLER_SIGNATURE(name) \
- void name (VteTerminal *terminal, \
- GValueArray *params)
+ void name (VteTerminal *terminal G_GNUC_UNUSED, \
+ GValueArray *params G_GNUC_UNUSED)
+#define VTE_SEQUENCE_HANDLER_PROTO(name) \
+ static VTE_SEQUENCE_HANDLER_SIGNATURE (name)
+
+#define VTE_SEQUENCE_HANDLER_INVOKE(handler, terminal, params) \
+ vte_sequence_handler_invoke (VTE_SEQUENCE_HANDLER_REFERENCE (handler), (terminal), (params))
/* The type of sequence handler handle. */
#ifndef USE_GCC_LABELS
+#if __GNUC__ >= 4
+#define USE_GCC_LABELS 1
+#else
+#define USE_GCC_LABELS 0
+#endif
+#endif
+
+#if !USE_GCC_LABELS
typedef VTE_SEQUENCE_HANDLER_SIGNATURE((*VteTerminalSequenceHandler));
#define VTE_SEQUENCE_HANDLER_REFERENCE(name) (name)
#define vte_sequence_handler_invoke(handler, terminal, params) (handler) ((terminal), (params))
-#define VTE_SEQUENCE_HANDLER_INVOKE(handler, terminal, params) (handler) ((terminal), (params))
-
#else
typedef void *VteTerminalSequenceHandler;
-
#define VTE_SEQUENCE_HANDLER_LABEL0(name) name##_label
#define VTE_SEQUENCE_HANDLER_LABEL(name) VTE_SEQUENCE_HANDLER_LABEL0(name)
#define VTE_SEQUENCE_HANDLER_REFERENCE(name) \
((VteTerminalSequenceHandler) ((char *) &&VTE_SEQUENCE_HANDLER_LABEL(name) - (char *) && vte_sequence_handler__base_label))
#define vte_sequence_handler_invoke(handler, terminal, params) \
- vte_sequence_handler_invoke_internal ((handler), NULL, (terminal), (params))
+ vte_sequence_handler_invoke_internal((handler), NULL, (terminal), (params)) \
-#define VTE_SEQUENCE_HANDLER_INVOKE(handler, terminal, params) \
- vte_sequence_handler_invoke (VTE_SEQUENCE_HANDLER_REFERENCE (handler), (terminal), (params))
+#endif
-static void
+
+
+
+
+
+/* More boilerplate */
+
+#if USE_GCC_LABELS
+
+void
+_vte_terminal_handle_sequence(VteTerminal *terminal2,
+ const char *match_s,
+ GQuark match G_GNUC_UNUSED,
+ GValueArray *params2)
+{
+
+void
vte_sequence_handler_invoke_internal (VteTerminalSequenceHandler handler,
- const char *name2,
- VteTerminal *terminal2,
- GValueArray *params2);
+ const char *name3,
+ VteTerminal *terminal3,
+ GValueArray *params3)
+{
+ /* Open-ended functions. Close at the other end of the file! */
+
+/* Prototype all lables... */
+#define VTE_SEQUENCE_HANDLER(name) __label__ VTE_SEQUENCE_HANDLER_LABEL (name);
+ __label__ vte_sequence_handler__base_label;
+#include "vteseq-list.h"
+#undef VTE_SEQUENCE_HANDLER
+
+#define static auto
#endif
+
+/* Prototype all handlers... */
+#define VTE_SEQUENCE_HANDLER(name) VTE_SEQUENCE_HANDLER_PROTO (name);
+#include "vteseq-list.h"
+#undef VTE_SEQUENCE_HANDLER
+
+
+
+
/* Call another handler, offsetting any long arguments by the given
* increment value. */
static void
@@ -606,45 +681,6 @@
}
-
-
-
-
-/* More boilerplate */
-
-#ifdef USE_GCC_LABELS
-static void
-vte_sequence_handler_invoke_internal (VteTerminalSequenceHandler handler,
- const char *name2,
- VteTerminal *terminal2,
- GValueArray *params2)
-{
- /* Open-ended function. Closes at the other end of the file! */
-
-/* Prototype all lables... */
-#define VTE_SEQUENCE_HANDLER(name) __label__ VTE_SEQUENCE_HANDLER_LABEL (name);
- __label__ vte_sequence_handler__base_label;
-#include "vteseq-list.h"
-#undef VTE_SEQUENCE_HANDLER
-
-#define static auto
-
-#endif
-
-
-
-#define VTE_SEQUENCE_HANDLER_PROTO(name) \
- static VTE_SEQUENCE_HANDLER_SIGNATURE (name)
-
-/* Prototype all handlers... */
-#define VTE_SEQUENCE_HANDLER(name) VTE_SEQUENCE_HANDLER_PROTO (name);
-#include "vteseq-list.h"
-#undef VTE_SEQUENCE_HANDLER
-
-
-
-
-
/* Manipulate certain terminal attributes. */
static void
vte_sequence_handler_decset_internal(VteTerminal *terminal,
@@ -3359,86 +3395,57 @@
}
}
-#ifdef USE_GCC_LABELS
+
+#if USE_GCC_LABELS
#undef static
- if (G_LIKELY (name2))
- handler = _vte_sequence_get_handler (name2);
+ if (G_LIKELY (name3))
+ handler = _vte_sequence_get_handler (name3);
goto *((char *) &&vte_sequence_handler__base_label + (gsize) handler);
-#define VTE_SEQUENCE_HANDLER(name) VTE_SEQUENCE_HANDLER_LABEL (name): name (terminal2, params2); return;
+#define VTE_SEQUENCE_HANDLER(name) VTE_SEQUENCE_HANDLER_LABEL (name): name (terminal3, params3); return;
vte_sequence_handler__base_label:
_vte_debug_print (VTE_DEBUG_MISC,
"No handler for control sequence `%s' defined.\n",
- name2);
+ name3);
return;
#include "vteseq-list.h"
#undef VTE_SEQUENCE_HANDLER
}
-#endif
+ _VTE_DEBUG_IF(VTE_DEBUG_PARSE)
+ display_control_sequence(match_s, params2);
-static void
-display_control_sequence(const char *name, GValueArray *params)
-{
-#ifdef VTE_DEBUG
- 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
+ vte_sequence_handler_invoke_internal (NULL, match_s, terminal2, params2);
}
+#else
+
+
/* Handle a terminal control sequence and its parameters. */
void
-_vte_terminal_handle_sequence(VteTerminal *terminal,
+_vte_terminal_handle_sequence(VteTerminal *terminal2,
const char *match_s,
- GQuark match,
- GValueArray *params)
+ GQuark match G_GNUC_UNUSED,
+ GValueArray *params2)
{
VteTerminalSequenceHandler handler;
_VTE_DEBUG_IF(VTE_DEBUG_PARSE)
- display_control_sequence(match_s, params);
+ display_control_sequence(match_s, params2);
-#ifdef USE_GCC_LABELS
- vte_sequence_handler_invoke_internal (NULL, match_s, terminal, params);
-#else
/* Find the handler for this control sequence. */
handler = _vte_sequence_get_handler (match_s);
if (handler != NULL) {
/* Let the handler handle it. */
- vte_sequence_handler_invoke (handler, terminal, params);
+ vte_sequence_handler_invoke (handler, terminal2, params2);
} else {
_vte_debug_print (VTE_DEBUG_MISC,
"No handler for control sequence `%s' defined.\n",
match_s);
}
-#endif
}
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]