Changeset 10201


Ignore:
Timestamp:
10/23/05 16:22:15 (16 years ago)
Author:
piso
Message:

Symbol refactoring (work in progress).

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

Legend:

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

    r10194 r10201  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Interpreter.java,v 1.94 2005-10-23 13:05:23 piso Exp $
     5 * $Id: Interpreter.java,v 1.95 2005-10-23 16:22:05 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    144144            initialDirectory = initialDirectory.concat(File.separator);
    145145        try {
    146             _DEFAULT_PATHNAME_DEFAULTS_.setSymbolValue(new Pathname(initialDirectory));
     146            Symbol.DEFAULT_PATHNAME_DEFAULTS.setSymbolValue(new Pathname(initialDirectory));
    147147        }
    148148        catch (Throwable t) {
  • trunk/j/src/org/armedbear/lisp/Lisp.java

    r10194 r10201  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Lisp.java,v 1.401 2005-10-23 13:02:13 piso Exp $
     5 * $Id: Lisp.java,v 1.402 2005-10-23 16:19:42 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    847847        final Pathname defaultPathname;
    848848        if (absolute) {
    849             defaultPathname = Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue(thread));
     849            defaultPathname =
     850                coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue(thread));
    850851        } else {
    851852            LispObject loadTruename = _LOAD_TRUENAME_.symbolValue(thread);
     
    854855                // We're loading a file.
    855856                device = ((Pathname)loadTruename).getDevice();
    856             } else
    857                 defaultPathname = Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue(thread));
     857            } else {
     858                defaultPathname =
     859                    coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue(thread));
     860            }
    858861        }
    859862        if (device instanceof Pathname) {
     
    14151418    }
    14161419
     1420    public static Pathname coerceToPathname(LispObject arg)
     1421        throws ConditionThrowable
     1422    {
     1423        if (arg instanceof Pathname)
     1424            return (Pathname) arg;
     1425        if (arg instanceof AbstractString)
     1426            return Pathname.parseNamestring((AbstractString)arg);
     1427        if (arg instanceof FileStream)
     1428            return ((FileStream)arg).getPathname();
     1429        signalTypeError(arg, list4(Symbol.OR, Symbol.PATHNAME,
     1430                                   Symbol.STRING, Symbol.FILE_STREAM));
     1431        // Not reached.
     1432        return null;
     1433    }
     1434
    14171435    public LispObject assq(LispObject item, LispObject alist)
    14181436        throws ConditionThrowable
     
    17171735    }
    17181736
    1719     public static final Symbol _DEFAULT_PATHNAME_DEFAULTS_ =
    1720         exportSpecial("*DEFAULT-PATHNAME-DEFAULTS*", PACKAGE_CL, null);
    17211737    static {
    17221738        String userDir = System.getProperty("user.dir");
     
    17261742        }
    17271743        // This string will be converted to a pathname when Pathname.java is loaded.
    1728         _DEFAULT_PATHNAME_DEFAULTS_.setSymbolValue(new SimpleString(userDir));
     1744        Symbol.DEFAULT_PATHNAME_DEFAULTS.initializeSpecial(new SimpleString(userDir));
    17291745    }
    17301746
  • trunk/j/src/org/armedbear/lisp/Load.java

    r10194 r10201  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Load.java,v 1.121 2005-10-23 13:05:23 piso Exp $
     5 * $Id: Load.java,v 1.122 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7070            // Filename is not absolute.
    7171            String dir =
    72                 Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue()).getNamestring();
     72                coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue()).getNamestring();
    7373            file = new File(dir, filename);
    7474            if (file != null) {
     
    516516                // If stream is closed, fall through...
    517517            }
    518             Pathname pathname = Pathname.coerceToPathname(filespec);
     518            Pathname pathname = coerceToPathname(filespec);
    519519            if (pathname instanceof LogicalPathname)
    520520                pathname = LogicalPathname.translateLogicalPathname((LogicalPathname)pathname);
  • trunk/j/src/org/armedbear/lisp/Pathname.java

    r10140 r10201  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Pathname.java,v 1.106 2005-10-17 18:52:55 piso Exp $
     5 * $Id: Pathname.java,v 1.107 2005-10-23 16:20:20 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    575575        else
    576576            return null;
    577     }
    578 
    579     public static Pathname coerceToPathname(LispObject arg)
    580         throws ConditionThrowable
    581     {
    582         if (arg instanceof Pathname)
    583             return (Pathname) arg;
    584         if (arg instanceof AbstractString)
    585             return parseNamestring((AbstractString)arg);
    586         if (arg instanceof FileStream)
    587             return ((FileStream)arg).getPathname();
    588         signalTypeError(arg, list4(Symbol.OR, Symbol.PATHNAME,
    589                                    Symbol.STRING, Symbol.FILE_STREAM));
    590         // Not reached.
    591         return null;
    592577    }
    593578
     
    977962        public LispObject execute(LispObject arg) throws ConditionThrowable
    978963        {
    979             Pathname pathname = Pathname.coerceToPathname(arg);
     964            Pathname pathname = coerceToPathname(arg);
    980965            if (pathname instanceof LogicalPathname)
    981966                pathname = LogicalPathname.translateLogicalPathname((LogicalPathname)pathname);
     
    10351020            throws ConditionThrowable
    10361021        {
    1037             Pathname pathname = Pathname.coerceToPathname(first);
     1022            Pathname pathname = coerceToPathname(first);
    10381023            if (second == NIL)
    10391024                return pathname.isWild() ? T : NIL;
     
    10771062            Pathname pathname = coerceToPathname(arg);
    10781063            Pathname defaultPathname =
    1079                 coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue());
     1064                coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue());
    10801065            LispObject defaultVersion = Keyword.NEWEST;
    10811066            return mergePathnames(pathname, defaultPathname, defaultVersion);
     
    12011186        throws ConditionThrowable
    12021187    {
    1203         Pathname pathname = Pathname.coerceToPathname(arg);
     1188        Pathname pathname = coerceToPathname(arg);
    12041189        if (pathname instanceof LogicalPathname)
    12051190            pathname = LogicalPathname.translateLogicalPathname((LogicalPathname)pathname);
     
    12091194        final Pathname defaultedPathname =
    12101195            mergePathnames(pathname,
    1211                            Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue()),
     1196                           coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue()),
    12121197                           NIL);
    12131198        final String namestring = defaultedPathname.getNamestring();
     
    12411226        public LispObject execute(LispObject arg) throws ConditionThrowable
    12421227        {
    1243             final Pathname pathname = Pathname.coerceToPathname(arg);
     1228            final Pathname pathname = coerceToPathname(arg);
    12441229            if (pathname.isWild())
    12451230                signal(new FileError("Bad place for a wild pathname.", pathname));
    12461231            Pathname defaultedPathname =
    12471232                mergePathnames(pathname,
    1248                                Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue()),
     1233                               coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue()),
    12491234                               NIL);
    12501235            File file = Utilities.getFile(defaultedPathname);
     
    13251310    static {
    13261311        try {
    1327             LispObject obj = _DEFAULT_PATHNAME_DEFAULTS_.getSymbolValue();
    1328             _DEFAULT_PATHNAME_DEFAULTS_.setSymbolValue(coerceToPathname(obj));
     1312            LispObject obj = Symbol.DEFAULT_PATHNAME_DEFAULTS.getSymbolValue();
     1313            Symbol.DEFAULT_PATHNAME_DEFAULTS.setSymbolValue(coerceToPathname(obj));
    13291314        }
    13301315        catch (Throwable t) {
  • trunk/j/src/org/armedbear/lisp/ShellCommand.java

    r10135 r10201  
    33 *
    44 * Copyright (C) 2000-2005 Peter Graves
    5  * $Id: ShellCommand.java,v 1.7 2005-10-17 16:45:19 piso Exp $
     5 * $Id: ShellCommand.java,v 1.8 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    240240            Stream outputStream = null;
    241241            if (second != NIL) {
    242                 Pathname pathname = Pathname.coerceToPathname(second);
     242                Pathname pathname = coerceToPathname(second);
    243243                namestring = pathname.getNamestring();
    244244                if (namestring == null) {
  • trunk/j/src/org/armedbear/lisp/Symbol.java

    r10195 r10201  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Symbol.java,v 1.215 2005-10-23 14:11:26 piso Exp $
     5 * $Id: Symbol.java,v 1.216 2005-10-23 16:20:45 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    824824    public static final Symbol _DEBUGGER_HOOK_ =
    825825        PACKAGE_CL.addExternalSymbol("*DEBUGGER-HOOK*");
    826     public static final Symbol _DEFAULT_PATHNAME_DEFAULTS_ =
     826    public static final Symbol DEFAULT_PATHNAME_DEFAULTS =
    827827        PACKAGE_CL.addExternalSymbol("*DEFAULT-PATHNAME-DEFAULTS*");
    828828    public static final Symbol _ERROR_OUTPUT_ =
  • trunk/j/src/org/armedbear/lisp/Utilities.java

    r10135 r10201  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: Utilities.java,v 1.13 2005-10-17 16:45:20 piso Exp $
     5 * $Id: Utilities.java,v 1.14 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    6868    {
    6969        return getFile(pathname,
    70                        Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue()));
     70                       coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue()));
    7171    }
    7272
  • trunk/j/src/org/armedbear/lisp/create_new_file.java

    r9058 r10201  
    33 *
    44 * Copyright (C) 2004-2005 Peter Graves
    5  * $Id: create_new_file.java,v 1.4 2005-05-05 14:25:40 piso Exp $
     5 * $Id: create_new_file.java,v 1.5 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3535    public LispObject execute(LispObject arg) throws ConditionThrowable
    3636    {
    37         Pathname pathname = Pathname.coerceToPathname(arg);
     37        Pathname pathname = coerceToPathname(arg);
    3838        String namestring = pathname.getNamestring();
    3939        if (namestring == null)
  • trunk/j/src/org/armedbear/lisp/delete_file.java

    r10031 r10201  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: delete_file.java,v 1.9 2005-09-25 20:48:43 piso Exp $
     5 * $Id: delete_file.java,v 1.10 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3737        // Don't follow symlinks! We want to delete the symlink itself, not
    3838        // the linked-to file.
    39         Pathname pathname = Pathname.coerceToPathname(arg);
     39        Pathname pathname = coerceToPathname(arg);
    4040        if (arg instanceof Stream)
    4141            ((Stream)arg)._close();
     
    4747        final Pathname defaultedPathname =
    4848            Pathname.mergePathnames(pathname,
    49                                     Pathname.coerceToPathname(_DEFAULT_PATHNAME_DEFAULTS_.symbolValue()),
     49                                    coerceToPathname(Symbol.DEFAULT_PATHNAME_DEFAULTS.symbolValue()),
    5050                                    NIL);
    5151        final String namestring = defaultedPathname.getNamestring();
  • trunk/j/src/org/armedbear/lisp/file_author.java

    r9059 r10201  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: file_author.java,v 1.3 2005-05-05 14:35:02 piso Exp $
     5 * $Id: file_author.java,v 1.4 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3434    public LispObject execute(LispObject arg) throws ConditionThrowable
    3535    {
    36         Pathname pathname = Pathname.coerceToPathname(arg);
     36        Pathname pathname = coerceToPathname(arg);
    3737        if (pathname.isWild())
    3838            signal(new FileError("Bad place for a wild pathname.", pathname));
  • trunk/j/src/org/armedbear/lisp/file_write_date.java

    r9059 r10201  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: file_write_date.java,v 1.4 2005-05-05 14:34:25 piso Exp $
     5 * $Id: file_write_date.java,v 1.5 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    3434    public LispObject execute(LispObject arg) throws ConditionThrowable
    3535    {
    36         Pathname pathname = Pathname.coerceToPathname(arg);
     36        Pathname pathname = coerceToPathname(arg);
    3737        if (pathname.isWild())
    3838            signal(new FileError("Bad place for a wild pathname.", pathname));
  • trunk/j/src/org/armedbear/lisp/probe_file.java

    r9059 r10201  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: probe_file.java,v 1.15 2005-05-05 14:36:16 piso Exp $
     5 * $Id: probe_file.java,v 1.16 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5555        public LispObject execute(LispObject arg) throws ConditionThrowable
    5656        {
    57             Pathname pathname = Pathname.coerceToPathname(arg);
     57            Pathname pathname = coerceToPathname(arg);
    5858            if (pathname.isWild())
    5959                signal(new FileError("Bad place for a wild pathname.", pathname));
     
    7070        public LispObject execute(LispObject arg) throws ConditionThrowable
    7171        {
    72             Pathname pathname = Pathname.coerceToPathname(arg);
     72            Pathname pathname = coerceToPathname(arg);
    7373            if (pathname.isWild())
    7474                signal(new FileError("Bad place for a wild pathname.", pathname));
  • trunk/j/src/org/armedbear/lisp/zip.java

    r9690 r10201  
    33 *
    44 * Copyright (C) 2005 Peter Graves
    5  * $Id: zip.java,v 1.2 2005-07-20 18:29:41 piso Exp $
     5 * $Id: zip.java,v 1.3 2005-10-23 16:22:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    4040        throws ConditionThrowable
    4141    {
    42         Pathname zipfilePathname = Pathname.coerceToPathname(first);
     42        Pathname zipfilePathname = coerceToPathname(first);
    4343        byte[] buffer = new byte[4096];
    4444        try {
     
    5151            LispObject list = second;
    5252            while (list != NIL) {
    53                 Pathname pathname = Pathname.coerceToPathname(list.car());
     53                Pathname pathname = coerceToPathname(list.car());
    5454                String namestring = pathname.getNamestring();
    5555                if (namestring == null) {
Note: See TracChangeset for help on using the changeset viewer.