⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 locale.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
enclosed between angle brackets(&lt;and&gt;),and must not duplicateany symbolic name in the current charmap file (if any), or any othersymbolic name defined in this collation definition.A&lt;<i>collating-symbol</i>&gt;defined via thiskeyword is only recognised with the LC_COLLATE category.<p><b>Example</b>:<code><pre>collating-symbol &lt;UPPER_CASE&gt;collating-symbol &lt;HIGH&gt;</code></pre><p>The<b>collating-symbol</b>keyword defines a symbolic namethat can be associated with a relative position inthe character order sequence.While such a symbolicname does not represent any collating element, itcan be used as a weight.<h5><a name = "tag_005_003_002_003">&nbsp;</a>The order_start Keyword</h5>The<b>order_start</b>keyword must precede collation order entries andalso defines the number of weights for this collation sequencedefinition and other collation rules.<p>The syntax of the<b>order_start</b>keyword is:<p><dl compact><dt> <dd><tt>"order_start %s;%s;...;%s\n"</tt>, &lt;<i>sort-rules</i>&gt;,&lt;<i>sort-rules</i>&gt;</dl></p><p>The operands to the<b>order_start</b>keyword are optional.If present, the operands define rules to be applied whenstrings are compared.The number of operands define howmany weights each element is assigned;if no operandsare present, one<b>forward</b>operand is assumed.If present, the first operand defines rules to be appliedwhen comparing strings using the first (primary) weight;the second when comparing strings using the second weight,and so on.Operands are separated by semicolons(;).Each operand consists of one or more collation directives,separated by commas(,).If the number of operands exceeds the{COLL_WEIGHTS_MAX}limit, the utility will issue a warning message.The following directives will be supported:<dl compact><dt><b>forward</b><dd>Specifies that comparison operations for theweight level proceed from start ofstring towards the end of string.<dt><b>backward</b><dd>Specifies that comparison operations for theweight level proceed from end ofstring towards the beginning of string.<dt><b>position</b><dd>Specifies that comparison operations for theweight level will consider the relativeposition ofelements in the strings not subject to<b>IGNORE</b>.The string containing an element not subject to<b>IGNORE</b>after the fewest collating elements subject to<b>IGNORE</b>from the start of the comparewill collate first.If both strings contain a character not subject to<b>IGNORE</b>in the same relative position, thecollating values assigned to the elements willdetermine the ordering.In case of equality, subsequent characters not subject to<b>IGNORE</b>are considered in the same manner.</dl><p>The directives<b>forward</b>and<b>backward</b>are mutually exclusive.<p><b>Example</b>:<code><pre>order_start    forward;backward</code></pre><p>If no operands are specified, a single<b>forward</b>operand is assumed.<p>The character (and collating element) order is defined bythe order in which characters and elements are specifiedbetween the<b>order_start</b>and<b>order_end</b>keywords.This character order is used in range expressions in regular expressions (see<xref href=re><a href="re.html#tag_007">Regular Expressions</a></xref>).Weights assigned to the characters andelements define the collation sequence;in the absenceof weights, the character order is also the collation sequence.<p>The<b>position</b>keyword provides the capability toconsider, in a compare, the relative position ofcharacters not subject to<b>IGNORE</b>.As an example, consider the two strings &quot;o-ring&quot; and &quot;or-ing&quot;.Assuming the hyphen is subject to<b>IGNORE</b>on the first pass, the two strings willcompare equal, and the position of the hyphen is immaterial.On second pass, all characters except the hyphen are subject to<b>IGNORE</b>,and in the normal case the two strings would again compare equal.By taking position into account, the first collates before the second.<h5><a name = "tag_005_003_002_004">&nbsp;</a>Collation Order</h5><xref type="5" name="collorder"></xref>The<b>order_start</b>keyword is followed by collating identifier entries.The syntax for the collating element entries is:<p><dl compact><dt> <dd><tt>"%s %s;%s;...;%s\n"</tt>, &lt;<i>collating-identifier</i>&gt;,&lt;<i>weight</i>&gt;,&lt;<i>weight</i>&gt;,...</dl></p><p>Each<i>collating-identifier</i>consists of either a character(in any of the forms defined in<xref href=locldefn><a href="#tag_005_003">Locale Definition</a></xref>),a&lt;<i>collating-element</i>&gt;,a&lt;<i>collating-symbol</i>&gt;,an ellipsis or the special symbol<b>UNDEFINED</b>.The order in which collating elements are specifieddetermines the characterorder sequence, such that eachcollating element compares less than the elements following it.The NUL character compares lower than any other character.<p>A&lt;<i>collating-element</i>&gt;is used to specify multi-charactercollating elements, and indicates that the character sequencespecified via the&lt;<i>collating-element</i>&gt;is to be collated asa unit and in the relative order specified by its place.<p>A&lt;<i>collating-symbol</i>&gt;is used to define a position inthe relative order for use in weights.No weights are specified with a&lt;<i>collating-symbol</i>&gt;.<p>The ellipsis symbol specifies that a sequence ofcharacters will collate according to their encoded character values.It is interpreted as indicating that all characters witha coded character set value higher than the value of thecharacter in the preceding line, and lower than thecoded character set value for the character in the followingline, in the current coded character set, will be placed inthe character collation order between the previous and thefollowing character in ascending order according to their codedcharacter set values.An initial ellipsis isinterpreted as if the preceding line specified the NULcharacter, and a trailing ellipsis as if the following linespecified the highest coded character set value in thecurrent coded character set.An ellipsis is treatedas invalid if the preceding or following lines do notspecify characters in the current coded character set.The use of the ellipsis symbol ties the definition to aspecific coded character set and may preclude the definitionfrom being portable between implementations.<p>The symbol<b>UNDEFINED</b>is interpreted as including all coded character set valuesnot specified explicitly or via the ellipsis symbol.Such characters are inserted in the character collationorder at the point indicated by the symbol, and inascending order according to their coded character set values.If no<b>UNDEFINED</b>symbol is specified, and the current coded character setcontains characters not specified in this section, theutility will issue a warning message and place suchcharacters at the end of the character collation order.<p>The optionaloperands for each collation-element are used to define the primary,secondary, or subsequent weights for the collating element.The first operand specifies the relative primary weight, the secondthe relative secondary weight, and so on.Two or more collation-elements can be assigned the same weight;they belong to the sameif they have the same primary weight.Collation behaves as if, for each weight level,elements subject to<b>IGNORE</b>are removed,unless the<b>position</b>collation directive is specified forthe corresponding level with the<b>order_start</b>keyword.Then each successive pair of elements is compared according to therelative weights for the elements.If the two strings compareequal, the process is repeated for the next weight level,up to the limit{COLL_WEIGHTS_MAX}.<p>Weights are expressed as characters (in any of the formsspecified in<xref href=locldefn><a href="#tag_005_003">Locale Definition</a></xref>),&lt;<i>collating-symbol</i>&gt;s,&lt;<i>collating-element</i>&gt;s,an ellipsis, or the special symbol<b>IGNORE</b>.A single character, a&lt;<i>collating-symbol</i>&gt;or a&lt;<i>collating-element</i>&gt;representthe relativeposition in the character collating sequence of thecharacter or symbol, rather than the character or characters themselves.Thus, rather than assigning absolute valuesto weights, a particular weight is expressed using the relativeorder value assigned to a collating element based on its orderin the character collation sequence.<p>One-to-many mapping is indicated by specifying two or moreconcatenated characters or symbolic names.For example, if the character&lt;eszet&gt;is given the string&lt;s&gt;&lt;s&gt;as a weight,comparisons are performed as if all occurrences ofthe character&lt;eszet&gt;are replaced by&lt;s&gt;&lt;s&gt;(assuming that&lt;s&gt;has the collating weight&lt;s&gt;).If it is necessary to define&lt;eszet&gt;and&lt;s&gt;&lt;s&gt;as an equivalence class, then acollating element must be defined for the stringss.<p>All characters specified via an ellipsis will by defaultbe assigned unique weights, equal to the relative order of characters.Characters specified via an explicit or implicit<b>UNDEFINED</b>special symbol will by default be assigned the sameprimary weight (that is, belong to the same equivalence class).An ellipsis symbol as a weight is interpreted to mean thateach character in the sequence has unique weights, equalto the relative order of their character in the character collation sequence.The use of the ellipsis as a weight is treatedas an error if the collating element is neither an ellipsisnor the special symbol<b>UNDEFINED</b>.<p>The special keyword<b>IGNORE</b>as a weight indicates thatwhen strings are compared using the weights at the levelwhere<b>IGNORE</b>is specified, the collating element is ignored; that is,as if the string did not contain the collating element.In regular expressions and pattern matching, allcharacters that are subject to<b>IGNORE</b>in their primary weight forman equivalence class.<p>An empty operand is interpreted as the collating element itself.<p>For example, the order statement:<code><pre>&lt;a&gt;    &lt;a&gt;;&lt;a&gt;</code></pre>is equal to:<code><pre>&lt;a&gt;</code></pre><p>An ellipsis can be used as an operand if the collating element wasan ellipsis, and is interpreted as the value of each characterdefined by the ellipsis.<p>The collation order as defined in this section defines theinterpretation of bracket expressions in regular expressions(see<xref href=rebrack><a href="re.html#tag_007_003_005">RE Bracket Expression</a></xref>).<br><p><b>Example</b>:<pre><dl compact><dt> <dd><table <tr valign=top><td align=left>order_start<td align=left>forward;backward<tr valign=top><td align=left>UNDEFINED<td align=left>IGNORE;IGNORE<tr valign=top><td align=left>&lt;LOW&gt;<tr valign=top><td align=left>&lt;space&gt;<td align=left>&lt;LOW&gt;;&lt;space&gt;<tr valign=top><td align=left>...<td align=left>&lt;LOW&gt;;...<tr valign=top><td align=left>&lt;a&gt;<td align=left>&lt;a&gt;;&lt;a&gt;<tr valign=top><td align=left>&lt;a-acute&gt;<td align=left>&lt;a&gt;;&lt;a-acute&gt;<tr valign=top><td align=left>&lt;a-grave&gt;<td align=left>&lt;a&gt;;&lt;a-grave&gt;<tr valign=top><td align=left>&lt;A&gt;<td align=left>&lt;a&gt;;&lt;A&gt;<tr valign=top><td align=left>&lt;A-acute&gt;<td align=left>&lt;a&gt;;&lt;A-acute&gt;<tr valign=top><td align=left>&lt;A-grave&gt;<td align=left>&lt;a&gt;;&lt;A-grave&gt;<tr valign=top><td align=left>&lt;ch&gt;<td align=left>&lt;ch&gt;;&lt;ch&gt;<tr valign=top><td align=left>&lt;Ch&gt;<td align=left>&lt;ch&gt;;&lt;Ch&gt;<tr valign=top><td align=left>&lt;s&gt;<td align=left>&lt;s&gt;;&lt;s&gt;<tr valign=top><td align=left>&lt;eszet&gt;<td align=left>"&lt;s&gt;&lt;s&gt;";"&lt;eszet&gt;&lt;eszet&gt;"<tr valign=top><td align=left>order_end</table></dl></pre><p>This example is interpreted as follows:<ol><p><li>The<b>UNDEFINED</b>means that all characters not specified inthis definition (explicitly or via the ellipsis) areignored for collation purposes; for regular expressionpurposes they are ordered first.<p><li>All characters between&lt;space&gt;and&lt;a&gt;have the same primary equivalence class and individual secondaryweights based on 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -