Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F3996151
context.lp
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Jul 8, 8:59 AM
Size
3 KB
Mime Type
text/plain
Expires
Fri, Jul 10, 8:59 AM (1 d, 12 h)
Engine
blob
Format
Raw Data
Handle
271965
Attached To
rXR Xreate
context.lp
View Options
% This Source Code Form is subject to the terms of the Mozilla Public
% License, v. 2.0. If a copy of the MPL was not distributed with this
% file, You can obtain one at http://mozilla.org/MPL/2.0/.
%% INPUT:
%% - latex_scope_demand(Scope, Subject)
%% Initial demand from clients
%%
%% - latex_registered_subjects(Subject, PossibleDecision)
%% Clients register possible decisions for respective subjects
%%
%% - latex_fn_signature
%%
%% OUTPUT:
%% - latex_fn_demand(Fn, Subject)
%% Which functions demand hidden latex arguments
%%
%% - latex_decision(Scope, Subject, Decision)
%% Provided decisions, values for hidden latex arguments
%%
%% SIGNATURES:
%% -Subject: string
%%
% CONTEXT PROPAGATION
%===========================================================
% nested scope propagation:
bind_scope(Scope, Context, Info):-
bind_scope(ScopeParent, Context, Info);
cfa_parent(Scope, scope(ScopeParent)).
% Strong or Uniform inter-function propagation:
bind_scope(Scope, Context, Info):-
bind_scope(ScopeParent, Context, Info): cfa_call(ScopeParent, FnCurrent);
cfa_parent(Scope, function(FnCurrent)); cfa_call(_, FnCurrent);
bind_scope(_, Context, Info); scope(Scope).
% weak inter-function propagation
bind_scope(Scope, Context, weak(ScopeParent)):-
not bind_scope(Scope, Context, strong);
bind_scope(ScopeParent, Context, strong);
cfa_call(ScopeParent, FnCurrent);
cfa_parent(Scope, function(FnCurrent)).
% DEMAND
%===========================================================
%demand propagations: scope level
latex_scope_demand(Scope, Subject):-
latex_scope_demand(ScopeChild, Subject);
cfa_parent(ScopeChild, scope(Scope)).
%propagation: fn level
latex_fn_demand(Fn, Subject):-
latex_scope_demand(ScopeFnBody, Subject);
cfa_parent(ScopeFnBody, function(Fn)).
latex_fn_demand_ordered(Fn, Subject, Id):-
Id= #sum{ 1, SubjLess : latex_fn_demand(Fn, SubjLess), SubjLess < Subject};
latex_fn_demand(Fn, Subject).
%propagation: inter-fn level
latex_scope_demand(Scope, Subject):-
latex_fn_demand(FnCallee, Subject);
not latex_decision(Scope, Subject, _);
cfa_call(Scope, FnCallee).
% DECISIONS
%===========================================================
latex_decision(Scope, Subject, Decision):-
latex_fn_demand(FnCallee, Subject);
bind_scope(Scope, Decision, strong);
cfa_call(Scope, FnCallee);
latex_registered_subjects(Subject, Decision).
%late decision
late((ScopeCaller, Subject), SubjectS, (AnyDecision), latex_decision(ScopeCaller, Subject, AnyDecision)):-
scope_fn(ScopeCaller, FnCaller);
cfa_parent(FnCallerBody, function(FnCaller));
latex_symbol(FnCaller, Subject, SubjectS);
cfa_call(ScopeCaller, FnCallee);
latex_fn_demand(FnCallee, Subject);
latex_registered_subjects(Subject, AnyDecision).
% UTILITY
%===========================================================
latex_symbol(Fn, Topic, s(TopicsOffset + TopicId, -2, FnBody)):-
cfa_parent(FnBody, function(Fn));
latex_parameters_group_offset(TopicsOffset);
latex_fn_demand_ordered(Fn, Topic, TopicId).
% IMPLEMENTATION
%===========================================================
scope_fn(Scope, Fn):-cfa_parent(Scope, function(Fn)).
scope_fn(Scope, Fn):-
scope_fn(ScopeParent, Fn);
cfa_parent(Scope, scope(ScopeParent)).
latex_parameters_group_offset(1000).
Event Timeline
Log In to Comment