1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

more pmatchification

* module/system/il/ghil.scm: No need for a match

* module/system/repl/command.scm: Pmatchify

* module/system/vm/disasm.scm: Pmatchify.
This commit is contained in:
Andy Wingo 2008-05-03 19:39:41 +02:00
parent 23d43503d1
commit e429de1e5f
3 changed files with 11 additions and 11 deletions

View file

@ -21,7 +21,6 @@
(define-module (system il ghil)
:use-syntax (system base syntax)
:use-module (ice-9 match)
:use-module (ice-9 regex)
:export
(

View file

@ -21,6 +21,7 @@
(define-module (system repl command)
:use-syntax (system base syntax)
:use-module (system base pmatch)
:use-module (system base compile)
:use-module (system repl common)
:use-module (system vm core)
@ -126,7 +127,7 @@ List available meta commands.
A command group name can be given as an optional argument.
Without any argument, a list of help commands and command groups
are displayed, as you have already seen ;)"
(match args
(pmatch args
(()
(display-group (lookup-group 'help))
(display "Command Groups:\n\n")
@ -140,9 +141,9 @@ are displayed, as you have already seen ;)"
(newline)
(display "Type `,COMMAND -h' to show documentation of each command.")
(newline))
(('all)
((all)
(for-each display-group *command-table*))
((? lookup-group group)
((,group) (guard (lookup-group group))
(display-group (lookup-group group)))
(else
(user-error "Unknown command group: ~A" (car args)))))
@ -162,15 +163,15 @@ Show description/documentation."
(define (option repl . args)
"option [KEY VALUE]
List/show/set options."
(match args
(pmatch args
(()
(for-each (lambda (key+val)
(format #t "~A\t~A\n" (car key+val) (cdr key+val)))
repl.options))
((key)
((,key)
(display (repl-option-ref repl key))
(newline))
((key val)
((,key ,val)
(repl-option-set! repl key val)
(case key
((trace)
@ -191,7 +192,7 @@ Quit this session."
(define (module repl . args)
"module [MODULE]
Change modules / Show current module."
(match args
(pmatch args
(() (puts (binding repl.env.module)))))
(define (use repl . args)

View file

@ -20,10 +20,10 @@
;;; Code:
(define-module (system vm disasm)
:use-module (system base pmatch)
:use-module (system vm core)
:use-module (system vm conv)
:use-module (ice-9 regex)
:use-module (ice-9 match)
:use-module (ice-9 format)
:use-module (ice-9 receive)
:export (disassemble-objcode disassemble-program disassemble-bytecode))
@ -71,8 +71,8 @@
(do ((addr+code (decode) (decode)))
((not addr+code) (newline))
(receive (addr code) addr+code
(match code
(('load-program x)
(pmatch code
((load-program ,x)
(let ((sym (gensym "")))
(set! programs (acons sym x programs))
(print-info addr (format #f "(load-program #~A)" sym) #f)))