diff options
author | Graham Hay <[email protected]> | 2014-12-20 16:26:42 +0000 |
---|---|---|
committer | Graham Hay <[email protected]> | 2014-12-20 17:22:46 +0000 |
commit | 1c8432ef144b238b8dfef21cbf0e48dae92cc298 (patch) | |
tree | 47e2e58db74243bc21c9ae1a9a517008afd83f76 /plugins/bootstrap.mk | |
parent | 1cea2ce79b5ec9b671d24f0628fa2b78a95b772c (diff) | |
download | erlang.mk-1c8432ef144b238b8dfef21cbf0e48dae92cc298.tar.gz erlang.mk-1c8432ef144b238b8dfef21cbf0e48dae92cc298.tar.bz2 erlang.mk-1c8432ef144b238b8dfef21cbf0e48dae92cc298.zip |
Added a gen_fsm template
Diffstat (limited to 'plugins/bootstrap.mk')
-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)." \ "" \ |