Changeset 13942


Ignore:
Timestamp:
05/24/12 09:50:34 (12 years ago)
Author:
Mark Evenson
Message:

Implement EXT:MAKE-TEMP-DIRECTORY.

Docstrings for MAKE-TEMP-DIRECTORY and MAKE-TEMP-PATHNAME

Adjust the signature of the GENSYM primitive to allow its use in Java
code. As far as I am concerned, all primitives should be public, as
they constitute the API of the Java part of the implementation.

Location:
trunk/abcl/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r13899 r13942  
    258258  }
    259259
    260   // ### make-temp-file => pathname
    261   private static final Primitive MAKE_TEMP_FILE = new make_temp_file();
     260  public static final Primitive MAKE_TEMP_FILE = new make_temp_file();
     261  @DocString(name="make_temp_file",
     262             doc="Create and return the pathname of a previously non-existent file.")
    262263  private static class make_temp_file extends Primitive {
    263264    make_temp_file() {
     
    277278          Debug.trace(e);
    278279        }
     280      return NIL;
     281    }
     282  }
     283
     284  public static final Primitive MAKE_TEMP_DIRECTORY = new make_temp_directory();
     285  @DocString(name="make_temp_directory",
     286             doc="Create and return the pathname of a previously non-existent directory.")
     287  private static class make_temp_directory extends Primitive {
     288    make_temp_directory() {
     289      super("make-temp-directory", PACKAGE_EXT, true, "");
     290    }
     291    @Override
     292    public LispObject execute()
     293    {
     294      try {
     295          String tmpdir = System.getProperty("java.io.tmpdir");
     296          String name = Primitives.GENSYM.execute().getStringValue();
     297          File dir = new File(tmpdir, name);
     298          File file = new File(dir, "xx");
     299
     300          if (file.mkdirs()) {
     301            return new Pathname(dir + "/");
     302          }
     303      } catch (Throwable t) {
     304        Debug.trace(t);
     305      }
    279306      return NIL;
    280307    }
  • trunk/abcl/src/org/armedbear/lisp/Primitives.java

    r13837 r13942  
    30723072
    30733073    // ### gensym
    3074     private static final Primitive GENSYM = new pf_gensym();
     3074    public static final Primitive GENSYM = new pf_gensym();
    30753075    private static final class pf_gensym extends Primitive {
    30763076        pf_gensym() {
Note: See TracChangeset for help on using the changeset viewer.