Changeset 15435
- Timestamp:
- 10/29/20 16:54:27 (2 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/Cons.java
r13440 r15435 151 151 } 152 152 153 @Override 154 public int hashCode() { 155 return this.sxhash(); 156 } 157 153 158 @Override 154 159 public final int sxhash() -
trunk/abcl/src/org/armedbear/lisp/JarPathname.java
r15423 r15435 343 343 344 344 String getRootJarAsURLString() { 345 return346 JarPathname.JAR_URI_PREFIX347 + ((Pathname)getRootJar()).getNamestring()348 + JarPathname.JAR_URI_SUFFIX;345 return 346 JarPathname.JAR_URI_PREFIX 347 + ((URLPathname)getRootJar()).getNamestring() 348 + JarPathname.JAR_URI_SUFFIX; 349 349 } 350 350 … … 398 398 return true; 399 399 } 400 return super.isLocalFile();400 return false; 401 401 } 402 402 -
trunk/abcl/src/org/armedbear/lisp/Pathname.java
r15424 r15435 1720 1720 } 1721 1721 } else { 1722 if (p.isLocalFile() && d.isLocalFile()) {1722 if (p.isLocalFile()) { 1723 1723 result.setDevice(d.getDevice()); 1724 1724 } else { -
trunk/abcl/src/org/armedbear/lisp/ZipCache.java
r15425 r15435 280 280 = (JarURLConnection) rootJarURL.openConnection(); 281 281 282 this.root = root;283 this.connection = connection;282 this.root = jar; 283 this.connection = jarConnection; 284 284 this.file = (ZipFile)connection.getJarFile(); 285 285 this.lastModified = connection.getLastModified(); … … 413 413 return result; 414 414 } 415 416 415 Pathname rootJar = (Pathname) jar.getRootJar(); 417 416 LispObject innerJars = jar.getJars().cdr(); … … 424 423 return getArchiveFile(jar); 425 424 } else { 425 result = getArchiveStreamFromFile(jar); 426 cache.put(result.root, result); 427 428 JarPathname nextArchive = new JarPathname(); 429 nextArchive 430 .setDevice(new Cons(rootJar, 431 new Cons(innerJars.car(), NIL))) 432 .setDirectory(NIL) 433 .setName(NIL) 434 .setType(NIL); 435 436 innerJars = innerJars.cdr(); 437 while (innerJars.car() != NIL) { 438 Pathname nextJarArchive = (Pathname)innerJars.car(); 439 440 JarPathname nextAsEntry = new JarPathname(); 441 nextAsEntry 442 .setDevice(nextArchive.getDevice()) 443 .setDirectory(nextJarArchive.getDirectory()) 444 .setName(nextJarArchive.getName()) 445 .setType(nextJarArchive.getType()); 446 // FIXME 447 // The pathnames for subsquent entries in a PATHNAME-JAR are relative. Should they be? 448 if (nextAsEntry.getDirectory().car().equals(Keyword.RELATIVE)) { 449 LispObject directories = nextAsEntry.getDirectory(); 450 directories = directories.cdr(); 451 directories = directories.push(Keyword.ABSOLUTE); 452 nextAsEntry.setDirectory(directories); 453 } 454 nextArchive.setDevice(nextArchive.getDevice().reverse().push(nextJarArchive).reverse()); 455 ArchiveStream stream = (ArchiveStream) result; 456 457 ZipEntry entry = stream.getEntry(nextAsEntry); 458 if (entry == null) { 459 return null; 460 } 461 462 InputStream inputStream = stream.getEntryAsInputStream(nextAsEntry); 463 if (inputStream == null) { 464 return null; 465 } 466 stream = new ArchiveStream(inputStream, nextArchive, entry); 467 result = stream; 468 cache.put(nextArchive, result); 469 470 innerJars = innerJars.cdr(); 471 if (innerJars.cdr().equals(NIL) 472 && (!jar.getDirectory().equals(NIL) 473 || !jar.getName().equals(NIL) 474 || !jar.getType().equals(NIL))) { 475 simple_error("Currently unimplemented retrieval of an entry in a nested pathnames"); 476 return (Archive)UNREACHED; 477 } 478 } 479 480 return result; 481 } 482 } 483 484 static ArchiveStream getArchiveStreamFromFile(JarPathname p) { 426 485 JarPathname root = new JarPathname(); 427 root.setDevice(new Cons(rootJar, NIL)); 486 root.setDevice(new Cons(p.getRootJar(), NIL)); 487 Pathname nextJar = (Pathname)p.getJars().cdr().car(); 428 488 ArchiveFile rootArchiveFile = (ArchiveFile)getArchiveFile(root); 429 489 430 490 JarPathname innerArchive = new JarPathname(); 431 Pathname nextJar = (Pathname)innerJars.car(); 432 LispObject jars = list( rootJar, nextJar);491 492 LispObject jars = list(p.getRootJar(), nextJar); 433 493 innerArchive.setDevice(jars); 434 494 435 495 JarPathname innerArchiveAsEntry = new JarPathname(); 436 496 innerArchiveAsEntry 437 .setDevice(new Cons(root Jar, NIL))497 .setDevice(new Cons(root, NIL)) 438 498 .setDirectory(nextJar.getDirectory()) 439 499 .setName(nextJar.getName()) … … 448 508 return null; 449 509 } 450 ArchiveStream stream = new ArchiveStream(inputStream, innerArchive, entry); 451 result = stream; 452 cache.put(innerArchive, result); 453 454 innerJars = innerJars.cdr(); 455 while (innerJars.car() != NIL) { 456 simple_error("Currently unimplemented nested zip archive of depth greater than two: ~a" , jar); 457 return (Archive)UNREACHED; 458 } 459 460 return result; 461 } 462 } 510 ArchiveStream result = new ArchiveStream(inputStream, innerArchive, entry); 511 return result; 512 } 513 514 463 515 464 516 public static Archive getArchiveURL(JarPathname jar) { … … 552 604 } 553 605 606 // ## clear-zip-cache => boolean 607 private static final Primitive CLEAR_ZIP_CACHE = new clear_zip_cache(); 608 private static class clear_zip_cache extends Primitive { 609 clear_zip_cache() { 610 super("clear-zip-cache", PACKAGE_SYS, true); 611 } 612 @Override 613 public LispObject execute() { 614 int size = cache.size(); 615 cache.clear(); 616 return size == 0 ? NIL : T; 617 } 618 } 619 554 620 // ## remove-zip-cache-entry pathname => boolean 555 621 private static final Primitive REMOVE_ZIP_CACHE_ENTRY = new remove_zip_cache_entry();
Note: See TracChangeset
for help on using the changeset viewer.