Examples of ETuple


Examples of erjang.ETuple

          : name.atom;
   
    EObject value = load_string(desc, valBuf, valPtr, valLen);
         
         
    ETuple req = ETuple.make(am_http_header, bit, nam, ERT.am_undefined, value);

    return send_http(desc, req);
  }
View Full Code Here

Examples of erjang.ETuple

    EObject meth =
        (method == null)
        ? load_string(desc, data, meth_ptr, meth_len)
        : method.atom;
   
    ETuple version = new ETuple2(ERT.box(major), ERT.box(minor));
    ETuple req = ETuple.make(am_http_request, meth, load_uri(desc, uri), version);
   
    return send_http(desc, req);

  }
View Full Code Here

Examples of erjang.ETuple

      if (op == null) {
        return -1;
      }
     
      ETuple2 ok = new ETuple2(ERT.am_ok, req);
      ETuple msg = ETuple.make(am_inet_async, desc.port(), ERT.box(op.id), ok);
     
      desc.driver_send_term(op.caller, msg);

    } else {
          /* {http, S, {http_request,Meth,Uri,Version}}} */
     
      ETuple http = ETuple.make(am_http, desc.port(), req);
     
      desc.driver_output_term(http);

    }
   
View Full Code Here

Examples of erjang.ETuple

    collectList(list, iol, out);
  }

  @BIF
  public static EObject tuple_to_list(EObject tup) {
    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

Examples of erjang.ETuple

      ETuple2 t2;
      EPortControl ctrl;
      ETuple3 t3;
      ETuple4 t4;
      ETuple tup;
      if ((t2 = ETuple2.cast(msg)) != null) {

        EObject sender = t2.elem1;

        ETuple2 cmd;
        if ((cmd = ETuple2.cast(t2.elem2)) != null) {
          // cmd must be one of
          // {command, iodata()}
          // {connect, PID}

          if (cmd.elem1 == EPort.am_command) {
            if (cmd.elem2.collectIOList(out)) {
              EHandle caller = sender.testHandle();
             
              if (caller == null) {
                log.warning("*** sender is null? "+sender);
              }
             
              if (out.size() == 0) {
                instance.outputv(caller, ERT.EMPTY_BYTEBUFFER_ARR);
              } else {
                instance.outputv(caller, out.toArray(new ByteBuffer[out
                    .size()]));
              }
              // if collectIOList fails, do the port task die?
              // and how?
            }
           
            out.clear();

            continue next_message;

          } else if (cmd.elem1 == EPort.am_connect) {
            EPID new_owner;
            if ((new_owner = cmd.elem2.testPID()) == null)
              break;

            EPID old_owner = this.owner;
            this.owner = new_owner;

            old_owner.send(this.port, ETuple.make(this.self_handle(),
                    EPort.am_connected));

            continue next_message;

          }

        } else if (t2.elem2 == am_close) {
          this.reply_closed_to = t2.elem1.testPID();
          // will call instance.stop()
          return;
        }

      } else if ((ctrl = msg.testPortControl()) != null) {

        // port control messages are simply run
        ctrl.execute();
        continue next_message;

      } else if ((t3 = ETuple3.cast(msg)) != null) {

        // {'EXIT', From, Reason} comes in this way
        if (t3.elem1 == ERT.am_EXIT) {
          // close is handled by exception handling code
          return;
        }
      } else if ((tup = msg.testTuple()) != null && tup.arity() == 5) {
        // {'DOWN', ref, process, pid, reason}
        if (tup.elm(1) == ERT.am_DOWN) {
          ERef ref = tup.elm(2).testReference();
          instance.processExit(ref);
        }

      }

View Full Code Here

Examples of erjang.ETuple

      while (seq_has_more(map_seq) && (limit < 0 || count < limit)) {
       
        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

Examples of erjang.ETuple

  @BIF
  public static EObject insert(EProc proc, EObject tab, EObject oneOrMore) {
   
    // test arguments
    ETable table = resolve(proc, tab, true);
    ETuple one = oneOrMore.testTuple();
    ESeq more = oneOrMore.testSeq();
    if (table == null || (one == null && more == null)) {
      throw ERT.badarg(tab, oneOrMore);
    }
View Full Code Here

Examples of erjang.ETuple

  }

  private static EObject get_elm(EObject tab, EObject key, ESmall p,
      ESeq ent) {
   
    ETuple tup = ent.head().testTuple();
    if (tup == null || p.value < 1 || p.value > tup.arity()) {
      throw ERT.badarg(tab, key, p);
    }
   
    return tup.elm(p.value);
  }
View Full Code Here

Examples of erjang.ETuple

  @BIF
  public static EObject insert_new(EProc proc, EObject tab, EObject oneOrMore) {
   
    // test arguments
    ETable table = resolve(proc, tab, true);
    ETuple one = oneOrMore.testTuple();
    ESeq more = oneOrMore.testSeq();
    if (table == null || (one == null && more == null)) {
      throw ERT.badarg(tab, oneOrMore);
    }
View Full Code Here

Examples of erjang.ETuple

  @BIF static public EObject delete_object(EProc proc, EObject tab, EObject obj) {
   
   
    // test arguments
    ETable table = resolve(proc, tab, true);
    ETuple one = obj.testTuple();
    if (table == null || one == null ) {
      throw ERT.badarg(tab, obj);
    }

    table.delete_object(one);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.