www.delorie.com/gnu/docs/recode/recode_61.html   search  
 
Buy GNU books!


The recode reference manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.4 Interpreted character dumps

Dumps are surfaces meant to express, in ways which are a bit more readable, the bit patterns used to represent characters. They allow the inspection or debugging of character streams, but also, they may assist a bit the production of C source code which, once compiled, would hold in memory a copy of the original coding. However, recode does not attempt, in any way, to produce complete C source files in dumps. User hand editing or `Makefile' trickery is still needed for adding missing lines. Dumps may be given in decimal, hexadecimal and octal, and be based over chunks of either one, two or four eight-bit bytes. Formatting has been chosen to respect the C language syntax for number constants, with commas and newlines inserted appropriately.

However, when dumping two or four byte chunks, the last chunk may be incomplete. This is observable through the usage of narrower expression for that last chunk only. Such a shorter chunk would not be compiled properly within a C initialiser, as all members of an array share a single type, and so, have identical sizes.

Octal-1
This surface corresponds to an octal expression of each input byte.

It is available in recode under the name Octal-1, with o1 and o as acceptable aliases.

Octal-2
This surface corresponds to an octal expression of each pair of input bytes, except for the last pair, which may be short.

It is available in recode under the name Octal-2 and has o2 for an alias.

Octal-4
This surface corresponds to an octal expression of each quadruple of input bytes, except for the last quadruple, which may be short.

It is available in recode under the name Octal-4 and has o4 for an alias.

Decimal-1
This surface corresponds to an decimal expression of each input byte.

It is available in recode under the name Decimal-1, with d1 and d as acceptable aliases.

Decimal-2
This surface corresponds to an decimal expression of each pair of input bytes, except for the last pair, which may be short.

It is available in recode under the name Decimal-2 and has d2 for an alias.

Decimal-4
This surface corresponds to an decimal expression of each quadruple of input bytes, except for the last quadruple, which may be short.

It is available in recode under the name Decimal-4 and has d4 for an alias.

Hexadecimal-1
This surface corresponds to an hexadecimal expression of each input byte.

It is available in recode under the name Hexadecimal-1, with x1 and x as acceptable aliases.

Hexadecimal-2
This surface corresponds to an hexadecimal expression of each pair of input bytes, except for the last pair, which may be short.

It is available in recode under the name Hexadecimal-2, with x2 for an alias.

Hexadecimal-4
This surface corresponds to an hexadecimal expression of each quadruple of input bytes, except for the last quadruple, which may be short.

It is available in recode under the name Hexadecimal-4, with x4 for an alias.

When removing a dump surface, that is, when reading a dump results back into a sequence of bytes, the narrower expression for a short last chunk is recognised, so dumping is a fully reversible operation. However, in case you want to produce dumps by other means than through recode, beware that for decimal dumps, the library has to rely on the number of spaces to establish the original byte size of the chunk.

Although the library might report reversibility errors, removing a dump surface is a rather forgiving process: one may mix bases, group a variable number of data per source line, or use shorter chunks in places other than at the far end. Also, source lines not beginning with a number are skipped. So, recode should often be able to read a whole C header file, wrapping the results of a previous dump, and regenerate the original byte string.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003  

Please take a moment to fill out this visitor survey
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)