C# 클래스 Rhino.Tools.Shell.Global

상속: Rhino.ImporterTopLevel
파일 보기 프로젝트 열기: hazzik/Rhino.Net

공개 메소드들

메소드 설명
DefineClass ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void

Load a Java class that defines a JavaScript object using the conventions outlined in ScriptableObject.defineClass.

Load a Java class that defines a JavaScript object using the conventions outlined in ScriptableObject.defineClass.

This method is defined as a JavaScript function.

Deserialize ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
Doctest ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns 2 (since 2 tests were executed).

Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns 2 (since 2 tests were executed).

Gc ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
GetConsole ( Encoding cs ) : ShellConsole
GetErr ( ) : TextWriter
GetIn ( ) : Stream
GetOut ( ) : TextWriter
GetPrompts ( Context cx ) : string[]
Global ( ) : System
Global ( Context cx ) : System
Help ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void

Print a help message.

Print a help message. This method is defined as a JavaScript function.

Init ( Context cx ) : void
Init ( ContextFactory factory ) : void
InitQuitAction ( QuitAction quitAction ) : void

Set the action to call from quit().

Set the action to call from quit().

InstallRequire ( Context cx, IList modulePath, bool sandboxed ) : Require
IsInitialized ( ) : bool
Load ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void

Load and execute a set of JavaScript source files.

Load and execute a set of JavaScript source files. This method is defined as a JavaScript function.

LoadClass ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void

Load and execute a script compiled to a class file.

Load and execute a script compiled to a class file.

This method is defined as a JavaScript function. When called as a JavaScript function, a single argument is expected. This argument should be the name of a class that implements the Script interface, as will any script compiled by jsc.

Print ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

Print the string values of its arguments.

Print the string values of its arguments. This method is defined as a JavaScript function. Note that its arguments are of the "varargs" form, which allows it to handle an arbitrary number of arguments supplied to the JavaScript function.

Quit ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void

Call embedding-specific quit action passing its argument as int32 exit code.

Call embedding-specific quit action passing its argument as int32 exit code. This method is defined as a JavaScript function.

ReadFile ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

The readFile reads the given file content and convert it to a string using the specified character coding or default character coding if explicit coding argument is not given.

The readFile reads the given file content and convert it to a string using the specified character coding or default character coding if explicit coding argument is not given.

Usage:

 readFile(filePath) readFile(filePath, charCoding) 
The first form converts file's context to string using the default character coding.
ReadUrl ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

The readUrl opens connection to the given URL, read all its data and converts them to a string using the specified character coding or default character coding if explicit coding argument is not given.

The readUrl opens connection to the given URL, read all its data and converts them to a string using the specified character coding or default character coding if explicit coding argument is not given.

Usage:

 readUrl(url) readUrl(url, charCoding) 
The first form converts file's context to string using the default charCoding.
RunCommand ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

Execute the specified command with the given argument and options as a separate process and return the exit status of the process.

Execute the specified command with the given argument and options as a separate process and return the exit status of the process.

Usage:

 runCommand(command) runCommand(command, arg1, ..., argN) runCommand(command, arg1, ..., argN, options) 
All except the last arguments to runCommand are converted to strings and denote command name and its arguments. If the last argument is a JavaScript object, it is an option object. Otherwise it is converted to string denoting the last argument and options objects assumed to be empty. The following properties of the option object are processed:
  • args - provides an array of additional command arguments
  • env - explicit environment object. All its enumerable properties define the corresponding environment variable names.
  • input - the process input. If it is not java.io.InputStream, it is converted to string and sent to the process as its input. If not specified, no input is provided to the process.
  • output - the process output instead of java.lang.System.out. If it is not instance of java.io.OutputStream, the process output is read, converted to a string, appended to the output property value converted to string and put as the new value of the output property.
  • err - the process error output instead of java.lang.System.err. If it is not instance of java.io.OutputStream, the process error output is read, converted to a string, appended to the err property value converted to string and put as the new value of the err property.
RunDoctest ( Context cx, Scriptable scope, string session, string sourceName, int lineNumber ) : int
Seal ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void

The seal function seals all supplied arguments.

The seal function seals all supplied arguments.

Serialize ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
SetErr ( TextWriter err ) : void
SetIn ( Stream @in ) : void
SetOut ( TextWriter @out ) : void
SetSealedStdLib ( bool value ) : void
Spawn ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

The spawn function runs a given function or script in a different thread.

The spawn function runs a given function or script in a different thread. js> function g() { a = 7; } js> a = 3; 3 js> spawn(g) Thread[Thread-1,5,main] js> a 3

Sync ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

The sync function creates a synchronized function (in the sense of a Java synchronized method) from an existing function.

