This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-03
Channels
- # bangalore-clj (1)
- # beginners (16)
- # boot (23)
- # chestnut (5)
- # cljs-dev (3)
- # cljsjs (3)
- # clojure (115)
- # clojure-conj (3)
- # clojure-italy (17)
- # clojure-russia (22)
- # clojurescript (20)
- # core-async (11)
- # events (3)
- # fulcro (91)
- # funcool (5)
- # heroku (7)
- # hoplon (5)
- # leiningen (3)
- # off-topic (2)
- # om (1)
- # onyx (9)
- # parinfer (1)
- # protorepl (2)
- # re-frame (3)
- # slack-help (2)
- # spacemacs (5)
- # unrepl (1)
I am semi-new to clojure and I’m sitting with an funcool/octet problem, would this be the right forum to ask questions?
well assuming this is the right forum, I’ll ask and we’ll see what I receive : )
I’m trying to parse parts of the zip file specification using octet and a fair amount of the spec uses variable length strings. octet supports variable length strings, but if I’m reading things correctly, only if the length is a four byte int32 and immediately preceding the string data. The zip spec has plenty of instances where the you have a record and the stringlength is either an int16 or is not immediately before the data. I would like to solve this with a custom special-string*
spec which would take a keyword as an argument and the keyword would point to the spec containing the length of the string.
example from zip specification:
central file header signature 4 bytes (0x02014b50)
...
file name length 2 bytes
extra field length 2 bytes
file comment length 2 bytes
disk number start 2 bytes
internal file attributes 2 bytes
external file attributes 4 bytes
relative offset of local header 4 bytes
file name (variable size)
extra field (variable size)
file comment (variable size)
in this case I would like to have:
(spec
:file-name-length int16
:extra-field-length int16
:file-comment-length int16
...
:file-name (special-string* :file-name-length)
...
)