Register types and protocols at runtime.

We can't do separate compilation if we use #define in each compilation
unit independently.
Register fields at runtime.
Runtime functions and definitions in a separate compilation unit.
Remove counting of protocols and types in the compiler.