Mercurial > MadButterfly
annotate nodejs/coord.cc @ 562:1b6402f07cd4 Android_Skia
Make root coord availabe for Javascript code
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Mon, 07 Jun 2010 14:45:01 +0800 |
parents | ce7a35abcb0d |
children | bc207070e3d5 |
rev | line source |
---|---|
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
1 #include <stdio.h> |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
2 #include <v8.h> |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 extern "C" { |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 #include "mb.h" |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 #include "mb_X_supp.h" |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 #include "mb_tools.h" |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 #include "X_supp_njs.h" |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
9 } |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
11 #include "mbfly_njs.h" |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
12 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
13 #ifndef ASSERT |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
14 #define ASSERT(x) |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
15 #endif |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
16 |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 using namespace v8; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
18 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
19 static Handle<Value> |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
20 xnjsmb_coord_get_index(uint32_t index, const AccessorInfo &info) { |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
21 HandleScope scope; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
22 Handle<Object> self; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
23 coord_t *coord; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
24 co_aix v; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
26 if(index < 0 || index >= 6) |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
27 THROW("Invalid index"); |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
28 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
29 self = info.This(); |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
30 coord = (coord_t *)UNWRAP(self); |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
31 v = coord_get_matrix(coord)[index]; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
32 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
33 return Number::New(v); |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
34 } |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
35 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
36 static Handle<Value> |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
37 xnjsmb_coord_set_index(uint32_t index, Local<Value> value, |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
38 const AccessorInfo &info) { |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
39 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
40 HandleScope scope; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
41 Handle<Object> self; |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
42 Handle<Object> js_rt; |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
43 redraw_man_t *rdman; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
44 coord_t *coord; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
45 co_aix v; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
46 |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
47 if(index < 0 || index >= 6) |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
48 THROW("Invalid Index"); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
49 if(!value->IsNumber()) |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
50 THROW("Invalid value"); |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
51 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
52 self = info.This(); |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
53 coord = (coord_t *)UNWRAP(self); |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
54 v = value->NumberValue(); |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
55 coord_get_matrix(coord)[index] = v; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
56 |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
57 js_rt = GET(self, "mbrt")->ToObject(); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
58 rdman = xnjsmb_rt_rdman(js_rt); |
557
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
59 rdman_coord_changed(rdman, coord); |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
60 |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
61 return value; |
0ca8437a91fa
Implement Indexed Property interceptors
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
62 } |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
63 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
64 static Persistent<ObjectTemplate> coord_obj_temp; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
65 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
66 static void |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
67 xnjsmb_init_temp(void) { |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
68 coord_obj_temp = Persistent<ObjectTemplate>(ObjectTemplate::New()); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
69 coord_obj_temp->SetIndexedPropertyHandler(xnjsmb_coord_get_index, |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
70 xnjsmb_coord_set_index); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
71 coord_obj_temp->SetInternalFieldCount(1); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
72 } |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
73 |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
74 static Handle<Object> |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
75 xnjsmb_coord_new_jsobj(coord_t *coord, Handle<Object> parent_obj, |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
76 Handle<Object> js_rt) { |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
77 Handle<Object> coord_obj; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
78 static int init_temp = 0; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
79 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
80 if(!init_temp) { |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
81 xnjsmb_init_temp(); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
82 init_temp = 1; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
83 } |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
84 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
85 coord_obj = coord_obj_temp->NewInstance(); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
86 ASSERT(coord_obj != NULL); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
87 WRAP(coord_obj, coord); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
88 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
89 if(!parent_obj.IsEmpty()) |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
90 SET(coord_obj, "parent", parent_obj); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
91 SET(coord_obj, "mbrt", js_rt); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
92 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
93 return coord_obj; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
94 } |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
95 |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
96 /*! \brief Create a coord object associated with the rdman of the runtime. |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
97 * |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
98 * Two internal fields, coord and rdman. |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
99 */ |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
100 Handle<Value> |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
101 xnjsmb_coord_new(const Arguments &args) { |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
102 HandleScope scope; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
103 Handle<Object> js_rt; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
104 Handle<Object> coord_obj, parent_obj; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
105 njs_runtime_t *rt; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
106 redraw_man_t *rdman; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
107 coord_t *coord, *parent = NULL; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
108 int argc; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
109 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
110 argc = args.Length(); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
111 if(argc > 1) |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
112 THROW("Too many arguments (> 1)"); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
113 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
114 js_rt = args.This(); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
115 rt = (njs_runtime_t *)UNWRAP(js_rt); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
116 rdman = X_njs_MB_rdman(rt); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
117 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
118 if(argc == 1) { |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
119 parent_obj = args[0]->ToObject(); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
120 parent = (coord_t *)UNWRAP(parent_obj); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
121 } |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
122 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
123 coord = rdman_coord_new(rdman, parent); |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
124 ASSERT(coord != NULL); |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
125 coord_obj = xnjsmb_coord_new_jsobj(coord, parent_obj, js_rt); |
560
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
126 |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
127 return coord_obj; |
ce7a35abcb0d
Function to instantiate coord for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
557
diff
changeset
|
128 } |
562
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
129 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
130 /*! \brief Initialize Javascript object for root coord of a runtime. |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
131 * |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
132 * \param js_rt is the runtime object to create the root object for. |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
133 * |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
134 * After the function, js_rt.root is the object for root coord in |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
135 * Javascript. |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
136 */ |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
137 void |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
138 xnjsmb_coord_mkroot(Handle<Object> js_rt) { |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
139 redraw_man_t *rdman; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
140 coord_t *root; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
141 Handle<Object> obj; |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
142 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
143 rdman = xnjsmb_rt_rdman(js_rt); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
144 root = rdman_get_root(rdman); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
145 obj = xnjsmb_coord_new_jsobj(root, Handle<Object>(NULL), js_rt); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
146 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
147 SET(js_rt, "root", obj); |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
560
diff
changeset
|
148 } |