C# 클래스 Prolog.PrologContext

상속: IDisposable
파일 보기 프로젝트 열기: ianhorswill/UnityProlog 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
IndexicalBindingStack object>>.List
Output System.IO.TextWriter
This object

Private Properties

프로퍼티 타입 설명
AbortWokenGoals void
GetCallArgumentsAsArray object[]
GetStackTop Structure
NewStep void
PrologContext System
PrologContext System
Prove IEnumerable
Prove IEnumerable
ProveAllWokenGoals IEnumerable
ProveWokenGoalsInternal IEnumerable
PushArguments void
PushArguments void
PushGoalStack void
WakeUpGoal void

공개 메소드들

메소드 설명
Allocate ( KnowledgeBase kb, object thisValue ) : PrologContext

Gets a context that is currently free to use. Should be relased afterward using ReleaseContext().

Dispose ( ) : void
GetStack ( int frame, int offset ) : object

Reads a value from the stack.

GoalStackGoal ( ushort frame ) : Structure

Returns the goal at the specified position on the stack

GoalStackParent ( ushort frame ) : ushort

Returns the stack position of the parent goal of the goal at the specified position on the stack

IsTrue ( Structure goal ) : bool

Test whether GOAL is provable

IsTrue ( string predicateName ) : bool

Test whether GOAL is provable

MakeFrame ( int size ) : int

Reserve space for a new frame.

MarkTrail ( ) : int

Marks a place on the trail so subsequent bindings can be undone. Present implementation does not actually modify the stack in any way.

PopFrame ( int framePointer ) : void

Resets stack pointer to point at base of old frame.

PopGoalStack ( ) : void

Mark that this is the start of a new clause

Removes the top goal from the goal stack

PrologContext ( KnowledgeBase kb, int stepLimit ) : System

Creates a PrologContext that can for at most the specified number of steps.

Reset ( ) : void
Reset ( object thisValue ) : void

Forcibly clears the execution context.

ResetStackAndProve ( Structure goal ) : IEnumerable

Resets the context (clears stack, etc.) and starts a proof of the specified goal.

ResetStackAndProve ( object goal ) : IEnumerable

Resets the context (clears stack, etc.) and starts a proof of the specified goal.

ResetStepLimit ( ) : void

