Changeset 20012
- Timestamp:
- 09/27/08 11:23:53 (5 years ago)
- Location:
- lang/cplusplus/llv8call/trunk/ext
- Files:
-
- 4 modified
-
nspr/io.cc (modified) (1 diff)
-
nspr/nspr-v8.h (modified) (1 diff)
-
nspr/process.cc (modified) (1 diff)
-
posix/posix.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/cplusplus/llv8call/trunk/ext/nspr/io.cc
r19912 r20012 10 10 11 11 using namespace v8; 12 13 static inline Handle<Object> nspr_namespace() {14 return Context::GetCurrent()->Global()15 ->Get(String::New("org"))->ToObject()16 ->Get(String::New("coderepos"))->ToObject()17 ->Get(String::New("nspr"))->ToObject();18 }19 12 20 13 static Handle<Value> _Access(const Arguments& args) { -
lang/cplusplus/llv8call/trunk/ext/nspr/nspr-v8.h
r19856 r20012 17 17 } 18 18 19 static inline v8::Handle<v8::Object> nspr_namespace() { 20 return v8::Context::GetCurrent()->Global() 21 ->Get(v8::String::New("org"))->ToObject() 22 ->Get(v8::String::New("coderepos"))->ToObject() 23 ->Get(v8::String::New("nspr"))->ToObject(); 24 } 25 -
lang/cplusplus/llv8call/trunk/ext/nspr/process.cc
r19856 r20012 15 15 String::Utf8Value name(args[0]->ToString()); 16 16 PRFileDesc *fd = PR_GetInheritedFD(*name); 17 Handle<Function> tmpl = Handle<Function>::Cast( Context::GetCurrent()->Global()->Get(String::New("IO")));17 Handle<Function> tmpl = Handle<Function>::Cast(nspr_namespace()->Get(String::New("IO"))); 18 18 Handle<Object> obj = tmpl->NewInstance(); 19 19 obj->SetInternalField(0, External::New((void*)fd)); -
lang/cplusplus/llv8call/trunk/ext/posix/posix.cc
r19912 r20012 3 3 #include <cstring> 4 4 #include "v8ext.h" 5 #include "llv8-util.h"6 5 #include <unistd.h> 7 6 #include <sys/wait.h> 7 8 #define assert_args(args, length) do { if ((args).Length() != (length)) { return v8::ThrowException(v8::String::New("Exception: missing args")); } } while (0) 8 9 9 10 using namespace v8; 10 11 11 12 static Handle<Value> _Fork(const Arguments& args) { 13 assert_args(args, 0); 12 14 return Int32::New(fork()); 15 } 16 17 static Handle<Value> _sleep(const Arguments& args) { 18 assert_args(args, 1); 19 sleep(args[0]->Int32Value()); 20 return Undefined(); 13 21 } 14 22 … … 19 27 Handle<Object> target = Object::New(); 20 28 target->Set(String::New("Fork"), FunctionTemplate::New(_Fork)->GetFunction()); 29 target->Set(String::New("Sleep"), FunctionTemplate::New(_sleep)->GetFunction()); 21 30 return target; 22 31 }
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)