Re: [RFC] DSPBRIDGE: Kill CAMelCaSiNg

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

 



On Mon, Sep 21, 2009 at 3:05 PM, Felipe Contreras
<felipe.contreras@xxxxxxxxx> wrote:
> Yes, I think we should do that, and make some sort of release,
> possibly squashing all the changes... my current branch counts 218
> commits.
I think it should be somehow announced before. Because, f.e., my
patches is so big to rewrite them
(and most of them are accepted already, although I can't see commits
in public repository)

> I did a few more cleanups (yeah, I'm too picky) and here's the result.
Actually even this could be simplified :-)

> #**
> #* @brief - changes camel casing to ones with smaller case
> #*
> camel_to_norm() {
>        echo $1 | tr '\_' '+' | sed 's/\([A-Z]\)/_\l\1/g' | sed
> 's/^_\([a-z]\)/\1/g' | \
I suppose there is could be used code like: sed -e '<expr1>; <expr2>'
instead of two or more sed calls.

>        tr 'A-Z' 'a-z' | sed "s/\([a-z][a-z]\+\)/-\1-/g" | tr -d '_'| \
tr -d '_' is the 's/_//g' expression for sed

>        tr '-' '_' | sed -e "s/_$//g" | sed -e "s/^_//g" | tr '+' '_' | \
>        sed -e "s/__*/_/g" | sed -e "s/_\([0-9][0-9]*\)/\1/g" | \
>        sed -e "s/^[a-z]\_\([a-z][a-z]\+\)/\1/g"
The similar. It could be optimized to a few sed calls (perhaps even to
one call with all expressions in a sequence).

> # grab the output for only the ones we want..
> grep "$DIR_FILE" tags | grep -v "^\!" | sed -e
> "s/\/\^.*\"/REPLACE_1/g" > $TMPFILE
sed could match and skip lines like grep -v 'smth.': sed -e '/^!/d; ...'

>                                dos2unix -n $file $TMPFILE1
>                                sed -e "s/\<$token\>/$new/g" $TMPFILE1 > $file
dos2unix actually one expression for sed, AFAIK.
And new sed versions (starting from 3.8?) have -i which means 'in place'.

P.S. And personally I prefer to use perl :-)

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux