natlinkmain and _vocola_main
Natlinkmain controls the calling back at the beginning of each utterance (beginCallback) and after each change of microphone state or change of user (speech profile) (changeCallback, of type "mic" or of type "user").
This function is called before all the grammar files (in the userDirectory - for example Unimacro grammars - and in the baseDirectory - _vocola_main.py and grammars that are generated by Vocola) are called back in gotBegin.
Vocola needs a special action at this moment, because when a Vocola user file has been changed, Vocola must run the vcl2py procedure in order to produce the appropriate python grammar file.
In order to do this natlinkmain calls the function _vocola_main.vocolaBeginCallback. This function can see if anything has been changed. If so runs the vcl2py procedure and reports back if a new python grammar file has been made (2) or an existing python grammar file has been changed (1). If nothing was changed it simply returns None. Natlinkmain takes the appropriate action in checking grammar files or loading the new grammar files.
When a new user is opened this natlinkmain function runs. All grammar files are unloaded, and loaded again. In this procedure _vocola_main goes first. It deletes all grammar files that were generated before, and runs vcl2py to make new grammar files. After this step all the grammar files are loaded.
What if Vocola is not running
If Vocola is not active (see in configuration procedure), it should have an instance variable vocolaEnabled set to None. If Vocola is active this variable should be 1.
So in order to have natlinkmain work correct, _vocola_main.py should be valid and do it least above things.
Checking for changed Vocola command files
By default checking for changed Vocola command files is performed at each utterance.