Renews the step limit (e.g. for when the repl is asking for a new solution.

RestoreVariables ( int savedTrailPointer ) : void

Restores the values of all variables back to the specified position on the trace (i.e. the undo stack).

SaveVariable ( LogicVariable lvar ) : void

Saves the current value of a variable on the trail (i.e. the undo stack).

SetCallArg ( int argumentNumber, object value ) : void

Sets argument for an upcoming call.

SetCurrentRule ( Prolog.KnowledgeBaseEntry rule ) : void

Set the rule currently being tried by the goal at the top of the stack.

SetStack ( int frame, int offset, object value ) : void

Modifies a value from the stack.

StackTrace ( string sourcePath, int lineNumber, string toplevelCommand, bool fullTrace ) : string

Generate a stack trace that's close enough to a normal mono stack dump that the Unity logger will understand it.

TraceOutput ( string format, object arg ) : void

Prints trace information.

UnwindStack ( ushort depth ) : void

Resets the stack to the specified depth.

비공개 메소드들

메소드 설명
AbortWokenGoals ( int newTracePointer ) : void
GetCallArgumentsAsArray ( int arity ) : object[]
GetStackTop ( bool throwOnEmptyStack ) : Structure
NewStep ( ) : void

Check whether the maximum number of steps has been exceeded. Called when a new step is initiated.

PrologContext ( ) : System
PrologContext ( KnowledgeBase kb ) : System

Creates a PrologContext with PrologContext.DefaultStepLimit

Prove ( Structure goal ) : IEnumerable

Proves the goal in the specified structure.

Prove ( object goal, string badGoalErrorMessage ) : IEnumerable

Proves the specified goal, throwing an exception with badGoalErrorMessage if the goal is ill-formed.

ProveAllWokenGoals ( ) : IEnumerable

Attempts to prove all woken goals, in the order they were woken.

ProveWokenGoalsInternal ( WokenGoal goals, int goalIndex ) : IEnumerable
PushArguments ( IList args ) : void

Copies args to a arguments position for the next stack frame.

PushArguments ( object args ) : void

Copies args to a arguments position for the next stack frame.

PushGoalStack ( Symbol functor, object args, ushort parentFrame ) : void
WakeUpGoal ( Structure goal ) : void

메소드 상세

Allocate() 공개 정적인 메소드

Gets a context that is currently free to use. Should be relased afterward using ReleaseContext().
public static Allocate ( KnowledgeBase kb, object thisValue ) : PrologContext
kb KnowledgeBase
thisValue object
리턴 PrologContext

Dispose() 공개 메소드

public Dispose ( ) : void
리턴 void

GetStack() 공개 메소드

Reads a value from the stack.
public GetStack ( int frame, int offset ) : object
frame int Base address of stack frame
offset int Offset into stack frame
리턴 object

GoalStackGoal() 공개 메소드

Returns the goal at the specified position on the stack
public GoalStackGoal ( ushort frame ) : Structure
frame ushort
리턴 Structure

GoalStackParent() 공개 메소드

Returns the stack position of the parent goal of the goal at the specified position on the stack
public GoalStackParent ( ushort frame ) : ushort
frame ushort
리턴 ushort

IsTrue() 공개 메소드

Test whether GOAL is provable
public IsTrue ( Structure goal ) : bool
goal Structure Goal to prove
리턴 bool

IsTrue() 공개 메소드

Test whether GOAL is provable
public IsTrue ( string predicateName ) : bool
predicateName string Name of the predicate to call
리턴 bool

MakeFrame() 공개 메소드

Reserve space for a new frame.
public MakeFrame ( int size ) : int
size int Number of words needed for frame
리턴 int

MarkTrail() 공개 메소드

Marks a place on the trail so subsequent bindings can be undone. Present implementation does not actually modify the stack in any way.
public MarkTrail ( ) : int
리턴 int

PopFrame() 공개 메소드

Resets stack pointer to point at base of old frame.
public PopFrame ( int framePointer ) : void
framePointer int Base of the frame we're popping off
리턴 void

PopGoalStack() 공개 메소드

Mark that this is the start of a new clause Removes the top goal from the goal stack
public PopGoalStack ( ) : void
리턴 void

PrologContext() 공개 메소드

Creates a PrologContext that can for at most the specified number of steps.
public PrologContext ( KnowledgeBase kb, int stepLimit ) : System
kb KnowledgeBase
stepLimit int
리턴 System

Reset() 공개 메소드

public Reset ( ) : void
리턴 void

Reset() 공개 메소드

Forcibly clears the execution context.
public Reset ( object thisValue ) : void
thisValue object
리턴 void

ResetStackAndProve() 공개 메소드

Resets the context (clears stack, etc.) and starts a proof of the specified goal.
public ResetStackAndProve ( Structure goal ) : IEnumerable
goal Structure Goal to attempt to prove
리턴 IEnumerable

ResetStackAndProve() 공개 메소드

Resets the context (clears stack, etc.) and starts a proof of the specified goal.
public ResetStackAndProve ( object goal ) : IEnumerable
goal object Goal to attempt to prove
리턴 IEnumerable

ResetStepLimit() 공개 메소드

Renews the step limit (e.g. for when the repl is asking for a new solution.
public ResetStepLimit ( ) : void
리턴 void

RestoreVariables() 공개 메소드

Restores the values of all variables back to the specified position on the trace (i.e. the undo stack).
public RestoreVariables ( int savedTrailPointer ) : void
savedTrailPointer int
리턴 void

SaveVariable() 공개 메소드

Saves the current value of a variable on the trail (i.e. the undo stack).
public SaveVariable ( LogicVariable lvar ) : void
lvar LogicVariable
리턴 void

SetCallArg() 공개 메소드

Sets argument for an upcoming call.
public SetCallArg ( int argumentNumber, object value ) : void
argumentNumber int Index of the argument (0=first, 1=second, etc.)
value object Value of the argument
리턴 void

SetCurrentRule() 공개 메소드

Set the rule currently being tried by the goal at the top of the stack.
public SetCurrentRule ( Prolog.KnowledgeBaseEntry rule ) : void
rule Prolog.KnowledgeBaseEntry the new rule.
리턴 void

SetStack() 공개 메소드

Modifies a value from the stack.
public SetStack ( int frame, int offset, object value ) : void
frame int Base address of stack frame
offset int Offset into stack frame
value object New value for stack variable
리턴 void

StackTrace() 공개 메소드

Generate a stack trace that's close enough to a normal mono stack dump that the Unity logger will understand it.
public StackTrace ( string sourcePath, int lineNumber, string toplevelCommand, bool fullTrace ) : string
sourcePath string Path for the source file being loaded.
lineNumber int Current line number in the source file.
toplevelCommand string Original prolog command to output, if stack is empty.
fullTrace bool If true, the complete stack is dumped, otherwise, just the starting frames.
리턴 string

TraceOutput() 공개 메소드

Prints trace information.
public TraceOutput ( string format, object arg ) : void
format string
arg object
리턴 void

UnwindStack() 공개 메소드

Resets the stack to the specified depth.
public UnwindStack ( ushort depth ) : void
depth ushort
리턴 void

프로퍼티 상세

IndexicalBindingStack 공개적으로 프로퍼티

public List> IndexicalBindingStack
리턴 object>>.List

Output 공개적으로 프로퍼티

The defaultstream to write output to.
public TextWriter,System.IO Output
리턴 System.IO.TextWriter

This 공개적으로 프로퍼티

The GameObject or Component responsible for initiating the current top-level goal.
public object This
리턴 object