]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/guile/lib/gdb/printing.scm
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / guile / lib / gdb / printing.scm
CommitLineData
ed3ef339
DE
1;; Additional pretty-printer support.
2;;
1d506c26 3;; Copyright (C) 2014-2024 Free Software Foundation, Inc.
ed3ef339
DE
4;;
5;; This file is part of GDB.
6;;
7;; This program is free software; you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation; either version 3 of the License, or
10;; (at your option) any later version.
11;;
12;; This program is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16;;
17;; You should have received a copy of the GNU General Public License
18;; along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gdb printing)
21 #:use-module ((gdb) #:select
ee7333ae
DE
22 (pretty-printer? objfile? progspace?
23 pretty-printers set-pretty-printers!
ded03782
DE
24 objfile-pretty-printers set-objfile-pretty-printers!
25 progspace-pretty-printers set-progspace-pretty-printers!))
186fcde0 26 #:use-module (gdb support))
ed3ef339
DE
27
28(define-public (prepend-pretty-printer! obj matcher)
29 "Add MATCHER to the beginning of the pretty-printer list for OBJ.
30If OBJ is #f, add MATCHER to the global list."
186fcde0
DE
31 (assert-type (pretty-printer? matcher) matcher SCM_ARG1
32 'prepend-pretty-printer! "pretty-printer")
ed3ef339 33 (cond ((eq? obj #f)
ee7333ae 34 (set-pretty-printers! (cons matcher (pretty-printers))))
ed3ef339 35 ((objfile? obj)
ded03782
DE
36 (set-objfile-pretty-printers!
37 obj (cons matcher (objfile-pretty-printers obj))))
38 ((progspace? obj)
39 (set-progspace-pretty-printers!
40 obj (cons matcher (progspace-pretty-printers obj))))
ed3ef339 41 (else
186fcde0
DE
42 (assert-type #f obj SCM_ARG1 'prepend-pretty-printer!
43 "#f, objfile, or progspace"))))
ed3ef339
DE
44
45(define-public (append-pretty-printer! obj matcher)
46 "Add MATCHER to the end of the pretty-printer list for OBJ.
47If OBJ is #f, add MATCHER to the global list."
186fcde0
DE
48 (assert-type (pretty-printer? matcher) matcher SCM_ARG1
49 'append-pretty-printer! "pretty-printer")
ed3ef339 50 (cond ((eq? obj #f)
ee7333ae 51 (set-pretty-printers! (append! (pretty-printers) (list matcher))))
ed3ef339 52 ((objfile? obj)
ded03782
DE
53 (set-objfile-pretty-printers!
54 obj (append! (objfile-pretty-printers obj) (list matcher))))
55 ((progspace? obj)
56 (set-progspace-pretty-printers!
57 obj (append! (progspace-pretty-printers obj) (list matcher))))
ed3ef339 58 (else
186fcde0
DE
59 (assert-type #f obj SCM_ARG1 'append-pretty-printer!
60 "#f, objfile, or progspace"))))