当前位置: 首页>>代码示例>>C#>>正文


C# Erlang类代码示例

本文整理汇总了C#中Erlang的典型用法代码示例。如果您正苦于以下问题:C# Erlang类的具体用法?C# Erlang怎么用?C# Erlang使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Erlang类属于命名空间,在下文中一共展示了Erlang类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OtpMbox

		// package constructor: called by OtpNode:createMbox(name)
		// to create a named mbox
		internal OtpMbox(OtpNode home, Erlang.Pid self, System.String name)
		{
			this._self = self;
			this.home = home;
			this.name = name;
			this.queue = new GenericQueue();
			this.links = new Links(10);
            this.monitors = new System.Collections.Hashtable(49, (float)0.95);
		}
开发者ID:saneman1,项目名称:otp.net,代码行数:11,代码来源:OtpMbox.cs

示例2: OtpMsg

 // send has receiver pid but no sender information
 internal OtpMsg(Erlang.Pid to, OtpInputStream paybuf)
 {
     this.tag = sendTag;
     this.from = null;
     this.to = to;
     this.toName = null;
     this.paybuf = paybuf;
     this.payload = null;
 }
开发者ID:bmizerany,项目名称:jungerl,代码行数:10,代码来源:OtpMsg.cs

示例3: subst

 public override bool subst(ref Erlang.Object obj, Erlang.VarBind binding)
 {
     if (isAny() || binding == null || binding.Empty)
         throw new UnboundVarException();
     Erlang.Object term = binding[m_var];
     if (term == null)
         throw new UnboundVarException("Variable " + m_var + " not bound!");
     obj = term;
     return true;
 }
开发者ID:saneman1,项目名称:otp.net,代码行数:10,代码来源:Var.cs

示例4: OtpOutputStream

        /*
        * Create a stream containing the serialized Erlang term.
        * Optionally include in the beginning Erlang protocol version byte.
        **/
        public OtpOutputStream(Erlang.Object o, bool writeVersion, bool writePktSize)
            : this()
        {
            if (!writePktSize)
            {
                encodeObject(o, writeVersion);
                return;
            }

            write4BE(0); // make space for length data,
                         // but final value is not yet known
            encodeObject(o, writeVersion);
            poke4BE(0, this._count - 4);
        }
开发者ID:saleyn,项目名称:otp.net,代码行数:18,代码来源:OtpOutputStream.cs

示例5: addLink

        internal virtual void addLink(Erlang.Pid local, Erlang.Pid remote)
        {
            lock(this)
            {
                int i;

                if ((i = find(local, remote)) == - 1)
                {
                    if (_count >= _links.Length)
                    {
                        Link[] tmp = new Link[_count * 2];
                        Array.Copy(_links, 0, tmp, 0, _count);
                        _links = tmp;
                    }
                    _links[_count++] = new Link(local, remote);
                }
            }
        }
开发者ID:e42s,项目名称:jungerl,代码行数:18,代码来源:Links.cs

示例6: OtpMsg

 // exit (etc) has from, to, reason
 internal OtpMsg(Tag tag, Erlang.Pid from, Erlang.Pid to, Erlang.Object reason)
     : this(tag, from, to, null, reason, null)
 {
 }
开发者ID:e42s,项目名称:jungerl,代码行数:5,代码来源:OtpMsg.cs

示例7: OtpOutputStream

 /*
 * Create a stream containing the encoded version of the given
 * Erlang term.
 **/
 public OtpOutputStream(Erlang.Object o)
     : this()
 {
     this.write_any(o);
 }
开发者ID:bmizerany,项目名称:jungerl,代码行数:9,代码来源:OtpOutputStream.cs

示例8: match

 public override bool match(Erlang.Object pattern, VarBind binding)
 {
     if (pattern is Erlang.Var)
         pattern.match(this, binding);
     else if (!(pattern is Erlang.List))
         return false;
     Erlang.List tup = pattern as Erlang.List;
     if (arity() != tup.arity())
         return false;
     for (int i = 0; i < arity(); ++i)
         if (!elems[i].match(tup[i], binding))
             return false;
     return true;
 }
开发者ID:saneman1,项目名称:otp.net,代码行数:14,代码来源:List.cs

