Changeset 4543
- Timestamp:
- 10/25/03 21:56:29 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/Primitives.java
r4532 r4543 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: Primitives.java,v 1.48 3 2003-10-25 18:55:08 dmcnaughtExp $5 * $Id: Primitives.java,v 1.484 2003-10-25 21:56:29 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 75 75 private static final int SYMBOL_PACKAGE = 41; 76 76 private static final int SYMBOL_PLIST = 42; 77 private static final int SYMBOL_VALUE = 43; 78 private static final int THIRD = 44; 79 private static final int UPPER_CASE_P = 45; 80 private static final int VALUES_LIST = 46; 81 private static final int VECTORP = 47; 77 private static final int THIRD = 43; 78 private static final int UPPER_CASE_P = 44; 79 private static final int VALUES_LIST = 45; 80 private static final int VECTORP = 46; 82 81 83 82 // Primitive2 84 private static final int MEMBER = 4 8;85 private static final int RPLACA = 4 9;86 private static final int RPLACD = 50;87 private static final int SET = 5 1;83 private static final int MEMBER = 47; 84 private static final int RPLACA = 48; 85 private static final int RPLACD = 49; 86 private static final int SET = 50; 88 87 89 88 private Primitives() … … 132 131 definePrimitive1("symbol-package", SYMBOL_PACKAGE); 133 132 definePrimitive1("symbol-plist", SYMBOL_PLIST); 134 definePrimitive1("symbol-value", SYMBOL_VALUE);135 133 definePrimitive1("third", THIRD); 136 134 definePrimitive1("upper-case-p", UPPER_CASE_P); … … 243 241 case SYMBOL_PACKAGE: // ### symbol-package 244 242 return checkSymbol(arg).getPackage(); 245 case SYMBOL_VALUE: // ### symbol-value246 if (arg == T)247 return T;248 if (arg == NIL)249 return NIL;250 return checkSymbol(arg).symbolValue();251 243 case SYMBOL_FUNCTION: { // ### symbol-function 252 244 LispObject function = arg.getSymbolFunction(); … … 503 495 }; 504 496 497 // ### symbol-value 498 private static final Primitive1 SYMBOL_VALUE = new Primitive1("symbol-value") 499 { 500 public LispObject execute(LispObject arg) throws ConditionThrowable 501 { 502 if (arg == T) 503 return T; 504 if (arg == NIL) 505 return NIL; 506 LispObject value = checkSymbol(arg).symbolValue(); 507 if (value instanceof SymbolMacro) 508 throw new ConditionThrowable(new LispError(arg + " has no dynamic value")); 509 return value; 510 } 511 }; 512 505 513 // ### + 506 private static final Primitive ADD = new Primitive("+") { 514 private static final Primitive ADD = new Primitive("+") 515 { 507 516 public LispObject execute(LispObject first, LispObject second) 508 517 throws ConditionThrowable … … 521 530 522 531 // ### - 523 private static final Primitive SUBTRACT = new Primitive("-") { 532 private static final Primitive SUBTRACT = new Primitive("-") 533 { 524 534 public LispObject execute(LispObject first, LispObject second) 525 535 throws ConditionThrowable … … 4522 4532 abs = (LispFloat)((Complex)obj).ABS(); 4523 4533 return Complex.getInstance(new LispFloat(Math.log(abs.getValue())), phase); 4524 } 4525 } 4526 4534 } 4535 } 4536 4527 4537 throw new ConditionThrowable(new TypeError(obj, "number")); 4528 4538 }
Note: See TracChangeset
for help on using the changeset viewer.