Changeset 12801


Ignore:
Timestamp:
07/11/10 20:03:22 (13 years ago)
Author:
Mark Evenson
Message:

MAKE-PATHNAME will now make UNC paths.

If the HOST passed by MAKE-PATHNAME is not a defined logical host, a
UNC pathname is constructed (on all platforms).

Fix namestrings to plausibly be ANSI defined strings.

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

Legend:

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

    r12800 r12801  
    151151    };
    152152
    153     // ### make-classloader &optional parent => java-class-loader
    154153    private static final Primitive MAKE_CLASSLOADER = new pf_make_classloader();
    155154    private static final class pf_make_classloader extends Primitive
     
    171170    };
    172171
    173     // ### dump-classpath &optional classloader => list-of-pathname-lists
    174172    private static final Primitive DUMP_CLASSPATH = new pf_dump_classpath();
    175173    private static final class pf_dump_classpath extends Primitive
     
    198196    };
    199197
    200     // ### add-to-classpath jar-or-jars &optional (classloader (get-current-classloader))
    201198    private static final Primitive ADD_TO_CLASSPATH = new pf_add_to_classpath();
    202199    private static final class pf_add_to_classpath extends Primitive
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r12799 r12801  
    592592                    sb.append(authority.getStringValue());
    593593                }
    594             } else {
    595                 if (!(this instanceof LogicalPathname)) {
    596                     sb.append("\\\\"); //UNC file support; if there's a host, it's a UNC path.
    597                 }
     594            } else if (this instanceof LogicalPathname) {
    598595                sb.append(host.getStringValue());
    599                 if (this instanceof LogicalPathname) {
    600                     sb.append(':');
    601                 } else {
    602                     sb.append(File.separatorChar);
    603                 }
     596                sb.append(':');
     597            } else {
     598                // UNC paths now use unprintable representation
     599                return null;
    604600            }
    605601        }
     
    838834    public String writeToString() {
    839835        final LispThread thread = LispThread.currentThread();
    840         boolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL);
    841         boolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL);
     836        final boolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL);
     837        final boolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL);
    842838        boolean useNamestring;
    843839        String s = null;
     
    883879            }
    884880        } else {
    885             final boolean ANSI_COMPATIBLE = true;
    886             final String separator;
    887             if (ANSI_COMPATIBLE) {
    888                 sb.append("#P(");
    889                 separator = "\"";
    890             } else {
    891                 sb.append("#P(");
    892                 separator = " ";
    893             }
    894             if (host != NIL) {
    895                 sb.append(":HOST ");
    896                 sb.append(host.writeToString());
    897                 sb.append(separator);
    898             }
    899             if (device != NIL) {
    900                 sb.append(":DEVICE ");
    901                 sb.append(device.writeToString());
    902                 sb.append(separator);
    903             }
    904             if (directory != NIL) {
    905                 sb.append(":DIRECTORY ");
    906                 sb.append(directory.writeToString());
    907                 sb.append(separator);
    908             }
    909             if (name != NIL) {
    910                 sb.append(":NAME ");
    911                 sb.append(name.writeToString());
    912                 sb.append(separator);
    913             }
    914             if (type != NIL) {
    915                 sb.append(":TYPE ");
    916                 sb.append(type.writeToString());
    917                 sb.append(separator);
    918             }
    919             if (version != NIL) {
    920                 sb.append(":VERSION ");
    921                 sb.append(version.writeToString());
    922                 sb.append(separator);
    923             }
    924             if (sb.charAt(sb.length() - 1) == ' ') { // XXX
    925                 sb.setLength(sb.length() - 1);
    926             }
    927             if (ANSI_COMPATIBLE) {
    928                 sb.append(')' + separator);
    929             } else {
    930                 sb.append(')');
     881            final SpecialBindingsMark mark = thread.markSpecialBindings();
     882            thread.bindSpecial(Symbol.PRINT_ESCAPE, T);
     883            try {
     884                final boolean ANSI_COMPATIBLE = true;
     885                final String SPACE = " ";
     886                if (ANSI_COMPATIBLE) {
     887                    sb.append("#P(\"");
     888                } else {
     889                    sb.append("#P(");
     890
     891                }
     892                if (host != NIL) {
     893                    sb.append(":HOST ");
     894                    sb.append(host.writeToString());
     895                    sb.append(SPACE);
     896                }
     897                if (device != NIL) {
     898                    sb.append(":DEVICE ");
     899                    sb.append(device.writeToString());
     900                    sb.append(SPACE);
     901                }
     902                if (directory != NIL) {
     903                    sb.append(":DIRECTORY ");
     904                    sb.append(directory.writeToString());
     905                    sb.append(SPACE);
     906                }
     907                if (name != NIL) {
     908                    sb.append(":NAME ");
     909                    sb.append(name.writeToString());
     910                    sb.append(SPACE);
     911                }
     912                if (type != NIL) {
     913                    sb.append(":TYPE ");
     914                    sb.append(type.writeToString());
     915                    sb.append(SPACE);
     916                }
     917                if (version != NIL) {
     918                    sb.append(":VERSION ");
     919                    sb.append(version.writeToString());
     920                    sb.append(SPACE);
     921                }
     922                if (sb.charAt(sb.length() - 1) == ' ') { // XXX
     923                    sb.setLength(sb.length() - 1);
     924                }
     925                if (ANSI_COMPATIBLE) {
     926                    sb.append(')' + "\"");
     927                } else {
     928                    sb.append(')');
     929                }
     930            } finally {
     931                thread.resetSpecialBindings(mark);
    931932            }
    932933        }
     
    12741275        final Pathname p;
    12751276        final boolean logical;
     1277        LispObject logicalHost = NIL;
    12761278        if (host != NIL) {
    12771279            if (host instanceof AbstractString) {
    1278                 host = LogicalPathname.canonicalizeStringComponent((AbstractString) host);
    1279             }
    1280             if (LOGICAL_PATHNAME_TRANSLATIONS.get(host) == null) {
    1281                 // Not a defined logical pathname host.
    1282                 error(new LispError(host.writeToString() + " is not defined as a logical pathname host."));
    1283             }
    1284             p = new LogicalPathname();
    1285             logical = true;
    1286             p.host = host;
     1280                logicalHost = LogicalPathname.canonicalizeStringComponent((AbstractString) host);
     1281            }
     1282            if (LOGICAL_PATHNAME_TRANSLATIONS.get(logicalHost) == null) {
     1283                // Not a defined logical pathname host -- A UNC path
     1284                //warning(new LispError(host.writeToString() + " is not defined as a logical pathname host."));
     1285                p = new Pathname();
     1286                logical = false;
     1287                p.host = host;
     1288            } else {
     1289                p = new LogicalPathname();
     1290                logical = true;
     1291                p.host = logicalHost;
     1292            }
    12871293            p.device = Keyword.UNSPECIFIC;
    12881294        } else {
Note: See TracChangeset for help on using the changeset viewer.