]>
Commit | Line | Data |
---|---|---|
ed3ef339 DE |
1 | ;; Additional pretty-printer support. |
2 | ;; | |
3 | ;; Copyright (C) 2014 Free Software Foundation, Inc. | |
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 | |
22 | (*pretty-printers* pretty-printer? objfile? | |
23 | objfile-pretty-printers set-objfile-pretty-printers!)) | |
24 | #:use-module (gdb init)) | |
25 | ||
26 | (define-public (prepend-pretty-printer! obj matcher) | |
27 | "Add MATCHER to the beginning of the pretty-printer list for OBJ. | |
28 | If OBJ is #f, add MATCHER to the global list." | |
29 | (%assert-type (pretty-printer? matcher) matcher SCM_ARG1 | |
30 | 'prepend-pretty-printer!) | |
31 | (cond ((eq? obj #f) | |
32 | (set! *pretty-printers* (cons matcher *pretty-printers*))) | |
33 | ((objfile? obj) | |
34 | (set-objfile-pretty-printers! obj | |
35 | (cons matcher | |
36 | (objfile-pretty-printers obj)))) | |
37 | (else | |
38 | (%assert-type #f obj SCM_ARG1 'prepend-pretty-printer!)))) | |
39 | ||
40 | (define-public (append-pretty-printer! obj matcher) | |
41 | "Add MATCHER to the end of the pretty-printer list for OBJ. | |
42 | If OBJ is #f, add MATCHER to the global list." | |
43 | (%assert-type (pretty-printer? matcher) matcher SCM_ARG1 | |
44 | 'append-pretty-printer!) | |
45 | (cond ((eq? obj #f) | |
46 | (set! *pretty-printers* (append! *pretty-printers* (list matcher)))) | |
47 | ((objfile? obj) | |
48 | (set-objfile-pretty-printers! obj | |
49 | (append! (objfile-pretty-printers obj) | |
50 | matcher))) | |
51 | (else | |
52 | (%assert-type #f obj SCM_ARG1 'append-pretty-printer!)))) |