Changes to support scoping of user-defined types and loading of built-in prototypes from a file rather than explicitly in upgrade.php (fix PHP incompatibility - SELF versus self).