-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathIDirectFBGL.cc
102 lines (67 loc) · 2.93 KB
/
IDirectFBGL.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#include "common.h"
#include "templates.h"
namespace DirectFB {
static v8::Persistent<v8::ObjectTemplate> m_IDirectFBGL;
/**********************************************************************************************************************/
static v8::Handle<v8::Value>
IDirectFBGL_Lock( const v8::Arguments& args )
{
IDirectFBGL *thiz = V8_DIRECTFB_INTERFACE( args.This(), IDirectFBGL );
if (!thiz)
return v8::ThrowException( v8::String::New( "Interface already released" ) );
V8_DIRECTFB_CALL( thiz->Lock( thiz ) );
return v8::Undefined();
}
static v8::Handle<v8::Value>
IDirectFBGL_Unlock( const v8::Arguments& args )
{
IDirectFBGL *thiz = V8_DIRECTFB_INTERFACE( args.This(), IDirectFBGL );
if (!thiz)
return v8::ThrowException( v8::String::New( "Interface already released" ) );
V8_DIRECTFB_CALL( thiz->Unlock( thiz ) );
return v8::Undefined();
}
static v8::Handle<v8::Value>
IDirectFBGL_GetAttributes( const v8::Arguments& args )
{
IDirectFBGL *thiz = V8_DIRECTFB_INTERFACE( args.This(), IDirectFBGL );
if (!thiz)
return v8::ThrowException( v8::String::New( "Interface already released" ) );
DFBGLAttributes attributes;
V8_DIRECTFB_CALL( thiz->GetAttributes( thiz, &attributes ) );
return DFBGLAttributes_construct( &attributes );
}
static v8::Handle<v8::Value>
IDirectFBGL_GetProcAddress( const v8::Arguments& args )
{
IDirectFBGL *thiz = V8_DIRECTFB_INTERFACE( args.This(), IDirectFBGL );
if (!thiz)
return v8::ThrowException( v8::String::New( "Interface already released" ) );
const char *name = NULL;
v8::String::Utf8Value utf8_name(args[0]);
name = *utf8_name;
void *ret_address;
#warning unimplemented (return pointer)
D_UNIMPLEMENTED();
V8_DIRECTFB_CALL( thiz->GetProcAddress( thiz, name, &ret_address ) );
return v8::Undefined();
}
/**********************************************************************************************************************/
v8::Handle<v8::ObjectTemplate>
IDirectFBGL_template()
{
if (m_IDirectFBGL.IsEmpty()) {
v8::HandleScope handle_scope;
v8::Handle<v8::ObjectTemplate> templ;
templ = v8::ObjectTemplate::New();
templ->SetInternalFieldCount( 1 );
templ->Set( v8::String::NewSymbol("Release"), v8::FunctionTemplate::New(IAny_release) );
templ->Set( v8::String::NewSymbol("Lock"), v8::FunctionTemplate::New(IDirectFBGL_Lock) );
templ->Set( v8::String::NewSymbol("Unlock"), v8::FunctionTemplate::New(IDirectFBGL_Unlock) );
templ->Set( v8::String::NewSymbol("GetAttributes"), v8::FunctionTemplate::New(IDirectFBGL_GetAttributes) );
templ->Set( v8::String::NewSymbol("GetProcAddress"), v8::FunctionTemplate::New(IDirectFBGL_GetProcAddress) );
m_IDirectFBGL = v8::Persistent<v8::ObjectTemplate>::New( handle_scope.Close( templ ) );
}
return m_IDirectFBGL;
}
}