aboutsummaryrefslogtreecommitdiff
path: root/tictactoe-2/apps/tictactoe
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2024-03-04 09:15:01 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2024-03-04 09:15:01 +0100
commitc34d7363b61a9e00c986b79793bf7cdc03e9ea99 (patch)
tree79c9121e2bff6bc938b7b36d1195e5759b163d2c /tictactoe-2/apps/tictactoe
parent0be77ac09408c13cc12b5953b9ac7459b549c202 (diff)
downloaderlang-workshop-c34d7363b61a9e00c986b79793bf7cdc03e9ea99.tar.gz
erlang-workshop-c34d7363b61a9e00c986b79793bf7cdc03e9ea99.tar.bz2
erlang-workshop-c34d7363b61a9e00c986b79793bf7cdc03e9ea99.tar.xz
erlang-workshop-c34d7363b61a9e00c986b79793bf7cdc03e9ea99.zip
wip
Diffstat (limited to 'tictactoe-2/apps/tictactoe')
-rw-r--r--tictactoe-2/apps/tictactoe/src/tictactoe.app.src15
-rw-r--r--tictactoe-2/apps/tictactoe/src/tictactoe_app.erl18
-rw-r--r--tictactoe-2/apps/tictactoe/src/tictactoe_sup.erl35
3 files changed, 68 insertions, 0 deletions
diff --git a/tictactoe-2/apps/tictactoe/src/tictactoe.app.src b/tictactoe-2/apps/tictactoe/src/tictactoe.app.src
new file mode 100644
index 0000000..ccce597
--- /dev/null
+++ b/tictactoe-2/apps/tictactoe/src/tictactoe.app.src
@@ -0,0 +1,15 @@
+{application, tictactoe,
+ [{description, "An OTP application"},
+ {vsn, "0.1.0"},
+ {registered, []},
+ {mod, {tictactoe_app, []}},
+ {applications,
+ [kernel,
+ stdlib
+ ]},
+ {env,[]},
+ {modules, []},
+
+ {licenses, ["Apache-2.0"]},
+ {links, []}
+ ]}.
diff --git a/tictactoe-2/apps/tictactoe/src/tictactoe_app.erl b/tictactoe-2/apps/tictactoe/src/tictactoe_app.erl
new file mode 100644
index 0000000..8829237
--- /dev/null
+++ b/tictactoe-2/apps/tictactoe/src/tictactoe_app.erl
@@ -0,0 +1,18 @@
+%%%-------------------------------------------------------------------
+%% @doc tictactoe public API
+%% @end
+%%%-------------------------------------------------------------------
+
+-module(tictactoe_app).
+
+-behaviour(application).
+
+-export([start/2, stop/1]).
+
+start(_StartType, _StartArgs) ->
+ tictactoe_sup:start_link().
+
+stop(_State) ->
+ ok.
+
+%% internal functions
diff --git a/tictactoe-2/apps/tictactoe/src/tictactoe_sup.erl b/tictactoe-2/apps/tictactoe/src/tictactoe_sup.erl
new file mode 100644
index 0000000..c506caf
--- /dev/null
+++ b/tictactoe-2/apps/tictactoe/src/tictactoe_sup.erl
@@ -0,0 +1,35 @@
+%%%-------------------------------------------------------------------
+%% @doc tictactoe top level supervisor.
+%% @end
+%%%-------------------------------------------------------------------
+
+-module(tictactoe_sup).
+
+-behaviour(supervisor).
+
+-export([start_link/0]).
+
+-export([init/1]).
+
+-define(SERVER, ?MODULE).
+
+start_link() ->
+ supervisor:start_link({local, ?SERVER}, ?MODULE, []).
+
+%% sup_flags() = #{strategy => strategy(), % optional
+%% intensity => non_neg_integer(), % optional
+%% period => pos_integer()} % optional
+%% child_spec() = #{id => child_id(), % mandatory
+%% start => mfargs(), % mandatory
+%% restart => restart(), % optional
+%% shutdown => shutdown(), % optional
+%% type => worker(), % optional
+%% modules => modules()} % optional
+init([]) ->
+ SupFlags = #{strategy => one_for_all,
+ intensity => 0,
+ period => 1},
+ ChildSpecs = [],
+ {ok, {SupFlags, ChildSpecs}}.
+
+%% internal functions