Fix command, enum, and typedef selection.

- Correctly respect api attribute to indicate specialization of entries
  for particular APIs
- Correctly determine required typedefs for the declared functions