From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: ulm@gentoo.org, python@gentoo.org
Subject: Re: [gentoo-dev] [New eclass] twisted-r1.eclass
Date: Sat, 3 Aug 2013 20:29:35 +0200 [thread overview]
Message-ID: <20130803202935.64951485@gentoo.org> (raw)
In-Reply-To: <20989.10178.719868.528622@a1i15.kph.uni-mainz.de>
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
Dnia 2013-08-03, o godz. 17:54:42
Ulrich Mueller <ulm@gentoo.org> napisał(a):
> >>>>> On Sat, 3 Aug 2013, Michał Górny 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=$(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=$(( ${ord} - 40))
> > # and convert it back to the character.
> > fl=$(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 is
practically equivalent.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
next prev parent reply other threads:[~2013-08-03 18:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-03 15:13 [gentoo-dev] [New eclass] twisted-r1.eclass Michał Górny
2013-08-03 15:54 ` Ulrich Mueller
2013-08-03 18:29 ` Michał Górny [this message]
2013-08-03 19:37 ` Ulrich Mueller
2013-08-03 19:42 ` Michał Górny
2013-08-03 19:37 ` Alex Xu
2013-08-03 19:47 ` Alex Xu
2013-08-03 19:49 ` Michał Górny
2013-08-03 21:57 ` Michał Górny
2013-08-03 22:28 ` Michał Górny
2013-08-04 5:15 ` [gentoo-dev] " Marien Zwart
2013-08-04 7:34 ` Michał Górny
2013-08-04 12:37 ` [gentoo-dev] " Michał Górny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130803202935.64951485@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=python@gentoo.org \
--cc=ulm@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox