Examples of EAtom


Examples of erjang.EAtom

public class Native extends ENative {

  @BIF
  static EObject get_static(EProc self, EObject clzz, EObject member) {

    EAtom clz_am = clzz.testAtom();
    EAtom mem_am = member.testAtom();

    if (clz_am == null || mem_am == null)
      throw ERT.badarg(clzz, member);

    try {

      Class<?> c = Class.forName(clz_am.getName());
      Field f = c.getField(mem_am.getName());

      if (java.lang.reflect.Modifier.isStatic(f.getModifiers())) {
        return JavaObject.box(self, f.get(null));
      } else {
        throw new ErlangError(EString.fromString("not a static field"),
View Full Code Here

Examples of erjang.EAtom

  }

  @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()];
      EObject[] at = type_seq.toArray();

      for (int i = 0; i < at.length; i++) {
        EAtom am = at[i].testAtom();
        if (am == null) {
          throw ERT.badarg(obj, member, typez, argz);
        }

        arg_types[i] = Class.forName(am.getName());
      }

      Method m = c.getMethod(mem_am.getName(), arg_types);

      Object res = m.invoke(receiver, JavaObject.convert_args(self, arg_types,
View Full Code Here

Examples of erjang.EAtom

    public void readExportSection() throws IOException {
    if (log.isLoggable(Level.FINE)) log.fine("readExportSection");
    int nExports = in.read4BE();
    exports = new FunctionInfo[nExports];
    if (log.isLoggable(Level.FINE)) log.fine("Number of exports: "+nExports);
    EAtom mod = moduleName();
    for (int i=0; i<nExports; i++) {
      int fun_atom_nr = in.read4BE();
      int arity    = in.read4BE();
      int label    = in.read4BE();
      EAtom fun = atom(fun_atom_nr);
      exports[i] = new FunctionInfo(mod, fun, arity, label);
      addFunctionAtLabel(exports[i]);
      if (log.isLoggable(Level.FINE) && atoms != null) {
        log.fine("- #"+(i+1)+": "+atom(fun_atom_nr)+"/"+arity+" @ "+label);
      }
View Full Code Here

Examples of erjang.EAtom

    public void readLocalFunctionSection() throws IOException {
    if (log.isLoggable(Level.FINE)) log.fine("readLocalFunctionSection");
    int nLocals = in.read4BE();
    localFunctions = new FunctionInfo[nLocals];
    if (log.isLoggable(Level.FINE)) log.fine("Number of locals: "+nLocals);
    EAtom mod = moduleName();
    for (int i=0; i<nLocals; i++) {
      int fun_atom_nr = in.read4BE();
      int arity    = in.read4BE();
      int label    = in.read4BE();
      EAtom fun = atom(fun_atom_nr);
      localFunctions[i] = new FunctionInfo(mod, fun, arity, label);
      addFunctionAtLabel(localFunctions[i]);
      if (log.isLoggable(Level.FINE) && atoms != null) {
        log.fine("- #"+(i+1)+": "+atom(fun_atom_nr)+"/"+arity+" @ "+label);
      }
View Full Code Here

Examples of erjang.EAtom

    public void readFunctionSection() throws IOException {
    if (log.isLoggable(Level.FINE)) log.fine("readFunctionSection");
    int nFunctions = in.read4BE();
    anonymousFuns = new AnonFun[nFunctions];
    if (log.isLoggable(Level.FINE)) log.fine("Number of function descrs: "+nFunctions);
    EAtom mod = moduleName();
    for (int i=0; i<nFunctions; i++) {
      int fun_atom_nr = in.read4BE();
      int arity     = in.read4BE();
      int label     = in.read4BE();
      int index     = in.read4BE();
      int free_vars = in.read4BE();
      int old_uniq  = in.read4BE();
      EAtom fun = atom(fun_atom_nr);
      anonymousFuns[i] = new AnonFun(mod, fun, arity, label,
          old_uniq, i, module_md5, index, free_vars);

      if (log.isLoggable(Level.FINE) && atoms != null) {
        log.fine("- #"+(i+1)+": "+fun+"/"+arity+" @ "+label);
View Full Code Here

Examples of erjang.EAtom

    externalFuns = new ExtFun[nImports];
    for (int i=0; i<nImports; i++) {
      int m_atm_no = in.read4BE();
      int f_atm_no = in.read4BE();
      int arity    = in.read4BE();
      EAtom mod = atom(m_atm_no), fun = atom(f_atm_no);
      externalFuns[i] = new ExtFun(mod, fun, arity);
      if (log.isLoggable(Level.FINE) && atoms != null) {
        log.fine("- #"+(i+1)+": "+mod+":"+fun+"/"+arity);
      }
    }
View Full Code Here

Examples of erjang.EAtom

  }

  @BIF
  public static EObject monitor_node(EProc proc, EObject node, EObject flag, EObject opts) throws Pausable {
   
    EAtom aname = node.testAtom();
    EAtom aflag = flag.testAtom();
    ESeq sopts = opts.testSeq();
   
    if (aname == null || aflag == null || sopts == null) {
      throw ERT.badarg(node, flag);
    }
View Full Code Here

Examples of erjang.EAtom

    throw new NotImplemented();
  }
 
  @BIF
  static public EAtom node() {
    EAtom val = ERT.getLocalNode().node();
    return val;
  }
View Full Code Here

Examples of erjang.EAtom

    throws Pausable
  {

    int creation;
    ESmall cr = arg_creation.testSmall();
    EAtom node = arg_node.testAtom();
   
    if (cr == null || node == null || cr.value > 3 || !is_node_name_atom(node)) {
      if (log.isLoggable(Level.FINE)) log.fine("cr="+cr+"; node="+node+"; is_name="+is_node_name_atom(node));
      throw ERT.badarg(arg_node, arg_creation);
    }
View Full Code Here

Examples of erjang.EAtom

  public static EObject setnode(EObject node_arg, EObject cid_arg, EObject type_arg)
    throws Pausable
  {
    //System.err.println("SETNODE("+node_arg+", "+cid_arg+", "+type_arg+")");
   
    EAtom node;
    int creation = 0;
   
    ETuple2 tup;
    if ((tup=ETuple2.cast(node_arg)) != null) {
      node = tup.elem1.testAtom();
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.