summaryrefslogtreecommitdiff
path: root/cook/debug.sld
diff options
context:
space:
mode:
Diffstat (limited to 'cook/debug.sld')
-rw-r--r--cook/debug.sld29
1 files changed, 29 insertions, 0 deletions
diff --git a/cook/debug.sld b/cook/debug.sld
new file mode 100644
index 0000000..9ae9638
--- /dev/null
+++ b/cook/debug.sld
@@ -0,0 +1,29 @@
+(define-library (cook debug)
+ (export cook->list)
+ (import (srfi 1)
+ (srfi 9)
+ (srfi 69)
+ (chibi)
+ (cook parse-internals))
+ (begin
+ (define (cook->list y)
+ (cond
+ ((amount? y)
+ (list 'amount (amount-quantity y) (amount-unit y)))
+ ((component? y)
+ (list 'component (component-name y) (cook->list (component-amount y))))
+ ((cookware? y)
+ (list 'cookware (cookware-name y) (cook->list (cookware-amount y))))
+ ((ingredient? y)
+ (list 'ingredient (ingredient-name y) (cook->list (ingredient-amount y))))
+ ((timer? y)
+ (list 'timer (timer-name y) (cook->list (timer-amount y))))
+ ((metadata-line? y)
+ (list 'metadata-line (metadata-line-key y) (metadata-line-value y)))
+ ((step? y)
+ (list 'step (map cook->list (step-elements y))))
+ ((hash-table? y)
+ (list 'metadata (cook->list (hash-table->alist y))))
+ ((list? y)
+ (map cook->list y))
+ (else y)))))