X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fcommand.scm;fp=mudsync%2Fcommand.scm;h=a79f50d3e7f878ae24b9a1b6d8d5d98ebaeb0086;hp=765962ce28dcd88defa2efbfe814f029bb5440c9;hb=4d4af0656b0402e630eea9393420197152945e5b;hpb=8df43947a29393266da4df9e43f7656e56558fd6 diff --git a/mudsync/command.scm b/mudsync/command.scm index 765962c..a79f50d 100644 --- a/mudsync/command.scm +++ b/mudsync/command.scm @@ -19,6 +19,7 @@ (define-module (mudsync command) #:use-module (mudsync parser) #:use-module (8sync actors) + #:use-module (8sync rmeta-slot) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (ice-9 control) @@ -31,6 +32,8 @@ command-action command-priority + build-commands + direct-command prep-indir-command prep-direct-command @@ -69,6 +72,26 @@ (action command-action) (priority command-priority)) +(define-syntax %build-command + (syntax-rules () + ((_ (verb ...) ((cmd-proc action-sym args ...) ...)) + (list (cons verb + (list (cmd-proc (list verb ...) + (quote action-sym) + args ...) + ...)) + ...)) + ((_ verb ((cmd-proc action-sym args ...) ...)) + (list (cons verb + (list (cmd-proc (list verb) + (quote action-sym) + args ...) + ...)))))) + +(define-syntax-rule (build-commands (verb-or-verbs cmd-defs ...) ...) + (wrap-rmeta-slot + (append (%build-command verb-or-verbs cmd-defs ...) ...))) + (define (direct-command verbs action) (make-command verbs