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

Comment #9 on issue 4377 by [email protected]: 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 <[email protected]>
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 <[email protected]>
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