-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsection-blocks.lisp
More file actions
57 lines (41 loc) · 1.78 KB
/
section-blocks.lisp
File metadata and controls
57 lines (41 loc) · 1.78 KB
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
(in-package :picflow)
;; Prototype section
;;;;;;;;;;;;;;;;;;;;
(defclass prototype-block (node)
((code :initarg :code :documentation "The code to be inserted in the prototype section")))
(defmethod prototype-code-emit ((node prototype-block))
(with-slots (code) node
(emit code)))
(defun define-prototype-code (code)
"Insert CODE into the prototype section of the output file"
(use-node (make-instance 'prototype-block :code code)))
;; Interrupt vector section
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defclass interrupt-vector-block (node)
((code :initarg :code :documentation "The code to be inserted in the interrupt vector section")))
(defmethod interrupt-vector-code-emit ((node interrupt-vector-block))
(with-slots (code) node
(emit code)))
(defun define-interrupt-vector-code (code)
"Insert CODE into the interrupt vector"
(use-node (make-instance 'interrupt-vector-block :code code)))
;; Init code block
;;;;;;;;;;;;;;;;;;
(defclass init-code-block (node)
((code :initarg :code :documentation "The code to be inserted in the init code in the main() function")))
(defmethod init-code-emit ((node init-code-block))
(with-slots (code) node
(emit code)))
(defun define-init-code (code)
"Insert CODE into the main() function for initialization"
(use-node (make-instance 'init-code-block :code code)))
;; Extra code block
;;;;;;;;;;;;;;;;;;;
(defclass extra-code-block (node)
((code :initarg :code :documentation "The code to be inserted in the extra code section")))
(defmethod extra-code-emit ((node extra-code-block))
(with-slots (code) node
(emit code)))
(defun define-extra-code (code)
"Insert CODE into the C file somewhere after the main() function"
(use-node (make-instance 'extra-code-block :code code)))