[pure-lang-svn] SF.net SVN: pure-lang: [290] pure/trunk
Status: Beta
Brought to you by:
agraef
From: <ag...@us...> - 2008-06-23 13:07:17
|
Revision: 290 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=290&view=rev Author: agraef Date: 2008-06-23 06:07:26 -0700 (Mon, 23 Jun 2008) Log Message: ----------- Make pure_invoke() callable from C. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/interpreter.cc pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-06-23 11:10:39 UTC (rev 289) +++ pure/trunk/ChangeLog 2008-06-23 13:07:26 UTC (rev 290) @@ -1,3 +1,7 @@ +2008-06-23 Albert Graef <Dr....@t-...> + + * runtime.h, runtime.cc: Make pure_invoke() callable from C. + 2008-06-22 Albert Graef <Dr....@t-...> * expr.cc, interpreter.cc, parser.yy, lexer.ll, printer.cc: Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-06-23 11:10:39 UTC (rev 289) +++ pure/trunk/interpreter.cc 2008-06-23 13:07:26 UTC (rev 290) @@ -2743,7 +2743,7 @@ assert(f.fp); e = 0; clock_t t0 = clock(); - pure_expr *res = pure_invoke(f.fp, e); + pure_expr *res = pure_invoke(f.fp, &e); if (interactive && stats) clocks = clock()-t0; // Get rid of our anonymous function. JIT->freeMachineCodeForFunction(f.f); @@ -2829,7 +2829,7 @@ assert(f.fp); e = 0; clock_t t0 = clock(); - pure_expr *res = pure_invoke(f.fp, e); + pure_expr *res = pure_invoke(f.fp, &e); if (interactive && stats) clocks = clock()-t0; // Get rid of our anonymous function. JIT->freeMachineCodeForFunction(f.f); Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-06-23 11:10:39 UTC (rev 289) +++ pure/trunk/runtime.cc 2008-06-23 13:07:26 UTC (rev 290) @@ -755,8 +755,10 @@ } extern "C" -pure_expr *pure_invoke(void *f, pure_expr*& e) +pure_expr *pure_invoke(void *f, pure_expr** _e) { + assert(_e); + pure_expr*& e = *_e; interpreter& interp = *interpreter::g_interp; // Cast the function pointer to the right type (takes no arguments, returns // a pure_expr*), so we can call it as a native function. Modified: pure/trunk/runtime.h =================================================================== --- pure/trunk/runtime.h 2008-06-23 11:10:39 UTC (rev 289) +++ pure/trunk/runtime.h 2008-06-23 13:07:26 UTC (rev 290) @@ -127,12 +127,9 @@ /* Run a Pure function and catch exceptions. If everything goes normal, pure_invoke returns the return value of the executed function. Otherwise it returns 0 and sets e to the exception value, as given by pure_throw(). - XXXFIXME: This only works with C++ and only supports parameterless - functions right now. */ + XXXFIXME: This only supports parameterless functions right now. */ -#ifdef __cplusplus -pure_expr *pure_invoke(void *f, pure_expr*& e); -#endif +pure_expr *pure_invoke(void *f, pure_expr** e); /* Count a new reference to an expression. This should be called whenever you want to store an expression somewhere, in order to prevent it from being This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |