Package erjang

Examples of erjang.ESmall


  public ExtFun asExtFun() {
    return new ExtFun(mod, fun, arity);
  }

  public ETuple toSymbolic() {
    return ETuple.make(mod, fun, new ESmall(arity));
  }
View Full Code Here


  static EObject labelToSymbolic_nf(Label label) {
    return label==null? NOFAIL_ATOM : label.toSymbolic();
  }

  static EObject bsFieldFlagsToSymbolic(int flags) {
    return ETuple.make(FIELD_FLAGS_ATOM, new ESmall(flags));
  }
View Full Code Here

  public static EObject setnode(EObject arg_node, EObject arg_creation)
    throws Pausable
  {

    int creation;
    ESmall cr = arg_creation.testSmall();
    EAtom node = arg_node.testAtom();
   
    if (cr == null || node == null || cr.value > 3 || !is_node_name_atom(node)) {
      if (log.isLoggable(Level.FINE)) log.fine("cr="+cr+"; node="+node+"; is_name="+is_node_name_atom(node));
      throw ERT.badarg(arg_node, arg_creation);
View Full Code Here

    int creation = 0;
   
    ETuple2 tup;
    if ((tup=ETuple2.cast(node_arg)) != null) {
      node = tup.elem1.testAtom();
      ESmall sm = tup.elem2.testSmall();
     
      if (node == null || sm==null || !is_node_name_atom(node))
        throw ERT.badarg(node_arg, cid_arg, type_arg);
     
      creation = sm.value;
    } else if ((node=node_arg.testAtom()) != null && is_node_name_atom(node)) {
      // ok
    } else {
      throw ERT.badarg(node_arg, cid_arg, type_arg);
    }
   
    /** first arg is ok */
   
    EInternalPort port = cid_arg.testInternalPort();
    if (port == null) {
      throw ERT.badarg(node_arg, cid_arg, type_arg);
    }

    ETuple t = type_arg.testTuple();
    if (t.arity() != 4) {
      throw ERT.badarg(node_arg, cid_arg, type_arg);
    }
   
    ESmall flags = t.elm(1).testSmall();
    ESmall version = t.elm(2).testSmall();
    if (flags == null || version == null) {
      throw ERT.badarg(node_arg, cid_arg, type_arg);
    }

    EPeer n = EPeer.get_or_create(node, creation, port, flags.value, version.value);
View Full Code Here

public class ErlHash {

  @BIF
  static public ESmall hash(EObject a1, EObject a2)
  {
    ESmall range;
    if ((range=a2.testSmall()) == null || range.value <= 0) throw ERT.badarg(a1,a2);
   
    int hash = make_broken_hash(a1);
   
    return ERT.box(1 + (hash % range.value));
View Full Code Here

        } else if (atom == am_named_table) {
          is_named = true;
          continue;
        }
      } else if ((t2 = ETuple2.cast(option)) != null) {
        ESmall pos;
        if (t2.elem1 == am_heir && t2.elem2 == am_none) {
          heir_data = null;
          heir_pid = null;
          continue;
        } else if (t2.elem1 == am_keypos
View Full Code Here

  }

  @BIF
  public static EObject lookup_element(EProc proc, EObject tab, EObject key, EObject pos) {
   
    ESmall p = pos.testSmall();
   
    // test arguments
    ETable table = resolve(proc, tab, false);
    if (table == null || p == null) {
      throw ERT.badarg(tab, key, pos);
View Full Code Here

    return ERT.box(bin.byteSize());
  }

  @BIF static ETuple2 split_binary(EObject bin, EObject idx) {
    EBitString b;
    ESmall i;
    if ((b=bin.testBitString()) == null
      || ((i=idx.testSmall()) == null)
      || i.value < 0
      || i.value > b.byteSize()) {
      throw ERT.badarg(bin, idx);
View Full Code Here

      ETuple2 tup;
      if (val == am_compressed) {
        compression = 6;
      } else if ((tup=ETuple2.cast(val)) != null) {
        if (tup.elem1 == am_compressed) {
          ESmall sm;
          if ((sm=tup.elem2.testSmall()) != null) {
            compression = sm.value;
          } else {
            throw ERT.badarg(obj, spec);
          }
        } else if (tup.elem1 == am_minor_version) {
          ESmall sm;
          if ((sm=tup.elem2.testSmall()) != null) {
            minor = sm.value;
          } else {
            throw ERT.badarg(obj, spec);
          }
View Full Code Here

  }

  @BIF
  public static EBinary integer_to_binary(EObject arg, EObject radix) {
    EInteger i = arg.testInteger();
    ESmall r = radix.testSmall();
    if (i == null || r == null || r.value < 2 || r.value > 36)
      throw ERT.badarg(arg, radix);

    String out;
    EBig big;
    ESmall small;
    if ((small=i.testSmall()) != null) {
      out = Integer.toString(small.value, r.value);
    } else if ((big=i.testBig()) != null) {
      out = big.value.toString(r.value);
    } else {
View Full Code Here

TOP

Related Classes of erjang.ESmall

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.