Subj : Re: Getting function name with generic function call hook To : Sterling Bates From : Brendan Eich Date : Mon Oct 27 2003 02:37 pm Sterling Bates wrote: >I've found a couple others who've claimed to have similar issues, but none >of the remedies worked for me. The most applicable response was this: > >http://groups.google.ca/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3B7779DF.2050105%40meer.net > >Here's the C code: > > JSObject *funobj = JSVAL_TO_OBJECT(argv[-2]); > JSFunction *fun = (JSFunction *) JS_GetPrivate(cx, funobj); > const char *name = JS_GetFunctionName(fun); > > JS_GetFunctionId is the modern way to get the full, jschar (Unicode plane 0 characters) name. >The following is the Delphi equivalent (to my best understanding): > > Dec(argv,2); // point to argv[-2] > funobj := PJSObject(argv^ or JSTYPE_OBJECT); // JSVAL_TO_OBJECT > > No, that's not what JSVAL_TO_OBJECT does. Please re-read jsapi.h near the top; note that JSTYPE_* has nothing to do with jsval values and tags. /be .