示例9: exit

 /*
 * <p> Send an exit signal to a remote {@link Pid pid}.
 * This method does not cause any links to be broken, except
 * indirectly if the remote {@link Pid pid} exits as a
 * result of this exit signal. </p>
 *
 * @param to the {@link Pid pid} to which the exit signal
 * should be sent.
 *
 * @param reason a string indicating the reason for the exit.
 **/
 // it's called exit, but it sends exit2
 public virtual void exit(Erlang.Pid to, System.String reason)
 {
     exit(2, to, reason);
 }
开发者ID:bmizerany,项目名称:jungerl,代码行数:16,代码来源:OtpMbox.cs

示例10: equals

 public virtual bool equals(Erlang.Pid local, Erlang.Pid remote)
 {
     return ((this._local.Equals(local) && this._remote.Equals(remote)) ||
             (this._local.Equals(remote) && this._remote.Equals(local)));
 }
开发者ID:e42s,项目名称:jungerl,代码行数:5,代码来源:Link.cs

示例11: contains

 public virtual bool contains(Erlang.Pid pid)
 {
     return (this._local.Equals(pid) || this._remote.Equals(pid));
 }
开发者ID:e42s,项目名称:jungerl,代码行数:4,代码来源:Link.cs

示例12: Link

 public Link(Erlang.Pid local, Erlang.Pid remote)
 {
     this._local = local;
     this._remote = remote;
 }
开发者ID:e42s,项目名称:jungerl,代码行数:5,代码来源:Link.cs

示例13: OtpMbox

 // package constructor: called by OtpNode:createMbox()
 // to create an anonymous
 internal OtpMbox(OtpNode home, Erlang.Pid self)
     : this(home, self, null)
 {
 }
开发者ID:bmizerany,项目名称:jungerl,代码行数:6,代码来源:OtpMbox.cs

示例14: subst

        public override bool subst(ref Erlang.Object a_term, VarBind binding)
        {
            System.Collections.Generic.List<Erlang.Object> result =
                new System.Collections.Generic.List<Erlang.Object>();
            bool changed = false;

            foreach (Erlang.Object term in this.elems)
            {
                Erlang.Object obj = null;
                if (term.subst(ref obj, binding))
                    result.Add(obj);
                else
                {
                    changed = true;
                    result.Add(term);
                }
            }

            if (!changed)
                return false;

            a_term = new Erlang.List(result.ToArray());
            return true;
        }
开发者ID:saneman1,项目名称:otp.net,代码行数:24,代码来源:List.cs

示例15: link

        /*
        * <p> Link to a remote mailbox or Erlang process. Links are
        * idempotent, calling this method multiple times will not result in
        * more than one link being created. </p>
        *
        * <p> If the remote process subsequently exits or the mailbox is
        * closed, a subsequent attempt to retrieve a message through this
        * mailbox will cause an {@link Exit Exit}
        * exception to be raised. Similarly, if the sending mailbox is
        * closed, the linked mailbox or process will receive an exit
        * signal. </p>
        *
        * <p> If the remote process cannot be reached in order to set the
        * link, the exception is raised immediately. </p>
        *
        * @param to the {@link Pid pid} representing the object to
        * link to.
        *
        * @exception Exit if the {@link Pid pid} referred
        * to does not exist or could not be reached.
        *
        **/
        public virtual void link(Erlang.Pid to)
        {
            try
            {
                System.String node = to.node();
                if (node.Equals(home.node()))
                {
                    if (!home.deliver(new OtpMsg(OtpMsg.linkTag, _self, to)))
                    {
                        throw new Erlang.Exit("noproc", to);
                    }
                }
                else
                {
                    OtpCookedConnection conn = home.getConnection(node);
                    if (conn != null)
                        conn.link(_self, to);
                    else
                        throw new Erlang.Exit("noproc", to);
                }
            }
            catch (Erlang.Exit e)
            {
                throw e;
            }
            catch (System.Exception)
            {
            }

            links.addLink(_self, to);
        }
开发者ID:bmizerany,项目名称:jungerl,代码行数:53,代码来源:OtpMbox.cs


注:本文中的Erlang类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。