[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: contest dependeded meanings for yes and no



Hello Frans,

On Tue, Jan 09, 2007 at 03:56:05PM +0100, Frans Pop wrote:
> On Tuesday 09 January 2007 15:45, Nicolas François wrote:
> > According to "info libc", the following expressions should be allowed:
> > yesexpr
> > "^([aA][lL][rR][eE][aA][dD][yY]|[cC][oO][rR][rR][eE][cC][tT]|[yY][eE][s
> >S])" yesexpr "^([nN][oO]|[iI][nN][cC][oO][rR][rR][eE][cC][tT])"
> >
> > In this case, I would however recommend to use a shorter form since
> > there is no ambiguity after the first char:
> > yesexpr "^[aAcCyY]"
> > noexpr "^[nNiI]"
> 
> The longer expression fails on typo's in the full string, yours does not. 
> I'd say that could be relevant.

Is the typo just that there are two yesexpr instead of a yesexpr and a noexpr?

I could successfully test it.
I'm attaching fr_HOME, which is a new locale I won't propose for
inclusion.
It gives an example with:
yesexpr "^([aA][lL][rR][eE][aA][dD][yY]|[cC][oO][rR][rR][eE][cC][tT]|[yY][eE][sS])"
noexpr "^([nN][oO]|[iI][nN][cC][oO][rR][rR][eE][cC][tT])"

and (commented):
yesexpr "^([oOyY]|nwi)"
noexpr "^(no|No)"

You just have to:
    mkdir locales gen
put fr_HOME in locales, then
    localedef -i locales/fr_HOME gen/fr_HOME

I'm attaching a test program (test.c, to be compiled with gcc -o test test.c)
Just execute:
    LOCPATH=gen/ LC_ALL=fr_HOME ./test

Here is an execution log:
$ LOCPATH=gen/ LC_ALL=fr_HOME ./test
yesexpr: '^([aA][lL][rR][eE][aA][dD][yY]|[cC][oO][rR][rR][eE][cC][tT]|[yY][eE][sS])'
noexpr: '^([nN][oO]|[iI][nN][cC][oO][rR][rR][eE][cC][tT])'
Yes or no? n
The answer did not match yesexpr or noexpr.
Yes or no? y
The answer did not match yesexpr or noexpr.
Yes or no? ye
The answer did not match yesexpr or noexpr.
Yes or no? already
The answer was: yes
$ LOCPATH=gen/ LC_ALL=fr_HOME ./test
yesexpr: '^([aA][lL][rR][eE][aA][dD][yY]|[cC][oO][rR][rR][eE][cC][tT]|[yY][eE][sS])'
noexpr: '^([nN][oO]|[iI][nN][cC][oO][rR][rR][eE][cC][tT])'
Yes or no? i
The answer did not match yesexpr or noexpr.
Yes or no? in
The answer did not match yesexpr or noexpr.
Yes or no? iNcOrrect
The answer was: no


$ LOCPATH=gen/ LC_ALL=fr_HOME ./test
yesexpr: '^([oOyY]|nwi)'
noexpr: '^(no|No)'
Yes or no? n
The answer did not match yesexpr or noexpr.
Yes or no? no
The answer was: no
$ LOCPATH=gen/ LC_ALL=fr_HOME ./test
yesexpr: '^([oOyY]|nwi)'
noexpr: '^(no|No)'
Yes or no? n
The answer did not match yesexpr or noexpr.
Yes or no? nw
The answer did not match yesexpr or noexpr.
Yes or no? nwi
The answer was: yes
$ LOCPATH=gen/ LC_ALL=fr_HOME ./test
yesexpr: '^([oOyY]|nwi)'
noexpr: '^(no|No)'
Yes or no? Oui
The answer was: yes


So the experiment seems to show it works.
I'm just a little bit worried by the BUGS section of rpmatch(3), which states
that only the first character is used. (probably an old bug, which could
indicate that the above usage is not portable; maybe it's just a bug in the
manpage too).

Kind Regards,
-- 
Nekral
comment_char %
escape_char  /
%
% French Language Locale for France
% Source: RAP
% Address: Sankt Jo//rgens Alle 8
%    DK-1615 Ko//benhavn V, Danmark
% Contact: Keld Simonsen
% Email: Keld.Simonsen@dkuug.dk
% Tel: +45 - 31226543
% Fax: +45 - 33256543
% Language: fr
% Territory: FR
% Revision: 4.3
% Date: 1996-10-15
% Users: general
% Charset: ISO-8859-1
% Distribution and use is free, also
% for commercial purposes.

