Mercurial > MadButterfly
comparison nodejs/coord.cc @ 667:7315c6e953c3
Remove xnjsmb_coord_new() in coord.cc
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Wed, 04 Aug 2010 21:58:10 +0800 |
parents | b6fb543d69ee |
children | a588eefd3f04 |
comparison
equal
deleted
inserted
replaced
666:b6fb543d69ee | 667:7315c6e953c3 |
---|---|
61 *err = "Unknown error"; | 61 *err = "Unknown error"; |
62 } | 62 } |
63 | 63 |
64 #include "coord-inc.h" | 64 #include "coord-inc.h" |
65 | 65 |
66 /*! \brief Create a coord object associated with the rdman of the runtime. | |
67 * | |
68 * Two internal fields, coord and rdman. | |
69 */ | |
70 Handle<Value> | |
71 xnjsmb_coord_new(const Arguments &args) { | |
72 HandleScope scope; | |
73 Handle<Object> js_rt; | |
74 Handle<Object> coord_obj, parent_obj; | |
75 njs_runtime_t *rt; | |
76 redraw_man_t *rdman; | |
77 coord_t *coord, *parent = NULL; | |
78 int argc; | |
79 | |
80 argc = args.Length(); | |
81 if(argc > 1) | |
82 THROW("Too many arguments (> 1)"); | |
83 | |
84 js_rt = args.This(); | |
85 rt = (njs_runtime_t *)UNWRAP(js_rt); | |
86 rdman = X_njs_MB_rdman(rt); | |
87 | |
88 if(argc == 1) { | |
89 parent_obj = args[0]->ToObject(); | |
90 parent = (coord_t *)UNWRAP(parent_obj); | |
91 } | |
92 | |
93 coord = rdman_coord_new(rdman, parent); | |
94 ASSERT(coord != NULL); | |
95 | |
96 coord_obj = xnjsmb_auto_coord_new(coord).As<Object>(); | |
97 if(!parent_obj.IsEmpty()) | |
98 SET(coord_obj, "parent", parent_obj); | |
99 SET(coord_obj, "mbrt", js_rt); | |
100 | |
101 scope.Close(coord_obj); | |
102 | |
103 return coord_obj; | |
104 } | |
105 | |
106 Handle<Value> export_xnjsmb_auto_coord_new(coord_t *coord) { | 66 Handle<Value> export_xnjsmb_auto_coord_new(coord_t *coord) { |
107 xnjsmb_auto_coord_new(coord); | 67 xnjsmb_auto_coord_new(coord); |
108 } | 68 } |
109 | 69 |
110 /*! \brief Initialize Javascript object for root coord of a runtime. | 70 /*! \brief Initialize Javascript object for root coord of a runtime. |