WHAT I DO NOW
-------------
My application runs small chunks of JScript code with the same style as
is accepted by eval() and within browser event handlers. That is to
say, a block of JScript where the last expression is returned as a
result, even though it has not 'return' statement. e.g.
var a = 1;
a * 2;
The result of this would be 2. I execute this using
IActiveScriptParse.ParseScriptText(), which works fine, but is slow if
done thousands of times.
WHAT I HAVE TRIED
-----------------
1. I tried IActiveScriptParse.AddScriptlet(), but it requires a
'return' statement if it is to give a result.
2. I tried IActiveScriptParseProcedure.ParseProcedureText, but it
also requires a 'return' statement, unless I pass in
SCRIPTPROC_ISEXPRESSION, in which case it will not accept
multiple statements.
3. I tried JScript.NET, but it also cannot handle blocks of code
like this, except within an eval(), in which case the code gets
parsed every time.
The only viable alternative I have at the moment is to use another
JavaScript library like v8, but this is not so good because it will
increase the size of my program and will require me to redistribute the
C runtime DLLs (because my applications is a .Net application and DLLs
compiled with /clr cannot be statatically linked to the C runtime).
Any help would be greatly appreciated.
Oliver
If you add the "return" keyword, and use IActiveScriptParse.AddScriptlet()
and IActiveScriptParseProcedure.ParseProcedureText, is it still slow?
"Oliver Bock" <olive...@nospam.nospam> wrote in message
news:OXXGr8CN...@TK2MSFTNGP06.phx.gbl...
I have not tried that because I cannot add the 'return' keyword due to
an existing body of code that must keep working. It might still be a
good experiment, but I have since found good information on doing this
in an old (but excellent) scripting FAQ that is still available in an
archive:
http://web.archive.org/web/20050408093442/www.mindspring.com/~mark_baker/toc.htm
Regards,
Oliver
Does the FAQ solve the problem?
"Oliver Bock" <olive...@nospam.nospam> wrote in message
news:u%23hjL3BO...@TK2MSFTNGP05.phx.gbl...