]> git.donarmstrong.com Git - lilypond.git/blob - scm/guile-debugger.scm
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scm / guile-debugger.scm
1 ;;;; This file is part of LilyPond, the GNU music typesetter.
2 ;;;;
3 ;;;; Copyright (C) 2010--2015 Ian Hulin <ian@hulin.org.uk>
4 ;;;;
5 ;;;; LilyPond is free software: you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation, either version 3 of the License, or
8 ;;;; (at your option) any later version.
9 ;;;;
10 ;;;; LilyPond is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ;;;; GNU General Public License for more details.
14 ;;;;
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
17
18 ;;; Commentary:
19
20 ;;; This file provides the support routines for a guile debugger called
21 ;;; from an environment controlled by LilyPond.  It works in conjunction
22 ;;; with file guile-debugger.ly.
23
24 ;;; Code:
25
26 (define-module (scm guile-debugger)
27   #:use-module (ice-9 debugger)
28   #:use-module (ice-9 debugging traps)
29   #:use-module (ice-9 debugging trace)
30   #:use-module (ice-9 debugging steps)
31   #:use-module (ice-9 debugging ice-9-debugger-extensions)
32   #:use-module (ice-9 readline)
33   #:export (set-break!
34             clear-break!
35             set-trace-call!
36             clear-trace-call!
37             set-trace-subtree!
38             clear-trace-subtree!
39             debug-help))
40
41 (define (set-break! proc)
42   (install-trap (make <procedure-trap>
43                   #:procedure proc
44                   #:behaviour debug-trap)))
45 (define (clear-break! proc)
46   (uninstall-trap (make <procedure-trap>
47                     #:procedure proc
48                     #:behaviour debug-trap)))
49
50
51 (define (set-trace-call! proc)
52   (install-trap (make <procedure-trap>
53                   #:procedure proc
54                   #:behaviour (list trace-trap
55                                     trace-at-exit))))
56 (define (clear-trace-call! proc)
57   (uninstall-trap (make <procedure-trap>
58                     #:procedure proc
59                     #:behaviour (list trace-trap
60                                       trace-at-exit))))
61
62 (define (set-trace-subtree! proc)
63   (install-trap (make <procedure-trap>
64                   #:procedure proc
65                   #:behaviour (list trace-trap
66                                     trace-until-exit))))
67
68 (define (clear-trace-subtree! proc)
69   (uninstall-trap (make <procedure-trap>
70                     #:procedure proc
71                     #:behaviour (list trace-trap
72                                       trace-until-exit))))
73
74 (define (debug-help )
75   (display "\nYou may add the following commands as debugging statements in your source file\n")
76   (display "or enter the set-x! commands at the guile prompt:\n\n")
77   (display " (set-break! <procedure>)\n")
78   (display "   causes guile to enter debugger on a call to <procedure>\n")
79   (display " (clear-break! <procedure>)\n")
80   (display "   disables a breakpoint previously set on a call to <procedure>\n")
81   (display " (set-trace-call! <procedure>)\n")
82   (display "   prints out a line when Scheme enters or exits <procedure>\n")
83   (display " (clear-trace-call! <procedure>)\n")
84   (display "   turns off tracing calls to <procedure>\n")
85   (display " (set-trace-subtree! <procedure>)\n")
86   (display "   displays each line of Scheme code executed during a call to <procedure>\n")
87   (display " (clear-trace-subtree! <procedure>)\n")
88   (display "   turns off tracing code during calls to <procedure>\n\n")
89   (display "Enter help at the guile debug> prompt for further information on debugger commands\n")
90   (newline))