Compare commits

..

No commits in common. "8b590695bb41107a00e7a41c250aba86880b331a" and "7dd2b1e137b2e330c452243ab82622a296d29d89" have entirely different histories.

3 changed files with 12 additions and 28 deletions

View file

@ -20,7 +20,7 @@ defmodule Scopes.CSys.Program do
end
def get_proc(state) do
get_proc(state.prog, state.stage)
get_proc(elem(state.prog, 0), state.stage)
end
defp get_proc(stages, stage) do
@ -31,11 +31,18 @@ defmodule Scopes.CSys.Program do
def basic_prog(args) do
default = basic_active(args)
%{default: default,
stages = %{
default: default,
initial: basic_initial(args),
active: default,
retired: default
}
transitions = %{
restart: :initial,
retire: :retired,
next: [initial: :active, active: :retired]
}
{stages, transitions}
end
def prepare_basic(args \\ []) do
@ -60,7 +67,8 @@ defmodule Scopes.CSys.Program do
[:csys, :connect | _rest] -> CSys.connect(msg, scope)
[:csys, :create, :succ | _rest] -> create_succ(msg, scope)
[:csys, :create, :pred | _rest] -> create_pred(msg, scope)
#[:csys, :next | _rest] -> next(msg, scope)
#[:csys, :next | _rest] -> next(scope, meta)
#[:csys, action | rest] -> transition(action, scope)
_ -> CSys.forward(msg, scope) || CSys.notify(msg, scope)
end
end
@ -74,7 +82,7 @@ defmodule Scopes.CSys.Program do
limit = args[:limit]
data = Shape.data(msg)
state = CSys.state(scope)
Logger.info data: data, state_value: state.value, threshold: threshold, self: self()
Logger.info data: data, state_value: state.value, threshold: threshold
value_n = state.value + data.value
if value_n >= threshold do
value_out = limit && rem(value_n - 1, limit) + limit || value_n

View file

@ -1,9 +0,0 @@
defmodule Scopes.Util do
defmacro fields_info(fields) do
names = for {f, _, _} <- fields do f end
quote do
Enum.zip(unquote(names), unquote(fields))
end
end
end

View file

@ -1,15 +0,0 @@
defmodule Scopes.UtilTest do
use ExUnit.Case, async: true
alias Scopes.Util
require Scopes.Util
describe "info:" do
test "fields" do
a = 17
b = 22
c = 42
assert [a: 17, b: 22, c: 42] = Util.fields_info([a, b, c])
end
end
end