Lots of places were assuming that bool and c int were interchangeable,
but of course on windows a c int is 32 bits and that confused
everybody. Tighten up the definitions in static-functions, which
causes us to fix boolean conversion. Also add tests for boolean
conversion, and also add better debug formatting of JS values.