[armedbear-cvs] r13444 - trunk/abcl/src/org/armedbear/lisp
ehuelsmann at common-lisp.net
ehuelsmann at common-lisp.net
Sat Aug 6 13:51:28 UTC 2011
Author: ehuelsmann
Date: Sat Aug 6 06:51:26 2011
New Revision: 13444
Log:
Reduce the number of required unreadableString() methods by removing
the ones taking a symbol argument: all invocations involved a constant
parameter, now replaced with a constant string instead.
Modified:
trunk/abcl/src/org/armedbear/lisp/EndOfFile.java
trunk/abcl/src/org/armedbear/lisp/Environment.java
trunk/abcl/src/org/armedbear/lisp/FileStream.java
trunk/abcl/src/org/armedbear/lisp/Layout.java
trunk/abcl/src/org/armedbear/lisp/LispObject.java
trunk/abcl/src/org/armedbear/lisp/RandomState.java
trunk/abcl/src/org/armedbear/lisp/TwoWayStream.java
Modified: trunk/abcl/src/org/armedbear/lisp/EndOfFile.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/EndOfFile.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/EndOfFile.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -74,6 +74,6 @@
@Override
public String getMessage()
{
- return unreadableString(Symbol.END_OF_FILE);
+ return unreadableString("END-OF-STREAM");
}
}
Modified: trunk/abcl/src/org/armedbear/lisp/Environment.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Environment.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/Environment.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -247,7 +247,7 @@
@Override
public String printObject()
{
- return unreadableString(Symbol.ENVIRONMENT);
+ return unreadableString("ENVIRONMENT");
}
// ### make-environment
Modified: trunk/abcl/src/org/armedbear/lisp/FileStream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/FileStream.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/FileStream.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -265,7 +265,7 @@
@Override
public String printObject()
{
- return unreadableString(Symbol.FILE_STREAM);
+ return unreadableString("FILE-STREAM");
}
// ### make-file-stream pathname namestring element-type direction if-exists external-format => stream
Modified: trunk/abcl/src/org/armedbear/lisp/Layout.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Layout.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/Layout.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -137,7 +137,7 @@
@Override
public String printObject()
{
- return unreadableString(Symbol.LAYOUT);
+ return unreadableString("LAYOUT");
}
// Generates a list of slot definitions for the slot names in this layout.
Modified: trunk/abcl/src/org/armedbear/lisp/LispObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispObject.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/LispObject.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -754,13 +754,27 @@
return toString();
}
+ /** Calls unreadableString(String s, boolean identity) with a default
+ * identity value of 'true'.
+ *
+ * @param s String representation of this object.
+ * @return String enclosed in the non-readable #< ... > markers
+ */
public final String unreadableString(String s) {
return unreadableString(s, true);
}
- public final String unreadableString(Symbol sym) {
- return unreadableString(sym, true);
- }
+ /** Creates a non-readably (as per CLHS terminology) representation
+ * of the 'this' object, using string 's'.
+ *
+ * If the current value of the variable *PRINT-READABLY* is T, a
+ * Lisp error is thrown and no value is returned.
+ *
+ * @param s
+ * @param identity when 'true', includes Java's identityHash for the object
+ * in the output.
+ * @return a non reabable string (i.e. one enclosed in the #< > markers)
+ */
public final String unreadableString(String s, boolean identity)
{
StringBuilder sb = new StringBuilder("#<");
@@ -774,12 +788,6 @@
return sb.toString();
}
- public final String unreadableString(Symbol symbol, boolean identity)
-
- {
- return unreadableString(symbol.printObject(), identity);
- }
-
// Special operator
public LispObject execute(LispObject args, Environment env)
Modified: trunk/abcl/src/org/armedbear/lisp/RandomState.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/RandomState.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/RandomState.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -93,7 +93,7 @@
@Override
public String printObject()
{
- return unreadableString(Symbol.RANDOM_STATE);
+ return unreadableString("RANDOM-STATE");
}
public LispObject random(LispObject arg)
Modified: trunk/abcl/src/org/armedbear/lisp/TwoWayStream.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/TwoWayStream.java Sat Aug 6 06:03:00 2011 (r13443)
+++ trunk/abcl/src/org/armedbear/lisp/TwoWayStream.java Sat Aug 6 06:51:26 2011 (r13444)
@@ -216,7 +216,7 @@
@Override
public String printObject()
{
- return unreadableString(Symbol.TWO_WAY_STREAM);
+ return unreadableString("TWO-WAY-STREAM");
}
// ### make-two-way-stream input-stream output-stream => two-way-stream
More information about the armedbear-cvs
mailing list