forked from kennytilton/cells
-
Notifications
You must be signed in to change notification settings - Fork 0
/
initialize.lisp
executable file
·58 lines (46 loc) · 1.79 KB
/
initialize.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
;; -*- mode: Lisp; Syntax: Common-Lisp; Package: cells; -*-
#|
Cells -- Automatic Dataflow Managememnt
Copyright (C) 1995, 2006 by Kenneth Tilton
(See defpackage.lisp for license and copyright notigification)
|#
(in-package :cells)
(eval-when (compile eval load)
(export '(c-envalue)))
(defstruct (c-envaluer (:conc-name nil))
envalue-rule)
(defmethod awaken-cell (c)
(declare (ignorable c)))
(defmethod awaken-cell ((c cell))
(assert (c-inputp c))
;
; nothing to calculate, but every cellular slot should be output
;
(when (> *data-pulse-id* (c-pulse-observed c))
;(trc nil "awaken-pulsing" :*dpid* *data-pulse-id* :cdpid (c-pulse-observed c) c)
(setf (c-pulse-observed c) *data-pulse-id*)
(trc nil "awaken cell observing" c *data-pulse-id*)
(let ((*observe-why* :awaken-cell))
(slot-value-observe (c-slot-name c) (c-model c) (c-value c) nil nil c))
(ephemeral-reset c)))
(defmethod awaken-cell ((c c-ruled))
(let (*depender*)
(calculate-and-set c :fn-awaken-cell nil)))
#+cormanlisp ; satisfy CormanCL bug
(defmethod awaken-cell ((c c-dependent))
(let (*depender*)
(trc nil "awaken-cell c-dependent clearing *depender*" c)
(calculate-and-set c :fn-awaken-cell nil)))
(defmethod awaken-cell ((c c-drifter))
;
; drifters *begin* valid, so the derived version's test for unbounditude
; would keep (drift) rule ever from being evaluated. correct solution
; (for another day) is to separate awakening (ie, linking to independent
; cs) from evaluation, tho also evaluating if necessary during
; awakening, because awakening's other role is to get an instance up to speed
; at once upon instantiation
;
(calculate-and-set c :fn-awaken-cell nil)
(cond ((c-validp c) (c-value c))
((c-unboundp c) nil)
(t "illegal state!!!")))