Package erjang

Examples of erjang.ESeq


    //
    // Call erlang:display( ["Hello, Joe!~n", []] )
    //
    EString hello_str = EString.fromString("Hello, Joe!~n");
    ESeq format_args = EList.make( hello_str, ERT.NIL );    
    RPC.call(am_erlang, am_display, (EObject)format_args );

   
    RPC.call(am_io, am_format, hello_str, ERT.NIL );
View Full Code Here


    public abstract EObject toSymbolic();
    }

  public static ESeq toSymbolicList(Operand[] args) {
    ESeq res = ERT.NIL;
    for (int i = args.length-1; i >= 0; i--) {
      res = res.cons(args[i].toSymbolic());
    }
    return res;
  }
View Full Code Here

   * @param spec
   * @return compiled/parsed match_spec
   */
  public static EMatchSpec compile(ESeq spec) {

    ESeq full_spec = spec;
    List<MatchFunction> funs = new ArrayList<MatchFunction>();

    for (; !spec.isNil(); spec = spec.tail()) {
      funs.add(parse_MatchFunction(spec.head()));
    }
View Full Code Here

  public static ESeq fun_info(EObject fun_arg)
  {
    EFun fun = fun_arg.testFunction();
    if (fun == null) throw ERT.badarg(fun_arg);
   
    ESeq res = ERT.NIL;
   
    boolean is_local = fun.is_local();
   
    res = res.cons(fun.info(ERT.am_type));
    res = res.cons(fun.info(ERT.am_env));
    res = res.cons(fun.info(ERT.am_arity));
    res = res.cons(fun.info(ERT.am_name));
   
    if (is_local) {
      res = res.cons(fun.info(ERT.am_uniq));
      res = res.cons(fun.info(ERT.am_index));
      res = res.cons(fun.info(ERT.am_new_uniq));
      res = res.cons(fun.info(ERT.am_new_index));
    }
   
    res = res.cons(fun.info(ERT.am_module));
   
    if (is_local) {
      res = res.cons(fun.info(ERT.am_pid));
    }
   
    return res;
  }
View Full Code Here

  @BIF
  static EObject call(EProc self, EObject obj, EObject member, EObject typez, EObject argz) {

    EAtom mem_am = member.testAtom();
    ESeq type_seq = typez.testSeq();
    ESeq arg_seq = argz.testSeq();

    Object receiver = JavaObject.unbox(self, Object.class, obj);

    if (mem_am == null || type_seq == null || arg_seq == null
        || type_seq.length() != arg_seq.length() || receiver == null)
      throw ERT.badarg(obj, member, typez, argz);

    try {
      Class<?> c = receiver.getClass();
      Class<?>[] arg_types = new Class<?>[type_seq.length()];
View Full Code Here

    return new EList(h, this);
  }

  @Override
  public ESeq tail() {
    ESeq tail = box(self, rest);
    return tail;
  }
View Full Code Here

          return false;
        }

      }
     
      ESeq spec;
      if (capture_spec == am_all
        || capture_spec == am_all_but_first
        || capture_spec == am_first
        || capture_spec == am_none
        ) {
        // ok
      } else if ((spec=capture_spec.testSeq()) != null) {
       
        // if it is a sequence, make sure elements are integers
        while (!spec.isNil()) {
          EObject val = spec.head();
          if (val.testSmall() == null && val.testString() == null && val.testAtom() == null)
            return false;
          spec = spec.tail();
        }
       
        // ok
      } else
        return false;
View Full Code Here

      String pattern;
      if (unicode) {
        CharArrayWriter out = new CharArrayWriter();
        CharCollector cc = new CharCollector(StandardCharsets.UTF_8, out);
        try {
          ESeq rest = io_or_char_list.collectCharList(cc, ERT.NIL);
          cc.end();
        } catch (CollectingException e) {
          return null;
        } catch (InvalidElementException e) {
          return null;
View Full Code Here

    String s = v.stringValue();
    Matcher m = int_pattern.matcher(s);
    if (m.matches()) {
      String ss = m.group(1);
      EInteger intval = ERT.box_parse(ss);
      ESeq rest;
      if (ss.length() == s.length()) {
        rest = ERT.NIL;
      } else {
        rest = new EString(s.substring(ss.length()));
      }
View Full Code Here

    String s = v.stringValue();
    Matcher m = float_pattern.matcher(s);
    if (m.matches()) {
      String ss = m.group(1);
      EDouble floatval = ERT.box( Double.parseDouble(ss) );
      ESeq rest;
      if (ss.length() == s.length()) {
        rest = ERT.NIL;
      } else {
        rest = new EString(s.substring(ss.length()));
      }
View Full Code Here

TOP

Related Classes of erjang.ESeq

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.