From e0ca103bd49aad316b40a87f7794bd541fb1948e Mon Sep 17 00:00:00 2001 From: eknauel Date: Thu, 15 Apr 2004 13:52:35 +0000 Subject: [PATCH] added weak list to ldap-session type --- scheme/types.scm | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/scheme/types.scm b/scheme/types.scm index 8f06fb9..027426e 100644 --- a/scheme/types.scm +++ b/scheme/types.scm @@ -1,12 +1,35 @@ +;;; weak lists + +(define (cons-weak obj list) + (cons (make-weak-pointer obj) list)) + +(define (filter-collected list) + (filter (lambda (weak-pointer) + (not (weak-pointer-ref weak-pointer))) + list)) + +;;; ldap-session + (define-record-type ldap-session :ldap-session - (make-ldap-session c-pointer bound? options) + (make-ldap-session c-pointer bound? options weak-list) ldap-session? (c-pointer ldap-session-c-pointer) (bound? ldap-session-bound? set-ldap-session-bound?!) - (options ldap-session-options set-ldap-session-options!)) + (options ldap-session-options set-ldap-session-options!) + (weak-list ldap-session-weak-list set-ldap-session-weak-list!)) + +(define (ldap-session-weak-list-add! session thing) + (set-ldap-session-weak-list! + session (cons-weak thing (ldap-session-weak-list session)))) + +(define (ldap-session-weak-list-filter! session) + (set-ldap-session-weak-list! + session (filter-collected (ldap-session-weak-list session)))) (define-exported-binding "ldap-session" :ldap-session) +;;; ldap session options + (define-record-type session-options :session-options (make-session-options implicit-unbind-ok? auto-unbind?) session-options?