Examples of EFun


Examples of erjang.EFun

      }

      Export exp = field.getAnnotation(Export.class);
      if (exp != null) {
        field.setAccessible(true);
        EFun value;
        try {
          value = (EFun) field.get(null);
        } catch (Exception e) {
          throw new Error(e);
        }
View Full Code Here

Examples of erjang.EFun

       
 
  @BIF
  public static EObject fun_info(EObject fun_arg, EObject spec_arg)
  {
    EFun fun = fun_arg.testFunction();
    EAtom spec = spec_arg.testAtom();
   
    if (fun == null || spec == null) throw ERT.badarg(fun_arg, spec_arg);
   
    return fun.info(spec);
  }
View Full Code Here

Examples of erjang.EFun

  }
 
  @BIF
  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

Examples of erjang.EFun

      throw ERT.badarg(a1, a2, a3);
    }
   
    int arity = a.length();
   
    EFun target = EModuleManager.resolve(new FunID(m,f,arity));
   
    if (target == null) {
      throw new ErlangUndefined(m, f, new ESmall(arity));
    }
   
View Full Code Here

Examples of erjang.EFun

    return null;
  }

  @Override
  public EFun testFunction() {
    EFun fun;

    if ((fun = testFunction2(0)) != null) {
      return fun;
    }
View Full Code Here

Examples of erjang.EFun

    Mapper mapper = type_mapper.get(type);
    if (mapper != null) {
      return mapper.map(val);
    }

    final EFun ifun;
    if (type.isInterface() && (ifun = val.testFunction2(3)) != null) {

      final ClassLoader loader = JavaObject.class
          .getClassLoader();
      return
      java.lang.reflect.Proxy.newProxyInstance(loader, new Class[] { type }, new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, final Method method, final Object[] args)
                throws Throwable {
             
              final Mailbox<Object> reply = new Mailbox<Object>(1);
             
              EFun job = EFunCG.get_fun_with_handler("erlang", "apply", 0, new EFunHandler() {
                @Override
                public EObject invoke(EProc proc, EObject[] _) throws Pausable {

                  EObject aa = JavaObject.box(proc, args);
                  EObject at = JavaObject.box(proc, method.getParameterTypes());
View Full Code Here

Examples of erjang.EFun

  }
 
  @BIF
  public static EObject run(EProc proc, EObject fun) throws Pausable {
    EFun f = fun.testFunction2(0);
    if (f == null) {
      throw ERT.badarg(fun);
    }
   
    return f.invoke(proc, new EObject[0]);
  }
View Full Code Here

Examples of erjang.EFun

  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 {

      ETuple t = fun.testTuple();
View Full Code Here

Examples of erjang.EFun

    EAtom fun = two.testAtom();
    ESeq  args = three.testSeq();
   
    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

Examples of erjang.EFun

      *
      * Treating native functions differently in EModule loading might
      * be a better solution.
      */
    public static synchronized EFun funForMethod(Method method, String module) {
        EFun fun = method_fun_map.get(method);
        if (fun==null) {
            method_fun_map.put(method, fun = createFunForMethod(method, module));
        }
        return fun;
    }
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.