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

📄 erlang.el

📁 OTP是开放电信平台的简称
💻 EL
📖 第 1 页 / 共 5 页
字号:
(defvar erlang-skel-import  '(& "%%-import(Module, [Function/Arity, ...])." n)  "*The skeleton of an `import' attribute.Please see the function `tempo-define-template'.")(defvar erlang-skel-compile nil  ;;  '(& "%%-compile(export_all)." n)  "*The skeleton of a `compile' attribute.Please see the function `tempo-define-template'.");; Comment templates.(defvar erlang-skel-date-function 'erlang-skel-dd-mmm-yyyy  "*Function which returns date string.Look in the module `time-stamp' for a battery of functions.")(defvar erlang-skel-copyright-comment '()  "*The template for a copyright line in the header, normally empty.This variable should be bound to a `tempo' template, for example:  '(& \"%%% Copyright (C) 2000, Yoyodyne, Inc.\" n)Please see the function `tempo-define-template'.")(defvar erlang-skel-created-comment  '(& "%%% Created : " (funcall erlang-skel-date-function) " by "      (user-full-name) " <" erlang-skel-mail-address ">" n)  "*The template for the \"Created:\" comment line.")(defvar erlang-skel-author-comment  '(& "%%% Author  : " (user-full-name) " <" erlang-skel-mail-address ">" n)  "*The template for creating the \"Author:\" line in the header.Please see the function `tempo-define-template'.")(defvar erlang-skel-file-comment  '(& "%%% File    : " (file-name-nondirectory buffer-file-name) n)"*The template for creating the \"Module:\" line in the header.Please see the function `tempo-define-template'.")(defvar erlang-skel-small-header  '(o (erlang-skel-include erlang-skel-module)      ;;                           erlang-skel-author)      n      (erlang-skel-include erlang-skel-compile			   ;;			   erlang-skel-export			   erlang-skel-vc))  "*The template of a small header without any comments.Please see the function `tempo-define-template'.")(defvar erlang-skel-normal-header  '(o (erlang-skel-include erlang-skel-copyright-comment			   erlang-skel-file-comment			   erlang-skel-author-comment)      "%%% Description : " p n      (erlang-skel-include erlang-skel-created-comment) n      (erlang-skel-include erlang-skel-small-header) n)  "*The template of a normal header.Please see the function `tempo-define-template'.")(defvar erlang-skel-large-header  '(o (erlang-skel-separator)      (erlang-skel-include erlang-skel-copyright-comment			   erlang-skel-file-comment			   erlang-skel-author-comment)      "%%% Description : " p n       "%%%" n      (erlang-skel-include erlang-skel-created-comment)      (erlang-skel-separator)       (erlang-skel-include erlang-skel-small-header) )  "*The template of a large header.Please see the function `tempo-define-template'.");; Server templates.(defvar erlang-skel-small-server  '((erlang-skel-include erlang-skel-large-header)    "-export([start/0,init/1])." n n n    "start() ->" n> "spawn(" (erlang-get-module-from-file-name)    ", init, [self()])." n n    "init(From) ->" n>    "loop(From)." n n    "loop(From) ->" n>    "receive" n>    p "_ ->" n>    "loop(From)" n>    "end."    )  "*Template of a small server.Please see the function `tempo-define-template'.");; Behaviour templates.(defvar erlang-skel-application  '((erlang-skel-include erlang-skel-large-header)    "-behaviour(application)." n n    "%% Application callbacks" n    "-export([start/2, stop/1])." n n    (erlang-skel-double-separator 2)    "%% Application callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: start(Type, StartArgs) -> {ok, Pid} |" n    "%%                                     {ok, Pid, State} |" n    "%%                                     {error, Reason}" n    "%% Description: This function is called whenever an application " n    "%% is started using application:start/1,2, and should start the processes" n    "%% of the application. If the application is structured according to the" n    "%% OTP design principles as a supervision tree, this means starting the" n    "%% top supervisor of the tree." n    (erlang-skel-separator 2)    "start(_Type, StartArgs) ->" n>    "case 'TopSupervisor':start_link(StartArgs) of" n>    "{ok, Pid} -> " n>    "{ok, Pid};" n>    "Error ->" n>    "Error" n>    "end." n    n    (erlang-skel-separator 2)    "%% Function: stop(State) -> void()" n    "%% Description: This function is called whenever an application" n    "%% has stopped. It is intended to be the opposite of Module:start/2 and" n    "%% should do any necessary cleaning up. The return value is ignored. "n    (erlang-skel-separator 2)    "stop(_State) ->" n>    "ok." n    n    (erlang-skel-double-separator 2)    "%% Internal functions" n    (erlang-skel-double-separator 2)    )  "*The template of an application behaviour.Please see the function `tempo-define-template'.")(defvar erlang-skel-supervisor  '((erlang-skel-include erlang-skel-large-header)    "-behaviour(supervisor)." n n    "%% API" n    "-export([start_link/0])." n n     "%% Supervisor callbacks" n    "-export([init/1])." n n    "-define(SERVER, ?MODULE)." n n        (erlang-skel-double-separator 2)    "%% API functions" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}" n    "%% Description: Starts the supervisor" n    (erlang-skel-separator 2)    "start_link() ->" n>    "supervisor:start_link({local, ?SERVER}, ?MODULE, [])." n     n    (erlang-skel-double-separator 2)    "%% Supervisor callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Func: init(Args) -> {ok,  {SupFlags,  [ChildSpec]}} |" n    "%%                     ignore                          |" n    "%%                     {error, Reason}" n    "%% Description: Whenever a supervisor is started using "n    "%% supervisor:start_link/[2,3], this function is called by the new process "n    "%% to find out about restart strategy, maximum restart frequency and child "n    "%% specifications." n    (erlang-skel-separator 2)    "init([]) ->" n>    "AChild = {'AName',{'AModule',start_link,[]}," n>    "permanent,2000,worker,['AModule']}," n>    "{ok,{{one_for_all,0,1}, [AChild]}}." n    n    (erlang-skel-double-separator 2)    "%% Internal functions" n    (erlang-skel-double-separator 2)    )  "*The template of an supervisor behaviour.Please see the function `tempo-define-template'.")(defvar erlang-skel-supervisor-bridge  '((erlang-skel-include erlang-skel-large-header)    "-behaviour(supervisor_bridge)." n n    "%% API" n    "-export([start_link/0])." n n    "%% supervisor_bridge callbacks" n    "-export([init/1, terminate/2])." n n        "-define(SERVER, ?MODULE)." 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: Starts the supervisor bridge" n    (erlang-skel-separator 2)     "start_link() ->" n>    "supervisor_bridge:start_link({local, ?SERVER}, ?MODULE, [])." n    n    (erlang-skel-double-separator 2)    "%% supervisor_bridge callbacks" n    (erlang-skel-double-separator 2)    (erlang-skel-separator 2)    "%% Funcion: init(Args) -> {ok,  Pid, State} |" n    "%%                        ignore            |" n    "%%                        {error, Reason}    " n    "%% Description:Creates a supervisor_bridge process, linked to the calling" n    "%% process, which calls Module:init/1 to start the subsystem. To ensure a" n    "%% synchronized start-up procedure, this function does not return until" n    "%% Module:init/1 has returned. "  n    (erlang-skel-separator 2)    "init([]) ->" n>    "case 'AModule':start_link() of" n>    "{ok, Pid} ->" n>    "{ok, Pid, #state{}};" n>    "Error ->" n>    "Error" n>    "end." n    n    (erlang-skel-separator 2)    "%% Func: terminate(Reason, State) -> void()" n    "%% Description:This function is called by the supervisor_bridge when it is"n    "%% about to terminate. It should be the opposite of Module:init/1 and stop"n    "%% the subsystem and do any necessary cleaning up.The return value is ignored."    (erlang-skel-separator 2)    "terminate(Reason, State) ->" n>    "'AModule':stop()," n>    "ok." n    n    (erlang-skel-double-separator 2)    "%% Internal functions" n    (erlang-skel-double-separator 2)    )  "*The template of an supervisor_bridge behaviour.Please see the function `tempo-define-template'.")(defvar erlang-skel-generic-server  '((erlang-skel-include erlang-skel-large-header)    "-behaviour(gen_server)." n n    "%% API" n    "-export([start_link/0])." n n        "%% gen_server callbacks" n    "-export([init/1, handle_call/3, handle_cast/2, "    "handle_info/2," n>    "terminate/2, code_change/3])." 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: Starts the server" n    (erlang-skel-separator 2)     "start_link() ->" n>    "gen_server:start_link({local, ?SERVER}, ?MODULE, [], [])." n    n    (erlang-skel-double-separator 2)    "%% gen_server callbacks" n    (erlang-skel-double-separator 2)    n    (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: "    "%% handle_call(Request, From, State) -> {reply, Reply, State} |" n    "%%                                      {reply, Reply, State, Timeout} |" n    "%%                                      {noreply, State} |" n    "%%                                      {noreply, State, Timeout} |" n    "%%                                      {stop, Reason, Reply, State} |" n     "%%                                      {stop, Reason, State}" n           "%% Description: Handling call messages" n    (erlang-skel-separator 2)    "handle_call(_Request, _From, State) ->" n>    "Reply = ok," n>    "{reply, Reply, State}." n    n    (erlang-skel-separator 2)    "%% Function: handle_cast(Msg, State) -> {noreply, State} |" n    "%%                                      {noreply, State, Timeout} |" n    "%%                                      {stop, Reason, State}" n    "%% Description: Handling cast messages" n    (erlang-skel-separator 2)    "handle_cast(_Msg, State) ->" n>    "{noreply, State}." n    n    (erlang-skel-separator 2)    "%% Function: handle_info(Info, State) -> {noreply, State} |" n    "%%                                       {noreply, State, Timeout} |" n    "%%                                       {stop, Reason, State}" n    "%% Description: Handling all non call/cast messages" n    (erlang-skel-separator 2)    "handle_info(_Info, State) ->" n>    "{noreply, State}." n    n    (erlang-skel-separator 2)    "%% Function: terminate(Reason, State) -> void()" n    "%% Description: This function is called by a gen_server when it is about to"n    "%% terminate. It should be the opposite of Module:init/1 and do any necessary"n    "%% cleaning up. When it returns, the gen_server terminates with Reason." n    "%% The return value is ignored." n         (erlang-skel-separator 2)    "terminate(_Reason, _State) ->" n>    "ok." n    n    (erlang-skel-separator 2)    "%% Func: 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 generic server.Please see the function `tempo-define-template'.")(defvar erlang-skel-gen-event  '((erlang-skel-include erlang-skel-large-header)    "-behaviour(gen_event)." n    "%% API" n    "-export([start_link/0, add_handler/0])." n n    "%% gen_event callbacks" n    "-export([init/1, handle_event/2, handle_call/2, " n>    "handle_info/2, terminate/2, code_change/3])." n n

⌨️ 快捷键说明

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