LC_IDENTIFICATION
title      "French locale for France"
source     "RAP"
address    "Sankt Jorgens Alle 8, DK-1615 K?benhavn V, Danmark"
contact    "Keld Simonsen"
email      "bug-glibc-locales@gnu.org"
tel        ""
fax        ""
language   "French"
territory  "France"
revision   "1.0"
date       "2000-06-28"
%
category  "fr_FR:2000";LC_IDENTIFICATION
category  "fr_FR:2000";LC_CTYPE
category  "fr_FR:2000";LC_COLLATE
category  "fr_FR:2000";LC_TIME
category  "fr_FR:2000";LC_NUMERIC
category  "fr_FR:2000";LC_MONETARY
category  "fr_FR:2000";LC_MESSAGES
category  "fr_FR:2000";LC_PAPER
category  "fr_FR:2000";LC_NAME
category  "fr_FR:2000";LC_ADDRESS
category  "fr_FR:2000";LC_TELEPHONE
category  "fr_FR:2000";LC_MEASUREMENT

END LC_IDENTIFICATION

LC_CTYPE
copy "i18n"

translit_start

% In France, accents are simply omitted if they cannot be represented.
include "translit_combining";""

translit_end

END LC_CTYPE

LC_COLLATE
% Copy the template from ISO/IEC 14651
copy "iso14651_t1"
END LC_COLLATE

LC_MESSAGES
% The default (fr_FR)
%yesexpr "<U005E><U005B><U006F><U004F><U0079><U0059><U005D><U002E><U002A>"
% uncomment the next line for: ^([oOyY]|nwi)
%yesexpr "<U005E><U0028><U005B><U006F><U004F><U0079><U0059><U005D><U007C><U006E><U0077><U0069><U0029>"
% uncomment the next line for:
%    ^([aA][lL][rR][eE][aA][dD][yY]|[cC][oO][rR][rR][eE][cC][tT]|[yY][eE][sS])
yesexpr "<U005E><U0028><U005B><U0061><U0041><U005D><U005B><U006C><U004C><U005D><U005B><U0072><U0052><U005D><U005B><U0065><U0045><U005D><U005B><U0061><U0041><U005D><U005B><U0064><U0044><U005D><U005B><U0079><U0059><U005D><U007C><U005B><U0063><U0043><U005D><U005B><U006F><U004F><U005D><U005B><U0072><U0052><U005D><U005B><U0072><U0052><U005D><U005B><U0065><U0045><U005D><U005B><U0063><U0043><U005D><U005B><U0074><U0054><U005D><U007C><U005B><U0079><U0059><U005D><U005B><U0065><U0045><U005D><U005B><U0073><U0053><U005D><U0029>"
% The default (fr_FR)
%noexpr  "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
% uncomment the next line for: ^(no|No)
%noexpr  "<U005E><U0028><U006E><U006F><U007C><U004E><U006F><U0029>"
% uncomment the next line for: ^([nN][oO]|[iI][nN][cC][oO][rR][rR][eE][cC][tT])
noexpr "<U005E><U0028><U005B><U006E><U004E><U005D><U005B><U006F><U004F><U005D><U007C><U005B><U0069><U0049><U005D><U005B><U006E><U004E><U005D><U005B><U0063><U0043><U005D><U005B><U006F><U004F><U005D><U005B><U0072><U0052><U005D><U005B><U0072><U0052><U005D><U005B><U0065><U0045><U005D><U005B><U0063><U0043><U005D><U005B><U0074><U0054><U005D><U0029>"
END LC_MESSAGES

LC_MONETARY
int_curr_symbol           "<U0045><U0055><U0052><U0020>"
currency_symbol           "<U20AC>"
mon_decimal_point         "<U002C>"
mon_thousands_sep         "<U0020>"
mon_grouping              3;3
positive_sign             ""
negative_sign             "<U002D>"
int_frac_digits           2
frac_digits               2
p_cs_precedes             0
p_sep_by_space            1
n_cs_precedes             0
n_sep_by_space            1
p_sign_posn               1
n_sign_posn               1
END LC_MONETARY

LC_NUMERIC
decimal_point             "<U002C>"
thousands_sep             "<U0020>"
grouping                  3;3
END LC_NUMERIC

