void ProjTransform::Initialize(Handle<Object> target) {

    NanScope();

    Local<FunctionTemplate> lcons = NanNew<FunctionTemplate>(ProjTransform::New);
    lcons->InstanceTemplate()->SetInternalFieldCount(1);
    lcons->SetClassName(NanNew("ProjTransform"));

    NODE_SET_PROTOTYPE_METHOD(lcons, "forward", forward);
    NODE_SET_PROTOTYPE_METHOD(lcons, "backward", backward);

    target->Set(NanNew("ProjTransform"), lcons->GetFunction());
    NanAssignPersistent(constructor, lcons);
}
void Expression::Initialize(Handle<Object> target) {

    NanScope();

    Local<FunctionTemplate> lcons = NanNew<FunctionTemplate>(Expression::New);
    lcons->InstanceTemplate()->SetInternalFieldCount(1);
    lcons->SetClassName(NanNew("Expression"));

    NODE_SET_PROTOTYPE_METHOD(lcons, "toString", toString);
    NODE_SET_PROTOTYPE_METHOD(lcons, "evaluate", evaluate);

    target->Set(NanNew("Expression"), lcons->GetFunction());
    NanAssignPersistent(constructor, lcons);
}
void XpcConnection::Init(v8::Handle<v8::Object> target) {
  v8::HandleScope scope;

  v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(XpcConnection::New);

  s_ct = v8::Persistent<v8::FunctionTemplate>::New(t);
  s_ct->InstanceTemplate()->SetInternalFieldCount(1);
  s_ct->SetClassName(v8::String::NewSymbol("XpcConnection"));

  NODE_SET_PROTOTYPE_METHOD(s_ct, "setup", XpcConnection::Setup);
  NODE_SET_PROTOTYPE_METHOD(s_ct, "sendMessage", XpcConnection::SendMessage);

  target->Set(v8::String::NewSymbol("XpcConnection"), s_ct->GetFunction());
}
Esempio n. 4
0
void ZipFile::Initialize(Handle<Object> target) {

    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(ZipFile::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("ZipFile"));

    // functions
    NODE_SET_PROTOTYPE_METHOD(constructor, "open", Open);
    NODE_SET_PROTOTYPE_METHOD(constructor, "read", Read);
    NODE_SET_PROTOTYPE_METHOD(constructor, "readFileSync", readFileSync);
    NODE_SET_PROTOTYPE_METHOD(constructor, "close", Close);
    NODE_SET_PROTOTYPE_METHOD(constructor, "addFile", Add_File);
    NODE_SET_PROTOTYPE_METHOD(constructor, "replaceFile", Replace_File);
    NODE_SET_PROTOTYPE_METHOD(constructor, "addDirectory", Add_Directory);
    NODE_SET_PROTOTYPE_METHOD(constructor, "save", Save);

    // properties
    constructor->InstanceTemplate()->SetAccessor(String::NewSymbol("count"), get_prop);
    constructor->InstanceTemplate()->SetAccessor(String::NewSymbol("names"), get_prop);

    // Initiate async handler
    ev_async_init(&notifier, Save_Callback);
    ev_async_start(EV_DEFAULT_UC_ &notifier);

    target->Set(String::NewSymbol("ZipFile"),constructor->GetFunction());
}
Esempio n. 5
0
Handle<Object> FixSession::wrapFixSession(FixSession* fixSession) {
	Local<FunctionTemplate> ctor = NanNew<FunctionTemplate>();

	ctor->InstanceTemplate()->SetInternalFieldCount(1);
	ctor->SetClassName(NanNew("FixSession"));

	Local<ObjectTemplate> proto = ctor->PrototypeTemplate();

	NODE_SET_PROTOTYPE_METHOD(ctor, "disconnect", disconnect);
	NODE_SET_PROTOTYPE_METHOD(ctor, "getSessionID", getSessionID);
	NODE_SET_PROTOTYPE_METHOD(ctor, "isEnabled", isEnabled);
	NODE_SET_PROTOTYPE_METHOD(ctor, "isLoggedOn", isLoggedOn);
	NODE_SET_PROTOTYPE_METHOD(ctor, "logon", logon);
	NODE_SET_PROTOTYPE_METHOD(ctor, "logout", logout);
	NODE_SET_PROTOTYPE_METHOD(ctor, "refresh", refresh);
	NODE_SET_PROTOTYPE_METHOD(ctor, "reset", reset);

	proto->SetAccessor(NanNew("senderSeqNum"), getSenderSeqNum, setSenderSeqNum);
	proto->SetAccessor(NanNew("targetSeqNum"), getTargetSeqNum, setTargetSeqNum);

	Handle<Object> obj = ctor->InstanceTemplate()->NewInstance();

	//obj->SetAlignedPointerInInternalField(0, NanNew<External>(fixSession));
	fixSession->Wrap(obj);
	return obj;
}
Esempio n. 6
0
void MultiPoint::Initialize(Handle<Object> target)
{
	HandleScope scope;

	constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(MultiPoint::New));
	constructor->Inherit(GeometryCollection::constructor);
	constructor->InstanceTemplate()->SetInternalFieldCount(1);
	constructor->SetClassName(String::NewSymbol("MultiPoint"));

	NODE_SET_PROTOTYPE_METHOD(constructor, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(constructor, "getGeometry", getGeometry);

	target->Set(String::NewSymbol("MultiPoint"), constructor->GetFunction());
}
void OracleClient::Init(Handle<Object> target) {
  HandleScope scope;

  Local<FunctionTemplate> t = FunctionTemplate::New(New);
  s_ct = Persistent<FunctionTemplate>::New(t);
  s_ct->InstanceTemplate()->SetInternalFieldCount(1);
  s_ct->SetClassName(String::NewSymbol("OracleClient"));

  NODE_SET_PROTOTYPE_METHOD(s_ct, "connect", Connect);
  NODE_SET_PROTOTYPE_METHOD(s_ct, "connectSync", ConnectSync);
  NODE_SET_PROTOTYPE_METHOD(s_ct, "createConnectionPoolSync", CreateConnectionPoolSync);
  NODE_SET_PROTOTYPE_METHOD(s_ct, "createConnectionPool", CreateConnectionPool);

  target->Set(String::NewSymbol("OracleClient"), s_ct->GetFunction());
}
Esempio n. 8
0
void FreeImage::Initialize(Handle<Object> target) {
  HandleScope scope;

  Local<FunctionTemplate> t = FunctionTemplate::New(New);
  constructor_template = Persistent<FunctionTemplate>::New(t);

  constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
  constructor_template->SetClassName(JS_STR("FreeImage"));

  NODE_SET_PROTOTYPE_METHOD(constructor_template, "getVersion", getVersion);
  NODE_SET_PROTOTYPE_METHOD(constructor_template, "load", load);
  NODE_SET_PROTOTYPE_METHOD(constructor_template, "save", save);

  target->Set(JS_STR("FreeImage"), constructor_template->GetFunction());
}
void CoordinateTransformation::Initialize(Handle<Object> target)
{
	NanScope();

	Local<FunctionTemplate> lcons = NanNew<FunctionTemplate>(CoordinateTransformation::New);
	lcons->InstanceTemplate()->SetInternalFieldCount(1);
	lcons->SetClassName(NanNew("CoordinateTransformation"));

	NODE_SET_PROTOTYPE_METHOD(lcons, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(lcons, "transformPoint", transformPoint);

	target->Set(NanNew("CoordinateTransformation"), lcons->GetFunction());

	NanAssignPersistent(constructor, lcons);
}
Esempio n. 10
0
void ZipFile::Initialize(Handle<Object> target) {
    HandleScope scope;
    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(ZipFile::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("ZipFile"));

    // functions
    NODE_SET_PROTOTYPE_METHOD(constructor, "readFileSync", readFileSync);
    NODE_SET_PROTOTYPE_METHOD(constructor, "readFile", readFile);

    // properties
    constructor->InstanceTemplate()->SetAccessor(String::NewSymbol("count"), get_prop);
    constructor->InstanceTemplate()->SetAccessor(String::NewSymbol("names"), get_prop);

    target->Set(String::NewSymbol("ZipFile"), constructor->GetFunction());
}
Esempio n. 11
0
        static void Init(v8::Handle<v8::Object> exports) {
            v8::Isolate* isolate = Isolate::GetCurrent();

            // Prepare constructor template
            v8::Local<v8::FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
            tpl->SetClassName(v8::String::NewFromUtf8(isolate, "Filters"));
            tpl->InstanceTemplate()->SetInternalFieldCount(1);

            // Prototype
            NODE_SET_PROTOTYPE_METHOD(tpl, "isAvailable", isAvailable);
            NODE_SET_PROTOTYPE_METHOD(tpl, "getNFilters", getNFilters);
            NODE_SET_PROTOTYPE_METHOD(tpl, "getFilter", getFilter);

            Constructor.Reset(v8::Isolate::GetCurrent(), tpl);
            exports->Set(v8::String::NewFromUtf8(isolate, "Filters"), tpl->GetFunction());
        }
Esempio n. 12
0
void MultiLineString::Initialize(Handle<Object> target)
{
	NanScope();

	Local<FunctionTemplate> lcons = NanNew<FunctionTemplate>(MultiLineString::New);
	lcons->Inherit(NanNew(GeometryCollection::constructor));
	lcons->InstanceTemplate()->SetInternalFieldCount(1);
	lcons->SetClassName(NanNew("MultiLineString"));

	NODE_SET_PROTOTYPE_METHOD(lcons, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(lcons, "polygonize", polygonize);

	target->Set(NanNew("MultiLineString"), lcons->GetFunction());

	NanAssignPersistent(constructor, lcons);
}
Esempio n. 13
0
void Polygon::Initialize(Handle<Object> target)
{
	HandleScope scope;

	constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Polygon::New));
	constructor->Inherit(Geometry::constructor);
	constructor->InstanceTemplate()->SetInternalFieldCount(1);
	constructor->SetClassName(String::NewSymbol("Polygon"));

	NODE_SET_PROTOTYPE_METHOD(constructor, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(constructor, "getArea", getArea);

	ATTR(constructor, "rings", ringsGetter, READ_ONLY_SETTER);

	target->Set(String::NewSymbol("Polygon"), constructor->GetFunction());
}
Esempio n. 14
0
void GeometryFactory::Initialize(Handle<Object> target) {
    Isolate* isolate = Isolate::GetCurrent();
    HandleScope scope(isolate);

    Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, GeometryFactory::New);
    tpl->InstanceTemplate()->SetInternalFieldCount(1);
    tpl->SetClassName(String::NewFromUtf8(isolate, "GeometryFactory"));

    NODE_SET_PROTOTYPE_METHOD(tpl, "getPrecisionModel", GetPrecisionModel);
    NODE_SET_PROTOTYPE_METHOD(tpl, "getSRID", GetSRID);
    NODE_SET_PROTOTYPE_METHOD(tpl, "destroy", Destroy);

    constructor.Reset(isolate, tpl->GetFunction());

    target->Set(String::NewFromUtf8(isolate, "GeometryFactory"), tpl->GetFunction());
}
Esempio n. 15
0
void StrTree::Initialize(Handle<Object> target) {
    HandleScope scope;

    Local<FunctionTemplate> t = FunctionTemplate::New(New);

    s_ct = Persistent<FunctionTemplate>::New(t);
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("StrTree"));

    NODE_SET_PROTOTYPE_METHOD(s_ct, "insert", Insert);
    NODE_SET_PROTOTYPE_METHOD(s_ct, "remove", Remove);
    NODE_SET_PROTOTYPE_METHOD(s_ct, "query", Query);

    target->Set(String::NewSymbol("StrTree"), s_ct->GetFunction());

}
Esempio n. 16
0
void ImageView::Initialize(Handle<Object> target) {

    HandleScope scope;

    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(ImageView::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("ImageView"));

    NODE_SET_PROTOTYPE_METHOD(constructor, "encodeSync", encodeSync);
    NODE_SET_PROTOTYPE_METHOD(constructor, "encode", encode);
    NODE_SET_PROTOTYPE_METHOD(constructor, "save", save);
    NODE_SET_PROTOTYPE_METHOD(constructor, "width", width);
    NODE_SET_PROTOTYPE_METHOD(constructor, "height", height);

    target->Set(String::NewSymbol("ImageView"),constructor->GetFunction());
}
void Datasource::Initialize(Handle<Object> target) {

    HandleScope scope;

    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Datasource::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("Datasource"));

    // methods
    NODE_SET_PROTOTYPE_METHOD(constructor, "parameters", parameters);
    NODE_SET_PROTOTYPE_METHOD(constructor, "describe", describe);
    NODE_SET_PROTOTYPE_METHOD(constructor, "features", features);
    NODE_SET_PROTOTYPE_METHOD(constructor, "get_featureset", get_featureset);

    target->Set(String::NewSymbol("Datasource"),constructor->GetFunction());
}
Esempio n. 18
0
void FreeImage::Initialize(Handle<Object> target) {
  NanScope();

  // constructor
  Local<FunctionTemplate> ctor = FunctionTemplate::New(FreeImage::New);
  NanAssignPersistent(FunctionTemplate, constructor_template, ctor);
  ctor->InstanceTemplate()->SetInternalFieldCount(1);
  ctor->SetClassName(JS_STR("FreeImage"));

  // prototype
  Local<ObjectTemplate> proto = ctor->PrototypeTemplate();
  NODE_SET_PROTOTYPE_METHOD(ctor, "load", load);
  NODE_SET_PROTOTYPE_METHOD(ctor, "save", save);
  proto->SetAccessor(JS_STR("getVersion"), getVersion);

  target->Set(JS_STR("FreeImage"), ctor->GetFunction());
}
Esempio n. 19
0
/////////////////////////////////////////
// DHT11 - Digital temperature and humidity sensor
void TNodejsDHT11Sensor::Init(v8::Handle<v8::Object> Exports) {
	v8::Isolate* Isolate = v8::Isolate::GetCurrent();
	v8::HandleScope HandleScope(Isolate);

	v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(Isolate, TNodeJsUtil::_NewJs<TNodejsDHT11Sensor>);
	tpl->SetClassName(v8::String::NewFromUtf8(Isolate, GetClassId().CStr()));

	// ObjectWrap uses the first internal field to store the wrapped pointer.
	tpl->InstanceTemplate()->SetInternalFieldCount(1);

	// Add all methods, getters and setters here.
	NODE_SET_PROTOTYPE_METHOD(tpl, "init", _init);
	NODE_SET_PROTOTYPE_METHOD(tpl, "read", _read);
	NODE_SET_PROTOTYPE_METHOD(tpl, "readSync", _readSync);

	Exports->Set(v8::String::NewFromUtf8(Isolate, GetClassId().CStr()), tpl->GetFunction());
}
Esempio n. 20
0
void DatasetBands::Initialize(Handle<Object> target)
{
	HandleScope scope;

	constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(DatasetBands::New));
	constructor->InstanceTemplate()->SetInternalFieldCount(1);
	constructor->SetClassName(String::NewSymbol("DatasetBands"));

	NODE_SET_PROTOTYPE_METHOD(constructor, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(constructor, "count", count);
	//NODE_SET_PROTOTYPE_METHOD(constructor, "create", create);
	NODE_SET_PROTOTYPE_METHOD(constructor, "get", get);

	ATTR_DONT_ENUM(constructor, "ds", dsGetter, READ_ONLY_SETTER);

	target->Set(String::NewSymbol("DatasetBands"), constructor->GetFunction());
}
void MemoryDatasource::Initialize(Handle<Object> target) {

    NanScope();

    Local<FunctionTemplate> lcons = NanNew<FunctionTemplate>(MemoryDatasource::New);
    lcons->InstanceTemplate()->SetInternalFieldCount(1);
    lcons->SetClassName(NanNew("MemoryDatasource"));

    // methods
    NODE_SET_PROTOTYPE_METHOD(lcons, "parameters", parameters);
    NODE_SET_PROTOTYPE_METHOD(lcons, "describe", describe);
    NODE_SET_PROTOTYPE_METHOD(lcons, "featureset", featureset);
    NODE_SET_PROTOTYPE_METHOD(lcons, "add", add);

    target->Set(NanNew("MemoryDatasource"), lcons->GetFunction());
    NanAssignPersistent(constructor, lcons);
}
Esempio n. 22
0
void Geometry::Initialize(Handle<Object> target) {

    HandleScope scope;

    constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(Geometry::New));
    constructor->InstanceTemplate()->SetInternalFieldCount(1);
    constructor->SetClassName(String::NewSymbol("Geometry"));

    NODE_SET_PROTOTYPE_METHOD(constructor, "extent", extent);
    NODE_SET_PROTOTYPE_METHOD(constructor, "type", type);
    NODE_MAPNIK_DEFINE_CONSTANT(constructor->GetFunction(),
                                "Point",MAPNIK_POINT)
    NODE_MAPNIK_DEFINE_CONSTANT(constructor->GetFunction(),
                                "LineString",MAPNIK_LINESTRING)
    NODE_MAPNIK_DEFINE_CONSTANT(constructor->GetFunction(),
                                "Polygon",MAPNIK_POLYGON)
    target->Set(String::NewSymbol("Geometry"),constructor->GetFunction());
}
Esempio n. 23
0
void Polygon::Initialize(Handle<Object> target)
{
	NanScope();

	Local<FunctionTemplate> lcons = NanNew<FunctionTemplate>(Polygon::New);
	lcons->Inherit(NanNew(Geometry::constructor));
	lcons->InstanceTemplate()->SetInternalFieldCount(1);
	lcons->SetClassName(NanNew("Polygon"));

	NODE_SET_PROTOTYPE_METHOD(lcons, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(lcons, "getArea", getArea);

	ATTR(lcons, "rings", ringsGetter, READ_ONLY_SETTER);

	target->Set(NanNew("Polygon"), lcons->GetFunction());

	NanAssignPersistent(constructor, lcons);
}
 void MessageProducer::Init( v8::Handle<v8::Object> exports ) 
 {
     Local<FunctionTemplate> tpl = FunctionTemplate::New( New ) ;
     tpl->SetClassName( NanNew( "FgiMessageProducer" ) );
     tpl->InstanceTemplate()->SetInternalFieldCount( 1 );
     NODE_SET_PROTOTYPE_METHOD( tpl, "send", Send );
     NanAssignPersistent( constructor, tpl->GetFunction() );
     exports->Set( NanNew( "FgiMessageProducer"), constructor );
 }
Esempio n. 25
0
        static void Init(v8::Handle<v8::Object> exports)
        {
            v8::Isolate* isolate = v8::Isolate::GetCurrent();

            // Prepare constructor template
            v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(isolate, New);
            tpl->SetClassName(v8::String::NewFromUtf8(isolate, "Cluster"));
            tpl->InstanceTemplate()->SetInternalFieldCount(1);

            // Prototype
            NODE_SET_PROTOTYPE_METHOD(tpl, "blob", blob);
            NODE_SET_PROTOTYPE_METHOD(tpl, "integer", integer);
            NODE_SET_PROTOTYPE_METHOD(tpl, "queue", queue);
            NODE_SET_PROTOTYPE_METHOD(tpl, "set", set);
            NODE_SET_PROTOTYPE_METHOD(tpl, "tag", tag);

            constructor.Reset(isolate, tpl->GetFunction());
            exports->Set(v8::String::NewFromUtf8(isolate, "Cluster"), tpl->GetFunction());
        }
Esempio n. 26
0
void FeatureDefn::Initialize(Handle<Object> target)
{
	HandleScope scope;

	constructor = Persistent<FunctionTemplate>::New(FunctionTemplate::New(FeatureDefn::New));
	constructor->InstanceTemplate()->SetInternalFieldCount(1);
	constructor->SetClassName(String::NewSymbol("FeatureDefn"));

	NODE_SET_PROTOTYPE_METHOD(constructor, "toString", toString);
	NODE_SET_PROTOTYPE_METHOD(constructor, "clone", clone);

	ATTR(constructor, "name", nameGetter, READ_ONLY_SETTER);
	ATTR(constructor, "fields", fieldsGetter, READ_ONLY_SETTER);
	ATTR(constructor, "styleIgnored", styleIgnoredGetter, styleIgnoredSetter);
	ATTR(constructor, "geomIgnored", geomIgnoredGetter, geomIgnoredSetter);
	ATTR(constructor, "geomType", geomTypeGetter, geomTypeSetter);
	
	target->Set(String::NewSymbol("FeatureDefn"), constructor->GetFunction());
}
Esempio n. 27
0
void CudaDevice::Initialize (Handle<Object> target) {
  HandleScope scope;

  cuInit(0);

  NODE_SET_METHOD(target, "DriverGetVersion", driverGetVersion);
  NODE_SET_METHOD(target, "DeviceGetCount", deviceGetCount);

  Local<FunctionTemplate> t = FunctionTemplate::New(CudaDevice::New);
  constructor_template = Persistent<FunctionTemplate>::New(t);
  constructor_template->InstanceTemplate()->SetInternalFieldCount(1);
  constructor_template->SetClassName(String::NewSymbol("CudaDevice"));

  NODE_SET_PROTOTYPE_METHOD(constructor_template, "GetName", CudaDevice::getName);
  NODE_SET_PROTOTYPE_METHOD(constructor_template, "TotalMem", CudaDevice::totalMem);
  NODE_SET_PROTOTYPE_METHOD(constructor_template, "ComputeCapability", CudaDevice::computeCapability);

  target->Set(String::NewSymbol("CudaDevice"), constructor_template->GetFunction());
}
Esempio n. 28
0
void GlobalVariable::Init(Handle<Object> target)
{
    HandleScope scope;

    Local<FunctionTemplate> t = FunctionTemplate::New(New);

    s_ct = Persistent<FunctionTemplate>::New(t);
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("GlobalVariable"));

    NODE_SET_PROTOTYPE_METHOD (s_ct, "dump", GlobalVariable::Dump);
    NODE_SET_PROTOTYPE_METHOD (s_ct, "setInitializer", GlobalVariable::SetInitializer);
    NODE_SET_PROTOTYPE_METHOD (s_ct, "setAlignment", GlobalVariable::SetAlignment);
    NODE_SET_PROTOTYPE_METHOD (s_ct, "toString", GlobalVariable::ToString);

    s_func = Persistent<Function>::New(s_ct->GetFunction());
    target->Set(String::NewSymbol("GlobalVariable"),
                s_func);
}
Esempio n. 29
0
  void AllocaInst::Init(Handle<Object> target)
  {
    HandleScope scope;

    Local<FunctionTemplate> t = FunctionTemplate::New(New);

    s_ct = Persistent<FunctionTemplate>::New(t);
    s_ct->Inherit (Instruction::s_ct);
    s_ct->InstanceTemplate()->SetInternalFieldCount(1);
    s_ct->SetClassName(String::NewSymbol("AllocaInst"));

    NODE_SET_PROTOTYPE_METHOD(s_ct, "dump", AllocaInst::Dump);
    NODE_SET_PROTOTYPE_METHOD(s_ct, "toString", AllocaInst::ToString);
    NODE_SET_PROTOTYPE_METHOD(s_ct, "setAlignment", AllocaInst::SetAlignment);

    s_func = Persistent< ::v8::Function>::New(s_ct->GetFunction());
    target->Set(String::NewSymbol("AllocaInst"),
		s_func);
  }
Esempio n. 30
0
  static void Init(v8::Handle<v8::Object> exports) {
    NanScope();
    v8::Local<v8::FunctionTemplate> tpl = NanNew<v8::FunctionTemplate>(New);
    tpl->SetClassName(NanNew("MyObject"));
    tpl->InstanceTemplate()->SetInternalFieldCount(1);

    NODE_SET_PROTOTYPE_METHOD(tpl, "getHandle", GetHandle);

    NanAssignPersistent(constructor, tpl->GetFunction());
    exports->Set(NanNew("MyObject"), tpl->GetFunction());
  }