Andrej Mitrovic , dans le message (digitalmars.D.announce:21155), a écrit : > Ok now I definitely need a dfix program. The problem is toUTFz can't > be used in UFCS like toUTF16z could, so now I have to replace all > expression.toUTF16z code to toUTFz!(const(wchar)*)(expression). > Personally I find this thing to be ugly enough to warrant a good alias > anyway. > > Anyone clever enough to do this via sed?
's/\([_a-zA-Z][_a-zA-Z0-9]*\) *\. *toUTF16z/toUTFz!(const(wchar)*)(\1)/g' will work with any expression that is made of one valid d identifier with no strange characters. Spaces are allowed arround the dot. I don't think this will catch anything else. However, things like templateName!expression.toUTF16z will get broken like this: templateName!toUTFz!(const(wchar)*)(expression). The compiler may not even complain... The sed expression could be modified to take care of this. Things like (expressionA ~ expressionB).toUTF16z will not be converted. I could find a patern easily for this one, but I would have to make a new one for every nested parenthesis. etc...
