nuget server logo nuget api documents
↑

API Docs / REnv / Environment

Environment

Full name SMRUCC.Rsharp.Runtime.Environment Assembly REnv Members 40

A R# scripting runtime context.

00 Remarks

(在一个环境对象容器之中,所有的对象都是以变量来表示的)

01 Syntax

SMRUCC.Rsharp.Runtime.Environment

02 Methods

NameOverloadsSummary
.ctor 4 run environment initialize: 1.
GetSymbolsNames 1 get all variable symbol names(function symbol is not included)
GetValue 1 Try to get value of the specific symbol
WriteLineHandler 1 a shortcut wrapper function pointer for base.print())
AddMessage 2 add error/warning message
setStackInfo 1 replace current stackframe information
FindSymbol 1 这个函数查找失败的时候只会返回空值
FindFunction 1 会首先在当前环境中的符号列表查找函数,如果不是函数则会在当前环境的函数列表中查找 如果当前环境中不存在,则会在父环境中查找符号
Delete 1 just removes the symbol reference in the runtime environment
AssignSymbol 1 do value assign
Push 1 Variable declare, just add a new symbol in current environment context.
asRVector 1
EnumerateAllFunctions 1 get all function symbols based on the environment context lineage to the root environment
EnumerateAllSymbols 1 get all symbols based on the environment context lineage to the root environment
GetEnumerator 1 get all symbols in current environment context
PushEnvironmentContext 1 add all of the data symbols from parent to join.
op_Concatenate 1 join two runtime environment, this function works for the function closure environment setup initialization.
GetAcceptorArguments 1
Clear 1
FindFunctionWithNamespaceRestrict 2
Evaluate 1
ToString 1
Dispose 1

03 Properties

NameOverloadsSummary
parent 1 最顶层的closure环境的parent是空值来的
stackFrame 1 The name of this current stack closure.(R function name, closure id, etc)
stackTrace 1 debug.getEnvironmentStack())
funcSymbols 1 导入的函数列表
messages 1 主要是存储警告消息
globalEnvironment 1 the global environment
last 1 get value of the special last variable in R# Environment
debugger 1 the debugger context object for the current R# interpreter runtime
isGlobal 1 It is the top level global environment?
value 1 Get/set variable value
isLINQContext 1

04 Fields

NameOverloadsSummary
global 1 In the constructor function of GlobalEnvironment, require attach itself to this parent field So this parent field should not be readonly

05 Members

method .ctor #
#ctor
method .ctor overload 4 #
#ctor(Environment, String, IEnumerable(Of Symbol), IEnumerable(Of Symbol))

context constructor for parallel task

Parameters
NameTypeDescription
parentEnvironment

-

stackNameString

-

symbolsIEnumerable(Of Symbol)

-

funcsIEnumerable(Of Symbol)

-

method .ctor overload 3 #
#ctor(Environment, String, Boolean)
Parameters
NameTypeDescription
isInheritsEnvironment

If is inherits mode, then all of the modification in sub-environment will affects the parent environment. Otherwise, the modification in sub-environment will do nothing to the parent environment.

method .ctor overload 2 #
#ctor(Environment, StackFrame, Boolean, Boolean)

Create a new runtime environment context

Parameters
NameTypeDescription
parentEnvironment

-

stackFrameStackFrame

-

isInheritsBoolean

If is inherits mode, then all of the modification in sub-environment will affects the parent environment. Otherwise, the modification in sub-environment will do nothing to the parent environment.

method GetSymbolsNames #
GetSymbolsNames

get all variable symbol names(function symbol is not included)

method GetValue #
GetValue(String, Object)

Try to get value of the specific symbol

Parameters
NameTypeDescription
nameString

-

Returns

this function returns nothing by default if the symbol is missing in the environment context

method WriteLineHandler #
WriteLineHandler

a shortcut wrapper function pointer for base.print()

method AddMessage overload 2 #
AddMessage(Object, MSG_TYPES)

add error/warning message

Parameters
NameTypeDescription
messageObject

-

levelMSG_TYPES

-

method AddMessage #
AddMessage(Message)

add error/warning message

Parameters
NameTypeDescription
msgMessage

-

method setStackInfo #
setStackInfo(StackFrame)

replace current stackframe information

Remarks

this method used for the internal R# loop, example like for loop/apply loop, etc

Parameters
NameTypeDescription
stackframeStackFrame

-

method FindSymbol #
FindSymbol(String, Boolean)

