Changeset 15272
- Timestamp:
- 04/07/13 23:38:46 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r15253 r15272 6 6 #include <sstream> 7 7 #include <iomanip> 8 9 #include <sys/stat.h> 8 10 9 11 #include <boost/tokenizer.hpp> … … 1918 1920 hrz = LN_SOLAR_NAUTIC_HORIZON; 1919 1921 if (arg==string("fact").substr(0, arg.length())) 1920 hrz = -1 5;1922 hrz = -13; 1921 1923 if (arg==string("astronomical").substr(0, arg.length())) 1922 1924 hrz = LN_SOLAR_ASTRONOMICAL_HORIZON; … … 2083 2085 return Undefined(); 2084 2086 2085 //if (main && JsGetCurrentState().index!=3) 2086 // JsSetState(3); 2087 const Handle<String> __date__ = String::New("__DATE__"); 2088 const Handle<String> __file__ = String::New("__FILE__"); 2089 2090 Handle<Value> save_date; 2091 Handle<Value> save_file; 2092 2093 Handle<Object> global = Context::GetCurrent()->Global(); 2094 if (!global.IsEmpty()) 2095 { 2096 struct stat attrib; 2097 if (stat(file.c_str(), &attrib)==0) 2098 { 2099 save_date = global->Get(__date__); 2100 save_file = global->Get(__file__); 2101 2102 global->Set(__file__, String::New(file.c_str())); 2103 2104 const Local<Value> date = Date::New(attrib.st_mtime*1000); 2105 if (!date.IsEmpty()) 2106 global->Set(__date__, date); 2107 } 2108 } 2087 2109 2088 2110 const Handle<Value> rc = script->Run(); … … 2094 2116 if (!rc->IsUndefined() && file!="internal") 2095 2117 JsResult(*String::AsciiValue(rc)); 2118 2119 if (!global.IsEmpty() && !save_date.IsEmpty()) 2120 { 2121 global->ForceSet(__date__, save_date); 2122 global->ForceSet(__file__, save_file); 2123 } 2096 2124 2097 2125 return handle_scope.Close(rc); … … 2415 2443 context->Global()->Set(String::New("arg"), args, ReadOnly); 2416 2444 2445 const Local<Value> starttime = Date::New(Time().JavaDate()); 2446 if (!starttime.IsEmpty()) 2447 context->Global()->Set(String::New("__START__"), starttime, ReadOnly); 2448 2417 2449 //V8::ResumeProfiler(); 2418 2450
Note:
See TracChangeset
for help on using the changeset viewer.