1 |
6 |
jlechner |
; Guile-specific functions.
|
2 |
|
|
; Copyright (C) 2000, 2004, 2009 Red Hat, Inc.
|
3 |
|
|
; This file is part of CGEN.
|
4 |
|
|
; See file COPYING.CGEN for details.
|
5 |
|
|
|
6 |
|
|
; symbol-bound? is deprecated in 1.6
|
7 |
|
|
"must pass #f for symbol-bound? first arg"; FIXME: Not sure this is 100% correct.
|
8 |
|
|
|
9 |
|
|
; FIXME: to be deleted
|
10 |
|
|
|
11 |
|
|
; CGEN uses reverse!
|
12 |
|
|
;; Guile 1.8 no longer has "." in %load-path so relative path loads
|
13 |
|
|
;; no longer work.
|
14 |
|
|
".";;; Enabling and disabling debugging features of the host Scheme.
|
15 |
|
|
;;; For the initial load proces, turn everything on. We'll disable it
|
16 |
|
|
;;; before we start doing the heavy computation.
|
17 |
|
|
;;; Call THUNK, with debugging enabled if FLAG is true, or disabled if
|
18 |
|
|
|
19 |
|
|
;;;
|
20 |
|
|
|
21 |
|
|
;;; all, beyond calling THUNK, so long as your backtraces are still
|
22 |
|
|
;;; helpful. In Guile, the debugging evaluator is slower, so we don't
|
23 |
|
|
;;; want to use it unless the user asked for it.)
|
24 |
|
|
;; Now, make that debugging / no-debugging setting actually take
|
25 |
|
|
;; effect.
|
26 |
|
|
;;
|
27 |
|
|
;; Guile has two separate evaluators, one that does the extra
|
28 |
|
|
;; bookkeeping for backtraces, and one which doesn't, but runs
|
29 |
|
|
|
30 |
|
|
;; ordinarily never consults the variable that says which evaluator
|
31 |
|
|
;; to use: whatever evaluator was running just keeps rolling along.
|
32 |
|
|
;; There are certain primitives, like some of the eval variants,
|
33 |
|
|
;; that do actually check. start-stack is one such primitive, but
|
34 |
|
|
;; we don't want to shadow whatever other stack id is there, so we
|
35 |
|
|
;; do all the real work in the ID argument, and do nothing in the
|
36 |
|
|
;; EXP argument. What a kludge.
|
37 |
|
|
;;; Apply PROC to ARGS, marking that application as the bottom of the
|
38 |
|
|
;;; stack for error backtraces.
|
39 |
|
|
|
40 |
|
|
;;; (On systems other than Guile, this doesn't really need to do
|
41 |
|
|
;;; anything other than apply PROC to ARGS, as long as something
|
42 |
|
|
;;; ensures that backtraces will work right.)
|
43 |
|
|
|
44 |
|
|
;; allows us to pass less fragile cut info to save-stack.
|
45 |
|
|
;;(display args (current-error-port))
|
46 |
|
|
;;(newline (current-error-port))
|
47 |
|
|
;; display-error takes 6 arguments.
|
48 |
|
|
;; If `quit' is called from elsewhere, it may not have 6
|
49 |
|
|
|
50 |
|
|
;; Grab a copy of the current stack,
|
51 |
|
|
;; Apply proc to args, and if any uncaught exception is thrown, call
|
52 |
|
|
;; handler WITHOUT UNWINDING THE STACK (that's the 'lazy' part). We
|
53 |
|
|
|
54 |
|
|
;; I have no idea why the 'load-stack' stack mark is
|
55 |
|
|
;; not still present on the stack; we're still loading
|
56 |
|
|
;; cgen-APP.scm, aren't we? But stack-id returns #f
|
57 |
|
|
;; in handler if we don't do a start-stack here.
|
58 |
|
|
|