parent
							
								
									89d742aed5
								
							
						
					
					
						commit
						8493e289d1
					
				|  | @ -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 | The structure REPLS offers procedures to start up the | ||||||
| read-eval-print-loop (REPL) from a script. | 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). | (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) | (with-inspecting-handler port prepare thunk) | ||||||
| 
 | 
 | ||||||
| This procedure installs a exception handler which captures all | This procedure installs a exception handler which captures all | ||||||
|  | @ -107,3 +121,17 @@ The procedural analogy to the ,proceed command. Continuation must be a | ||||||
| continuation object as captured by | continuation object as captured by | ||||||
| WITH-FATAL-AND-CAPTURING-ERROR-HANDLER, not a procedure 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. | ||||||
|  |  | ||||||
|  | @ -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)) | ||||||
|  | @ -10,6 +10,10 @@ | ||||||
| (define-interface socket2stdports-interface | (define-interface socket2stdports-interface | ||||||
|   (export socket<->stdports)) |   (export socket<->stdports)) | ||||||
| 
 | 
 | ||||||
|  | (define-interface gc-interface | ||||||
|  |   (export collect | ||||||
|  |           gc-count)) | ||||||
|  | 
 | ||||||
| (define-structure repls repls-interface | (define-structure repls repls-interface | ||||||
|   (open scheme-with-scsh |   (open scheme-with-scsh | ||||||
| 	command-levels | 	command-levels | ||||||
|  | @ -35,3 +39,12 @@ | ||||||
| 	handle | 	handle | ||||||
| 	threads) | 	threads) | ||||||
|   (files socket2stdport)) |   (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)) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Martin Gasbichler
						Martin Gasbichler