Mercurial > MadButterfly
annotate nodejs/mbfly_njs.h @ 1056:88bd0eee2b00
Rename X_supp_njs.[ch] to njs_mb_supp.[ch].
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 24 Nov 2010 15:58:04 +0800 |
parents | 586e50f82c1f |
children | 3eaf708b52c3 |
rev | line source |
---|---|
822
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
733
diff
changeset
|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- |
586e50f82c1f
Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents:
733
diff
changeset
|
2 // vim: sw=4:ts=8:sts=4 |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
3 #ifndef __MBFLY_NJS_H_ |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
4 #define __MBFLY_NJS_H_ |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
5 |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
6 #include <v8.h> |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
7 extern "C" { |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
8 #include <mb.h> |
1056
88bd0eee2b00
Rename X_supp_njs.[ch] to njs_mb_supp.[ch].
Thinker K.F. Li <thinker@codemud.net>
parents:
822
diff
changeset
|
9 #include "njs_mb_supp.h" |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
10 } |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
11 |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
12 #define THROW(x) \ |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
13 do { \ |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
14 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
|
15 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
|
16 return v8::ThrowException(exc); \ |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
17 } 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
|
18 #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
|
19 do { \ |
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
667
diff
changeset
|
20 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
|
21 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
|
22 v8::ThrowException(exc); \ |
683
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
23 return; \ |
675
c643af2095c5
Keep and retrieve respective js object to/from property store
Thinker K.F. Li <thinker@branda.to>
parents:
667
diff
changeset
|
24 } while(0) |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
25 #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
|
26 #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
|
27 #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
|
28 #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
|
29 |
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
30 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
|
31 |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
32 /* From coord.cc */ |
1b6402f07cd4
Make root coord availabe for Javascript code
Thinker K.F. Li <thinker@branda.to>
parents:
561
diff
changeset
|
33 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
|
34 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
|
35 |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
562
diff
changeset
|
36 /* From shapes.cc */ |
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
562
diff
changeset
|
37 void xnjsmb_shapes_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); |
683
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
38 shape_t *xnjsmb_path_new(njs_runtime_t *rt, const char *d); |
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
39 shape_t *xnjsmb_stext_new(njs_runtime_t *rt, const char *txt, |
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
40 float x, float y); |
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
41 shape_t *xnjsmb_image_new(njs_runtime_t *rt, float x, float y, |
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
42 float w, float h); |
690
86c6ebf1de25
Add JS binding for sh_rect_t
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
43 shape_t *xnjsmb_rect_new(njs_runtime_t *rt, float x, float y, |
86c6ebf1de25
Add JS binding for sh_rect_t
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
44 float w, float h, |
86c6ebf1de25
Add JS binding for sh_rect_t
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
45 float rx, float ry, const char **err); |
683
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
46 v8::Handle<v8::Value> export_xnjsmb_auto_path_new(shape_t *sh); |
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
47 v8::Handle<v8::Value> export_xnjsmb_auto_stext_new(shape_t *sh); |
7685c57e29d0
Migrate JS shapes binding to gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
676
diff
changeset
|
48 v8::Handle<v8::Value> export_xnjsmb_auto_image_new(shape_t *sh); |
690
86c6ebf1de25
Add JS binding for sh_rect_t
Thinker K.F. Li <thinker@branda.to>
parents:
687
diff
changeset
|
49 v8::Handle<v8::Value> export_xnjsmb_auto_rect_new(shape_t *sh); |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
562
diff
changeset
|
50 |
567
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
51 /* From paints.cc */ |
a12c3448afb6
Add dummy paint_color templates
Thinker K.F. Li <thinker@branda.to>
parents:
565
diff
changeset
|
52 void xnjsmb_paints_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
53 paint_t *xnjsmb_paint_color_new(njs_runtime_t *rt, |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
54 float r, float g, float b, float a, |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
55 const char **err); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
56 paint_t *xnjsmb_paint_image_new(njs_runtime_t *rt, mb_img_data_t *img, |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
57 const char **err); |
733
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
58 paint_t *xnjsmb_paint_linear_new(njs_runtime_t *rt, |
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
59 float x1, float y1, float x2, float y2, |
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
60 const char **err); |
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
61 paint_t *xnjsmb_paint_radial_new(njs_runtime_t *rt, |
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
62 float cx, float cy, float r, |
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
63 const char **err); |
687
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
64 v8::Handle<v8::Value> export_xnjsmb_auto_paint_color_new(paint_t *paint); |
da12923a789a
Migrate paints.cc to use gen_v8_binding.m4
Thinker K.F. Li <thinker@branda.to>
parents:
683
diff
changeset
|
65 v8::Handle<v8::Value> export_xnjsmb_auto_paint_image_new(paint_t *paint); |
733
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
66 v8::Handle<v8::Value> export_xnjsmb_auto_paint_linear_new(paint_t *sh); |
163f0d9e6382
Add binding for linear and radial paints for JS
Thinker K.F. Li <thinker@branda.to>
parents:
690
diff
changeset
|
67 v8::Handle<v8::Value> export_xnjsmb_auto_paint_radial_new(paint_t *sh); |
565
c0bc60448913
Constructor for path objects in Javascript domain
Thinker K.F. Li <thinker@branda.to>
parents:
562
diff
changeset
|
68 |
575
97159102f886
Function of query font face in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
69 /* From font.cc */ |
97159102f886
Function of query font face in Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
567
diff
changeset
|
70 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
|
71 |
638
683889344459
Skeleton of image loader for nodejs
Thinker K.F. Li <thinker@branda.to>
parents:
575
diff
changeset
|
72 /* From image_ldr.cc */ |
683889344459
Skeleton of image loader for nodejs
Thinker K.F. Li <thinker@branda.to>
parents:
575
diff
changeset
|
73 void |
639
dc32c1c140ae
First compilable image loader binding for Javascript
Thinker K.F. Li <thinker@branda.to>
parents:
638
diff
changeset
|
74 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
|
75 |
676
f264b50c469c
Bind subject of mouse_event to JS object of coord
Thinker K.F. Li <thinker@branda.to>
parents:
675
diff
changeset
|
76 /* 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
|
77 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
|
78 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
|
79 |
559
ef078d7c57b4
Use internal field to store njs_runtime_t object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff
changeset
|
80 #endif /* __MBFLY_NJS_H_ */ |