lilypond-auto
[Top][All Lists]
Advanced

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

Re: [Lilypond-auto] Issue 4377 in lilypond: Patch: Implement and use "de


From: lilypond
Subject: Re: [Lilypond-auto] Issue 4377 in lilypond: Patch: Implement and use "derived_unsmob"
Date: Tue, 12 May 2015 13:10:03 +0000

Updates:
        Status: Fixed
        Labels: -Patch-push Fixed_2_19_21

Comment #9 on issue 4377 by address@hidden: Patch: Implement and use "derived_unsmob"
https://code.google.com/p/lilypond/issues/detail?id=4377

Pushed to staging as
commit 809acd76be2af232cb4cbc43f86dad820bf97ae0
Author: David Kastrup <address@hidden>
Date:   Thu May 7 21:22:20 2015 +0200

    Issue 4377: Run a script for using derived_unsmob where obvious

    Script is:

    matched="[^()]*"
    for i in 1 2 3 4 5
    do
        matched="\\(($matched)\\|[^()]\\)*"
    done
    filelist="$(git grep -l '\<dynamic_cast[^>]*> ([_a-zA-Z]*::unsmob\>')"
typelist="$(sed -n 's/^.*\<dynamic_cast\s*<\([_a-zA-Z]\+\)\s*\*> (\([_a-zA-Z]*\)::unsmob\>.*$/\1/p' $filelist | sort -u )"
    for typ in $typelist
    do
        # crazy: we have unsmob definitions that are not even used
if git grep -q "$typ::unsmob" || git grep -q "\\<$typ"'\s*\*\s*unsmob\s*(SCM'
        then
        echo "There already is $typ::unsmob"
sed -i '/unsmob (SCM/,/;/!s/\<dynamic_cast\s*<\('"$typ"'\)\s*\*> (\([_a-zA-Z]*\)::unsmob\s*(\('"$matched"'\))\s*)/\1::unsmob (\3)/g' $filelist
        else
sed -i 's/\<dynamic_cast\s*<\('"$typ"'\)\s*\*> (\([_a-zA-Z]*\)::unsmob\s*(\('"$matched"'\))\s*)/derived_unsmob<\1> (\3)/g' $filelist
        fi
    done

    The awkward bit at the start of the script is for matching matched
    parentheses.  This replaces the construct

        dynamic_cast<T *>(xxx::unsmob (yyy))

    with

        derived_unsmob<T> (yyy)

    where appropriate.  If T::unsmob already exists, it is used
    instead (apart from inside of its own definition, of course).

commit 428488bdc1a29c40b7b2326be3587270c49ff86a
Author: David Kastrup <address@hidden>
Date:   Thu May 7 21:21:54 2015 +0200

    Define derived_unsmob<class T> function

    This is a shortcut for dynamic_cast<T *>(T::unsmob (...)) in order to
    provide an unsmob function for derived classes.


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings



reply via email to

[Prev in Thread] Current Thread [Next in Thread]