这个函数查找失败的时候只会返回空值

Parameters
NameTypeDescription
nameString

-

inheritsBoolean

andalso look into the parent environment for the target symbol by name?

method FindFunction #
FindFunction(String, Boolean)

会首先在当前环境中的符号列表查找函数,如果不是函数则会在当前环境的函数列表中查找 如果当前环境中不存在,则会在父环境中查找符号

Parameters
NameTypeDescription
nameString

-

[inherits]Boolean

-

Returns

returns nothing if symbol not found

method Delete #
Delete(String, Boolean)

just removes the symbol reference in the runtime environment

Parameters
NameTypeDescription
nameString

target symbol name that will be removes from the current environment context.

seekParentBoolean

andalso removes the symbol with the same name in any parent environment context? (是否将任意环境路径中的目标符号引用进行删除?)

method AssignSymbol #
AssignSymbol(String, Object, Boolean)

do value assign

Parameters
NameTypeDescription
nameString

-

valueObject

-

strictBoolean

create a new symbol automatically if target symbol name is not exists in current environment context? otherwise this function will populate an error message if this parameter value is config as false by default.

method Push #
Push(String, Object, Boolean, TypeCodes, Boolean)

Variable declare, just add a new symbol in current environment context.

Parameters
NameTypeDescription
nameString

-

valueObject

-

modeBoolean

-

overridesTypeCodes

enable overrides the constant symbol which is in status of lock binding?

Returns

返回错误消息或者对象值

method asRVector #
asRVector(TypeCodes, Object)
Parameters
NameTypeDescription
typeTypeCodes

-

valueObject

应该是确保这个变量值是非空的

method EnumerateAllFunctions #
EnumerateAllFunctions(Boolean)

get all function symbols based on the environment context lineage to the root environment

method EnumerateAllSymbols #
EnumerateAllSymbols(Boolean)

get all symbols based on the environment context lineage to the root environment

Returns

not includes the function symbols

method GetEnumerator #
GetEnumerator

get all symbols in current environment context

method PushEnvironmentContext #
PushEnvironmentContext(Environment, Environment)

add all of the data symbols from parent to join.

Parameters
NameTypeDescription
joinEnvironment

-

parentEnvironment

-

method op_Concatenate #
op_Concatenate(Environment, Environment)

join two runtime environment, this function works for the function closure environment setup initialization.

Remarks

this operator procedure calls may lock all of the parent environment context chain in parallel context

Parameters
NameTypeDescription
closureEnvironment

-

parentEnvironment

-

property parent #
parent

最顶层的closure环境的parent是空值来的

property stackFrame #
stackFrame

The name of this current stack closure.(R function name, closure id, etc)

property stackTrace #
stackTrace
Returns

from current stack to top stack

property funcSymbols #
funcSymbols

导入的函数列表

property messages #
messages

主要是存储警告消息

Remarks

A collection of the warning message

property globalEnvironment #
globalEnvironment

the global environment

property last #
last

get value of the special last variable in R# Environment

property debugger #
debugger

the debugger context object for the current R# interpreter runtime

Remarks

这个属性对外暴露了调试器的核心对象, 使得宿主程序可以在不访问 Environment.debugger 这个 Friend 字段的情况之下, 就可以通过订阅 DebuggerContext.OnBreakpointHit 事件 并且调用 DebuggerContext.Resume() 函数的方式来驱动调试会话

property isGlobal #
isGlobal

It is the top level global environment?

Remarks

(当前的环境是否为最顶层的全局环境?)

property value #
value(String)

Get/set variable value

Remarks

If the current stack does not contains the target variable, then the program will try to find the variable in his parent.

if variable in format like [var], then it means a global or parent environment variable

Parameters
NameTypeDescription
nameString

-

Returns

getter of this property is a wrapper of function Environment.FindSymbol(), and the setter of this property is a wrapper of visit data table Environment.symbols.

field global #
global

In the constructor function of GlobalEnvironment, require attach itself to this parent field So this parent field should not be readonly

property isLINQContext #
isLINQContext
method GetAcceptorArguments #
GetAcceptorArguments()
method Clear #
Clear()
method FindFunctionWithNamespaceRestrict #
FindFunctionWithNamespaceRestrict(String, String)
method FindFunctionWithNamespaceRestrict overload 2 #
FindFunctionWithNamespaceRestrict(String)
method Evaluate #
Evaluate(IEnumerable(Of Expression))
method ToString #
ToString()
method Dispose #
Dispose()