Changeset 12802
- Timestamp:
- 07/12/10 09:51:19 (13 years ago)
- Location:
- trunk/abcl/src/org/armedbear/lisp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
r12801 r12802 151 151 }; 152 152 153 // ### make-classloader &optional parent => java-class-loader 153 154 private static final Primitive MAKE_CLASSLOADER = new pf_make_classloader(); 154 155 private static final class pf_make_classloader extends Primitive … … 170 171 }; 171 172 173 // ### dump-classpath &optional classloader => list-of-pathname-lists 172 174 private static final Primitive DUMP_CLASSPATH = new pf_dump_classpath(); 173 175 private static final class pf_dump_classpath extends Primitive … … 196 198 }; 197 199 200 // ### add-to-classpath jar-or-jars &optional (classloader (get-current-classloader)) 198 201 private static final Primitive ADD_TO_CLASSPATH = new pf_add_to_classpath(); 199 202 private static final class pf_add_to_classpath extends Primitive -
trunk/abcl/src/org/armedbear/lisp/Pathname.java
r12801 r12802 62 62 protected LispObject version = NIL; 63 63 64 private volatileString namestring;64 private String namestring; 65 65 66 66 /** The protocol for changing any instance field (i.e. 'host', 'type', etc.) … … 243 243 } 244 244 if (Utilities.isPlatformWindows) { 245 if (s.startsWith("\\\\")) { // XXX What if string starts with '//'?245 if (s.startsWith("\\\\")) { 246 246 //UNC path support 247 247 // match \\<server>\<share>\[directories-and-files] … … 402 402 403 403 if (Utilities.isPlatformWindows) { 404 if (s.contains("\\")) { 405 s = s.replace("\\", "/"); 406 } 404 if (!s.contains(jarSeparator)) { 405 s = s.replace("/", "\\"); 406 } else { 407 StringBuilder result = new StringBuilder(); 408 for (int i = 0; i < s.length(); i++) { 409 char c = s.charAt(i); 410 if ( c != '/') { 411 result.append(c); 412 } else { 413 if (i != 0 && s.charAt(i-1) != '!') { 414 result.append("\\"); 415 } else { 416 result.append(c); 417 } 418 } 419 } 420 s = result.toString(); 421 } 407 422 } 408 423 … … 424 439 String d = null; 425 440 // Find last file separator char. 426 for (int i = s.length(); i-- > 0;) { 427 if (s.charAt(i) == '/') { 428 d = s.substring(0, i + 1); 429 s = s.substring(i + 1); 430 break; 441 if (Utilities.isPlatformWindows) { 442 for (int i = s.length(); i-- > 0;) { 443 char c = s.charAt(i); 444 if (c == '/' || c == '\\') { 445 d = s.substring(0, i + 1); 446 s = s.substring(i + 1); 447 break; 448 } 449 } 450 } else { 451 for (int i = s.length(); i-- > 0;) { 452 if (s.charAt(i) == '/') { 453 d = s.substring(0, i + 1); 454 s = s.substring(i + 1); 455 break; 456 } 431 457 } 432 458 } … … 592 618 sb.append(authority.getStringValue()); 593 619 } 594 } else if (this instanceof LogicalPathname) { 620 } else { 621 if (!(this instanceof LogicalPathname)) { 622 sb.append("\\\\"); //UNC file support; if there's a host, it's a UNC path. 623 } 595 624 sb.append(host.getStringValue()); 596 sb.append(':'); 597 } else { 598 // UNC paths now use unprintable representation 599 return null; 625 if (this instanceof LogicalPathname) { 626 sb.append(':'); 627 } else { 628 sb.append(File.separatorChar); 629 } 600 630 } 601 631 } … … 635 665 if (name instanceof AbstractString) { 636 666 String n = name.getStringValue(); 637 if (n.indexOf( '/') >= 0) {667 if (n.indexOf(File.separatorChar) >= 0) { 638 668 Debug.assertTrue(namestring == null); 639 669 return null; … … 706 736 // the namestring." 19.2.2.2.3.1 707 737 if (directory != NIL) { 708 final char separatorChar = '/'; 738 final char separatorChar; 739 if (isJar() || isURL()) { 740 separatorChar = '/'; 741 } else { 742 separatorChar = File.separatorChar; 743 } 709 744 LispObject temp = directory; 710 745 LispObject part = temp.car(); … … 754 789 String path = p.getNamestring(); 755 790 StringBuilder result = new StringBuilder(); 756 result.append(path); 757 791 if (Utilities.isPlatformWindows) { 792 for (int i = 0; i < path.length(); i++) { 793 char c = path.charAt(i); 794 if (c == '\\') { 795 result.append('/'); 796 } else { 797 result.append(c); 798 } 799 } 800 } else { 801 result.append(path); 802 } 758 803 // Entries in jar files are always relative, but Pathname 759 804 // directories are :ABSOLUTE. … … 834 879 public String writeToString() { 835 880 final LispThread thread = LispThread.currentThread(); 836 finalboolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL);837 finalboolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL);881 boolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL); 882 boolean printEscape = (Symbol.PRINT_ESCAPE.symbolValue(thread) != NIL); 838 883 boolean useNamestring; 839 884 String s = null; … … 857 902 } 858 903 } 859 } else { 904 } else { 860 905 useNamestring = false; 861 906 } … … 879 924 } 880 925 } else { 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); 932 } 926 sb.append("#P("); 927 if (host != NIL) { 928 sb.append(":HOST "); 929 sb.append(host.writeToString()); 930 sb.append(' '); 931 } 932 if (device != NIL) { 933 sb.append(":DEVICE "); 934 sb.append(device.writeToString()); 935 sb.append(' '); 936 } 937 if (directory != NIL) { 938 sb.append(":DIRECTORY "); 939 sb.append(directory.writeToString()); 940 sb.append(" "); 941 } 942 if (name != NIL) { 943 sb.append(":NAME "); 944 sb.append(name.writeToString()); 945 sb.append(' '); 946 } 947 if (type != NIL) { 948 sb.append(":TYPE "); 949 sb.append(type.writeToString()); 950 sb.append(' '); 951 } 952 if (version != NIL) { 953 sb.append(":VERSION "); 954 sb.append(version.writeToString()); 955 sb.append(' '); 956 } 957 if (sb.charAt(sb.length() - 1) == ' ') { 958 sb.setLength(sb.length() - 1); 959 } 960 sb.append(')'); 933 961 } 934 962 return sb.toString(); … … 1206 1234 } catch (IOException e) { 1207 1235 Debug.trace("Failed to make a Pathname from " 1208 + " ." + file + "'");1236 + "'" + file + "'"); 1209 1237 return null; 1210 1238 } … … 1275 1303 final Pathname p; 1276 1304 final boolean logical; 1277 LispObject logicalHost = NIL;1278 1305 if (host != NIL) { 1279 1306 if (host instanceof AbstractString) { 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 } 1307 host = LogicalPathname.canonicalizeStringComponent((AbstractString) host); 1308 } 1309 if (LOGICAL_PATHNAME_TRANSLATIONS.get(host) == null) { 1310 // Not a defined logical pathname host. 1311 error(new LispError(host.writeToString() + " is not defined as a logical pathname host.")); 1312 } 1313 p = new LogicalPathname(); 1314 logical = true; 1315 p.host = host; 1293 1316 p.device = Keyword.UNSPECIFIC; 1294 1317 } else { … … 1353 1376 for (int i = 0; i < limit; i++) { 1354 1377 char c = s.charAt(i); 1355 // XXX '\\' should be illegal in all Pathnames at this point?1356 1378 if (c == '/' || c == '\\' && Utilities.isPlatformWindows) { 1357 1379 error(new LispError("Invalid character #\\" + c -
trunk/abcl/src/org/armedbear/lisp/ShellCommand.java
r12797 r12802 236 236 // run-shell-command command &key directory (output *standard-output*) 237 237 // ### %run-shell-command command directory output => exit-code 238 private static final Primitive _RUN_SHELL_COMMAND = new pf_run_shell_command(); 239 private static class pf_run_shell_command extends Primitive { 240 pf_run_shell_command() { 241 super("%run-shell-command", PACKAGE_SYS, false, 242 "command directory output => exit-code"); 243 } 244 238 private static final Primitive _RUN_SHELL_COMMAND = 239 new Primitive("%run-shell-command", PACKAGE_SYS, false) 240 { 245 241 @Override 246 242 public LispObject execute(LispObject first, LispObject second,
Note: See TracChangeset
for help on using the changeset viewer.