Changes to kernel generation

1. Removed cmp_idx from proto contexts. Not needed anymore, parameters
   are numbered sequentially.
2. Changed parameter naming scheme slightly.
3. Made state parameter to context construcctors non-optional. This
   prevents errors with declaration of unneeded parameters.