The sync function creates a synchronized function (in the sense of a Java synchronized method) from an existing function. The new function synchronizes on the the second argument if it is defined, or otherwise the this object of its invocation. js> var o = { f : sync(function(x) { print("entry"); Packages.java.lang.Thread.sleep(x*1000); print("exit"); })}; js> spawn(function() {o.f(5);}); Thread[Thread-0,5,main] entry js> spawn(function() {o.f(5);}); Thread[Thread-1,5,main] js> exit entry exit

Toint32 ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object

Convert the argument to int32 number.

Convert the argument to int32 number.

Version ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : double

Get and set the language version.

Get and set the language version. This method is defined as a JavaScript function.

비공개 메소드들

메소드 설명
DoctestOutputMatches ( string expected, string actual ) : bool

Compare actual result of doctest to expected, modulo some acceptable differences.

Compare actual result of doctest to expected, modulo some acceptable differences. Currently just trims the strings before comparing, but should ignore differences in line numbers for error messages for example.

GetCharCodingFromType ( string type ) : string
GetClass ( object args ) : Type
GetInstance ( System.Function function ) : Global
LoadJLine ( Encoding cs ) : bool
Pipe ( bool fromProcess, Stream from, Stream to ) : void
ReadReader ( TextReader reader ) : string
ReadReader ( TextReader reader, int initialBufferSize ) : string
ReadUrl ( string filePath, string charCoding, bool urlIsFile ) : string
ReportRuntimeError ( string msgId ) : Exception
ReportRuntimeError ( string msgId, string msgArg ) : Exception
RunProcess ( string cmd, string environment, Stream @in, Stream @out, Stream err ) : int

Runs the given process using Runtime.exec().

Runs the given process using Runtime.exec(). If any of in, out, err is null, the corresponding process stream will be closed immediately, otherwise it will be closed as soon as all data will be read from/written to process

ToInputStream ( object value ) : Stream
ToOutputStream ( object value ) : Stream

메소드 상세

DefineClass() 공개 정적인 메소드

Load a Java class that defines a JavaScript object using the conventions outlined in ScriptableObject.defineClass.
Load a Java class that defines a JavaScript object using the conventions outlined in ScriptableObject.defineClass.

This method is defined as a JavaScript function.

/// IllegalAccessException /// if access is not available /// to a reflected class member /// /// InstantiationException /// if unable to instantiate /// the named class /// /// InvocationTargetException /// if an exception is thrown /// during execution of methods of the named class ///
public static DefineClass ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

Deserialize() 공개 정적인 메소드

public static Deserialize ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

Doctest() 공개 정적인 메소드

Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns 2 (since 2 tests were executed).
Example: doctest("js> function f() {\n > return 3;\n > }\njs> f();\n3\n"); returns 2 (since 2 tests were executed).
public static Doctest ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

Gc() 공개 정적인 메소드

public static Gc ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

GetConsole() 공개 메소드

public GetConsole ( Encoding cs ) : ShellConsole
cs System.Text.Encoding
리턴 ShellConsole

GetErr() 공개 메소드

public GetErr ( ) : TextWriter
리턴 System.IO.TextWriter

GetIn() 공개 메소드

public GetIn ( ) : Stream
리턴 Stream

GetOut() 공개 메소드

public GetOut ( ) : TextWriter
리턴 System.IO.TextWriter

GetPrompts() 공개 메소드

public GetPrompts ( Context cx ) : string[]
cx Rhino.Context
리턴 string[]

Global() 공개 메소드

public Global ( ) : System
리턴 System

Global() 공개 메소드

public Global ( Context cx ) : System
cx Rhino.Context
리턴 System

Help() 공개 정적인 메소드

Print a help message.
Print a help message. This method is defined as a JavaScript function.
public static Help ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

Init() 공개 메소드

public Init ( Context cx ) : void
cx Rhino.Context
리턴 void

Init() 공개 메소드

public Init ( ContextFactory factory ) : void
factory ContextFactory
리턴 void

InitQuitAction() 공개 메소드

Set the action to call from quit().
Set the action to call from quit().
public InitQuitAction ( QuitAction quitAction ) : void
quitAction QuitAction
리턴 void

InstallRequire() 공개 메소드

public InstallRequire ( Context cx, IList modulePath, bool sandboxed ) : Require
cx Rhino.Context
modulePath IList
sandboxed bool
리턴 Rhino.Commonjs.Module.Require

IsInitialized() 공개 메소드

public IsInitialized ( ) : bool
리턴 bool

Load() 공개 정적인 메소드

Load and execute a set of JavaScript source files.
Load and execute a set of JavaScript source files. This method is defined as a JavaScript function.
public static Load ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

LoadClass() 공개 정적인 메소드

Load and execute a script compiled to a class file.
Load and execute a script compiled to a class file.

This method is defined as a JavaScript function. When called as a JavaScript function, a single argument is expected. This argument should be the name of a class that implements the Script interface, as will any script compiled by jsc.

/// IllegalAccessException /// if access is not available /// to the class /// /// InstantiationException /// if unable to instantiate /// the named class ///
public static LoadClass ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

