-# Copyright 2014-2017 Free Software Foundation, Inc.
+# Copyright 2014-2019 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result
return $result
}
+
+# Wrap STR in an ANSI terminal escape sequences -- one to set the
+# style to STYLE, and one to reset the style to the default. The
+# return value is suitable for use as a regular expression.
+
+# STYLE can either be the payload part of an ANSI terminal sequence,
+# or a shorthand for one of the gdb standard styles: "file",
+# "function", "variable", or "address".
+
+proc style {str style} {
+ switch -exact -- $style {
+ title { set style 1 }
+ file { set style 32 }
+ function { set style 33 }
+ highlight { set style 31 }
+ variable { set style 36 }
+ address { set style 34 }
+ }
+ return "\033\\\[${style}m${str}\033\\\[m"
+}