On 12 March 2013 02:25, Daniel Murphy <yebblies@nospamgmail.com> wrote:
"Iain Buclaw" <ibuclaw@ubuntu.com> wrote in message
news:mailman.357.1363023395.14496.digitalmars-d@puremagic.com...
>
> (The D conversion seems to think it's lisp).
>

    Expression resolveLoc(Loc loc, Scope sc)
    {
    tracein("resolveLoc");
    scope(success) traceout("resolveLoc");
    scope(failure) traceerr("resolveLoc");
    {
        FuncDeclaration fd;
        if (sc.callsc && sc.callsc.func)
        fd = sc.callsc.func;
         else fd = sc.func;
        const(char)* s;
        if (fd)
        {
            const(char)* funcStr = fd.Dsymbol.toPrettyChars();
            HdrGenState hgs;
            OutBuffer buf = new OutBuffer();
            functionToCBuffer2(cast(TypeFunction)fd.type, buf, &hgs, 0,
funcStr);
            buf.writebyte(0);
            s = cast(const(char)*)buf.extractData();
        }
         else {
            s = "";
        }
        Expression e = new StringExp(loc, cast(char*)s);
        e = e.semantic(sc);
        e = e.castTo(sc, type);
        return e;
    }
    }




Yes, I know it can be cleaned up.  Just thought I might chime in on a point I thought was amusing.


Regards
--
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';