csys: some minor clean-up; provide :default stage
This commit is contained in:
parent
7a52e75868
commit
fec2a1b42d
2 changed files with 6 additions and 11 deletions
|
|
@ -14,7 +14,6 @@ defmodule Scopes.CSys.Environ do
|
|||
|
||||
def get_stage(env, prog, stage) do
|
||||
Agent.get(env, fn {_parent, progs} ->
|
||||
#progs[prog][stage]
|
||||
stages = progs[prog]
|
||||
stages[stage] || stages[:default]
|
||||
end)
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ defmodule Scopes.CSys.Program do
|
|||
# programs
|
||||
|
||||
def basic_prog() do
|
||||
%{initial: &std_proc/1,
|
||||
active: &std_proc/1,
|
||||
retired: &std_proc/1
|
||||
%{default: &std_proc/1
|
||||
#initial: &std_proc/1,
|
||||
#active: &std_proc/1,
|
||||
#retired: &std_proc/1
|
||||
}
|
||||
end
|
||||
|
||||
# processors
|
||||
|
||||
#def std_proc({:parent}, scope) do
|
||||
def std_proc(msg) do
|
||||
scope = Process.get(:scope)
|
||||
case msg do
|
||||
|
|
@ -36,10 +36,6 @@ defmodule Scopes.CSys.Program do
|
|||
update_neuron({state, proc, syns, env})
|
||||
end
|
||||
|
||||
def xx_std_proc(msg, scope) do
|
||||
forward(msg, scope) || notify(msg, scope)
|
||||
end
|
||||
|
||||
# processor steps
|
||||
|
||||
def notify(msg, scope) do
|
||||
|
|
@ -52,9 +48,9 @@ defmodule Scopes.CSys.Program do
|
|||
|
||||
# step functions
|
||||
|
||||
def create_parent({_state, procs, _syns, env}) do
|
||||
def create_parent({_state, proc, _syns, env}) do
|
||||
syn = synapse(self(), &Function.identity/1, 0)
|
||||
#neuron({[], Environ.get_stage(env, :basic, :initial), [syn], env})
|
||||
neuron({[], procs, [syn], env})
|
||||
neuron({[], proc, [syn], env})
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue