Changeset 15490


Ignore:
Timestamp:
11/30/20 08:22:33 (2 years ago)
Author:
Mark Evenson
Message:

Implement EXT:AS-JAR-PATHNAME-ARCHIVE

AS-JAR-PATHNAME-ARCHIVE returns its argument as a JAR-PATHNAME archive.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/JarPathname.java

    r15460 r15490  
    9999    return result;
    100100  }
     101
     102  @DocString(name="as-jar-pathname-archive",
     103             args="pathname",
     104             returns="jar-pathname",
     105             doc="Returns PATHNAME as a reference to a JAR-PATHNAME archive"
     106             + "\n"
     107             + "If PATHNAME names an ordinary file, the resulting JAR-PATHNAME addresses the"
     108             + "file as an archive.  If PATHNAME names an entry in an archive, the resulting"
     109             + "JAR-PATHNAME addresses that entry as a zip archive within that archive.")
     110  private static final Primitive AS_JAR_PATHNAME_ARCHIVE = new pf_as_jar_pathname_archive();
     111  private static class pf_as_jar_pathname_archive extends Primitive {
     112    pf_as_jar_pathname_archive() {
     113      super("as-jar-pathname-archive", PACKAGE_EXT, true);
     114    }
     115    @Override
     116    public LispObject execute(LispObject arg) {
     117      if (arg instanceof AbstractString) {
     118        arg = coerceToPathname(arg);
     119      }
     120      if (arg instanceof JarPathname) {
     121        return createFromEntry((JarPathname)arg);
     122      } if (arg instanceof Pathname) {
     123        return createFromPathname((Pathname)arg);
     124      }
     125      type_error(arg,
     126                 list(Symbol.OR,
     127                      Symbol.PATHNAME, Symbol.URL_PATHNAME,
     128                      Symbol.JAR_PATHNAME));
     129      return (LispObject)UNREACHED;
     130    }
     131  };
    101132   
    102133  static public JarPathname createFromFile(String s) {
Note: See TracChangeset for help on using the changeset viewer.