Open file only when necessary.  Part of issue #123

This change is to make sure that we only open the file whose
language we are trying to figure out only when it is really
necessary.  In addition, code that supports templates (identified
by their extension .in) has been moved to execute before the code
that looks inside the files.  All unit tests pass.

Warning: I removed a piece of code commented thusly:

  This is needed for backward compatibility about #line directive
  behavior.

I do not know what this is about, either this is no longer
applicable or we need another unit test
Fixed up whitespace.  No code changes.
Minor renaming of macros.
Merge pull request #132 from fishman/defer-fopen

Open file only when necessary.  Part of issue #123