Skip to content

Commit

Permalink
Start of an implementation of PATHNAME :CASE conventions
Browse files Browse the repository at this point in the history
TODO test, and memoize per a suitable PATHNAME predicate whether a
given filesystem is case preserving.  Hook this implementation up.

Will resolve <armedbear#660>.
  • Loading branch information
easye committed May 1, 2024
1 parent d0a5253 commit 51f9605
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/org/armedbear/lisp/Pathname.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ public Pathname setVersion(LispObject version) {
return this;
}

/** One of the keywords :LOCAL or :COMMON */
protected LispObject _case = NIL;
public LispObject getCase() {
return _case;
}

public Pathname setCase(LispObject _case) {
this._case = _case;
return this;
}

/**
* The path component separator used by internally generated
* path namestrings.
Expand Down Expand Up @@ -462,7 +473,8 @@ public LispObject getParts() {
new Cons("DIRECTORY", getDirectory()),
new Cons("NAME", getName()),
new Cons("TYPE", getType()),
new Cons("VERSION", getVersion()));
new Cons("VERSION", getVersion()),
new Cons("CASE", getCase()));
return parts;
}

Expand Down Expand Up @@ -1100,13 +1112,15 @@ static final LispObject _makePathname(LispObject[] args) {
LispObject name = NIL;
LispObject type = NIL;
LispObject version = NIL;
LispObject _case = NIL;
Pathname defaults = null;
boolean hostSupplied = false;
boolean deviceSupplied = false;
boolean nameSupplied = false;
boolean typeSupplied = false;
boolean directorySupplied = false;
boolean versionSupplied = false;
boolean _caseSupplied = false;
for (int i = 0; i < args.length; i += 2) {
LispObject key = args[i];
LispObject value = args[i + 1];
Expand Down Expand Up @@ -1163,7 +1177,10 @@ static final LispObject _makePathname(LispObject[] args) {
} else if (key == Keyword.DEFAULTS) {
defaults = coerceToPathname(value);
} else if (key == Keyword.CASE) {
// Ignored.
Pathname.checkCaseArgument(value); // possible non-local exit

_case = value;
_caseSupplied = true;
}
}
if (defaults != null) {
Expand Down

0 comments on commit 51f9605

Please sign in to comment.