Status: Started
Owner: [email protected]
Labels: Type-Enhancement Patch-new

New issue 4377 by [email protected]: Patch: Implement and use "derived_unsmob"
https://code.google.com/p/lilypond/issues/detail?id=4377

Implement and use "derived_unsmob"

The name is open to discussion, and basically this is not more than a
proof-of-concept for making it easy to experiment with variants of
issue 4365: it is obviously easy to change the chosen name by changing
the script.

It is apparent that a lot of replacements occur in the definition of a
"native" unsmob function itself.  And not all such definitions are
used whenever possible.

Contains 2 commits (latter touches just lily/include/smobs.hh):


Run a script for using derived_unsmob where obvious

Script is:

matched="[^()]*"
for i in 1 2 3 4 5
do
    matched="\\(($matched)\\|[^()]\\)*"
done
sed -i 's/\<dynamic_cast\s*<\([_a-zA-Z]\+\)\s*\*> (\([_a-zA-Z]*\)::unsmob\s*(\('"$matched"'\))\s*)/derived_unsmob<\1> (\3)/g' $(git grep -l '\<dynamic_cast[^>]*> ([_a-zA-Z]*::unsmob\>')

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)



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.

http://codereview.appspot.com/238020043

--
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