www.pudn.com > xvoice-0.8.1.rar > COMMANDS
The xvoice.xml file contains entries with the following structure:
<xvoice>
<application name='emacs' expr='emacs'>
<<root>> = "expand" -> <key char='/' alt='true'/>
| "open file> -> <key char='xf' control='true'/>
............
</application>
.....other apps defined here ....
</xvoice>
There are three kinds of top-level elements which can appear under <xvoice>:
<application name='emacs' expr='emacs'> -- defines a grammar which will be
loaded by xvoice automatically when you say "command mode" in a matching
window. "name" is the name of the grammar. "expr" is used by xvoice to match the
name of the application window. It is a regular expression. E.g. "VIM.*" will match
vim windows which dynamically set their title bar. "Netscape.*" will match
Netscape windows.
<vocab name='shell'> -- defines a grammar which is not automatically associated
with any application, but can be loaded by xvoice with a <grammar> event. This is
used to provide context grammars. For example if you want different commands for
XTerm if you're using bash, ncftp, vim, etc., you can define them as <vocab>, and
define commands like
| "shell commands on" -> <grammar name='shell' action='on' />
to load your commands.
<define> -- defines a grammar which can be included by a <grammar> or <vocab>.
This works like a macro, or #include in C. The grammar in a <define> is never
complied. It is merely written to a .bnf file. This allows common elements to
be declared once and used by many applications, e.g. character commands ("a",
"b", ...), or number translations ("two hundred five", etc.). A <define> section
must not have a <<root>> element. A <application> or <vocab> includes the definition
by using INCLUDE, e.g.
INCLUDE "numbers.bnf"
The ".bnf" is required.
For details on BNF format, consult the ViaVoice users guide.