1 21 22 package org.armedbear.lisp; 23 24 public final class get_properties extends Primitive2 26 { 27 private get_properties() 28 { 29 super("get-properties", "plist indicator-list"); 30 } 31 32 public LispObject execute(LispObject first, LispObject second) 33 throws ConditionThrowable 34 { 35 final LispThread thread = LispThread.currentThread(); 36 LispObject plist = first; 37 while (plist != NIL) { 38 if (plist.cdr().atom()) 39 return signal(new TypeError("Malformed property list: " + first + ".")); 40 LispObject indicator = plist.car(); 41 LispObject indicators = second; 42 while (indicators instanceof Cons) { 43 if (indicator == indicators.car()) 44 return thread.setValues(indicator, plist.cadr(), plist); 45 indicators = indicators.cdr(); 46 } 47 if (indicators != NIL) 48 signal(new TypeError(String.valueOf(second) + " is not a proper list.")); 49 plist = plist.cddr(); 50 } 51 return thread.setValues(NIL, NIL, NIL); 52 } 53 54 private static final get_properties GET_PROPERTIES = new get_properties(); 55 } 56 | Popular Tags |