Main commit of the day.

Added more patterns, function prototypes, more constants, a set of
global variables, and a few more utility functions. Added error
reporting function.