Add a stack for the shells.

This commit has multiple changes:
- create a common interface for the different (sub)shells, such as the core shell and mdb
- add a stack of these shells
- control these shells from one top-level loop based on the stack
- pass the displayer to use as an argument to line_available instead of making it a member
  of the shell object.