-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathstatic.lisp
80 lines (74 loc) · 2.86 KB
/
static.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
(FILEHEADER STATIC)
(PRINT '(STATIC VARIABLE FUNCTIONS WRITTEN BY BLAKE MCBRIDE))
(PRINT '(VERSION 2))
(DEFINEQ
(PROGS
(NLAMBDA $MACRO$
(EVAL ([LAMBDA (L)
(LIST 'PROG
(GETPROP '**STATIC** (CAR L))
(LIST 'RETURN
(LIST 'PROG1
(CONS 'PROG
(APPEND (CDR L) NIL))
(LIST 'SAVE-STATIC (CAR L]
$MACRO$))))
(SAVE-STATIC
[NLAMBDA (N ENV)
(SETQ ENV (BINDENV N))
(PUTPROP '**STATIC** N
(MAPCAR (GETPROP '**STATIC** N)
'(LAMBDA
(X)
(LIST (CAR X)
(LIST 'QUOTE
(EVSTK (CAR X) ENV])
(DELETE-STATIC
(NLAMBDA (N L)
(COND ((NULL L) (REMPROP '**STATIC** N))
(T (AND (ATOM L) (SETQ L (CONS L NIL)))
[PUTPROP '**STATIC** N
(SUBSET
(GETPROP '**STATIC** N)
'(LAMBDA
(X)
(COND ((MEMB (CAR X) L) NIL) (X]
N))))
(GET-STATIC
(LAMBDA (N) (GETPROP '**STATIC** N)))
(ADD-STATIC
(NLAMBDA (N L)
[PUTPROP '**STATIC** N
(NCONC (GETPROP '**STATIC** N)
(MAPCAR L
'(LAMBDA
(L)
(COND ((ATOM L) (LIST L NIL))
(T (LIST
(CAR L)
(LIST 'QUOTE
(EVSTK
(CADR L)
(BINDENV N]
N))
(CREATE-STATIC
(NLAMBDA (N L)
[PUTPROP '**STATIC** N
(MAPCAR L
'(LAMBDA
(L)
(COND ((ATOM L) (LIST L NIL))
(T (LIST
(CAR L)
(LIST 'QUOTE
(EVSTK
(CADR L)
(BINDENV N]
N))
)
(PRINT 'STATICFNS)
(RPAQQ STATICFNS
(PROGS SAVE-STATIC DELETE-STATIC GET-STATIC ADD-STATIC CREATE-STATIC))
(RPAQQ STATICCOMS (STATIC VARIABLE FUNCTIONS WRITTEN BY BLAKE MCBRIDE))
(RPAQ STATICGENNR 2)
STOP