generating php and c++ source and fixing bug in generate-code script