# HG changeset patch # User Thinker K.F. Li # Date 1275909500 -28800 # Node ID 0cd1511272d2690cf781667c8e64f8e42af08b14 # Parent bc207070e3d5ee713c30741aceb44330321abc35 Make base type for shapes. With following methods - show(), and - hide(). diff -r bc207070e3d5 -r 0cd1511272d2 nodejs/Makefile.am --- a/nodejs/Makefile.am Mon Jun 07 17:24:46 2010 +0800 +++ b/nodejs/Makefile.am Mon Jun 07 19:18:20 2010 +0800 @@ -1,5 +1,5 @@ -mbfly_node_SRCS = mbfly_njs.cc X_supp_njs.c coord.cc +mbfly_node_SRCS = mbfly_njs.cc X_supp_njs.c coord.cc shapes.cc mbfly_node_CFLAGS= -I$(abs_top_builddir)/include \ -I$(abs_top_srcdir)/include \ -I$(prefix)/include \ diff -r bc207070e3d5 -r 0cd1511272d2 nodejs/shapes.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nodejs/shapes.cc Mon Jun 07 19:18:20 2010 +0800 @@ -0,0 +1,58 @@ +#include +#include "mbfly_njs.h" + +extern "C" { +#include +} + +using namespace v8; + +/*! \defgroup shape_temp Templates for shape and derive. + * + * @{ + */ +static Persistent xnjsmb_shape_temp; + +static Handle +xnjsmb_shape_show(const Arguments &args) { + shape_t *sh; + Handle self; + + self = args.This(); + sh = (shape_t *)UNWRAP(self); + sh_show(sh); + + return Null(); +} + +static Handle +xnjsmb_shape_hide(const Arguments &args) { + shape_t *sh; + Handle self; + + self = args.This(); + sh = (shape_t *)UNWRAP(self); + sh_hide(sh); + + return Null(); +} + +static void +xnjsmb_init_shape_temp(void) { + Handle temp; + Handle proto_temp; + Handle method_temp; + + temp = FunctionTemplate::New(); + temp->SetClassName(String::New("shape")); + xnjsmb_shape_temp = Persistent::New(temp); + proto_temp = temp->PrototypeTemplate(); + + method_temp = FunctionTemplate::New(xnjsmb_shape_show); + SET(proto_temp, "show", method_temp); + method_temp = FunctionTemplate::New(xnjsmb_shape_hide); + SET(proto_temp, "hide", method_temp); +} + +/* @} */ + diff -r bc207070e3d5 -r 0cd1511272d2 nodejs/wscript --- a/nodejs/wscript Mon Jun 07 17:24:46 2010 +0800 +++ b/nodejs/wscript Mon Jun 07 19:18:20 2010 +0800 @@ -23,7 +23,7 @@ obj = conf.new_task_gen('cxx', 'shlib', 'node_addon') obj.target = 'mbfly' - obj.source = 'mbfly_njs.cc coord.cc' + obj.source = 'mbfly_njs.cc coord.cc shapes.cc' obj.add_objects = 'X_supp_njs.o' obj.staticlib = 'mbfly'