Print() 공개 정적인 메소드

Print the string values of its arguments.
Print the string values of its arguments. This method is defined as a JavaScript function. Note that its arguments are of the "varargs" form, which allows it to handle an arbitrary number of arguments supplied to the JavaScript function.
public static Print ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

Quit() 공개 정적인 메소드

Call embedding-specific quit action passing its argument as int32 exit code.
Call embedding-specific quit action passing its argument as int32 exit code. This method is defined as a JavaScript function.
public static Quit ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

ReadFile() 공개 정적인 메소드

The readFile reads the given file content and convert it to a string using the specified character coding or default character coding if explicit coding argument is not given.
The readFile reads the given file content and convert it to a string using the specified character coding or default character coding if explicit coding argument is not given.

Usage:

 readFile(filePath) readFile(filePath, charCoding) 
The first form converts file's context to string using the default character coding.
public static ReadFile ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

ReadUrl() 공개 정적인 메소드

The readUrl opens connection to the given URL, read all its data and converts them to a string using the specified character coding or default character coding if explicit coding argument is not given.
The readUrl opens connection to the given URL, read all its data and converts them to a string using the specified character coding or default character coding if explicit coding argument is not given.

Usage:

 readUrl(url) readUrl(url, charCoding) 
The first form converts file's context to string using the default charCoding.
public static ReadUrl ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

RunCommand() 공개 정적인 메소드

Execute the specified command with the given argument and options as a separate process and return the exit status of the process.
Execute the specified command with the given argument and options as a separate process and return the exit status of the process.

Usage:

 runCommand(command) runCommand(command, arg1, ..., argN) runCommand(command, arg1, ..., argN, options) 
All except the last arguments to runCommand are converted to strings and denote command name and its arguments. If the last argument is a JavaScript object, it is an option object. Otherwise it is converted to string denoting the last argument and options objects assumed to be empty. The following properties of the option object are processed:
  • args - provides an array of additional command arguments
  • env - explicit environment object. All its enumerable properties define the corresponding environment variable names.
  • input - the process input. If it is not java.io.InputStream, it is converted to string and sent to the process as its input. If not specified, no input is provided to the process.
  • output - the process output instead of java.lang.System.out. If it is not instance of java.io.OutputStream, the process output is read, converted to a string, appended to the output property value converted to string and put as the new value of the output property.
  • err - the process error output instead of java.lang.System.err. If it is not instance of java.io.OutputStream, the process error output is read, converted to a string, appended to the err property value converted to string and put as the new value of the err property.
public static RunCommand ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

RunDoctest() 공개 메소드

public RunDoctest ( Context cx, Scriptable scope, string session, string sourceName, int lineNumber ) : int
cx Rhino.Context
scope Scriptable
session string
sourceName string
lineNumber int
리턴 int

Seal() 공개 정적인 메소드

The seal function seals all supplied arguments.
The seal function seals all supplied arguments.
public static Seal ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

Serialize() 공개 정적인 메소드

public static Serialize ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : void
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 void

SetErr() 공개 메소드

public SetErr ( TextWriter err ) : void
err System.IO.TextWriter
리턴 void

SetIn() 공개 메소드

public SetIn ( Stream @in ) : void
@in Stream
리턴 void

SetOut() 공개 메소드

public SetOut ( TextWriter @out ) : void
@out System.IO.TextWriter
리턴 void

SetSealedStdLib() 공개 메소드

public SetSealedStdLib ( bool value ) : void
value bool
리턴 void

Spawn() 공개 정적인 메소드

The spawn function runs a given function or script in a different thread.
The spawn function runs a given function or script in a different thread. js> function g() { a = 7; } js> a = 3; 3 js> spawn(g) Thread[Thread-1,5,main] js> a 3
public static Spawn ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

Sync() 공개 정적인 메소드

The sync function creates a synchronized function (in the sense of a Java synchronized method) from an existing function.
The sync function creates a synchronized function (in the sense of a Java synchronized method) from an existing function. The new function synchronizes on the the second argument if it is defined, or otherwise the this object of its invocation. js> var o = { f : sync(function(x) { print("entry"); Packages.java.lang.Thread.sleep(x*1000); print("exit"); })}; js> spawn(function() {o.f(5);}); Thread[Thread-0,5,main] entry js> spawn(function() {o.f(5);}); Thread[Thread-1,5,main] js> exit entry exit
public static Sync ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

Toint32() 공개 정적인 메소드

Convert the argument to int32 number.
Convert the argument to int32 number.
public static Toint32 ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : object
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 object

Version() 공개 정적인 메소드

Get and set the language version.
Get and set the language version. This method is defined as a JavaScript function.
public static Version ( Context cx, Scriptable thisObj, object args, System.Function funObj ) : double
cx Rhino.Context
thisObj Scriptable
args object
funObj System.Function
리턴 double