49 lines
1.8 KiB
Plaintext
49 lines
1.8 KiB
Plaintext
;;;; The fixture C-x C-e is tested against: one value of every shape the
|
|
;;;; renderer knows, held in globals so an expression has something real to
|
|
;;;; read out of a running process.
|
|
;;;;
|
|
;;;; It keeps running rather than counting reloads, because a thunk only runs
|
|
;;;; when the program next reaches a frame boundary. (agent/wait 5) is both the
|
|
;;;; poll and the pacing — 5ms of nothing, which is what a frame is when there
|
|
;;;; is no frame.
|
|
(import agent "vendor:agent")
|
|
|
|
(defstruct V [x f32 y f32])
|
|
(defstruct Blob [id i32 name str pos V tags [3 i32]])
|
|
(defenum Colour [red 0 green 1 blue 2])
|
|
|
|
(defonce ticks i64)
|
|
(defonce big u64)
|
|
(defonce b Blob)
|
|
(defonce arr [4 i32])
|
|
(defonce col Colour)
|
|
|
|
;;; Read by nothing on purpose: it is here to be *evaluated*, so that C-x C-e
|
|
;;; is tested against a constant living in the program's memory and not only
|
|
;;; against arithmetic the compiler could have done itself.
|
|
(defconst step-by i64 3)
|
|
|
|
;;; Called by nothing here either, and for the same reason: it is the buffer's
|
|
;;; *own* macro, and what it is for is to be called from an expression typed at
|
|
;;; the editor. A session used to hold the prelude's macros and its imports'
|
|
;;; and not these, so (tenfold 7) was an unknown name in the very file that
|
|
;;; declares it. Nothing in this program names it, so no macro module is built
|
|
;;; for the build itself -- the first one is paid by the evaluation that calls
|
|
;;; it.
|
|
(defmacro tenfold [& args]
|
|
`(* ~(at args 0) 10))
|
|
|
|
(defn main [] i32
|
|
(agent/start "/tmp/flan-printers-fallback.sock")
|
|
(set big 0xFFFFFFFFFFFFFFFF)
|
|
(set (.id b) 7)
|
|
(set (.name b) "sandy \"quoted\"")
|
|
(set (.x (.pos b)) 1.5)
|
|
(set (at (.tags b) 1) 42)
|
|
(set (at arr 2) 9)
|
|
(set col :blue)
|
|
(dotimes [i 4000]
|
|
(agent/wait 5)
|
|
(set ticks (+ ticks 1)))
|
|
0)
|