bytecode reader

Hi,
I currently write a tool to parse the LLVM bytecode file (.bc file). So I
have some very basic questions:
- First, about the Abbreviation ID ( "0"=END_BLOCK, "1"=ENTER_SUBBLOCK...):
how to read these ID from the file stream ? I mean, I don't know, how many
bit length they are. It doesn't exist on the document.
- Second, how is the order to read the bytecode ?
For example 4 bytes after the LLVM IR magic nr.: 21 0C 00 00
It describes the MODULE_BLOCK with its parameters, actually. But I don't
know how
to extract them from those bytes.

I hope that somebody can help me answer these questions.

Thanks and Regards,
Quang