C99/compiler fixes
API fixes
scripting: port implementation to C

many GAPS still to be filled. JSON export missing.
API stubs