diff options
author | Loïc Hoguin <[email protected]> | 2014-12-22 16:14:23 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-12-22 16:14:23 +0200 |
commit | 708812c67f4625d7f91c7ccd9388ecab61a8359d (patch) | |
tree | 41359a3d605eb880c4f86ddd605908c0cb4c1fff /plugins | |
parent | 0f4fbea3715d07ab6e88e1718c997ce5befea538 (diff) | |
parent | 1c8432ef144b238b8dfef21cbf0e48dae92cc298 (diff) | |
download | erlang.mk-708812c67f4625d7f91c7ccd9388ecab61a8359d.tar.gz erlang.mk-708812c67f4625d7f91c7ccd9388ecab61a8359d.tar.bz2 erlang.mk-708812c67f4625d7f91c7ccd9388ecab61a8359d.zip |
Merge branch 'gen_fsm-template' of https://github.com/grahamrhay/erlang.mk
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/bootstrap.mk | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk index 9397253..6fba54c 100644 --- a/plugins/bootstrap.mk +++ b/plugins/bootstrap.mk @@ -117,6 +117,48 @@ tpl_gen_server = "-module($(n))." \ "" \ "code_change(_OldVsn, State, _Extra) ->" \ " {ok, State}." +tpl_gen_fsm = "-module($(n))." \ + "-behaviour(gen_fsm)." \ + "" \ + "%% API." \ + "-export([start_link/0])." \ + "" \ + "%% gen_fsm." \ + "-export([init/1])." \ + "-export([handle_event/3])." \ + "-export([handle_sync_event/4])." \ + "-export([handle_info/3])." \ + "-export([terminate/3])." \ + "-export([code_change/4])." \ + "" \ + "-record(state, {" \ + "})." \ + "" \ + "%% API." \ + "" \ + "-spec start_link() -> {ok, pid()}." \ + "start_link() ->" \ + " gen_fsm:start_link(?MODULE, [], [])." \ + "" \ + "%% gen_fsm." \ + "" \ + "init([]) ->" \ + " {ok, initial_state, \#state{}}." \ + "" \ + "handle_event(_Event, StateName, State) ->" \ + " {next_state, StateName, State}." \ + "" \ + "handle_sync_event(_Event, _From, StateName, State) ->" \ + " {reply, ignored, StateName, State}." \ + "" \ + "handle_info(_Info, StateName, State) ->" \ + " {next_state, StateName, State}." \ + "" \ + "terminate(_Reason, _StateName, _State) ->" \ + " ok." \ + "" \ + "code_change(_OldVsn, StateName, State, _Extra) ->" \ + " {ok, StateName, State}." tpl_cowboy_http = "-module($(n))." \ "-behaviour(cowboy_http_handler)." \ "" \ |