Code formatted. Comments and test added.

The extra spaces before 'typedef int flags' in termgenerator.h are removed. And an appropriate documentation comment is added.
Also a test has been added on SmokeTest.java to show that the #616 bug is solved.