Changeset 4971


Ignore:
Timestamp:
12/04/03 18:40:57 (18 years ago)
Author:
piso
Message:

PATHNAME-TYPE

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

Legend:

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

    r4877 r4971  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Autoload.java,v 1.107 2003-11-23 18:57:31 piso Exp $
     5 * $Id: Autoload.java,v 1.108 2003-12-04 18:40:57 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    263263        autoload("packagep", "PackageFunctions");
    264264        autoload("pathname", "Pathname");
     265        autoload("pathname-type", "Pathname");
    265266        autoload("pathnamep", "Pathname");
    266267        autoload("probe-file", "probe_file");
  • trunk/j/src/org/armedbear/lisp/Pathname.java

    r4626 r4971  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Pathname.java,v 1.18 2003-11-03 15:24:13 piso Exp $
     5 * $Id: Pathname.java,v 1.19 2003-12-04 18:40:34 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    218218    };
    219219
     220    // ### pathname-type
     221    private static final Primitive1 PATHNAME_TYPE = new Primitive1("pathname-type")
     222    {
     223        public LispObject execute(LispObject arg) throws ConditionThrowable
     224        {
     225            String namestring;
     226            if (arg instanceof LispString)
     227                namestring = ((LispString)arg).getValue();
     228            else if (arg instanceof Pathname)
     229                namestring = ((Pathname)arg).getNamestring();
     230            else
     231                throw new ConditionThrowable(new TypeError(arg, "pathname designator"));
     232            if (namestring != null) {
     233                for (int i = namestring.length(); i-- > 0;) {
     234                    char c = namestring.charAt(i);
     235                    if (c == '.')
     236                        return new LispString(namestring.substring(i + 1));
     237                }
     238            }
     239            return NIL;
     240        }
     241    };
     242
    220243    // ### user-homedir-pathname
    221244    // user-homedir-pathname &optional host => pathname
Note: See TracChangeset for help on using the changeset viewer.