Changeset 3638
- Timestamp:
- 09/09/03 23:17:27 (20 years ago)
- Location:
- trunk/j/src/org/armedbear/lisp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/lisp/Autoload.java
r3611 r3638 3 3 * 4 4 * Copyright (C) 2003 Peter Graves 5 * $Id: Autoload.java,v 1.5 1 2003-09-08 02:25:23piso Exp $5 * $Id: Autoload.java,v 1.52 2003-09-09 23:17:27 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 228 228 autoload(PACKAGE_SYS, "%structure-set-2", "StructureObject"); 229 229 autoload(PACKAGE_SYS, "%time", "Time"); 230 autoload(PACKAGE_SYS, "hash-table-entries", "HashTable"); 230 231 autoload(PACKAGE_SYS, "make-fill-pointer-output-stream", "FillPointerOutputStream"); 231 232 autoload(PACKAGE_SYS, "puthash", "HashTable"); -
trunk/j/src/org/armedbear/lisp/HashTable.java
r3519 r3638 3 3 * 4 4 * Copyright (C) 2002-2003 Peter Graves 5 * $Id: HashTable.java,v 1.1 5 2003-08-25 19:15:29piso Exp $5 * $Id: HashTable.java,v 1.16 2003-09-09 23:16:37 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 44 44 45 45 private HashTable(LispObject test, int size, LispObject rehashSize, 46 LispObject rehashThreshold) throws LispError 46 LispObject rehashThreshold) 47 throws LispError 47 48 { 48 49 if (test == NIL || test == Symbol.EQ.getSymbolFunction()) … … 63 64 // gethash key hash-table &optional default => value, present-p 64 65 public synchronized LispObject gethash(LispObject key, 65 LispObject defaultValue) throws LispError 66 LispObject defaultValue) 67 throws LispError 66 68 { 67 69 LispObject[] values = new LispObject[2]; … … 226 228 } 227 229 230 // Returns a list of (key . value) pairs. 231 private LispObject ENTRIES() 232 { 233 LispObject list = NIL; 234 for (int i = buckets.length; i-- > 0;) { 235 HashEntry e = buckets[i]; 236 while (e != null) { 237 list = new Cons(new Cons(e.key, e.value), list); 238 e = e.next; 239 } 240 } 241 return list; 242 } 243 228 244 private static class HashEntry 229 245 { … … 269 285 return ht.gethash(key, defaultValue); 270 286 } 271 throw new TypeError(args[1], "hash 287 throw new TypeError(args[1], "hash-table"); 272 288 } 273 289 }; … … 294 310 return ht.puthash(key, value); 295 311 } 296 throw new TypeError(args[1], "hash 312 throw new TypeError(args[1], "hash-table"); 297 313 } 298 314 }; … … 308 324 return ht.remhash(key); 309 325 } 310 throw new TypeError(second, "hash 326 throw new TypeError(second, "hash-table"); 311 327 } 312 328 }; … … 329 345 } 330 346 }; 347 348 // ### hash-table-entries 349 private static final Primitive1 HASH_TABLE_ENTRIES = 350 new Primitive1("hash-table-entries", PACKAGE_SYS, false) { 351 public LispObject execute(LispObject arg) throws LispError 352 { 353 if (arg instanceof HashTable) 354 return ((HashTable)arg).ENTRIES(); 355 throw new TypeError(arg, "hash-table"); 356 } 357 }; 331 358 }
Note: See TracChangeset
for help on using the changeset viewer.