Changeset 14125
- Timestamp:
- 06/08/12 17:24:12 (12 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r14122 r14125 302 302 HandleScope handle_scope; 303 303 304 //const void *ptr = Local<External>::Cast(info.This()->GetInternalField(0))->Value(); 305 304 306 const String::Utf8Value str(args.Holder()->Get(String::New("name"))); 305 307 return Boolean::New(JsUnsubscribe(*str)); … … 320 322 //if (counter==cnt) 321 323 // return info.Holder();//Holder()->Get(String::New("data")); 322 //cout << counter << " " << cnt << endl;323 324 //const void *ppp = Local<External>::Cast(info.This()->GetInternalField(0))->Value();325 //info.This()->SetInternalField(0, External::New((void*)evt));326 //cout << info.This().327 324 328 325 const vector<Description> vec = JsDescription(*str); … … 418 415 const String::Utf8Value str(args[0]); 419 416 420 JsSubscribe(*str); 421 422 //args.This()->SetInternalField(0, External::New((void*)test)); 423 //obj->SetInternalFieldCount(1); 424 425 Handle<ObjectTemplate> obj = ObjectTemplate::New(); 426 obj->Set(String::New("get"), FunctionTemplate::New(WrapGetData), ReadOnly); 427 obj->Set(String::New("close"), FunctionTemplate::New(WrapClose), ReadOnly); 428 obj->Set(String::New("name"), String::New(*str), ReadOnly); 429 //obj->Set(String::New("toString"), String::New(("[object Dim "+string(*str)+"]").c_str()), ReadOnly); 430 431 return obj->NewInstance(); 417 void *ptr = JsSubscribe(*str); 418 if (ptr==0) 419 return ThrowException(String::New(("Subscription to '"+string(*str)+"' already exists.").c_str())); 420 421 Handle<ObjectTemplate> tem = ObjectTemplate::New(); 422 tem->Set(String::New("get"), FunctionTemplate::New(WrapGetData), ReadOnly); 423 tem->Set(String::New("close"), FunctionTemplate::New(WrapClose), ReadOnly); 424 tem->Set(String::New("name"), String::New(*str), ReadOnly); 425 tem->SetInternalFieldCount(1); 426 //tem->Set(String::New("toString"), String::New(("[object Dim "+string(*str)+"]").c_str()), ReadOnly); 427 428 Handle<Object> obj = tem->NewInstance(); 429 obj->SetInternalField(0, External::New(ptr)); 430 431 return handle_scope.Close(obj); 432 432 433 433 // Persistent<Object> p = Persistent<Object>::New(obj->NewInstance()); -
trunk/FACT++/src/InterpreterV8.h
r14093 r14125 71 71 virtual std::pair<int32_t, std::string> JsState(const std::string &) { return std::make_pair(-256, ""); }; 72 72 virtual void *JsSubscribe(const std::string &) { return 0; }; 73 virtual bool JsUnsubscribe(const std::string &) { return false; };73 virtual bool JsUnsubscribe(const void *) { return false; }; 74 74 virtual std::vector<Description> JsDescription(const std::string &) { return std::vector<Description>(); }; 75 75 virtual std::pair<uint64_t, EventImp *> JsGetEvent(const std::string &) { return std::make_pair(0, (EventImp*)0); };
Note:
See TracChangeset
for help on using the changeset viewer.