This patch reorganizes the terminal's source code to become easier to extend. It also enables the strict warning level.