wvtest/javascript/v8shell.cc
void RunShell(v8::Handle<v8::Context> context) {
  fprintf(stderr, "V8 version %s [sample shell]\n", v8::V8::GetVersion());
  static const int kBufferSize = 256;
  // Enter the execution environment before evaluating any code.
  v8::Context::Scope context_scope(context);
  v8::Local<v8::String> name(v8::String::New("(shell)"));
  while (true) {
    char buffer[kBufferSize];
    fprintf(stderr, "> ");
    char* str = fgets(buffer, kBufferSize, stdin);
    if (str == NULL) break;
    v8::HandleScope handle_scope;
    ExecuteString(v8::String::New(str), name, true, true);
  }
  printf("\n");
}
// The read-eval-execute loop of the shell.
The read-eval-execute loop of the shell.
The read - eval - execute loop of the shell .
void RunShell(v8::Handle<v8::Context> context) {
  fprintf(stderr, "V8 version %s [sample shell]\n", v8::V8::GetVersion());
  static const int kBufferSize = 256;
  v8::Context::Scope context_scope(context);
  v8::Local<v8::String> name(v8::String::New("(shell)"));
  while (true) {
    char buffer[kBufferSize];
    fprintf(stderr, "> ");
    char* str = fgets(buffer, kBufferSize, stdin);
    if (str == NULL) break;
    v8::HandleScope handle_scope;
    ExecuteString(v8::String::New(str), name, true, true);
  }
  printf("\n");
}
void RunShell ( v8 :: Handle < v8 :: Context > context ) { fprintf ( stderr , " \n " , v8 :: V8 :: GetVersion ( ) ) ; static const int kBufferSize = 256 ; v8 :: Context :: Scope context_scope ( context ) ; v8 :: Local < v8 :: String > name ( v8 :: String :: New ( " " ) ) ; while ( true ) { char buffer [ kBufferSize ] ; fprintf ( stderr , " " ) ; char * str = fgets ( buffer , kBufferSize , stdin ) ; if ( str == NULL ) break ; v8 :: HandleScope handle_scope ; ExecuteString ( v8 :: String :: New ( str ) , name , true , true ) ; } printf ( " \n " ) ; }
The read-eval-execute loop of the shell.
The read - eval - execute loop of the shell .
// Enter the execution environment before evaluating any code.