Package erjang

Examples of erjang.EObject


   
    return barr.asBinary();
  }

  private static void collectList(EObject list, ECons iol, OutputStream barr) throws IOException {
    EObject tail;
    ECons cons;
    for (tail=iol; (cons = tail.testNonEmptyList()) != null; tail = cons.tail()) {
      EObject hd = cons.head();

      ESmall sm;
      EBinary bi;
      ECons co;
      if ((sm = hd.testSmall()) != null) {
        if (sm.value < 0 || sm.value > 255)
          throw ERT.badarg(list);
        barr.write(sm.value);
      } else if ((bi = hd.testBinary()) != null) {
        bi.writeTo(barr);
      } else if ((co = hd.testNonEmptyList()) != null) {
        collectList(list, co, barr);
      } else if (hd.isNil()) {
      } else {
        throw ERT.badarg(list);
      }
    }
View Full Code Here


    ETuple t;
    if ((t=tup.testTuple()) == null) { throw ERT.badarg(tup); }

    ESeq res = ERT.NIL;
    for (int i = t.arity(); i > 0; i--) {
      EObject e = t.elm(i);
      res = res.cons(e==null?ERT.NIL:e);
    }
   
    return res;
  }
View Full Code Here

    final EObject[] tmp = l1.toArray();

    // Step 2: Delete elements occurring l2 (but only once)
    int tmp_start = 0;
    for (ESeq cur = l2; !cur.isNil(); cur=cur.tail()) {
      EObject elm = cur.head();
      for (int i=tmp_start; i<tmp.length; i++) {
        if (tmp[i] != null && tmp[i].equalsExactly(elm)) {
          // Delete element
          tmp[i] = null;
View Full Code Here

       
        IMapEntry mape = (IMapEntry) map_seq.first();
        map_seq = map_seq.next();
       
        ETuple candidate = (ETuple) mape.getValue();
        EObject res;
        if ((res = matcher.match(candidate)) != null) {
          count += 1;
          vals = vals.cons(res);
        }
      }
View Full Code Here

  @BIF
  static EObject apply(EProc proc, EObject fun, EObject args) throws Pausable {
    ESeq a = args.testSeq();
    if (a==null) throw ERT.badarg(fun,args);
   
    EObject res;
    EFun f = fun.testFunction();
    if (f != null) {
      res = apply_last(proc, f, a);
    } else {
View Full Code Here

   
    if ((mod==null && t == null && jo == null)||fun==null||args==null) throw ERT.badarg(one, two, three);
   
    EFun f = ERT.resolve_fun(one, fun, args.length());
   
    EObject res = apply_last(proc, f, args);
   
    while (res == EProc.TAIL_MARKER) {
      res = proc.tail.go(proc);
    }
View Full Code Here

        throw exit;
    }
   
    @BIF
    public static EObject binary_part(EObject bin, EObject start, EObject length) {
      EObject result = binary_part_guard(bin, start, length);
      if (result == null) {
        throw ERT.badarg(bin, start, length);       
      }
      return result;
    }
View Full Code Here

      }
    } else {
      throw ERT.badarg(term, matchSpec, how);
    }
   
    EObject res = spec.match(term);
    if (res == null) {
      return ETuple.make(ERT.am_ok, ERT.FALSE, ERT.NIL, ERT.NIL);
    } else {
      return ETuple.make(ERT.am_ok, ERT.TRUE, ERT.NIL, ERT.NIL);
    }
View Full Code Here

    ERT.run_async(job, task);
  }

  protected void driver_outputv(ByteBuffer hdr, ByteBuffer[] ev) throws Pausable {
   
    EObject resp = ERT.NIL;
   
    if (task.send_binary_data) {
   
    if (ev.length > 0) {
      ev[ev.length-1].flip();
      resp = EBinary.make(ev[ev.length-1]);
   
      for (int i = ev.length-2; i >= 0; i--) {
        ev[i].flip();
        resp = resp.cons( EBinary.make(ev[i]) );
      }
    }
   
    } else {
      throw new NotImplemented();
View Full Code Here

   
    if ((status & EDriverTask.ERTS_PORT_SFLG_LINEBUF_IO) != 0) {
      throw new NotImplemented();
    }
   
    EObject tail = null;
    if (buf == null || !buf.hasRemaining()) {
      tail = ERT.NIL;
    } else if (task.send_binary_data) {
      tail = EBinary.make(buf);
    } else {
View Full Code Here

TOP

Related Classes of erjang.EObject

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.