Ejemplo n.º 1
0
  static String[] c_signature(Class c, String expr) {
    if (c.isPrimitive()) return strs("j" + c.toString(), expr, expr);
    if (c == Pointer.class)
      return strs(
          "void*",
          "createPointerFromIO(env, " + expr + ", NULL)",
          "getPointerPeer(env, " + expr + ")"); // TODO callIO
    if (c == CLong.class)
      return strs("long", "BoxCLong(env, " + expr + ")", "UnBoxCLong(env, " + expr + ")");
    if (c == SizeT.class)
      return strs("size_t", "BoxSizeT(env, " + expr + ")", "UnBoxSizeT(env, " + expr + ")");
    if (c == TimeT.class)
      return strs("time_t", "BoxTimeT(env, " + expr + ")", "UnBoxTimeT(env, " + expr + ")");

    throw new UnsupportedOperationException("Cannot compute C signature for " + c.getName());
  }
Ejemplo n.º 2
0
 static String name(Class c) {
   return c.getName().replace('.', '/');
 }