LC_TIME
abday   "<U0064><U0069><U006D>";"<U006C><U0075><U006E>";/
        "<U006D><U0061><U0072>";"<U006D><U0065><U0072>";/
        "<U006A><U0065><U0075>";"<U0076><U0065><U006E>";/
        "<U0073><U0061><U006D>"
day     "<U0064><U0069><U006D><U0061><U006E><U0063><U0068><U0065>";/
        "<U006C><U0075><U006E><U0064><U0069>";/
        "<U006D><U0061><U0072><U0064><U0069>";/
        "<U006D><U0065><U0072><U0063><U0072><U0065><U0064><U0069>";/
        "<U006A><U0065><U0075><U0064><U0069>";/
        "<U0076><U0065><U006E><U0064><U0072><U0065><U0064><U0069>";/
        "<U0073><U0061><U006D><U0065><U0064><U0069>"
abmon   "<U006A><U0061><U006E>";"<U0066><U00E9><U0076>";/
        "<U006D><U0061><U0072>";"<U0061><U0076><U0072>";/
        "<U006D><U0061><U0069>";"<U006A><U0075><U006E>";/
        "<U006A><U0075><U0069>";"<U0061><U006F><U00FB>";/
        "<U0073><U0065><U0070>";"<U006F><U0063><U0074>";/
        "<U006E><U006F><U0076>";"<U0064><U00E9><U0063>"
mon     "<U006A><U0061><U006E><U0076><U0069><U0065><U0072>";/
        "<U0066><U00E9><U0076><U0072><U0069><U0065><U0072>";/
        "<U006D><U0061><U0072><U0073>";/
        "<U0061><U0076><U0072><U0069><U006C>";/
        "<U006D><U0061><U0069>";/
        "<U006A><U0075><U0069><U006E>";/
        "<U006A><U0075><U0069><U006C><U006C><U0065><U0074>";/
        "<U0061><U006F><U00FB><U0074>";/
        "<U0073><U0065><U0070><U0074><U0065><U006D><U0062><U0072><U0065>";/
        "<U006F><U0063><U0074><U006F><U0062><U0072><U0065>";/
        "<U006E><U006F><U0076><U0065><U006D><U0062><U0072><U0065>";/
        "<U0064><U00E9><U0063><U0065><U006D><U0062><U0072><U0065>"
d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
d_fmt   "<U0025><U0064><U002E><U0025><U006D><U002E><U0025><U0059>"
t_fmt   "<U0025><U0054>"
am_pm   "";""
t_fmt_ampm ""
date_fmt "<U0025><U0041><U0020><U0025><U002D><U0065><U0020>/
<U0025><U0042><U0020><U0025><U0059><U002C><U0020>/
<U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0028><U0055><U0054><U0043><U0025><U007A><U0029>"
first_weekday 2
END LC_TIME

LC_PAPER
height   297
width    210
END LC_PAPER

LC_TELEPHONE
tel_int_fmt    "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
<U006C>"
tel_dom_fmt    "<U0025><U0061><U0020><U0025><U006C>"
int_prefix     "<U0033><U0033>"
int_select     "<U0030><U0030>"
END LC_TELEPHONE

LC_MEASUREMENT
measurement    1
END LC_MEASUREMENT

LC_NAME
name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
<U0025><U006D><U0025><U0074><U0025><U0066>"
name_gen    ""
name_mr     "<U004D><U002E>"
name_mrs    "<U004D><U006D><U0065>"
name_miss   "<U004D><U006C><U006C><U0065>"
name_ms     ""
END LC_NAME

LC_ADDRESS
postal_fmt    "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
<U004E><U0025><U0025><U007A><U0020><U0025><U0054><U0025>/
<U004E><U0025><U0063><U0025><U004E>"
country_ab2 "<U0046><U0052>"
country_ab3 "<U0046><U0052><U0041>"
country_num 250
country_name "<U0046><U0072><U0061><U006E><U0063><U0065>"
country_car "<U0046>"
country_post "<U0046><U0052>"
country_isbn 2
lang_name "<U0066><U0072><U0061><U006E><U00E7><U0061><U0069><U0073>"
lang_ab   "<U0066><U0072>"
lang_term "<U0066><U0072><U0061>"
lang_lib  "<U0066><U0072><U0065>"
END LC_ADDRESS

Reply to: