From 779dc6f65b65f45439355545fb1063b40dcc44ea Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Mon, 3 Sep 2012 17:23:02 +0200 Subject: [PATCH] Defining views --- src/utils.scm | 3 ++- src/views.scm | 14 +++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/utils.scm b/src/utils.scm index eb20531..d63a511 100644 --- a/src/utils.scm +++ b/src/utils.scm @@ -19,7 +19,8 @@ #:export (use-cache-with arguments-calling arguments-apply - bound?)) + bound? + make-producer)) ;;; Cache for procedures diff --git a/src/views.scm b/src/views.scm index f021286..4665729 100644 --- a/src/views.scm +++ b/src/views.scm @@ -26,25 +26,21 @@ (define view-type (make-record-type "view" - '(id body meshes priority) + '(id constructor body meshes priority) (lambda (record port) (format port "#" (length (view-meshes record)))))) -(define (make-view body meshes) ((record-constructor view-type) (gensym) body meshes 0)) +(define (make-view constructor) ((record-constructor view-type) (gensym) constructor #f '() 0)) (define view? (record-predicate view-type)) (define view-id (record-accessor view-type 'id)) +(define view-constructor (record-accessor view-type 'constructor)) (define view-body (record-accessor view-type 'body)) (define view-meshes (record-accessor view-type 'meshes)) (define view-priority (record-accessor view-type 'priority)) -(define-macro (define-view meshes . body) - `(make-view - ,(cond ((null? body) `(lambda () #f)) - (else `(lambda () ,@body))) - (map (lambda (m) - `(,(mesh-inner-property m 'id) . ,m)) - ,meshes))) +(define-macro (define-view body) + `(make-view (lambda () ,body))) (define activated-views '()) (define (sort-views views-alist) -- 2.39.5