From 4e51826b44a80a645349e77f1c48276068279d84 Mon Sep 17 00:00:00 2001 From: jsancho Date: Tue, 20 Sep 2011 19:29:48 +0000 Subject: [PATCH] --- src/gacela_mobs.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gacela_mobs.scm b/src/gacela_mobs.scm index dabb9dc..313848c 100755 --- a/src/gacela_mobs.scm +++ b/src/gacela_mobs.scm @@ -77,19 +77,28 @@ (let ((name (car mob-head)) (attr (cdr mob-head))) `(define ,(string->symbol (string-concatenate (list "make-" (symbol->string name)))) (lambda* ,(if (null? attr) '() `(#:key ,@attr)) - (lambda-mob () ,@body))))) + (the-mob ',name () ,attr ,@body))))) -(define-macro (lambda-mob attr . body) +(define-macro (the-mob type attr publish . body) (let ((mob-id-symbol (gensym)) - (type-mob - `(let ,(cons `(,mob-id-symbol (gensym)) attr) + (type-symbol (gensym))) + `(let ((,mob-id-symbol (gensym)) + (,type-symbol ,type) + ,@attr) (lambda* (#:optional (option #f)) (define (kill-me) (hide-mob-hash ,mob-id-symbol)) (case option ((get-mob-id) ,mob-id-symbol) + ((get-type) + ,type-symbol) (else + (display ,(cons 'list (map (lambda (x) `(acons ',(car x) ,(car x) '())) publish))) + (newline) (catch #t (lambda () ,@body) (lambda (key . args) #f)))))))) + +(define-macro (lambda-mob attr . body) + `(the-mob 'undefined ,attr '() ,@body)) -- 2.39.5