fixes for VS and Mono compatibility
code cleanup
generator for protocol-c code