示例#1
0
 public Type getTypeFor(Class clas) {
   if (clas.isPrimitive()) {
     String name = clas.getName();
     if (name.equals("boolean")) {
       if (booleanType == null) booleanType = new LangPrimType(Type.booleanType, this);
       return booleanType;
     }
     return Scheme.getNamedType(name);
   }
   return Type.make(clas);
 }
示例#2
0
  void initLisp() {
    LocationEnumeration e = Scheme.builtin().enumerateAllLocations();
    while (e.hasMoreElements()) {
      importLocation(e.nextLocation());
    }

    try {
      // Force it to be loaded now, so we can over-ride let* length etc.
      loadClass("kawa.lib.prim_syntax");
      loadClass("kawa.lib.std_syntax");
      loadClass("kawa.lib.lists");
      loadClass("kawa.lib.strings");
      loadClass("gnu.commonlisp.lisp.PrimOps");
    } catch (java.lang.ClassNotFoundException ex) {
      // Ignore - happens while building this directory.
    }

    kawa.lang.Lambda lambda = new kawa.lang.Lambda();
    lambda.setKeywords(asSymbol("&optional"), asSymbol("&rest"), asSymbol("&key"));
    lambda.defaultDefault = nilExpr;
    defun("lambda", lambda);
    defun("defun", new defun(lambda));

    defun("defvar", new defvar(false));
    defun("defconst", new defvar(true));
    defun("defsubst", new defun(lambda));
    defun("function", new function(lambda));
    defun("setq", new setq());
    defun("prog1", new prog1("prog1", 1));
    defun("prog2", prog1.prog2);
    defun("progn", new kawa.standard.begin());
    defun("unwind-protect", new gnu.commonlisp.lang.UnwindProtect());
    Procedure not = new gnu.kawa.functions.Not(this);
    defun("not", not);
    defun("null", not);
    defun("eq", new gnu.kawa.functions.IsEq(this, "eq"));
    defun("equal", new gnu.kawa.functions.IsEqual(this, "equal"));
    defun("typep", new gnu.kawa.reflect.InstanceOf(this));
    defun("princ", displayFormat);
    defun("prin1", writeFormat);

    defProcStFld("=", "gnu.commonlisp.lang.CommonLisp", "numEqu");
    defProcStFld("<", "gnu.commonlisp.lang.CommonLisp", "numLss");
    defProcStFld(">", "gnu.commonlisp.lang.CommonLisp", "numGrt");
    defProcStFld("<=", "gnu.commonlisp.lang.CommonLisp", "numLEq");
    defProcStFld(">=", "gnu.commonlisp.lang.CommonLisp", "numGEq");

    defProcStFld("functionp", "gnu.commonlisp.lisp.PrimOps");
  }
示例#3
0
 public Type getTypeFor(String name) {
   if (name == "t") name = "java.lang.Object";
   return Scheme.string2Type(name);
 }