Source/NFX.Erlang/ErlInputStream.cs
/// <summary>
/// Read Erlang reference from the stream
/// </summary>
Read Erlang reference from the stream
Read Erlang reference from the stream
public ErlRef ReadRef()
      {
        var tag = readTag();
        switch (tag)
        {
          case ErlExternalTag.Ref:
            var node1       = ReadAtom();
            var id          = Read4BE() & 0x3ffff; 
            var creation1   = Read1() & 0x03; 
            return new ErlRef(node1, id, 0, 0, creation1);
          case ErlExternalTag.NewRef:
            var arity       = Read2BE();
            var node2       = ReadAtom();
            var creation2   = Read1() & 0x03; 
            var ids = new int[arity];
            for(int i=0; i < arity; i++)
                ids[i] = Read4BE();
            return new ErlRef(node2, ids, creation2);
          default:
            throw new ErlException(StringConsts.ERL_INVALID_TERM_TYPE_ERROR,
              "ref", tag.ToString());
        }
      }
public ErlRef ReadRef ( ) { var tag = readTag ( ) ; switch ( tag ) { case ErlExternalTag . Ref : var node1 = ReadAtom ( ) ; var id = Read4BE ( ) & 0x3ffff ; var creation1 = Read1 ( ) & 0x03 ; return new ErlRef ( node1 , id , 0 , 0 , creation1 ) ; case ErlExternalTag . NewRef : var arity = Read2BE ( ) ; var node2 = ReadAtom ( ) ; var creation2 = Read1 ( ) & 0x03 ; var ids = new int [ arity ] ; for ( int i = 0 ; i < arity ; i ++ ) ids [ i ] = Read4BE ( ) ; return new ErlRef ( node2 , ids , creation2 ) ; default : throw new ErlException ( StringConsts . ERL_INVALID_TERM_TYPE_ERROR , " " , tag . ToString ( ) ) ; } }
Read Erlang reference from the stream
Read Erlang reference from the stream
// 18 bits // 2 bits // 2 bits