[cfe-dev] Rewrite : Modify RewriteModernObjC::SynthMessageExpr

Vincent R. forumer at smartmobili.com
Fri Aug 2 07:21:39 PDT 2013


Hi,

So I am progressing slowly with my rewriting project to convert objc to 
c# but now I am able at least
to transform method declaration from this

- (void) setAlternateTitle: (NSString *)aString
{
   [_cell setAlternateTitle: aString];
   [self setNeedsDisplay: YES];
}

to this:

public virtual void setAlternateTitle_(NSString *aString) {
   [self->_cell setAlternateTitle:aString];
   [self setNeedsDisplay:((BOOL)1)];
}

there is still the * after NSString after the parameter but I think I 
will manage to remove it.
However rewrite the objc syntax for function call is a lot tricky 
because in the original implementation
that I have disabled it was generating something like :

static void _I_NSButton_setAlternateTitle_(NSButton * self, SEL _cmd, 
NSString *aString) {
   ((void (*)(id, SEL, NSString *))(void *)objc_msgSend)((id)(*(id 
*)((char *)self + OBJC_IVAR_$_NSControl$_cell)), 
sel_registerName("setAlternateTitle:"), (NSString *)aString);
   ((void (*)(id, SEL, BOOL))(void *)objc_msgSend)((id)self, 
sel_registerName("setNeedsDisplay:"), ((BOOL)1));
}

The method that rewrite this part is located inside 
RewriteModernObjC::SynthMessageExpr but it's a presently a bit too 
tricky for
me to understand how to change it to obtain :

_cell.setAlternateTitle(aString);
this.setNeedsDisplay(true);


I am also ready to hire someone just for this task, if this is 
something that can interest you please contact me at vrichomme A.T 
smartmobili D.O.T com.
Please note that I might not be able to answer you during the next 10 
days.

Thanks







More information about the cfe-dev mailing list