Not logged in. Login

Hexlines Assignment

Introduction to hexlines

The utility hexlines is available in the tools/util directory of the parabix-devel repository. Its purpose is to print out each line of a source data file using hexadecimal notation. It is compiled with an overall system make or just using make hexlines.

For example, assume we have the file hello.txt with the contents:

Hello
Hi
你好

Then the command bin/hexlines hello.txt will produce the following output.

48656C6C6F
4869
E4BDA0E5A5BD

The source code for hexlines has extensive comments which describe the implementation using Parabix methods.

The hexlines utility has also been annotated with commands that allow the calculated streams and stream sets to be printed out. Using the command bin/hexlines --enable-illustrator hello.txt produces the following output.

      ByteStream | Hello Hi ...... 
  BasisBits[4-7] | 466660460EBAEAB0
  BasisBits[0-3] | 85CCFA89A4D055DA
           nonLF | 11111.11.111111.
   hexInsertMask | 1.1.1.1.1.11.1.11.1.1.1.1.1.1
spreadBasis[4-7] | 4060606060040600E0B0A0E0A0B00
spreadBasis[0-3] | 8050C0C0F0A8090A40D0005050D0A
   hexBasis[4-7] | 33333434340333304344434343440
   hexBasis[0-3] | 4865636366A4869A542410551524A
        hexLines | 48656C6C6F 4869 E4BDA0E5A5BD

Class Participation Assignment

Your task is to modify hexlines to produce slightly more readable output, by inserting spaces between each pair of hexadecimal characters. In this case the output from bin/hexlines hello.txt should look like the following.

48 65 6C 6C 6F
48 69
E4 BD A0 E5 A5 BD

You will have time in class to work on this assignment. It is due Wednesday May 22 2024, 19:00.

Updated Thu May 16 2024, 17:35 by cameron.