[vte] matcher: Use less relocations



commit a0d4cd974927a3b08c09d346c34430775835179d
Author: Christian Persch <chpe gnome org>
Date:   Thu May 22 20:10:45 2014 +0200

    matcher: Use less relocations

 src/caps.c    |  455 +++++++++++++++++++++++++++++----------------------------
 src/caps.h    |    8 +-
 src/matcher.c |   12 +-
 3 files changed, 237 insertions(+), 238 deletions(-)
---
diff --git a/src/caps.c b/src/caps.c
index faaea19..3f0e3bc 100644
--- a/src/caps.c
+++ b/src/caps.c
@@ -40,251 +40,256 @@
 #define SI  "\017"
 #define DEL "\177"
 
+#define ENTRY(seq, name) seq "\0" name "\0"
+#define COMMENT(c)
+
 /* From some really old XTerm docs we had at the office, and an updated
  * version at Moy, Gildea, and Dickey. */
-struct _vte_capability_string _vte_xterm_capability_strings[] = {
-       {ENQ, "return-terminal-status"},
-        {BEL, "bell"},
-        {BS,  "backspace"},
-        {TAB, "tab"},
-        {LF,  "line-feed"},
-       {VT,  "vertical-tab"},
-       {FF,  "form-feed"},
-        {CR,  "carriage-return"},
-        {DEL, "backspace"},
+const char _vte_xterm_capability_strings[] =
+        ENTRY(ENQ, "return-terminal-status")
+        ENTRY(BEL, "bell")
+        ENTRY(BS,  "backspace")
+        ENTRY(TAB, "tab")
+        ENTRY(LF,  "line-feed")
+        ENTRY(VT,  "vertical-tab")
+        ENTRY(FF,  "form-feed")
+        ENTRY(CR,  "carriage-return")
+        ENTRY(DEL, "backspace")
+
+        ENTRY(ESC " F", "7-bit-controls")
+        ENTRY(ESC " G", "8-bit-controls")
+        ENTRY(ESC " L", "ansi-conformance-level-1")
+        ENTRY(ESC " M", "ansi-conformance-level-2")
+        ENTRY(ESC " N", "ansi-conformance-level-3")
+        ENTRY(ESC "#3", "double-height-top-half")
+        ENTRY(ESC "#4", "double-height-bottom-half")
+        ENTRY(ESC "#5", "single-width")
+        ENTRY(ESC "#6", "double-width")
+        ENTRY(ESC "#8", "screen-alignment-test")
 
-       {ESC " F", "7-bit-controls"},
-       {ESC " G", "8-bit-controls"},
-       {ESC " L", "ansi-conformance-level-1"},
-       {ESC " M", "ansi-conformance-level-2"},
-       {ESC " N", "ansi-conformance-level-3"},
-       {ESC "#3", "double-height-top-half"},
-       {ESC "#4", "double-height-bottom-half"},
-       {ESC "#5", "single-width"},
-       {ESC "#6", "double-width"},
-       {ESC "#8", "screen-alignment-test"},
+        COMMENT(/* These are actually designate-other-coding-system from ECMA 35,)
+                   COMMENT( * but we don't support the full repertoire.  Actually, we don't)
+                   COMMENT( * know what the full repertoire looks like. */)
+        ENTRY(ESC "%%@", "default-character-set")
+        ENTRY(ESC "%%G", "utf-8-character-set")
 
-       /* These are actually designate-other-coding-system from ECMA 35,
-        * but we don't support the full repertoire.  Actually, we don't
-        * know what the full repertoire looks like. */
-       {ESC "%%@", "default-character-set"},
-       {ESC "%%G", "utf-8-character-set"},
+        ENTRY(ESC "(0", "alternate-character-set-start")
+        ENTRY(ESC "(B", "alternate-character-set-end")
 
-        {ESC "(0", "alternate-character-set-start"},
-        {ESC "(B", "alternate-character-set-end"},
+        ENTRY(ESC "7", "save-cursor")
+        ENTRY(ESC "8", "restore-cursor")
+        ENTRY(ESC "=", "application-keypad")
+        ENTRY(ESC ">", "normal-keypad")
+        ENTRY(ESC "D", "index")
+        ENTRY(ESC "E", "next-line")
+        COMMENT(/* ENTRY(ESC "F", "cursor-lower-left") */)
+        ENTRY(ESC "H", "tab-set")
+        ENTRY(ESC "M", "reverse-index")
+        COMMENT(/* ENTRY(ESC "N", "single-shift-g2") */)
+        COMMENT(/* ENTRY(ESC "O", "single-shift-g3") */)
+        ENTRY(ESC "P%s" ESC "\\", "device-control-string")
+        ENTRY(ESC "V", "start-of-guarded-area")
+        ENTRY(ESC "W", "end-of-guarded-area")
+        ENTRY(ESC "X", "start-of-string")
+        ENTRY(ESC "\\", "end-of-string")
+        ENTRY(ESC "Z", "return-terminal-id")
+        ENTRY(ESC "c", "full-reset")
+        ENTRY(ESC "l", "memory-lock")
+        ENTRY(ESC "m", "memory-unlock")
+        COMMENT(/* ENTRY(ESC "n", "invoke-g2-character-set") */)
+        COMMENT(/* ENTRY(ESC "o", "invoke-g3-character-set") */)
+        COMMENT(/* ENTRY(ESC "|", "invoke-g3-character-set-as-gr") */)
+        COMMENT(/* ENTRY(ESC "}", "invoke-g2-character-set-as-gr") */)
+        COMMENT(/* ENTRY(ESC "~", "invoke-g1-character-set-as-gr") */)
 
-       {ESC "7", "save-cursor"},
-       {ESC "8", "restore-cursor"},
-       {ESC "=", "application-keypad"},
-       {ESC ">", "normal-keypad"},
-       {ESC "D", "index"},
-       {ESC "E", "next-line"},
-        /* {ESC "F", "cursor-lower-left"}, */
-       {ESC "H", "tab-set"},
-       {ESC "M", "reverse-index"},
-       /* {ESC "N", "single-shift-g2"}, */
-       /* {ESC "O", "single-shift-g3"}, */
-       {ESC "P%s" ESC "\\", "device-control-string"},
-       {ESC "V", "start-of-guarded-area"},
-       {ESC "W", "end-of-guarded-area"},
-       {ESC "X", "start-of-string"},
-       {ESC "\\", "end-of-string"},
-       {ESC "Z", "return-terminal-id"},
-       {ESC "c", "full-reset"},
-       {ESC "l", "memory-lock"},
-       {ESC "m", "memory-unlock"},
-       /* {ESC "n", "invoke-g2-character-set"}, */
-       /* {ESC "o", "invoke-g3-character-set"}, */
-       /* {ESC "|", "invoke-g3-character-set-as-gr"}, */
-       /* {ESC "}", "invoke-g2-character-set-as-gr"}, */
-       /* {ESC "~", "invoke-g1-character-set-as-gr"}, */
+        COMMENT(/* APC stuff omitted. */)
 
-       /* APC stuff omitted. */
+        COMMENT(/* DCS stuff omitted. */)
 
-       /* DCS stuff omitted. */
+        ENTRY(CSI "@", "insert-blank-characters")
+        ENTRY(CSI "%d@", "insert-blank-characters")
+        ENTRY(CSI "A", "cursor-up")
+        ENTRY(CSI "%dA", "cursor-up")
+        ENTRY(CSI "B", "cursor-down")
+        ENTRY(CSI "%dB", "cursor-down")
+        ENTRY(CSI "C", "cursor-forward")
+        ENTRY(CSI "%dC", "cursor-forward")
+        ENTRY(CSI "D", "cursor-backward")
+        ENTRY(CSI "%dD", "cursor-backward")
+        ENTRY(CSI "E", "cursor-next-line")
+        ENTRY(CSI "%dE", "cursor-next-line")
+        ENTRY(CSI "F", "cursor-preceding-line")
+        ENTRY(CSI "%dF", "cursor-preceding-line")
+        ENTRY(CSI "G", "cursor-character-absolute")
+        ENTRY(CSI "%dG", "cursor-character-absolute")
+        ENTRY(CSI "H", "cursor-position")
+        ENTRY(CSI ";H", "cursor-position")
+        ENTRY(CSI "%dH", "cursor-position")
+        ENTRY(CSI "%d;H", "cursor-position")
+        ENTRY(CSI ";%dH", "cursor-position-top-row")
+        ENTRY(CSI "%d;%dH", "cursor-position")
+        ENTRY(CSI "I", "cursor-forward-tabulation")
+        ENTRY(CSI "%dI", "cursor-forward-tabulation")
+        ENTRY(CSI "J", "erase-in-display")
+        ENTRY(CSI "%dJ", "erase-in-display")
+        ENTRY(CSI "?J", "selective-erase-in-display")
+        ENTRY(CSI "?%dJ", "selective-erase-in-display")
+        ENTRY(CSI "K", "erase-in-line")
+        ENTRY(CSI "%dK", "erase-in-line")
+        ENTRY(CSI "?K", "selective-erase-in-line")
+        ENTRY(CSI "?%dK", "selective-erase-in-line")
+        ENTRY(CSI "L", "insert-lines")
+        ENTRY(CSI "%dL", "insert-lines")
+        ENTRY(CSI "M", "delete-lines")
+        ENTRY(CSI "%dM", "delete-lines")
+        ENTRY(CSI "P", "delete-characters")
+        ENTRY(CSI "%dP", "delete-characters")
+        ENTRY(CSI "S", "scroll-up")
+        ENTRY(CSI "%dS", "scroll-up")
+        ENTRY(CSI "T", "scroll-down")
+        ENTRY(CSI "%dT", "scroll-down")
+        ENTRY(CSI "%d;%d;%d;%d;%dT", "initiate-hilite-mouse-tracking")
+        ENTRY(CSI "X", "erase-characters")
+        ENTRY(CSI "%dX", "erase-characters")
+        ENTRY(CSI "Z", "cursor-back-tab")
+        ENTRY(CSI "%dZ", "cursor-back-tab")
 
-       {CSI "@", "insert-blank-characters"},
-       {CSI "%d@", "insert-blank-characters"},
-       {CSI "A", "cursor-up"},
-       {CSI "%dA", "cursor-up"},
-       {CSI "B", "cursor-down"},
-       {CSI "%dB", "cursor-down"},
-       {CSI "C", "cursor-forward"},
-       {CSI "%dC", "cursor-forward"},
-       {CSI "D", "cursor-backward"},
-       {CSI "%dD", "cursor-backward"},
-       {CSI "E", "cursor-next-line"},
-       {CSI "%dE", "cursor-next-line"},
-       {CSI "F", "cursor-preceding-line"},
-       {CSI "%dF", "cursor-preceding-line"},
-       {CSI "G", "cursor-character-absolute"},
-       {CSI "%dG", "cursor-character-absolute"},
-        {CSI "H", "cursor-position"},
-       {CSI ";H", "cursor-position"},
-       {CSI "%dH", "cursor-position"},
-       {CSI "%d;H", "cursor-position"},
-        {CSI ";%dH", "cursor-position-top-row"},
-       {CSI "%d;%dH", "cursor-position"},
-       {CSI "I", "cursor-forward-tabulation"},
-        {CSI "%dI", "cursor-forward-tabulation"},
-       {CSI "J", "erase-in-display"},
-       {CSI "%dJ", "erase-in-display"},
-       {CSI "?J", "selective-erase-in-display"},
-       {CSI "?%dJ", "selective-erase-in-display"},
-       {CSI "K", "erase-in-line"},
-       {CSI "%dK", "erase-in-line"},
-       {CSI "?K", "selective-erase-in-line"},
-       {CSI "?%dK", "selective-erase-in-line"},
-       {CSI "L", "insert-lines"},
-       {CSI "%dL", "insert-lines"},
-       {CSI "M", "delete-lines"},
-       {CSI "%dM", "delete-lines"},
-       {CSI "P", "delete-characters"},
-       {CSI "%dP", "delete-characters"},
-       {CSI "S", "scroll-up"},
-       {CSI "%dS", "scroll-up"},
-       {CSI "T", "scroll-down"},
-       {CSI "%dT", "scroll-down"},
-       {CSI "%d;%d;%d;%d;%dT", "initiate-hilite-mouse-tracking"},
-       {CSI "X", "erase-characters"},
-       {CSI "%dX", "erase-characters"},
-       {CSI "Z", "cursor-back-tab"},
-       {CSI "%dZ", "cursor-back-tab"},
+        ENTRY(CSI "`", "character-position-absolute")
+        ENTRY(CSI "%d`", "character-position-absolute")
+        ENTRY(CSI "b", "repeat")
+        ENTRY(CSI "%db", "repeat")
+        ENTRY(CSI "c", "send-primary-device-attributes")
+        ENTRY(CSI "%dc", "send-primary-device-attributes")
+        ENTRY(CSI ">c", "send-secondary-device-attributes")
+        ENTRY(CSI ">%dc", "send-secondary-device-attributes")
+        ENTRY(CSI "=c", "send-tertiary-device-attributes")
+        ENTRY(CSI "=%dc", "send-tertiary-device-attributes")
+        ENTRY(CSI "?%mc", "linux-console-cursor-attributes")
+        ENTRY(CSI "d", "line-position-absolute")
+        ENTRY(CSI "%dd", "line-position-absolute")
+        ENTRY(CSI "f", "cursor-position")
+        ENTRY(CSI ";f", "cursor-position")
+        ENTRY(CSI "%df", "cursor-position")
+        ENTRY(CSI "%d;f", "cursor-position")
+        ENTRY(CSI ";%df", "cursor-position-top-row")
+        ENTRY(CSI "%d;%df", "cursor-position")
+        ENTRY(CSI "g", "tab-clear")
+        ENTRY(CSI "%dg", "tab-clear")
 
-       {CSI "`", "character-position-absolute"},
-       {CSI "%d`", "character-position-absolute"},
-       {CSI "b", "repeat"},
-       {CSI "%db", "repeat"},
-       {CSI "c", "send-primary-device-attributes"},
-       {CSI "%dc", "send-primary-device-attributes"},
-       {CSI ">c", "send-secondary-device-attributes"},
-       {CSI ">%dc", "send-secondary-device-attributes"},
-       {CSI "=c", "send-tertiary-device-attributes"},
-       {CSI "=%dc", "send-tertiary-device-attributes"},
-       {CSI "?%mc", "linux-console-cursor-attributes"},
-       {CSI "d", "line-position-absolute"},
-       {CSI "%dd", "line-position-absolute"},
-        {CSI "f", "cursor-position"},
-        {CSI ";f", "cursor-position"},
-        {CSI "%df", "cursor-position"},
-        {CSI "%d;f", "cursor-position"},
-        {CSI ";%df", "cursor-position-top-row"},
-        {CSI "%d;%df", "cursor-position"},
-       {CSI "g", "tab-clear"},
-       {CSI "%dg", "tab-clear"},
+        ENTRY(CSI "%mh", "set-mode")
+        ENTRY(CSI "?%mh", "decset")
 
-       {CSI "%mh", "set-mode"},
-       {CSI "?%mh", "decset"},
+        ENTRY(CSI "%mi", "media-copy")
+        ENTRY(CSI "?%mi", "dec-media-copy")
 
-       {CSI "%mi", "media-copy"},
-       {CSI "?%mi", "dec-media-copy"},
+        ENTRY(CSI "%ml", "reset-mode")
+        ENTRY(CSI "?%ml", "decreset")
 
-       {CSI "%ml", "reset-mode"},
-       {CSI "?%ml", "decreset"},
+        ENTRY(CSI "%mm", "character-attributes")
 
-       {CSI "%mm", "character-attributes"},
+        ENTRY(CSI "%dn", "device-status-report")
+        ENTRY(CSI "?%dn", "dec-device-status-report")
+        ENTRY(CSI "!p", "soft-reset")
+        ENTRY(CSI "%d;%d\"p", "set-conformance-level")
+        ENTRY(CSI "%d\"q", "select-character-protection")
 
-       {CSI "%dn", "device-status-report"},
-       {CSI "?%dn", "dec-device-status-report"},
-       {CSI "!p", "soft-reset"},
-       {CSI "%d;%d\"p", "set-conformance-level"},
-       {CSI "%d\"q", "select-character-protection"},
+        ENTRY(CSI "r", "set-scrolling-region")
+        ENTRY(CSI ";r", "set-scrolling-region")
+        ENTRY(CSI ";%dr", "set-scrolling-region-from-start")
+        ENTRY(CSI "%dr", "set-scrolling-region-to-end")
+        ENTRY(CSI "%d;r", "set-scrolling-region-to-end")
+        ENTRY(CSI "%d;%dr", "set-scrolling-region")
 
-       {CSI "r", "set-scrolling-region"},
-       {CSI ";r", "set-scrolling-region"},
-       {CSI ";%dr", "set-scrolling-region-from-start"},
-       {CSI "%dr", "set-scrolling-region-to-end"},
-       {CSI "%d;r", "set-scrolling-region-to-end"},
-       {CSI "%d;%dr", "set-scrolling-region"},
+        ENTRY(CSI "?%mr", "restore-mode")
+        ENTRY(CSI "s", "save-cursor")
+        ENTRY(CSI "?%ms", "save-mode")
+        ENTRY(CSI "u", "restore-cursor")
 
-       {CSI "?%mr", "restore-mode"},
-       {CSI "s", "save-cursor"},
-       {CSI "?%ms", "save-mode"},
-       {CSI "u", "restore-cursor"},
+        ENTRY(CSI "%mt", "window-manipulation")
 
-       {CSI "%mt", "window-manipulation"},
+        ENTRY(CSI "%d;%d;%d;%dw", "enable-filter-rectangle")
+        ENTRY(CSI "%dx", "request-terminal-parameters")
+        ENTRY(CSI "%d;%d'z", "enable-locator-reporting")
+        ENTRY(CSI "%m'ENTRY(", "select-locator-events")
+        ENTRY(CSI "%d'|", "request-locator-position")
 
-       {CSI "%d;%d;%d;%dw", "enable-filter-rectangle"},
-       {CSI "%dx", "request-terminal-parameters"},
-       {CSI "%d;%d'z", "enable-locator-reporting"},
-       {CSI "%m'{", "select-locator-events"},
-       {CSI "%d'|", "request-locator-position"},
+        COMMENT(/* Set text parameters, BEL-terminated versions. */)
+        ENTRY(OSC ";%s" BEL, "set-icon-and-window-title") COMMENT(/* undocumented default */)
+        ENTRY(OSC "0;%s" BEL, "set-icon-and-window-title")
+        ENTRY(OSC "1;%s" BEL, "set-icon-title")
+        ENTRY(OSC "2;%s" BEL, "set-window-title")
+        ENTRY(OSC "3;%s" BEL, "set-xproperty")
+        ENTRY(OSC "4;%s" BEL, "change-color-bel")
+        ENTRY(OSC "6;%s" BEL, "set-current-file-uri")
+        ENTRY(OSC "7;%s" BEL, "set-current-directory-uri")
+        ENTRY(OSC "10;%s" BEL, "change-foreground-color-bel")
+        ENTRY(OSC "11;%s" BEL, "change-background-color-bel")
+        ENTRY(OSC "12;%s" BEL, "change-cursor-color-bel")
+        ENTRY(OSC "13;%s" BEL, "change-mouse-cursor-foreground-color-bel")
+        ENTRY(OSC "14;%s" BEL, "change-mouse-cursor-background-color-bel")
+        ENTRY(OSC "15;%s" BEL, "change-tek-foreground-color-bel")
+        ENTRY(OSC "16;%s" BEL, "change-tek-background-color-bel")
+        ENTRY(OSC "17;%s" BEL, "change-highlight-background-color-bel")
+        ENTRY(OSC "18;%s" BEL, "change-tek-cursor-color-bel")
+        ENTRY(OSC "19;%s" BEL, "change-highlight-foreground-color-bel")
+        ENTRY(OSC "46;%s" BEL, "change-logfile")
+        ENTRY(OSC "50;#%d" BEL, "change-font-number")
+        ENTRY(OSC "50;%s" BEL, "change-font-name")
+        ENTRY(OSC "104" BEL, "reset-color")
+        ENTRY(OSC "104;%m" BEL, "reset-color")
+        ENTRY(OSC "110" BEL, "reset-foreground-color")
+        ENTRY(OSC "111" BEL, "reset-background-color")
+        ENTRY(OSC "112" BEL, "reset-cursor-color")
+        ENTRY(OSC "113" BEL, "reset-mouse-cursor-foreground-color")
+        ENTRY(OSC "114" BEL, "reset-mouse-cursor-background-color")
+        ENTRY(OSC "115" BEL, "reset-tek-foreground-color")
+        ENTRY(OSC "116" BEL, "reset-tek-background-color")
+        ENTRY(OSC "117" BEL, "reset-highlight-background-color")
+        ENTRY(OSC "118" BEL, "reset-tek-cursor-color")
+        ENTRY(OSC "119" BEL, "reset-highlight-foreground-color")
 
-       /* Set text parameters, BEL-terminated versions. */
-       {OSC ";%s" BEL, "set-icon-and-window-title"}, /* undocumented default */
-       {OSC "0;%s" BEL, "set-icon-and-window-title"},
-       {OSC "1;%s" BEL, "set-icon-title"},
-       {OSC "2;%s" BEL, "set-window-title"},
-       {OSC "3;%s" BEL, "set-xproperty"},
-       {OSC "4;%s" BEL, "change-color-bel"},
-        {OSC "6;%s" BEL, "set-current-file-uri"},
-        {OSC "7;%s" BEL, "set-current-directory-uri"},
-       {OSC "10;%s" BEL, "change-foreground-color-bel"},
-       {OSC "11;%s" BEL, "change-background-color-bel"},
-       {OSC "12;%s" BEL, "change-cursor-color-bel"},
-       {OSC "13;%s" BEL, "change-mouse-cursor-foreground-color-bel"},
-       {OSC "14;%s" BEL, "change-mouse-cursor-background-color-bel"},
-       {OSC "15;%s" BEL, "change-tek-foreground-color-bel"},
-       {OSC "16;%s" BEL, "change-tek-background-color-bel"},
-       {OSC "17;%s" BEL, "change-highlight-background-color-bel"},
-       {OSC "18;%s" BEL, "change-tek-cursor-color-bel"},
-       {OSC "19;%s" BEL, "change-highlight-foreground-color-bel"},
-       {OSC "46;%s" BEL, "change-logfile"},
-       {OSC "50;#%d" BEL, "change-font-number"},
-       {OSC "50;%s" BEL, "change-font-name"},
-       {OSC "104" BEL, "reset-color"},
-       {OSC "104;%m" BEL, "reset-color"},
-       {OSC "110" BEL, "reset-foreground-color"},
-       {OSC "111" BEL, "reset-background-color"},
-       {OSC "112" BEL, "reset-cursor-color"},
-       {OSC "113" BEL, "reset-mouse-cursor-foreground-color"},
-       {OSC "114" BEL, "reset-mouse-cursor-background-color"},
-       {OSC "115" BEL, "reset-tek-foreground-color"},
-       {OSC "116" BEL, "reset-tek-background-color"},
-       {OSC "117" BEL, "reset-highlight-background-color"},
-       {OSC "118" BEL, "reset-tek-cursor-color"},
-       {OSC "119" BEL, "reset-highlight-foreground-color"},
+        COMMENT(/* Set text parameters, ST-terminated versions. */)
+        ENTRY(OSC ";%s" ST, "set-icon-and-window-title") COMMENT(/* undocumented default */)
+        ENTRY(OSC "0;%s" ST, "set-icon-and-window-title")
+        ENTRY(OSC "1;%s" ST, "set-icon-title")
+        ENTRY(OSC "2;%s" ST, "set-window-title")
+        ENTRY(OSC "3;%s" ST, "set-xproperty")
+        ENTRY(OSC "4;%s" ST, "change-color-st")
+        ENTRY(OSC "6;%s" ST, "set-current-file-uri")
+        ENTRY(OSC "7;%s" ST, "set-current-directory-uri")
+        ENTRY(OSC "10;%s" ST, "change-foreground-color-st")
+        ENTRY(OSC "11;%s" ST, "change-background-color-st")
+        ENTRY(OSC "12;%s" ST, "change-cursor-color-st")
+        ENTRY(OSC "13;%s" ST, "change-mouse-cursor-foreground-color-st")
+        ENTRY(OSC "14;%s" ST, "change-mouse-cursor-background-color-st")
+        ENTRY(OSC "15;%s" ST, "change-tek-foreground-color-st")
+        ENTRY(OSC "16;%s" ST, "change-tek-background-color-st")
+        ENTRY(OSC "17;%s" ST, "change-highlight-background-color-st")
+        ENTRY(OSC "18;%s" ST, "change-tek-cursor-color-st")
+        ENTRY(OSC "19;%s" ST, "change-highlight-foreground-color-st")
+        ENTRY(OSC "46;%s" ST, "change-logfile")
+        ENTRY(OSC "50;#%d" ST, "change-font-number")
+        ENTRY(OSC "50;%s" ST, "change-font-name")
+        ENTRY(OSC "104" ST, "reset-color")
+        ENTRY(OSC "104;%m" ST, "reset-color")
+        ENTRY(OSC "110" ST, "reset-foreground-color")
+        ENTRY(OSC "111" ST, "reset-background-color")
+        ENTRY(OSC "112" ST, "reset-cursor-color")
+        ENTRY(OSC "113" ST, "reset-mouse-cursor-foreground-color")
+        ENTRY(OSC "114" ST, "reset-mouse-cursor-background-color")
+        ENTRY(OSC "115" ST, "reset-tek-foreground-color")
+        ENTRY(OSC "116" ST, "reset-tek-background-color")
+        ENTRY(OSC "117" ST, "reset-highlight-background-color")
+        ENTRY(OSC "118" ST, "reset-tek-cursor-color")
+        ENTRY(OSC "119" ST, "reset-highlight-foreground-color")
 
-       /* Set text parameters, ST-terminated versions. */
-       {OSC ";%s" ST, "set-icon-and-window-title"}, /* undocumented default */
-       {OSC "0;%s" ST, "set-icon-and-window-title"},
-       {OSC "1;%s" ST, "set-icon-title"},
-       {OSC "2;%s" ST, "set-window-title"},
-       {OSC "3;%s" ST, "set-xproperty"},
-       {OSC "4;%s" ST, "change-color-st"},
-        {OSC "6;%s" ST, "set-current-file-uri"},
-        {OSC "7;%s" ST, "set-current-directory-uri"},
-       {OSC "10;%s" ST, "change-foreground-color-st"},
-       {OSC "11;%s" ST, "change-background-color-st"},
-       {OSC "12;%s" ST, "change-cursor-color-st"},
-       {OSC "13;%s" ST, "change-mouse-cursor-foreground-color-st"},
-       {OSC "14;%s" ST, "change-mouse-cursor-background-color-st"},
-       {OSC "15;%s" ST, "change-tek-foreground-color-st"},
-       {OSC "16;%s" ST, "change-tek-background-color-st"},
-       {OSC "17;%s" ST, "change-highlight-background-color-st"},
-       {OSC "18;%s" ST, "change-tek-cursor-color-st"},
-       {OSC "19;%s" ST, "change-highlight-foreground-color-st"},
-       {OSC "46;%s" ST, "change-logfile"},
-       {OSC "50;#%d" ST, "change-font-number"},
-       {OSC "50;%s" ST, "change-font-name"},
-       {OSC "104" ST, "reset-color"},
-       {OSC "104;%m" ST, "reset-color"},
-       {OSC "110" ST, "reset-foreground-color"},
-       {OSC "111" ST, "reset-background-color"},
-       {OSC "112" ST, "reset-cursor-color"},
-       {OSC "113" ST, "reset-mouse-cursor-foreground-color"},
-       {OSC "114" ST, "reset-mouse-cursor-background-color"},
-       {OSC "115" ST, "reset-tek-foreground-color"},
-       {OSC "116" ST, "reset-tek-background-color"},
-       {OSC "117" ST, "reset-highlight-background-color"},
-       {OSC "118" ST, "reset-tek-cursor-color"},
-       {OSC "119" ST, "reset-highlight-foreground-color"},
+        COMMENT(/* These may be bogus, I can't find docs for them anywhere (#104154). */)
+        ENTRY(OSC "21;%s" BEL, "set-text-property-21")
+        ENTRY(OSC "2L;%s" BEL, "set-text-property-2L")
+        ENTRY(OSC "21;%s" ST, "set-text-property-21")
+        ENTRY(OSC "2L;%s" ST, "set-text-property-2L")
 
-       /* These may be bogus, I can't find docs for them anywhere (#104154). */
-       {OSC "21;%s" BEL, "set-text-property-21"},
-       {OSC "2L;%s" BEL, "set-text-property-2L"},
-       {OSC "21;%s" ST, "set-text-property-21"},
-       {OSC "2L;%s" ST, "set-text-property-2L"},
+        "\0";
 
-       {NULL, NULL},
-};
+#undef ENTRY
+#undef COMMENT
diff --git a/src/caps.h b/src/caps.h
index b3f6254..6f20d92 100644
--- a/src/caps.h
+++ b/src/caps.h
@@ -35,13 +35,7 @@ G_BEGIN_DECLS
 #define _VTE_CAP_SS2 _VTE_CAP_ESC "N"  /* Single-shift to G2 */
 #define _VTE_CAP_SS3 _VTE_CAP_ESC "O"  /* Single-shift to G3 */
 
