From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 859561381F3 for ; Sat, 3 Aug 2013 19:47:24 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0CB13E0B20; Sat, 3 Aug 2013 19:47:16 +0000 (UTC) Received: from nm26-vm0.bullet.mail.bf1.yahoo.com (nm26-vm0.bullet.mail.bf1.yahoo.com [98.139.213.74]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 29AB5E0AF7 for ; Sat, 3 Aug 2013 19:47:14 +0000 (UTC) Received: from [66.196.81.170] by nm26.bullet.mail.bf1.yahoo.com with NNFMP; 03 Aug 2013 19:47:14 -0000 Received: from [98.139.211.161] by tm16.bullet.mail.bf1.yahoo.com with NNFMP; 03 Aug 2013 19:47:14 -0000 Received: from [127.0.0.1] by smtp218.mail.bf1.yahoo.com with NNFMP; 03 Aug 2013 19:47:14 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s1024; t=1375559234; bh=jDucMQt2ERBgol5NbxFVIF45wTs03wsbun+yKDZCC7s=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:X-Rocket-Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:References:In-Reply-To:X-Enigmail-Version:Content-Type; b=19lwm1gp6bg1wNkfOS5HtZmKSkDcZaGSI85wqKjgvzJcZ31N+ucf061bTr0WJUjTcbMrew0h7Wu/5GRmxjsDsvHuFJKHRb2/DuLIKRfw5B0rOq79+sFCs6Xg62yEKCXRnCJYz60OlqJqqxnYgjRJKlJ2QzACxkJI8kk4peBkuOQ= X-Yahoo-Newman-Id: 257373.60385.bm@smtp218.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: w09f24IVM1mvIIlilS4hT8HEDN_wiWYsJMF6z.S4jQAsI23 rO0U9IVpkGY6QGNajEH8LShDtYI0lgpC9Jx7_ITEgz3SUzrAY174.zj1l.N5 v1kLJvMhOPBia8xX2LDwyEtO1wDYOAxlva_Av2cFDpRMeAC8IJWrLwBmXx0e 93zrlP34B4XKYOwYsTXyPSDA1H1ISm2n9AfMHqyr2UclLDb.RSmf0qIYj736 CnyZGoTuf1WhAUKuoXSaAdwgdTF1LaK85ycxeauvdc86JZLNLOCtpYS7LQ6j RPZYzD39pSGHW_RCP3E0.8YdM0wonZQHmo1PUIEOc8PVt1xJz2Xu_wQ_yuQj uBuBiSlIIGbAeADQ.ZHfGq7N57AyDcnHsqOnV24WNkmy9AftV7OGPKoRYc7w 9pckmh_lZ1bEPeWXSN1sgp1Y5CZvmJlpIJA5_ABxfYy45CTQIR2Eqky56ldX _som1p5.5fQKqmmrS6xtdsZmpat0Qv7aG7GYDcqixFfDy_JG6izFWCstM5EF AOS.Lf266hDIke6edriwKq6Y_ycm_TmdQyzjeAucv23M8C.3WPwkIvm0- X-Yahoo-SMTP: Zybq.GKswBCVR5oJTLrx1T39m2F9FA-- X-Rocket-Received: from [192.168.0.100] (alex_y_xu@99.254.149.174 with ) by smtp218.mail.bf1.yahoo.com with SMTP; 03 Aug 2013 12:47:14 -0700 PDT Message-ID: <51FD5E41.5020700@yahoo.ca> Date: Sat, 03 Aug 2013 15:47:13 -0400 From: Alex Xu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130701 Thunderbird/17.0.7 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [New eclass] twisted-r1.eclass References: <20130803171303.18911eba@gentoo.org> <20989.10178.719868.528622@a1i15.kph.uni-mainz.de> <20130803202935.64951485@gentoo.org> <51FD5C12.9020901@yahoo.ca> In-Reply-To: <51FD5C12.9020901@yahoo.ca> X-Enigmail-Version: 1.6a1pre Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2LAJBGVGWTGSXICGTRJRP" X-Archives-Salt: 589a62fd-5662-43a6-b8f6-a03c02638dea X-Archives-Hash: 696ee1d665161ecf6976f3d9466a188b This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2LAJBGVGWTGSXICGTRJRP Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 03/08/13 03:37 PM, Alex Xu wrote: > On 03/08/13 02:29 PM, Micha=C5=82 G=C3=B3rny wrote: >> Dnia 2013-08-03, o godz. 17:54:42 >> Ulrich Mueller napisa=C5=82(a): >> >>>>>>>> On Sat, 3 Aug 2013, Micha=C5=82 G=C3=B3rny wrote: >>> >>>> 2. The eclass comes with a pure bash-3.2 CamelCase converter for >>>> changing PNs like 'twisted-foo' into 'TwistedFoo'. The relevant code= >>>> can be moved to eutils as portable replacements for bash-4 ${foo^} >>>> and friends. >>> >>>> # obtain octal ASCII code for the first letter. >>>> local ord=3D$(printf '%o' "'${fl}") >>>> >>>> # check if it's [a-z]. ASCII codes are locale-safe. >>>> if [[ ${ord} -ge 141 && ${ord} -le 172 ]]; then >>>> # now substract 040 to make it upper-case. >>>> # fun fact: in range 0141..0172, decimal '- 40' is fine. >>>> local ord=3D$(( ${ord} - 40)) >>>> # and convert it back to the character. >>>> fl=3D$(printf '\'${ord}) >>>> fi >>> >>> This looks just horrible. You do decimal arithmetic on octal numbers?= >> >> Yes. Bash wasn't really happy to do octal arithmetic for me. Yet >> in this particular case, with proper assumptions, decimal arithmetic i= s >> practically equivalent. >> >=20 > # obtain decimal ASCII code for the first letter. > local fl=3D$(printf '%d' "'${w}") >=20 > # check if it's [a-z]. ASCII codes are locale-safe. > if [[ ${ord} -ge 97 && ${ord} -le 122 ]]; then > local ord=3D$(( ${ord} - 32 )) > # and convert it back to the character. > fl=3D$(printf '\'${ord}) > fi >=20 > echo -n "${fl}${w:1}" >=20 > Probably var names should be adjusted, I'm not too familiar with bash > locals. >=20 > printf '%d' "'twisted" outputs "116" as expected, similar to > printf("%d", *"asdf qwerty") in C. >=20 > Tested in Bash 4.2.45. >=20 > Now time to sit back and wait for it to break in bash > . >=20 I am dumb. Please disregard the previous message. ------enig2LAJBGVGWTGSXICGTRJRP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAEBAgAGBQJR/V5BAAoJEOFfLQs172iqAO4P/RZouSIwtUC7T2x2AJnR39jW jb+gjrdh0A2eo1xQ3zj1kgCgMlXPFaRjKwHmxmEiJVCdK6ulTvOiqOrSmQOVzp3q FH2ypCp3ttI+ZyCt/bGMwIZ5ZAP+QCqogqhFe29G+JKwZ5PvsIpTzok9awRLIJop pbSqR3jM+IisE9jXknciGPbSLNvrJ9PSSJyx1R65DD/EFuyXlcNWjmjWH9aFx2Gq GMibSex6s1k8bvnw+71S85y/uZxRx4neEDWlrPudF8wY2vr5VFVUdNsYNvS1peUa XEGcqnWQhCWslN8PdMYOOGykajgvFzgIRAnNw49fVYFTz1+zeKTTrxg+eaENN25G jRdH2XS7ukS6x5Zzap9mWtFyWv3PvuTsjtTgmLiSzMF2pkocs8Z7ZbGgtoXQt2DY N1ao3QRUsIa6WEPzSn0kgB2BRSGff9S/IRLWC0uioeSRMQFKBK5ynLOfE/RgKwZ3 tcJrUaAcriEh5FGU4vbb0sx6JKEVFrngtCft4GjnrBBYLpdmeLBklfap/gW1zYUk bGSdLHSZK2AMhMRPC0awULM3yHxXkNgVoKtS1DxNWyEtYpSQluc6oP2qEemASxuf KZrshqwgEbwuStHZ3QLyIK+4ed9wbpCpnQRP8ztv0ppOD5rRiQ3FtqjgXa9pTWyX h3Jc0ZVUeaiyo/IWx40r =5OXS -----END PGP SIGNATURE----- ------enig2LAJBGVGWTGSXICGTRJRP--