feat(zig): native Arboricx bundle parser and C ABI
This commit is contained in:
23
lib/arboricx-dispatch.tri
Normal file
23
lib/arboricx-dispatch.tri
Normal file
@@ -0,0 +1,23 @@
|
||||
!import "arboricx.tri" !Local
|
||||
!import "patterns.tri" !Local
|
||||
|
||||
-- Multi-purpose kernel dispatch.
|
||||
--
|
||||
-- runArboricxTyped tag bundleBytes args
|
||||
-- tag 0 → hostTree (runArboricxToTree)
|
||||
-- tag 1 → hostString (runArboricxToString)
|
||||
-- tag 2 → hostNumber (runArboricxToNumber)
|
||||
-- tag 3 → hostBool (runArboricxToBool)
|
||||
-- tag 4 → hostList (runArboricxToList)
|
||||
-- tag 5 → hostBytes (runArboricxToBytes)
|
||||
-- otherwise → err 99 bundleBytes
|
||||
|
||||
runArboricxTyped = (tag bs args :
|
||||
match tag
|
||||
[[(equal? hostTreeTag) (_ : runArboricxToTree bs args)]
|
||||
[(equal? hostStringTag) (_ : runArboricxToString bs args)]
|
||||
[(equal? hostNumberTag) (_ : runArboricxToNumber bs args)]
|
||||
[(equal? hostBoolTag) (_ : runArboricxToBool bs args)]
|
||||
[(equal? hostListTag) (_ : runArboricxToList bs args)]
|
||||
[(equal? hostBytesTag) (_ : runArboricxToBytes bs args)]
|
||||
[otherwise (_ : err 99 bs)]])
|
||||
Reference in New Issue
Block a user