-struct _vte_capability_string {
-       const char *code;
-       const char *value;
-};
-
-/* The xterm-specific terminal control strings, terminated by NULLs. */
-extern struct _vte_capability_string _vte_xterm_capability_strings[];
+extern const char _vte_xterm_capability_strings[];
 
 G_END_DECLS
 
diff --git a/src/matcher.c b/src/matcher.c
index c383b61..4c753e2 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -54,15 +54,15 @@ static void
 _vte_matcher_init(struct _vte_matcher *matcher)
 {
        const char *code, *value;
-       int i;
 
        _vte_debug_print(VTE_DEBUG_LIFECYCLE, "_vte_matcher_init()\n");
 
-        for (i = 0; _vte_xterm_capability_strings[i].value != NULL; i++) {
-                code = _vte_xterm_capability_strings[i].code;
-                value = _vte_xterm_capability_strings[i].value;
-                _vte_matcher_add(matcher, code, strlen (code), value);
-        }
+        code = _vte_xterm_capability_strings;
+        do {
+                value = strchr(code, '\0') + 1;
+                _vte_matcher_add(matcher, code, strlen(code), value);
+                code = strchr(value, '\0') + 1;
+        } while (*code);
 
        _VTE_DEBUG_IF(VTE_DEBUG_MATCHER) {
                g_printerr("Matcher contents:\n");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]