manual.md in bindata-1.4.5 vs manual.md in bindata-1.5.0

- old
+ new

@@ -38,35 +38,40 @@ manipulating. It supports all the common datatypes that are found in structured binary data. Support for dependent and variable length fields is built in. -Last updated: 2012-07-24 +Last updated: 2013-05-21 +## Source code + +[BinData](http://github.com/dmendel/bindata) is hosted on Github. + ## License BinData is released under the same license as Ruby. -Copyright © 2007 - 2012 [Dion Mendel](mailto:dion@lostrealm.com) +Copyright © 2007 - 2013 [Dion Mendel](mailto:dion@lostrealm.com) ## Donate Want to donate? My favourite local charity is [Perth Raptor Care](http://care.raptor.id.au/help.html#PAL). --------------------------------------------------------------------------- # Installation -You can install BinData via rubygems. +You can install BinData via rubygems (recommended). gem install bindata -Alternatively, visit the -[download](http://rubyforge.org/frs/?group_id=3252) page and download -BinData as a tar file. +or as source package. + git clone http://github.com/dmendel/bindata.git + cd bindata && ruby setup.rb + --------------------------------------------------------------------------- # Overview BinData declarations are easy to read. Here's an example. @@ -1355,10 +1360,24 @@ uint16 end {:ruby} +## Dynamically creating Types + +Sometimes the format of a record is not known until runtime. You can use the +`BinData::Struct` class to dynamically create a new type. To be able to reuse +this type, you can give it a name. + + # Dynamically create my_new_type + BinData::Struct.new(:name => :my_new_type, + :fields => [ [:int8, :a], [:int8, :b] ]) + + # Create an array of these types + array = BinData::Array.new(:type => :my_new_type) +{:ruby} + ## Skipping over unused data Some structures contain binary data that is irrelevant to your purposes. Say you are interested in 50 bytes of data located 10 megabytes into the @@ -1557,10 +1576,10 @@ decided by the `protocol` field. Modelling this structure can be difficult when the nesting is recursive, e.g. IP tunneling. Here is an example of the simplest possible recursive TLV structure, a [list that can contains atoms or other -lists](http://bindata.rubyforge.org/svn/trunk/examples/list.rb). +lists](http://github.com/dmendel/bindata/blob/master/examples/list.rb). --------------------------------------------------------------------------- # Alternatives