comparison nodejs/mbfly_njs.h @ 683:7685c57e29d0

Migrate JS shapes binding to gen_v8_binding.m4
author Thinker K.F. Li <thinker@branda.to>
date Sat, 07 Aug 2010 18:27:53 +0800
parents f264b50c469c
children da12923a789a
comparison
equal deleted inserted replaced
682:4a38e571cfce 683:7685c57e29d0
2 #define __MBFLY_NJS_H_ 2 #define __MBFLY_NJS_H_
3 3
4 #include <v8.h> 4 #include <v8.h>
5 extern "C" { 5 extern "C" {
6 #include <mb.h> 6 #include <mb.h>
7 #include "X_supp_njs.h"
7 } 8 }
8 9
9 #define THROW(x) \ 10 #define THROW(x) \
10 do { \ 11 do { \
11 v8::Handle<v8::Value> exc; \ 12 v8::Handle<v8::Value> exc; \
15 #define THROW_noret(x) \ 16 #define THROW_noret(x) \
16 do { \ 17 do { \
17 v8::Handle<v8::Value> exc; \ 18 v8::Handle<v8::Value> exc; \
18 exc = v8::Exception::Error(v8::String::New(x)); \ 19 exc = v8::Exception::Error(v8::String::New(x)); \
19 v8::ThrowException(exc); \ 20 v8::ThrowException(exc); \
21 return; \
20 } while(0) 22 } while(0)
21 #define UNWRAP(o) v8::External::Unwrap((o)->GetInternalField(0)) 23 #define UNWRAP(o) v8::External::Unwrap((o)->GetInternalField(0))
22 #define WRAP(o, v) (o)->SetInternalField(0, v8::External::Wrap(v)) 24 #define WRAP(o, v) (o)->SetInternalField(0, v8::External::Wrap(v))
23 #define SET(o, n, v) (o)->Set(v8::String::New(n), v) 25 #define SET(o, n, v) (o)->Set(v8::String::New(n), v)
24 #define GET(o, n) (o)->Get(v8::String::New(n)) 26 #define GET(o, n) (o)->Get(v8::String::New(n))
29 void xnjsmb_coord_mkroot(v8::Handle<v8::Object> js_rt); 31 void xnjsmb_coord_mkroot(v8::Handle<v8::Object> js_rt);
30 v8::Handle<v8::Value> export_xnjsmb_auto_coord_new(coord_t *coord); 32 v8::Handle<v8::Value> export_xnjsmb_auto_coord_new(coord_t *coord);
31 33
32 /* From shapes.cc */ 34 /* From shapes.cc */
33 void xnjsmb_shapes_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); 35 void xnjsmb_shapes_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp);
36 shape_t *xnjsmb_path_new(njs_runtime_t *rt, const char *d);
37 shape_t *xnjsmb_stext_new(njs_runtime_t *rt, const char *txt,
38 float x, float y);
39 shape_t *xnjsmb_image_new(njs_runtime_t *rt, float x, float y,
40 float w, float h);
41 v8::Handle<v8::Value> export_xnjsmb_auto_path_new(shape_t *sh);
42 v8::Handle<v8::Value> export_xnjsmb_auto_stext_new(shape_t *sh);
43 v8::Handle<v8::Value> export_xnjsmb_auto_image_new(shape_t *sh);
34 44
35 /* From paints.cc */ 45 /* From paints.cc */
36 void xnjsmb_paints_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp); 46 void xnjsmb_paints_init_mb_rt_temp(v8::Handle<v8::FunctionTemplate> rt_temp);
37 47
38 /* From font.cc */ 48 /* From font.cc */