-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstaticdata.lisp
39 lines (31 loc) · 1.15 KB
/
staticdata.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
;;; -*- Package: user -*-
(in-package "USER")
;;;----------------------------------------------------------------------
;;; Constructs for declaring static data.
;; Define NAME to refer to a static word of data in memory
;; of value VALUE.
(defconstruct defword (name value)
`(skip
(staticval ,name)
(label ,name)
(dataword ,value)))
(defconstruct defarray (name &rest elements)
`(skip
(staticarray ,name)
(label ,name)
. ,(mapcar #'(lambda (elem) `(dataword ,elem)) elements)))
;;;----------------------------------------------------------------------
;; VALUE is a word of data that should be included at
;; this point in the program in literal form.
(defconstruct dataword (value)
`(data ,value))
(defconstruct staticval (name)
(values nil (add-staticval name env)))
(defconstruct staticarray (name)
(values nil (add-staticarray name env)))
;; If the flow of control gets to code surrounded by SKIP it will skip over
;; the contents without executing them.
(defconstruct skip (&body body)
;; Implemented by an unconditional branch pair around the body.
`(sbra-pair ,(gentemp "_PRESKIP") ,(gentemp "_POSTSKIP")
. ,body))