C# Class Prolog.PrologContext

Inheritance: IDisposable
Afficher le fichier Open project: ianhorswill/UnityProlog Class Usage Examples

Méthodes publiques

Свойство Type Description
IndexicalBindingStack object>>.List
Output System.IO.TextWriter
This object

Private Properties

Свойство Type Description
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

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
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

Method Details

Allocate() public static méthode

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
Résultat PrologContext

Dispose() public méthode

public Dispose ( ) : void
Résultat void

GetStack() public méthode

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
Résultat object

GoalStackGoal() public méthode

Returns the goal at the specified position on the stack
public GoalStackGoal ( ushort frame ) : Structure
frame ushort
Résultat Structure

GoalStackParent() public méthode

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
Résultat ushort

IsTrue() public méthode

Test whether GOAL is provable
public IsTrue ( Structure goal ) : bool
goal Structure Goal to prove
Résultat bool

IsTrue() public méthode

Test whether GOAL is provable
public IsTrue ( string predicateName ) : bool
predicateName string Name of the predicate to call
Résultat bool

MakeFrame() public méthode

Reserve space for a new frame.
public MakeFrame ( int size ) : int
size int Number of words needed for frame
Résultat int

MarkTrail() public méthode

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
Résultat int

PopFrame() public méthode

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
Résultat void

PopGoalStack() public méthode

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

PrologContext() public méthode

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

Reset() public méthode

public Reset ( ) : void
Résultat void

Reset() public méthode

Forcibly clears the execution context.
public Reset ( object thisValue ) : void
thisValue object
Résultat void

ResetStackAndProve() public méthode

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
Résultat IEnumerable

ResetStackAndProve() public méthode

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
Résultat IEnumerable

ResetStepLimit() public méthode

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

RestoreVariables() public méthode

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
Résultat void

SaveVariable() public méthode

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

SetCallArg() public méthode

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
Résultat void

SetCurrentRule() public méthode

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.
Résultat void

SetStack() public méthode

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
Résultat void

StackTrace() public méthode

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.
Résultat string

TraceOutput() public méthode

Prints trace information.
public TraceOutput ( string format, object arg ) : void
format string
arg object
Résultat void

UnwindStack() public méthode

Resets the stack to the specified depth.
public UnwindStack ( ushort depth ) : void
depth ushort
Résultat void

Property Details

IndexicalBindingStack public_oe property

public List> IndexicalBindingStack
Résultat object>>.List

Output public_oe property

The defaultstream to write output to.
public TextWriter,System.IO Output
Résultat System.IO.TextWriter

This public_oe property

The GameObject or Component responsible for initiating the current top-level goal.
public object This
Résultat object