summaryrefslogtreecommitdiff
path: root/src/gizmo/wasp-bless.el
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2025-05-01 17:06:41 -0400
committerLLLL Colonq <llll@colonq>2025-05-01 17:06:41 -0400
commitfb01362a9dd816fc0d0e50052ab4764dd30e46f3 (patch)
treed581df21e161a0483d8b02ea4519debb4501a4a7 /src/gizmo/wasp-bless.el
parentb21ecce6645fc17c520b722de3d96e550c77c490 (diff)
You know we love updating with a horrendous commit message
Diffstat (limited to 'src/gizmo/wasp-bless.el')
-rw-r--r--src/gizmo/wasp-bless.el60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/gizmo/wasp-bless.el b/src/gizmo/wasp-bless.el
index 109b2f35..c3175548 100644
--- a/src/gizmo/wasp-bless.el
+++ b/src/gizmo/wasp-bless.el
@@ -22,21 +22,21 @@
"Construct an Emacs Lisp value representation of the value J."
(let ((tag (alist-get 'tag j)))
(cond
- ((s-equals? tag "ValueInteger") (alist-get 'contents j))
- ((s-equals? tag "ValueArray")
- (-map #'w/bless-parse-value (alist-get 'contents j)))
- (t (message "Unknown Bless tag: %s" tag)))))
+ ((s-equals? tag "ValueInteger") (alist-get 'contents j))
+ ((s-equals? tag "ValueArray")
+ (-map #'w/bless-parse-value (alist-get 'contents j)))
+ (t (message "Unknown Bless tag: %s" tag)))))
(defun w/bless-parse-effect (j)
"Construct an Emacs Lisp value representation of the effect J."
(let ((tag (alist-get 'tag j))
- (c (alist-get 'contents j)))
- (cond
- ((s-equals? tag "EffectPrint") `(print ,(w/bless-parse-value c)))
- ((s-equals? tag "EffectPrintBackwards") `(print-backwards ,(w/bless-parse-value c)))
- ((s-equals? tag "EffectSoundboard") `(soundboard ,(w/bless-parse-value c)))
- ((s-equals? tag "EffectModelToggle") `(model-toggle ,(w/bless-parse-value c)))
- )))
+ (c (alist-get 'contents j)))
+ (cond
+ ((s-equals? tag "EffectPrint") `(print ,(w/bless-parse-value c)))
+ ((s-equals? tag "EffectPrintBackwards") `(print-backwards ,(w/bless-parse-value c)))
+ ((s-equals? tag "EffectSoundboard") `(soundboard ,(w/bless-parse-value c)))
+ ((s-equals? tag "EffectModelToggle") `(model-toggle ,(w/bless-parse-value c)))
+ )))
(defun w/bless-parse-stack (j)
"Construct an Emacs Lisp value representation of the stack J."
@@ -63,32 +63,32 @@ Optionally limit evaluation to FUEL steps."
(with-current-buffer buf
(erase-buffer))
(make-process
- :name "wasp-bless-eval"
- :buffer buf
- :command `("bless" "-j" "eval" ,@(if fuel (list "--fuel" (number-to-string fuel)) nil) ,str)
- :sentinel
- (lambda (_ _)
- (let* ((s (with-current-buffer buf (buffer-string)))
- (j (json-read-from-string s))
- (status (alist-get 'status j)))
- (kill-buffer buf)
- (if (s-equals? status "success")
- (funcall
+ :name "wasp-bless-eval"
+ :buffer buf
+ :command `("bless" "-j" "eval" ,@(if fuel (list "--fuel" (number-to-string fuel)) nil) ,str)
+ :sentinel
+ (lambda (_ _)
+ (let* ((s (with-current-buffer buf (buffer-string)))
+ (j (json-read-from-string s))
+ (status (alist-get 'status j)))
+ (kill-buffer buf)
+ (if (s-equals? status "success")
+ (funcall
k
(cons
- (w/bless-parse-stack (alist-get 'stack (alist-get 'data j)))
- (w/bless-parse-effects (alist-get 'effects (alist-get 'data j)))))
- (w/bless-error (alist-get 'data j))))))))
+ (w/bless-parse-stack (alist-get 'stack (alist-get 'data j)))
+ (w/bless-parse-effects (alist-get 'effects (alist-get 'data j)))))
+ (w/bless-error (alist-get 'data j))))))))
(defun w/bless (str &optional fuel)
"Run the Bless program STR and apply its side effects.
Optionally limit evaluation to FUEL steps."
(w/bless-eval
- str
- (lambda (res)
- (--each (cdr res)
- (w/bless-apply-effect it)))
- fuel))
+ str
+ (lambda (res)
+ (--each (cdr res)
+ (w/bless-apply-effect it)))
+ fuel))
(provide 'wasp-bless)
;;; wasp-bless.el ends here