annotate nodejs/mbfly_njs.h @ 568:d796e6b8b97e Android_Skia

Real initialize a paint_color_t object for paint_color JS obj
author Thinker K.F. Li <thinker@branda.to>
date Wed, 09 Jun 2010 14:10:58 +0800
parents a12c3448afb6
children 97159102f886
rev   line source
559
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 #ifndef __MBFLY_NJS_H_
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 #define __MBFLY_NJS_H_
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 #include <v8.h>
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 extern "C" {
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 #include <mb.h>
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 }
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 #define THROW(x) \
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 do { \
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11 v8::Handle<v8::Value> exc; \
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 exc = v8::Exception::Error(v8::String::New(x)); \
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 return v8::ThrowException(exc); \
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14 } while(0)
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 #define UNWRAP(o) v8::External::Unwrap((o)->GetInternalField(0))
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 #define WRAP(o, v) (o)->SetInternalField(0, v8::External::Wrap(v))
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17 #define SET(o, n, v) (o)->Set(v8::String::New(n), v)
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18 #define GET(o, n) (o)->Get(v8::String::New(n))
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 redraw_man_t *xnjsmb_rt_rdman(v8::Handle<v8::Object> mbrt);
562
1b6402f07cd4 Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents: 561
diff changeset
21
1b6402f07cd4 Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents: 561
diff changeset
22 /* From coord.cc */
561
a3c13c2a4792 Function template on runtime object for xnjsmb_coord_new()
Thinker K.F. Li <thinker@branda.to>
parents: 559
diff changeset
23 v8::Handle<v8::Value> xnjsmb_coord_new(const v8::Arguments &args);
562
1b6402f07cd4 Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents: 561
diff changeset
24 void xnjsmb_coord_mkroot(v8::Handle<v8::Object> js_rt);
559
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 562
diff changeset
26 /* From shapes.cc */
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 562
diff changeset
27 void xnjsmb_shapes_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp);
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 562
diff changeset
28
567
a12c3448afb6 Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents: 565
diff changeset
29 /* From paints.cc */
a12c3448afb6 Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents: 565
diff changeset
30 void xnjsmb_paints_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp);
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 562
diff changeset
31
559
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 #endif /* __MBFLY_NJS_H_ */