Example #1
0
 public static Term execute(Process proc, Module m, Instruction i, List params) {
   Tuple tuple = i.arg(0).toArg(proc).toTuple();
   List dst = i.arg(2).toList();
   while (dst.length() > 0) {
     Integer arity = dst.head().toInteger();
     dst = dst.tail();
     Term lbl = dst.head();
     if (tuple.arity() == arity.toInt()) {
       return lbl;
     }
     dst = dst.tail();
   }
   return i.arg(1);
 }
Example #2
0
 public static Term dispatch(List params) {
   switch (params.length()) {
     case 3:
       Tuple portName = params.head().toTuple();
       params = params.tail();
       List portSettings = params.head().toList();
       return open_port_2(portName, portSettings);
     default:
       throw Error.badarg;
   }
 }
Example #3
0
 public static Term dispatch(List params) {
   switch (params.length()) {
     case 2:
       PortID socket = params.head().toPortID();
       params = params.tail();
       List opts = params.head().toList();
       return getopts_2(socket, opts);
     default:
       throw Error.badarg;
   }
 }
Example #4
0
 public static Term dispatch(List params) {
   switch (params.length()) {
     case 2:
       Atom flag = params.head().toAtom();
       params = params.tail();
       Term value = params.head();
       return process_flag_2(flag, value);
     default:
       throw Error.badarg;
   }
 }
Example #5
0
  public Process(PID pid, Atom module, Atom fun, List args) {
    this(pid);

    FunctionSignature s = new FunctionSignature(module, fun, Integer.of(args.length()));
    signatures.push(s);

    int index = 0;
    while (args.length() > 0) {
      setX(index++, args.head());
      args = args.tail();
    }
  }