[armedbear-cvs] r12801 - trunk/abcl/src/org/armedbear/lisp
Mark Evenson
mevenson at common-lisp.net
Sun Jul 11 20:03:24 UTC 2010
Author: mevenson
Date: Sun Jul 11 16:03:22 2010
New Revision: 12801
Log:
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.
Modified:
trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
trunk/abcl/src/org/armedbear/lisp/Pathname.java
Modified: trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java Sun Jul 11 16:03:22 2010
@@ -150,7 +150,6 @@
}
};
- // ### make-classloader &optional parent => java-class-loader
private static final Primitive MAKE_CLASSLOADER = new pf_make_classloader();
private static final class pf_make_classloader extends Primitive
{
@@ -170,7 +169,6 @@
}
};
- // ### dump-classpath &optional classloader => list-of-pathname-lists
private static final Primitive DUMP_CLASSPATH = new pf_dump_classpath();
private static final class pf_dump_classpath extends Primitive
{
@@ -197,7 +195,6 @@
}
};
- // ### add-to-classpath jar-or-jars &optional (classloader (get-current-classloader))
private static final Primitive ADD_TO_CLASSPATH = new pf_add_to_classpath();
private static final class pf_add_to_classpath extends Primitive
{
Modified: trunk/abcl/src/org/armedbear/lisp/Pathname.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Pathname.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/Pathname.java Sun Jul 11 16:03:22 2010
@@ -591,16 +591,12 @@
sb.append("//");
sb.append(authority.getStringValue());
}
- } else {
- if (!(this instanceof LogicalPathname)) {
- sb.append("\\\\"); //UNC file support; if there's a host, it's a UNC path.
- }
+ } else if (this instanceof LogicalPathname) {
sb.append(host.getStringValue());
- if (this instanceof LogicalPathname) {
- sb.append(':');
- } else {
- sb.append(File.separatorChar);
- }
+ sb.append(':');
+ } else {
+ // UNC paths now use unprintable representation
+ return null;
}
}
if (device == NIL) {
@@ -837,8 +833,8 @@
@Override
public String writeToString() {
final LispThread thread = LispThread.currentThread();
- boolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL);
- boolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL);
+ final boolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL);
+ final boolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL);
boolean useNamestring;
String s = null;
s = getNamestring();
@@ -882,52 +878,57 @@
sb.append('"');
}
} else {
- final boolean ANSI_COMPATIBLE = true;
- final String separator;
- if (ANSI_COMPATIBLE) {
- sb.append("#P(");
- separator = "\"";
- } else {
- sb.append("#P(");
- separator = " ";
- }
- if (host != NIL) {
- sb.append(":HOST ");
- sb.append(host.writeToString());
- sb.append(separator);
- }
- if (device != NIL) {
- sb.append(":DEVICE ");
- sb.append(device.writeToString());
- sb.append(separator);
- }
- if (directory != NIL) {
- sb.append(":DIRECTORY ");
- sb.append(directory.writeToString());
- sb.append(separator);
- }
- if (name != NIL) {
- sb.append(":NAME ");
- sb.append(name.writeToString());
- sb.append(separator);
- }
- if (type != NIL) {
- sb.append(":TYPE ");
- sb.append(type.writeToString());
- sb.append(separator);
- }
- if (version != NIL) {
- sb.append(":VERSION ");
- sb.append(version.writeToString());
- sb.append(separator);
- }
- if (sb.charAt(sb.length() - 1) == ' ') { // XXX
- sb.setLength(sb.length() - 1);
- }
- if (ANSI_COMPATIBLE) {
- sb.append(')' + separator);
- } else {
- sb.append(')');
+ final SpecialBindingsMark mark = thread.markSpecialBindings();
+ thread.bindSpecial(Symbol.PRINT_ESCAPE, T);
+ try {
+ final boolean ANSI_COMPATIBLE = true;
+ final String SPACE = " ";
+ if (ANSI_COMPATIBLE) {
+ sb.append("#P(\"");
+ } else {
+ sb.append("#P(");
+
+ }
+ if (host != NIL) {
+ sb.append(":HOST ");
+ sb.append(host.writeToString());
+ sb.append(SPACE);
+ }
+ if (device != NIL) {
+ sb.append(":DEVICE ");
+ sb.append(device.writeToString());
+ sb.append(SPACE);
+ }
+ if (directory != NIL) {
+ sb.append(":DIRECTORY ");
+ sb.append(directory.writeToString());
+ sb.append(SPACE);
+ }
+ if (name != NIL) {
+ sb.append(":NAME ");
+ sb.append(name.writeToString());
+ sb.append(SPACE);
+ }
+ if (type != NIL) {
+ sb.append(":TYPE ");
+ sb.append(type.writeToString());
+ sb.append(SPACE);
+ }
+ if (version != NIL) {
+ sb.append(":VERSION ");
+ sb.append(version.writeToString());
+ sb.append(SPACE);
+ }
+ if (sb.charAt(sb.length() - 1) == ' ') { // XXX
+ sb.setLength(sb.length() - 1);
+ }
+ if (ANSI_COMPATIBLE) {
+ sb.append(')' + "\"");
+ } else {
+ sb.append(')');
+ }
+ } finally {
+ thread.resetSpecialBindings(mark);
}
}
return sb.toString();
@@ -1273,17 +1274,22 @@
}
final Pathname p;
final boolean logical;
+ LispObject logicalHost = NIL;
if (host != NIL) {
if (host instanceof AbstractString) {
- host = LogicalPathname.canonicalizeStringComponent((AbstractString) host);
+ logicalHost = LogicalPathname.canonicalizeStringComponent((AbstractString) host);
+ }
+ if (LOGICAL_PATHNAME_TRANSLATIONS.get(logicalHost) == null) {
+ // Not a defined logical pathname host -- A UNC path
+ //warning(new LispError(host.writeToString() + " is not defined as a logical pathname host."));
+ p = new Pathname();
+ logical = false;
+ p.host = host;
+ } else {
+ p = new LogicalPathname();
+ logical = true;
+ p.host = logicalHost;
}
- if (LOGICAL_PATHNAME_TRANSLATIONS.get(host) == null) {
- // Not a defined logical pathname host.
- error(new LispError(host.writeToString() + " is not defined as a logical pathname host."));
- }
- p = new LogicalPathname();
- logical = true;
- p.host = host;
p.device = Keyword.UNSPECIFIC;
} else {
p = new Pathname();
More information about the armedbear-cvs
mailing list