Changeset 12802


Ignore:
Timestamp:
07/12/10 09:51:19 (13 years ago)
Author:
Mark Evenson
Message:

Re-apply grovel tags patch.

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

Legend:

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

    r12801 r12802  
    151151    };
    152152
     153    // ### make-classloader &optional parent => java-class-loader
    153154    private static final Primitive MAKE_CLASSLOADER = new pf_make_classloader();
    154155    private static final class pf_make_classloader extends Primitive
     
    170171    };
    171172
     173    // ### dump-classpath &optional classloader => list-of-pathname-lists
    172174    private static final Primitive DUMP_CLASSPATH = new pf_dump_classpath();
    173175    private static final class pf_dump_classpath extends Primitive
     
    196198    };
    197199
     200    // ### add-to-classpath jar-or-jars &optional (classloader (get-current-classloader))
    198201    private static final Primitive ADD_TO_CLASSPATH = new pf_add_to_classpath();
    199202    private static final class pf_add_to_classpath extends Primitive
  • trunk/abcl/src/org/armedbear/lisp/Pathname.java

    r12801 r12802  
    6262    protected LispObject version = NIL;
    6363
    64     private volatile String namestring;
     64    private String namestring;
    6565
    6666    /** The protocol for changing any instance field (i.e. 'host', 'type', etc.)
     
    243243        }
    244244        if (Utilities.isPlatformWindows) {
    245             if (s.startsWith("\\\\")) { // XXX What if string starts with '//'?
     245            if (s.startsWith("\\\\")) {
    246246                //UNC path support
    247247                // match \\<server>\<share>\[directories-and-files]
     
    402402
    403403        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            }
    407422        }
    408423
     
    424439        String d = null;
    425440        // 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                }
    431457            }
    432458        }
     
    592618                    sb.append(authority.getStringValue());
    593619                }
    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                }
    595624                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                }
    600630            }
    601631        }
     
    635665        if (name instanceof AbstractString) {
    636666            String n = name.getStringValue();
    637             if (n.indexOf('/') >= 0) {
     667            if (n.indexOf(File.separatorChar) >= 0) {
    638668                Debug.assertTrue(namestring == null);
    639669                return null;
     
    706736        // the namestring." 19.2.2.2.3.1
    707737        if (directory != NIL) {
    708             final char separatorChar = '/';
     738            final char separatorChar;
     739            if (isJar() || isURL()) {
     740                separatorChar = '/';
     741            } else {
     742                separatorChar = File.separatorChar;
     743            }
    709744            LispObject temp = directory;
    710745            LispObject part = temp.car();
     
    754789        String path = p.getNamestring();
    755790        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        }
    758803        // Entries in jar files are always relative, but Pathname
    759804        // directories are :ABSOLUTE.
     
    834879    public String writeToString() {
    835880        final LispThread thread = LispThread.currentThread();
    836         final boolean printReadably = (Symbol.PRINT_READABLY.symbolValue(thread) != NIL);
    837         final boolean 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);
    838883        boolean useNamestring;
    839884        String s = null;
     
    857902                }
    858903            }
    859         } else { 
     904        } else {
    860905            useNamestring = false;
    861906        }
     
    879924            }
    880925        } 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(')');
    933961        }
    934962        return sb.toString();
     
    12061234        } catch (IOException e) {
    12071235            Debug.trace("Failed to make a Pathname from "
    1208               + "." + file + "'");
     1236              + "'" + file + "'");
    12091237            return null;
    12101238        }
     
    12751303        final Pathname p;
    12761304        final boolean logical;
    1277         LispObject logicalHost = NIL;
    12781305        if (host != NIL) {
    12791306            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;
    12931316            p.device = Keyword.UNSPECIFIC;
    12941317        } else {
     
    13531376        for (int i = 0; i < limit; i++) {
    13541377            char c = s.charAt(i);
    1355             // XXX '\\' should be illegal in all Pathnames at this point?
    13561378            if (c == '/' || c == '\\' && Utilities.isPlatformWindows) {
    13571379                error(new LispError("Invalid character #\\" + c
  • trunk/abcl/src/org/armedbear/lisp/ShellCommand.java

    r12797 r12802  
    236236    // run-shell-command command &key directory (output *standard-output*)
    237237    // ### %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    {
    245241        @Override
    246242        public LispObject execute(LispObject first, LispObject second,
Note: See TracChangeset for help on using the changeset viewer.