Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
drumchallenge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tnias
drumchallenge
Commits
e1cdee8d
Commit
e1cdee8d
authored
7 years ago
by
tnias
Browse files
Options
Downloads
Patches
Plain Diff
Improve documentation
parent
1f78541f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+31
-5
31 additions, 5 deletions
README.md
src/parser.rs
+1
-0
1 addition, 0 deletions
src/parser.rs
with
32 additions
and
5 deletions
README.md
+
31
−
5
View file @
e1cdee8d
Rust implementation of
[
golang challenge #1
](
http://golang-challenge.org/go-challenge1
)
.
A simple binary fileformat for a drum machine is given. The task is to reverse
A simple binary file
format for a drum machine is given. The task is to reverse
it and implement a decoder it.
##
ToDo
##
File format
-
[ ] write example cli that pretty prints the fixture's contents
-
[ ] create documentation/tutorial/walkthrough and give it to
`nom`
community
-
[ ] describt binary format (result of re)
There is no real specification. But this is my understanding based on looking
at the provided example files and reading the challenge description.
A file starts with a header and is followed by multiple lines. All numbers are
encoded with big endianness.
### Header
Size | encoding | Description
-----|----------|------------
6 | ASCII | magic bytes "SPLICE"
8 | u64 | file size (bytes _after_ this field are counted)
32 | ASCII | version string (of the editor used to create the file?)
4 | f32 | tempo
### Line
Size | Encoding | Description
-----|----------|----------------
1 | u8 | id
4 | u32 | length of the name field (n_l)
n | ASCII | name
16 | bool[] | data (encoded as information when to hit)
## To-do
-
[ ] write example CLI that pretty prints the fixture's contents
-
[ ] create documentation / tutorial / walk through
-
[ ] describe implementation steps
-
[ ] maybe add something (tests!?) that allows for better/easier debugging
-
[ ] find out how to properly debug
This diff is collapsed.
Click to expand it.
src/parser.rs
+
1
−
0
View file @
e1cdee8d
...
...
@@ -46,6 +46,7 @@ named!(parse_pattern<&[u8], Pattern>,
// ignore all unused bytes at the end
IResult
::
Done
(
_
,
pattern
)
=>
pattern
,
// XXX: what type of input could trigger this?
// -> uncommon values in file length?
// TODO: make it not panic and handle it gracefully
// TODO: add extra testcase, that triggers this path
_
=>
panic!
(
"this should never be reached"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment