⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erlang.el

📁 OTP是开放电信平台的简称
💻 EL
📖 第 1 页 / 共 5 页
字号:
    "-record(state, {})." n n    (erlang-skel-double-separator 2)    "%% gen_event callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: start_link() -> {ok,Pid} | {error,Error} " n    "%% Description: Creates an event manager." n    (erlang-skel-separator 2)     "start_link() ->" n>    "gen_event:start_link({local, ?SERVER}). " n    n    (erlang-skel-separator 2)    "%% Function: add_handler() -> ok | {'EXIT',Reason} | term()" n    "%% Description: Adds an event handler" n    (erlang-skel-separator 2)     "add_handler() ->" n>    "gen_event:add_handler(?SERVER, ?MODULE, [])." n     n    (erlang-skel-double-separator 2)    "%% gen_event callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: init(Args) -> {ok, State}" n    "%% Description: Whenever a new event handler is added to an event manager,"n    "%% this function is called to initialize the event handler." n    (erlang-skel-separator 2)    "init([]) ->" n>    "{ok, #state{}}." n    n    (erlang-skel-separator 2)    "%% Function:  "n    "%% handle_event(Event, State) -> {ok, State} |" n    "%%                               {swap_handler, Args1, State1, Mod2, Args2} |"n    "%%                               remove_handler" n    "%% Description:Whenever an event manager receives an event sent using"n    "%% gen_event:notify/2 or gen_event:sync_notify/2, this function is called for"n    "%% each installed event handler to handle the event. "n    (erlang-skel-separator 2)    "handle_event(_Event, State) ->" n>    "{ok, State}." n    n    (erlang-skel-separator 2)    "%% Function: " n    "%% handle_call(Request, State) -> {ok, Reply, State} |" n    "%%                                {swap_handler, Reply, Args1, State1, "n    "%%                                  Mod2, Args2} |" n    "%%                                {remove_handler, Reply}" n    "%% Description: Whenever an event manager receives a request sent using"n    "%% gen_event:call/3,4, this function is called for the specified event "n    "%% handler to handle the request."n    (erlang-skel-separator 2)    "handle_call(_Request, State) ->" n>    "Reply = ok," n>    "{ok, Reply, State}." n    n    (erlang-skel-separator 2)    "%% Function: " n    "%% handle_info(Info, State) -> {ok, State} |" n    "%%                             {swap_handler, Args1, State1, Mod2, Args2} |" n    "%%                              remove_handler" n    "%% Description: This function is called for each installed event handler when"n    "%% an event manager receives any other message than an event or a synchronous"n    "%% request (or a system message)."n    (erlang-skel-separator 2)    "handle_info(_Info, State) ->" n>    "{ok, State}." n    n    (erlang-skel-separator 2)    "%% Function: terminate(Reason, State) -> void()" n    "%% Description:Whenever an event handler is deleted from an event manager,"n    "%% this function is called. It should be the opposite of Module:init/1 and "n    "%% do any necessary cleaning up. " n    (erlang-skel-separator 2)    "terminate(_Reason, _State) ->" n>    "ok." n    n    (erlang-skel-separator 2)    "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n    "%% Description: Convert process state when code is changed" n    (erlang-skel-separator 2)    "code_change(_OldVsn, State, _Extra) ->" n>    "{ok, State}." n    n    (erlang-skel-separator 2)    "%%% Internal functions" n    (erlang-skel-separator 2)    )  "*The template of a gen_event.Please see the function `tempo-define-template'.")(defvar erlang-skel-gen-fsm  '((erlang-skel-include erlang-skel-large-header)    "-behaviour(gen_fsm)." n n    "%% API" n    "-export([start_link/0])." n n        "%% gen_fsm callbacks" n    "-export([init/1, state_name/2, state_name/3, handle_event/3," n>    "handle_sync_event/4, handle_info/3, terminate/3, code_change/4])." n n    "-record(state, {})." n n    (erlang-skel-double-separator 2)    "%% API" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: start_link() -> ok,Pid} | ignore | {error,Error}" n    "%% Description:Creates a gen_fsm process which calls Module:init/1 to"n    "%% initialize. To ensure a synchronized start-up procedure, this function" n    "%% does not return until Module:init/1 has returned.  " n    (erlang-skel-separator 2)     "start_link() ->" n>    "gen_fsm:start_link({local, ?SERVER}, ?MODULE, [], [])." n     n    (erlang-skel-double-separator 2)    "%% gen_fsm callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: init(Args) -> {ok, StateName, State} |" n    "%%                         {ok, StateName, State, Timeout} |" n    "%%                         ignore                              |" n    "%%                         {stop, StopReason}                   " n    "%% Description:Whenever a gen_fsm is started using gen_fsm:start/[3,4] or"n    "%% gen_fsm:start_link/3,4, this function is called by the new process to "n    "%% initialize. " n    (erlang-skel-separator 2)    "init([]) ->" n>    "{ok, state_name, #state{}}." n    n    (erlang-skel-separator 2)    "%% Function: "n    "%% state_name(Event, State) -> {next_state, NextStateName, NextState}|" n    "%%                             {next_state, NextStateName, " n    "%%                                NextState, Timeout} |" n    "%%                             {stop, Reason, NewState}" n    "%% Description:There should be one instance of this function for each possible"n    "%% state name. Whenever a gen_fsm receives an event sent using" n    "%% gen_fsm:send_event/2, the instance of this function with the same name as"n    "%% the current state name StateName is called to handle the event. It is also "n    "%% called if a timeout occurs. " n    (erlang-skel-separator 2)    "state_name(_Event, State) ->" n>    "{next_state, state_name, State}." n    n    (erlang-skel-separator 2)    "%% Function:" n    "%% state_name(Event, From, State) -> {next_state, NextStateName, NextState} |"n    "%%                                   {next_state, NextStateName, " n    "%%                                     NextState, Timeout} |" n    "%%                                   {reply, Reply, NextStateName, NextState}|"n    "%%                                   {reply, Reply, NextStateName, " n    "%%                                    NextState, Timeout} |" n    "%%                                   {stop, Reason, NewState}|" n    "%%                                   {stop, Reason, Reply, NewState}" n    "%% Description: There should be one instance of this function for each" n    "%% possible state name. Whenever a gen_fsm receives an event sent using" n    "%% gen_fsm:sync_send_event/2,3, the instance of this function with the same"n    "%% name as the current state name StateName is called to handle the event." n    (erlang-skel-separator 2)    "state_name(_Event, _From, State) ->" n>    "Reply = ok," n>    "{reply, Reply, state_name, State}." n    n    (erlang-skel-separator 2)    "%% Function: " n    "%% handle_event(Event, StateName, State) -> {next_state, NextStateName, "n    "%%						  NextState} |" n    "%%                                          {next_state, NextStateName, "n    "%%					          NextState, Timeout} |" n    "%%                                          {stop, Reason, NewState}" n    "%% Description: Whenever a gen_fsm receives an event sent using"n    "%% gen_fsm:send_all_state_event/2, this function is called to handle"n    "%% the event." n    (erlang-skel-separator 2)    "handle_event(_Event, StateName, State) ->" n>    "{next_state, StateName, State}." n    n    (erlang-skel-separator 2)    "%% Function: " n    "%% handle_sync_event(Event, From, StateName, "n    "%%                   State) -> {next_state, NextStateName, NextState} |" n    "%%                             {next_state, NextStateName, NextState, " n    "%%                              Timeout} |" n    "%%                             {reply, Reply, NextStateName, NextState}|" n    "%%                             {reply, Reply, NextStateName, NextState, " n    "%%                              Timeout} |" n    "%%                             {stop, Reason, NewState} |" n    "%%                             {stop, Reason, Reply, NewState}" n    "%% Description: Whenever a gen_fsm receives an event sent using"n    "%% gen_fsm:sync_send_all_state_event/2,3, this function is called to handle"n    "%% the event."n    (erlang-skel-separator 2)    "handle_sync_event(Event, From, StateName, State) ->" n>    "Reply = ok," n>    "{reply, Reply, StateName, State}." n    n    (erlang-skel-separator 2)    "%% Function: " n    "%% handle_info(Info,StateName,State)-> {next_state, NextStateName, NextState}|" n    "%%                                     {next_state, NextStateName, NextState, "n    "%%                                       Timeout} |" n    "%%                                     {stop, Reason, NewState}" n    "%% Description: This function is called by a gen_fsm when it receives any"n    "%% other message than a synchronous or asynchronous event"n    "%% (or a system message)." n    (erlang-skel-separator 2)    "handle_info(_Info, StateName, State) ->" n>    "{next_state, StateName, State}." n    n    (erlang-skel-separator 2)    "%% Function: terminate(Reason, StateName, State) -> void()" n    "%% Description:This function is called by a gen_fsm when it is about"n    "%% to terminate. It should be the opposite of Module:init/1 and do any"n    "%% necessary cleaning up. When it returns, the gen_fsm terminates with"n    "%% Reason. The return value is ignored." n    (erlang-skel-separator 2)    "terminate(_Reason, _StateName, _State) ->" n>    "ok." n    n    (erlang-skel-separator 2)    "%% Function:" n    "%% code_change(OldVsn, StateName, State, Extra) -> {ok, StateName, NewState}" n    "%% Description: Convert process state when code is changed" n    (erlang-skel-separator 2)    "code_change(_OldVsn, StateName, State, _Extra) ->" n>    "{ok, StateName, State}." n    n    (erlang-skel-separator 2)    "%%% Internal functions" n    (erlang-skel-separator 2)    )  "*The template of a gen_fsm.Please see the function `tempo-define-template'.")(defvar erlang-skel-lib  '((erlang-skel-include erlang-skel-large-header)    "%% API" n    "-export([])." n n        (erlang-skel-double-separator 2)    "%% API" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: " n    "%% Description:" n    (erlang-skel-separator 2)     n    (erlang-skel-double-separator 2)    "%% Internal functions" n    (erlang-skel-double-separator 2)    )  "*The template of a library module.Please see the function `tempo-define-template'.")(defvar erlang-skel-corba-callback  '((erlang-skel-include erlang-skel-large-header)    "%% Include files" n n    "%% API" n    "-export([])." n n    "%% Corba callbacks" n    "-export([init/1, terminate/2, code_change/3])." n n    "-record(state, {})." n n        (erlang-skel-double-separator 2)    "%% Corba callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: init(Args) -> {ok, State} |" n    "%%                         {ok, State, Timeout} |" n    "%%                         ignore               |" n    "%%                         {stop, Reason}" n    "%% Description: Initiates the server" n    (erlang-skel-separator 2)    "init([]) ->" n>    "{ok, #state{}}." n    n    (erlang-skel-separator 2)    "%% Function: terminate(Reason, State) -> void()" n    "%% Description: Shutdown the server" n    (erlang-skel-separator 2)    "terminate(_Reason, _State) ->" n>    "ok." n    n    (erlang-skel-separator 2)    "%% Function: code_change(OldVsn, State, Extra) -> {ok, NewState} " n    "%% Description: Convert process state when code is changed" n    (erlang-skel-separator 2)    "code_change(_OldVsn, State, _Extra) ->" n>    "{ok, State}." n    n    (erlang-skel-double-separator 2)    "%% Internal functions" n    (erlang-skel-double-separator 2)    )  "*The template of a library module.Please see the function `tempo-define-template'.")(defvar erlang-skel-ts-test-suite '((erlang-skel-include erlang-skel-large-header)   "%% Note: This directive should only be used in test suites." n    "-compile(export_all)." n n    "-include(\"test_server.hrl\")." n n        "%% Test server callback functions" n    (erlang-skel-separator 2)    "%% Function: init_per_suite(Config) -> Config" n    "%% Config - [tuple()]" n    "%%   A list of key/value pairs, holding the test case configuration." n    "%% Description: Initialization before the whole suite" n    "%%" n    "%% Note: This function is free to add any key/value pairs to the Config" n    "%% variable, but should NOT alter/remove any existing entries." n    (erlang-skel-separator 2)     "init_per_suite(Config) ->" n >    "Config." n n    (erlang-skel-separator 2)    "%% Function: end_per_suite(Config) -> _" n    "%% Config - [tuple()]" n    "%%   A list of key/value pairs, holding the test case configuration." n    "%% Description: Cleanup after the whole suite" n    (erlang-skel-separator 2)    "end_per_suite(_Config) ->" n >    "ok." n n    (erlang-skel-separator 2)    "%% Function: init_per_testcase(TestCase, Config) -> Config" n    "%% Case - atom()" n    "%%   Name of the test case that is about to be run." n    "%% Config - [tuple()]" n    "%%   A list of key/value pairs, holding the test case configuration." n    "%%" n    "%% Description: Initialization before each test case" n    "%%" n    "%% Note: This function is free to add any key/value pairs to the Config" n    "%% variable, but should NOT alter/remove any existing entries." n    "%% Description: Initialization before each test case" n    (erlang-skel-separator 2)    "init_per_testcase(_TestCase, Config) ->" n >    "Config." n n    (erlang-skel-separator 2)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -