Пример #1
0
  public void eval(Environment aEnvironment, int aStackTop) throws Exception {
    // Get operator
    LispError.checkArgumentCore(
        aEnvironment,
        aStackTop,
        getArgumentPointer(aEnvironment, aStackTop, 1).getCons() != null,
        1);
    String orig = getArgumentPointer(aEnvironment, aStackTop, 1).getCons().string();
    LispError.checkArgumentCore(aEnvironment, aStackTop, orig != null, 1);

    // The arity
    LispError.checkArgumentCore(
        aEnvironment,
        aStackTop,
        getArgumentPointer(aEnvironment, aStackTop, 2).getCons() != null,
        2);
    LispError.checkArgumentCore(
        aEnvironment,
        aStackTop,
        getArgumentPointer(aEnvironment, aStackTop, 2).getCons().string() != null,
        2);
    int arity =
        Integer.parseInt(getArgumentPointer(aEnvironment, aStackTop, 2).getCons().string(), 10);

    aEnvironment.unFenceRule(UtilityFunctions.symbolName(aEnvironment, orig), arity);

    // Return true
    UtilityFunctions.internalTrue(aEnvironment, getResult(aEnvironment, aStackTop));
  }
Пример #2
0
 public void eval(Environment aEnvironment, int aStackTop) throws Exception {
   ConsPointer first = new ConsPointer();
   UtilityFunctions.internalTail(first, argumentPointer(aEnvironment, aStackTop, 1));
   UtilityFunctions.internalTail(result(aEnvironment, aStackTop), first);
   ConsPointer head = new ConsPointer();
   head.setCons(aEnvironment.iListAtom.copy(false));
   head.getCons().rest().setCons(result(aEnvironment, aStackTop).getCons().subList().getCons());
   result(aEnvironment, aStackTop).getCons().subList().setCons(head.getCons());
 }
Пример #3
0
  public void eval(Environment aEnvironment, int aStackTop) throws Exception {
    LispError.checkCore(
        aEnvironment, aStackTop, aEnvironment.iSecure == false, LispError.KLispErrSecurityBreach);

    ConsPointer evaluated = new ConsPointer();
    evaluated.setCons(argumentPointer(aEnvironment, aStackTop, 1).getCons());

    // Get file name
    LispError.checkArgumentCore(aEnvironment, aStackTop, evaluated.getCons() != null, 1);
    String orig = evaluated.getCons().string();
    LispError.checkArgumentCore(aEnvironment, aStackTop, orig != null, 1);

    UtilityFunctions.loadDefFile(aEnvironment, orig);
    UtilityFunctions.internalTrue(aEnvironment, result(aEnvironment, aStackTop));
  }
Пример #4
0
  void Compare(Environment aEnvironment, int aStackTop) throws Exception {
    ConsPointer result1 = new ConsPointer();
    ConsPointer result2 = new ConsPointer();
    result1.setCons(
        BuiltinFunctionInitialize.getArgumentPointer(aEnvironment, aStackTop, 1).getCons());
    result2.setCons(
        BuiltinFunctionInitialize.getArgumentPointer(aEnvironment, aStackTop, 2).getCons());
    boolean cmp;
    BigNumber n1 = result1.getCons().getNumber(aEnvironment.getPrecision());
    BigNumber n2 = result2.getCons().getNumber(aEnvironment.getPrecision());
    if (n1 != null && n2 != null) {
      cmp = numfunc(n1, n2);
    } else {
      String str1;
      String str2;
      str1 = result1.getCons().string();
      str2 = result2.getCons().string();
      LispError.checkArgumentCore(aEnvironment, aStackTop, str1 != null, 1);
      LispError.checkArgumentCore(aEnvironment, aStackTop, str2 != null, 2);
      // the getPrecision argument is ignored in "lex" functions
      cmp = lexfunc(str1, str2, aEnvironment.getTokenHash(), aEnvironment.getPrecision());
    }

    UtilityFunctions.internalBoolean(
        aEnvironment, BuiltinFunctionInitialize.getResult(aEnvironment, aStackTop), cmp);
  }
 public void eval(Environment aEnvironment, int aStackTop) throws Exception {
   org.mathpiper.lisp.UtilityFunctions.internalDefMacroRuleBase(aEnvironment, aStackTop, true);
 }