I am trying to create a reusable structure for reading in data from a
binary data stream. I have attached a ragel file that demonstrates the
problem I am having and would appreciate tips and advice on what I am
doing wrong or better ways to go about solving the problem.

I have defined Word8b, Word16b and Word32b to represent the blocks I
will be reading from the data stream. The data is accumulated into a
temporary variable (temp) and then assigned to the specific variable on
exit from the appropriate machine. It works fine for small numbers but
does strange things with numbers >127. It seems to be a problem with
signed vs unsigned but I can't figure out what it is.

What I expect
a8 1 b8 ff a16 2 b16 fe a32 3 b32 fd

What I get
 
a8 1 b8 ffff a16 2 b16 fffe a32 3 b32 fffffffd 



_______________________________________________
ragel-users mailing list
[email protected]
http://www.complang.org/mailman/listinfo/ragel-users

Reply via email to