Value name_to_char(AbstractString * s) { AbstractString * lower = s->downcase(); if (lower->equal("null")) return make_character(0); if (lower->equal("bell")) return make_character(7); if (lower->equal("backspace")) return make_character('\b'); if (lower->equal("tab")) return make_character('\t'); if (lower->equal("linefeed")) return make_character('\n'); if (lower->equal("newline")) return make_character('\n'); if (lower->equal("page")) return make_character('\f'); if (lower->equal("return")) return make_character('\r'); if (lower->equal("space")) return make_character(' '); if (lower->equal("rubout")) return make_character(127); // Unknown. return NIL; }
LogicalPathname::LogicalPathname(AbstractString * host, AbstractString * rest) : Pathname(WIDETAG_LOGICAL_PATHNAME) { // final int limit = rest.length(); // for (int i = 0; i < limit; i++) { // char c = rest.charAt(i); // if (LOGICAL_PATHNAME_CHARS.indexOf(c) < 0) { // error(new ParseError("The character #\\" + c + " is not valid in a logical pathname.")); // return; // } // } // this.host = new SimpleString(host); _host = make_value(host); // "The device component of a logical pathname is always :UNSPECIFIC; no // other component of a logical pathname can be :UNSPECIFIC." _device = K_unspecific; long semi = rest->last_index_of(';'); if (semi >= 0) { // directory AbstractString * d = rest->substring(0, semi); _directory = parse_logical_pathname_directory(d); rest = rest->substring(semi + 1); } else { // "If a relative-directory-marker precedes the directories, the // directory component is parsed as relative; otherwise, the directory // component is parsed as absolute." _directory = make_cons(K_absolute); } long dot = rest->index_of('.'); if (dot >= 0) { AbstractString * n = rest->substring(0, dot); if (n->equal("*")) _name = K_wild; else _name = make_value(n->upcase()); rest = rest->substring(dot + 1); dot = rest->index_of('.'); if (dot >= 0) { AbstractString * t = rest->substring(0, dot); if (t->equal("*")) _type = K_wild; else // _type = new SimpleString(t.toUpperCase()); _type = make_value(t->upcase()); // What's left is the version. AbstractString * v = rest->substring(dot + 1); if (v->equal("*")) _version = K_wild; else if (v->equal("NEWEST") || v->equal("newest")) _version = K_newest; else // _version = PACKAGE_CL.intern("PARSE-INTEGER").execute(new SimpleString(v)); printf("FIXME!! LogicalPathname constructor\n"); } else { AbstractString * t = rest; if (t->equal("*")) _type = K_wild; else // type = new SimpleString(t.toUpperCase()); _type = make_value(t->upcase()); } } else { AbstractString * n = rest; if (n->equal("*")) _name = K_wild; else if (n->length() > 0) // name = new SimpleString(n.toUpperCase()); _name = make_value(n->upcase()); } }