Changeset 9973


Ignore:
Timestamp:
09/14/05 19:55:12 (16 years ago)
Author:
piso
Message:

MAKE-FILE-STREAM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/FileStream.java

    r9545 r9973  
    33 *
    44 * Copyright (C) 2004-2005 Peter Graves
    5  * $Id: FileStream.java,v 1.25 2005-06-27 20:08:45 piso Exp $
     5 * $Id: FileStream.java,v 1.26 2005-09-14 19:55:12 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    518518    // ### make-file-stream pathname element-type direction if-exists => stream
    519519    private static final Primitive MAKE_FILE_STREAM =
    520         new Primitive("make-file-stream", PACKAGE_SYS, false,
    521                       "pathname element-type direction if-exists")
     520        new Primitive("make-file-stream", PACKAGE_SYS, true,
     521                      "pathname namestring element-type direction if-exists")
    522522    {
    523523        public LispObject execute(LispObject first, LispObject second,
    524                                   LispObject third, LispObject fourth)
     524                                  LispObject third, LispObject fourth,
     525                                  LispObject fifth)
    525526            throws ConditionThrowable
    526527        {
    527             Pathname pathname = Pathname.coerceToPathname(first);
    528             LispObject elementType = second;
    529             LispObject direction = third;
    530             LispObject ifExists = fourth;
     528            final Pathname pathname;
     529            try {
     530                pathname = (Pathname) first;
     531            }
     532            catch (ClassCastException e) {
     533                return signalTypeError(first, Symbol.PATHNAME);
     534            }
     535            final LispObject namestring;
     536            try {
     537                namestring = (AbstractString) second;
     538            }
     539            catch (ClassCastException e) {
     540                return signalTypeError(second, Symbol.STRING);
     541            }
     542            LispObject elementType = third;
     543            LispObject direction = fourth;
     544            LispObject ifExists = fifth;
    531545            if (direction != Keyword.INPUT && direction != Keyword.OUTPUT &&
    532546                direction != Keyword.IO)
    533547                signal(new LispError("Direction must be :INPUT, :OUTPUT, or :IO."));
    534             String namestring = pathname.getNamestring();
    535             if (namestring == null)
    536                 return NIL;
    537             try {
    538                 return new FileStream(pathname, namestring, elementType,
    539                                       direction, ifExists);
     548            try {
     549                return new FileStream(pathname, namestring.getStringValue(),
     550                                      elementType, direction, ifExists);
    540551            }
    541552            catch (FileNotFoundException e) {
Note: See TracChangeset for help on using the changeset viewer.