Examples of ETuple2


Examples of erjang.ETuple2

  }
 
  @BIF
  static public EObject universaltime_to_localtime(EObject a1)
  {
    ETuple2 dt;
    if ((dt=ETuple2.cast(a1)) != null) {
      ETuple3 date;
      ETuple3 time;
      ESmall year;
      ESmall month;
      ESmall day;
      ESmall hour;
      ESmall minute;
      ESmall sec;
      if (   (date=ETuple3.cast( dt.elem1 )) != null
        && (year = date.elem1.testSmall()) != null
        && (month = date.elem2.testSmall()) != null
        && (day = date.elem3.testSmall()) != null
       
        && (time=ETuple3.cast( dt.elem2 )) != null
        && (hour = time.elem1.testSmall()) != null
        && (minute = time.elem2.testSmall()) != null
        && (sec = time.elem3.testSmall()) != null
       
      ) {

        Calendar in_date = GregorianCalendar.getInstance(UTC_TIME_ZONE);
        in_date.set(Calendar.YEAR, year.value);
        in_date.set(Calendar.MONTH, month.value-1+Calendar.JANUARY);
        in_date.set(Calendar.DAY_OF_MONTH, day.value);
       
        in_date.set(Calendar.HOUR_OF_DAY, hour.value);
        in_date.set(Calendar.MINUTE, minute.value);
        in_date.set(Calendar.SECOND, sec.value);
       
        Calendar out_date = GregorianCalendar.getInstance();
        out_date.setTimeInMillis(in_date.getTimeInMillis());
       
        ETuple3 date2 = new ETuple3();
        date2.set(1, ERT.box(out_date.get(Calendar.YEAR)));
        date2.set(2, ERT.box(out_date.get(Calendar.MONTH)-Calendar.JANUARY+1));
        date2.set(3, ERT.box(out_date.get(Calendar.DAY_OF_MONTH)));
       
        ETuple3 time2 = new ETuple3();
        time2.set(1, ERT.box(out_date.get(Calendar.HOUR_OF_DAY)));
        time2.set(2, ERT.box(out_date.get(Calendar.MINUTE)));
        time2.set(3, ERT.box(out_date.get(Calendar.SECOND)));
       
        return new ETuple2(date2, time2);   
      }
    }

    throw ERT.badarg(a1);
  }
View Full Code Here

Examples of erjang.ETuple2

    ETuple3 time2 = new ETuple3();
    time2.set(1, ERT.box(out_date.get(Calendar.HOUR_OF_DAY)));
    time2.set(2, ERT.box(out_date.get(Calendar.MINUTE)));
    time2.set(3, ERT.box(out_date.get(Calendar.SECOND)));
   
    return new ETuple2(date2, time2);   
  }
View Full Code Here

Examples of erjang.ETuple2

  }
 
  @BIF
  static public EObject universaltime_to_posixtime(EObject a1)
  {
    ETuple2 dt;
    if ((dt=ETuple2.cast(a1)) != null) {
      ETuple3 date;
      ETuple3 time;
      ESmall year;
      ESmall month;
View Full Code Here

Examples of erjang.ETuple2

  @Override
  int http_error(TCPINet desc, byte[] data, int pos, int len) throws Pausable {

    EObject line = load_string(desc, data, pos, len);

    ETuple2 req = new ETuple2(am_http_error, line);
   
    if (desc.active == ActiveType.PASSIVE) {
          /* {inet_async, S, Ref, {error,{http_error,Line}}} */

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

    } else {
View Full Code Here

Examples of erjang.ETuple2

  }
 
  @BIF
  static public EObject system_monitor() {
    if (log.isLoggable(Level.FINE)) log.fine("system_monitor setting ignored");
    return new ETuple2(sysmon_pid, ERT.NIL);
  }
View Full Code Here

Examples of erjang.ETuple2

    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.ETuple2

      AsyncOp op = desc.deq_async();
      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 {
View Full Code Here

Examples of erjang.ETuple2

    return ERT.am_ok;
  }

        @BIF
        public static EObject dt_spread_tag(EObject bool) {
            return new ETuple2(ERT.box(0), ERT.NIL);
        }
View Full Code Here

Examples of erjang.ETuple2

    EAtom scheme = null;
    switch (uri.type) {
    case URI_STAR:
      return (EAtom)am_star;
    case URI_ABS_PATH:
      return new ETuple2(am_abs_path, load_string(desc, uri.s1_data, uri.s1_ptr, uri.s1_len));
    case URI_HTTPS:
      scheme = am_https;
    case URI_HTTP:
      if (scheme == null) { scheme = am_http; }
      return ETuple.make(am_absoluteURI,
View Full Code Here

Examples of erjang.ETuple2

      || i.value > b.byteSize()) {
      throw ERT.badarg(bin, idx);
    }

    long split = i.value*8;
    return new ETuple2(b.substring(0, split),
               b.substring(split));

    /* more efficient, but works only for EBinary */

    // return new ETuple2(b.sub_binary(0, i.value),
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.