First work on type-system.  Added cdefine functionality to core, various small fixes and enhancements.