// ShellUtils.h #pragma once #include #include #include #include #include #include #include "../scripting/engine.h" // Executes a string within the current v8 context. bool ExecuteString(v8::Handle source, v8::Handle name, bool print_result, bool report_exceptions); v8::Handle Print(const v8::Arguments& args); v8::Handle Load(const v8::Arguments& args); v8::Handle ListFiles(const v8::Arguments& args); v8::Handle Quit(const v8::Arguments& args); v8::Handle Version(const v8::Arguments& args); v8::Handle JSFork(const v8::Arguments& args); v8::Handle Join(const v8::Arguments& args); v8::Handle ReadFile(const char* name); void ReportException(v8::TryCatch* handler); void installShellUtils( mongo::Scope &scope, v8::Handle& global ); #define jsassert(x,msg) assert(x) std::ostream& operator<<( std::ostream &s, const v8::Handle & o ); std::ostream& operator<<( std::ostream &s, const v8::Handle * try_catch ); std::string toSTLString( const v8::Handle & o ); // Scoped management of mongo program instances. Simple implementation: // destructor kills all mongod instances created by the shell. struct MongoProgramScope { MongoProgramScope() {} // Avoid 'unused variable' warning. ~MongoProgramScope(); }; void RecordMyLocation( const char *_argv0 ); void KillMongoProgramInstances();