annotate nodejs/mbfly_njs.h @ 676:f264b50c469c

Bind subject of mouse_event to JS object of coord
author Thinker K.F. Li <thinker@branda.to>
date Fri, 06 Aug 2010 13:33:47 +0800
parents c643af2095c5
children 7685c57e29d0
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)
675
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 667
diff changeset
15 #define THROW_noret(x) \
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 667
diff changeset
16 do { \
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 667
diff changeset
17 v8::Handle<v8::Value> exc; \
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 667
diff changeset
18 exc = v8::Exception::Error(v8::String::New(x)); \
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 667
diff changeset
19 v8::ThrowException(exc); \
c643af2095c5 Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents: 667
diff changeset
20 } while(0)
559
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 #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
22 #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
23 #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
24 #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
25
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 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
27
1b6402f07cd4 Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents: 561
diff changeset
28 /* From coord.cc */
1b6402f07cd4 Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents: 561
diff changeset
29 void xnjsmb_coord_mkroot(v8::Handle<v8::Object> js_rt);
666
b6fb543d69ee Use binding generator to implement mb_rt
Thinker K.F. Li <thinker@branda.to>
parents: 639
diff changeset
30 v8::Handle<v8::Value> export_xnjsmb_auto_coord_new(coord_t *coord);
559
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31
565
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 562
diff changeset
32 /* From shapes.cc */
c0bc60448913 Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents: 562
diff changeset
33 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
34
567
a12c3448afb6 Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents: 565
diff changeset
35 /* From paints.cc */
a12c3448afb6 Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents: 565
diff changeset
36 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
37
575
97159102f886 Function of query font face in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 567
diff changeset
38 /* From font.cc */
97159102f886 Function of query font face in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 567
diff changeset
39 void xnjsmb_font_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> mb_rt_temp);
97159102f886 Function of query font face in Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 567
diff changeset
40
638
683889344459 Skeleton of image loader for nodejs
Thinker K.F. Li <thinker@branda.to>
parents: 575
diff changeset
41 /* From image_ldr.cc */
683889344459 Skeleton of image loader for nodejs
Thinker K.F. Li <thinker@branda.to>
parents: 575
diff changeset
42 void
639
dc32c1c140ae First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents: 638
diff changeset
43 xnjsmb_img_ldr_init_mb_rt_temp(v8::Handle<v8::Object> mb_rt_temp);
638
683889344459 Skeleton of image loader for nodejs
Thinker K.F. Li <thinker@branda.to>
parents: 575
diff changeset
44
676
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
45 /* From observer.cc */
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
46 v8::Handle<v8::Value> export_xnjsmb_auto_subject_new(subject_t *subject);
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
47 void xnjsmb_observer_init(void);
f264b50c469c Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents: 675
diff changeset
48
559
ef078d7c57b4 Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
49 #endif /* __MBFLY_NJS_H_ */