Added structure GC

Clean up doc
This commit is contained in:
Martin Gasbichler 2004-03-27 06:23:46 +00:00
parent 89d742aed5
commit 8493e289d1
3 changed files with 57 additions and 1 deletions

View File

@ -1,3 +1,14 @@
The interaction library currently offers three structures that provide
a programmatic interface to Scheme 48's debugging facilities:
* REPLS starts the read-eval-print-loop with arbitrary input and
output ports.
* INSPECT-EXCEPTION provides exception handlers that allow interactive
inspection of exceptions and their backtrace.
* GC provides a small run-time interface to the garbage collector.
The structure REPLS offers procedures to start up the
read-eval-print-loop (REPL) from a script.
@ -28,6 +39,9 @@ from the socket's output port and prints it to
(current-output-port).
The structure INSPECT-EXCEPTION makes some of the functionality of the
,debug and ,preview commands available.
(with-inspecting-handler port prepare thunk)
This procedure installs a exception handler which captures all
@ -106,4 +120,18 @@ WITH-FATAL-AND-CAPTURING-ERROR-HANDLER.
The procedural analogy to the ,proceed command. Continuation must be a
continuation object as captured by
WITH-FATAL-AND-CAPTURING-ERROR-HANDLER, not a procedure as captured by
CALL-WITH-CURRENT-CONTINUATION.
CALL-WITH-CURRENT-CONTINUATION.
The structure GC provides a procedure equivalent to the ,collect
command and offers some statistics about the garbage collector.
(collect outport) -> unspecified
Invokes the GC and prints the number of free words before and after
the collection to OUTPORT.
(gc-count) -> number
Returns the number of times the garbage collector has been invoked
since the start of the system.

15
scsh/interaction/gc.scm Normal file
View File

@ -0,0 +1,15 @@
(define (collect port)
(let ((before (memory-status (enum memory-status-option available) #f)))
(primitive-collect)
(let ((after (memory-status (enum memory-status-option available) #f)))
(display "Before: " port)
(write before port)
(display " words free in semispace" port)
(newline port)
(display "After: " port)
(write after port)
(display " words free in semispace" port)
(newline port))))
(define (gc-count)
(memory-status (enum memory-status-option gc-count) #f))

View File

@ -10,6 +10,10 @@
(define-interface socket2stdports-interface
(export socket<->stdports))
(define-interface gc-interface
(export collect
gc-count))
(define-structure repls repls-interface
(open scheme-with-scsh
command-levels
@ -35,3 +39,12 @@
handle
threads)
(files socket2stdport))
(define-structure gc gc-interface
(open scheme
enumerated
(subset architecture (memory-status-option))
(modify primitives (rename (collect primitive-collect))
(expose collect memory-status))
threads)
(files gc))