<html lang="en"> <head> <title>Filter Modes - Aspell Developer's Manual</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="description" content="Aspell spell checker developer's manual."> <meta name="generator" content="makeinfo 4.8"> <link title="Top" rel="start" href="index.html#Top"> <link rel="prev" href="Filter-Interface.html#Filter-Interface" title="Filter Interface"> <link rel="next" href="Data-Structures.html#Data-Structures" title="Data Structures"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This is the developer's manual for Aspell. Copyright (C) 2002, 2003, 2004, 2006 Kevin Atkinson. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <p> <a name="Filter-Modes"></a> Next: <a rel="next" accesskey="n" href="Data-Structures.html#Data-Structures">Data Structures</a>, Previous: <a rel="previous" accesskey="p" href="Filter-Interface.html#Filter-Interface">Filter Interface</a>, Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> <hr> </div> <h2 class="chapter">12 Filter Modes</h2> <p>Filter modes are the preferred way to specify combinations of filters which are used regularly and thus abbreviate Aspell's command line arguments. <p>A new filter mode is specified by a file named like the filter new mode and prefixed by <samp><span class="file">.amf</span></samp> (Aspell Mode File). If such a file is accessible by the path set via filter-path option Aspell will try to load the contained mode specification. <h3 class="section">12.1 Aspell Mode File</h3> <p>The first key in the made file has be the <code>mode</code> key. It is checked against the mode name part of the .amf file. If the <code>mode</code> key is missing mode file will be rejected. <p>The same holds for the <code>aspell</code> key which specifies the version(s) of Aspell which is(are) required by the filter. <p>If these two keys are followed by at least one <code>magic</code> key Aspell will be able to select the entire mode from extension and if required from contents of the file to spell implicitly. <p>The last key of the required keys is the <code>des[c[ription]]</code> key. It gives a short description of the filter mode which will displayed when type <samp><span class="command">aspell help</span></samp>. <p>The rest of the file consists of the keys <code>filter</code> and <code>option</code> to load filters are set various options. <h4 class="subsection">12.1.1 Version Line</h4> <p>Each version line must start with <code>aspell</code> and be followed by a version, optionally prefixed by a relational operator. The relation operator can be one of `<', `<=', `=', `>=' or '>' for allowing Aspell version with version number being lower, lower or equal, equal to, greater or equal or greater than required version number, respectfully. If the relation operator is omitted `=' is assumed. <h4 class="subsection">12.1.2 Magic Line</h4> <p>The magic line contains a description which requirements files have to fulfill in order to implicitly activate the entire mode at least one such line is required. Each magic line has the following format: <pre class="example"> MAGIC /<magic key>/<fileextention>[/<fileextention>] </pre> <p>The magic key consist of three `:' separated fields. The first two are byte counts the last is a regular expression. The first byte count indicates the first byte the regular expression will be applied to the second byte count indicates the number of bytes to test against the regular expression. <p>If mode selection should only occurred on basis of the listed file extensions the magic key should consist of the “<noregex>” special string. <p>At least one <fileextention> is required per MAGIC line. <fileextention> may not be empty and should not contain a leading `.' as this is assumed implicitly. <p>Multiple MAGIC lines are allowed. Modes may be extended limited by additional <label>.amf files located in –filter-path Thus file extensions may be prefixed by `+' or `-' to indicate that the entire extension has to be added ore removed from this <magic key> if neither is specified than a `+' is assumed implicitly. <h4 class="subsection">12.1.3 Description Line</h4> <p>The required description line will be printed when typing <samp><span class="command">aspell help</span></samp>. Keep it as short as possible. Possible abbreviations are <code>des</code> and <code>desc</code>. <h4 class="subsection">12.1.4 Filter and Option Lines</h4> <p>The <code>filter</code> and <code>option</code> keys load filters and set filter options. <p>The value of the <code>filter</code> key is equal to the value of Aspell's <code>[add|rem]-filter</code> option. <p>Each <code>option</code> line has the following format: <pre class="example"> OPTION <option> [<value>] </pre> <p>The format of the <option> and <value> is the same format as found in the Aspell configuration file. <!-- Following this comes the section ``Data Structures'' --> <!-- *- end of new text -*- --> <!-- The section ``Config Options'' was here --> </body></html>