1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include "builtins/builtins.h"
#include "parse/parse.h"
#include "execute/execute.h"
using namespace empathy;
namespace empathy::builtins
{
void SetupApiCompiler( Env& e )
{
weak_ptr< Env > pEnv = e.shared_from_this();
RegisterBuiltinFunc< Eager< Value > ( Value, string ) >( e, "ExternalFunction"_sid,
[pEnv]( const Value& f, const string& symbol )
{
auto ft = FromValue< FuncType >( f );
if( !ft )
return ToValue( "error"s ).setPoison();
|
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "builtins/builtins.h"
#include "parse/parse.h"
#include "execute/execute.h"
using namespace empathy;
namespace empathy::builtins
{
void SetupApiCompiler( Env& e )
{
weak_ptr< Env > pEnv = e.shared_from_this();
RegisterBuiltinFunc< Eager< void > ( bool ) >( e, "DiagnosticsTraceMode"_sid,
[pEnv]( bool enable )
{
DiagnosticsManager::GetInstance().setTraceMode( enable );
} );
RegisterBuiltinFunc< Eager< Value > ( Value, string ) >( e, "ExternalFunction"_sid,
[pEnv]( const Value& f, const string& symbol )
{
auto ft = FromValue< FuncType >( f );
if( !ft )
return ToValue( "error"s ).setPoison();
|