Changeset 14059 for trunk/FACT++/src/InterpreterV8.cc
- Timestamp:
- 06/03/12 22:50:55 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r14055 r14059 191 191 return ThrowException(String::New("Argument 1 must be an uint32.")); 192 192 193 const HandleScope handle_scope;194 195 193 JsSleep(args[0]->Int32Value()); 196 194 197 195 return Undefined(); 196 } 197 198 Handle<Value> InterpreterV8::FuncState(const Arguments& args) 199 { 200 if (args.Length()!=1) 201 return ThrowException(String::New("Number of arguments must be exactly 1.")); 202 203 if (!args[0]->IsString()) 204 return ThrowException(String::New("Argument 1 must be a string.")); 205 206 const HandleScope handle_scope; 207 208 const String::Utf8Value str(args[0]); 209 return Integer::New(JsState(*str)); 210 } 211 212 Handle<Value> InterpreterV8::FuncName(const Arguments& args) 213 { 214 if (args.Length()!=1) 215 return ThrowException(String::New("Number of arguments must be exactly 1.")); 216 217 if (!args[0]->IsString()) 218 return ThrowException(String::New("Argument 1 must be a string.")); 219 220 const HandleScope handle_scope; 221 222 const String::Utf8Value str(args[0]); 223 return String::New(JsName(*str).c_str()); 198 224 } 199 225 … … 272 298 dim->Set(String::New("wait"), FunctionTemplate::New(WrapWait), ReadOnly); 273 299 dim->Set(String::New("send"), FunctionTemplate::New(WrapSend), ReadOnly); 300 dim->Set(String::New("state"), FunctionTemplate::New(WrapState), ReadOnly); 301 dim->Set(String::New("name"), FunctionTemplate::New(WrapName), ReadOnly); 302 dim->Set(String::New("sleep"), FunctionTemplate::New(WrapSleep), ReadOnly); 274 303 275 304 Handle<ObjectTemplate> global = ObjectTemplate::New(); 276 305 global->Set(String::New("dim"), dim, ReadOnly); 277 306 global->Set(String::New("include"), FunctionTemplate::New(WrapInclude), ReadOnly); 278 global->Set(String::New("sleep"), FunctionTemplate::New(WrapSleep), ReadOnly);279 307 global->Set(String::New("exit"), FunctionTemplate::New(WrapExit), ReadOnly); 280 308 global->Set(String::New("version"), FunctionTemplate::New(InterpreterV8::FuncVersion), ReadOnly); … … 293 321 for (auto it=map.begin(); it!=map.end(); it++) 294 322 args->Set(String::New(it->first.c_str()), String::New(it->second.c_str())); 323 context->Global()->Set(String::New("$"), args); 295 324 context->Global()->Set(String::New("arg"), args); 296 325
Note:
See TracChangeset
for help on using the changeset viewer.