binload - write a binary file to the output using simple commands from the input
Synopsis
Description
Options
Command Syntax
Examples
See Also
License
Copyright
Authors
binload [options...]
binload creates a file containing binary data with the specified formats and values. Commands read from the input first specify common data types, such as a four byte integer, or an eight byte float, and then a series of values are entered. These data values are emitted to the output in the binary representation of that data type. This tool provides a simple method for producing complex binary files.
binload may be obtained as part of the drm_tools package from: http://sourceforge.net/projects/drmtools/
-in <FILE> File to read fixed length binary records from. "-" or not specified [Default] reads from stdin.
-out <FILE> Write output to FILE. (Default - write to stdout).
-table <FILE> Specify FILE holding at least 256 text lines corresponding to byte values 0-255. Parse the t STRING into fields corresponding to lines in FILE and emit the corresponding line number as an unsigned 1 byte integer.
-pad <CHAR> With -table having entries of size M, if the length of the text with t or T is not a multiple of M, append CHAR 1 to M-1 times until it is. CHAR may not be the null character. (Default - exit with an error when dangling characters on the end of a string are encountered.)
-h -help --help -? --?? Print the help message. (Default - do not print help message.)
-hsyntax Print command syntax.
-hexamples Print examples. (Default - do not print examples.)
-i Emit version, copyright, license and contact information.( Default - do not emit information.)
Commands are not case sensitive unless indicated. Separate all values with type specifiers with white space.Input z N next data has field size N, N must be 1, 2, 4, or 8 [default] i next data is signed int. u next data is unsigned int [default] f next data is float. Size must be 4 or 8. s next data has bytes swapped n next data has native byte order [default] P,p reduce int 16, 32, or 64 bit field by one byte at the leading/trailing end. The computer’s CPU determines which bytes are leading, and which are trailing. Z 8 i P P is a 6 byte integer, only the last 6 bytes are emitted. Setting a type resets this modifier to zero. Swap is applied BEFORE pad bytes are removed. N [N [N...]] series of numerical data values to write using current settings Allowed notations for each type: hex (0xFA): data type used is unsigned int at the current size. signed integers (-1, 123, +123). unsigned integers (0, 123, +123, NOT -123). floats (0.1, 0.1e-10, -0.2e-20). t\n"string"\n Requires -table. Decompose the STRING into a series of lines from the table file, and emit the corresponding line number as an unsigned byte. If multiple lines have the same string the smallest line number will be used. Works best if the table has fixed length strings. The string must be on a separate line with no extra spaces before or after it and no more than 256 characters. STRING cannot contain the end of line character, to emit it use the sequence: z 1 u 0x0A. Only the single EOL character may separate t from STRING. Matches are not case sensitive T\n"string"\n Case sensitive variant of -t. c CHAR Override -pad or preceding c value. ? show current setting e exit
% binload z 4 i 0 0xFF 0xFFFF 0xFFFFFFFF eWrite the binary file: 00000000FF000000FFFF0000FFFFFFFF
Commands are z 4 a 4 byte data field, i signed int ... 4 data values (hex notation forces int to unsigned) e exit
% binload z 4 i s 0 0xFF 0xFFFF 0xFFFFFFFF n 0xFF e
Write the binary file: 00000000000000FF0000FFFFFFFFFFFFFF000000 Command are z 4 a 4 byte data field, i signed int s swap byte order ... 4 data values (hex notation forces int to unsigned) e exit
GNU General Public License 2
Copyright (C) 2015 David Mathog and Caltech.
David Mathog, Biology Division, Caltech <mathog@caltech.edu>
drm_tools | binload (1) | 0.0.3 DEC 04 2015 |