[armedbear-cvs] r13445 - trunk/abcl/src/org/armedbear/lisp
ehuelsmann at common-lisp.net
ehuelsmann at common-lisp.net
Sat Aug 6 14:46:29 UTC 2011
Author: ehuelsmann
Date: Sat Aug 6 07:46:28 2011
New Revision: 13445
Log:
Print unreadable strings with unreadableString() exclusively,
so it can throw a Lisp error when printing something unreadable.
Modified:
trunk/abcl/src/org/armedbear/lisp/Autoload.java
trunk/abcl/src/org/armedbear/lisp/AutoloadMacro.java
trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java
trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java
trunk/abcl/src/org/armedbear/lisp/EndOfFile.java
trunk/abcl/src/org/armedbear/lisp/Function.java
trunk/abcl/src/org/armedbear/lisp/Lisp.java
trunk/abcl/src/org/armedbear/lisp/LispObject.java
trunk/abcl/src/org/armedbear/lisp/Package.java
trunk/abcl/src/org/armedbear/lisp/SingleFloat.java
trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java
trunk/abcl/src/org/armedbear/lisp/StructureClass.java
Modified: trunk/abcl/src/org/armedbear/lisp/Autoload.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Autoload.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/Autoload.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -261,7 +261,7 @@
@Override
public String printObject()
{
- StringBuffer sb = new StringBuffer("#<AUTOLOAD ");
+ StringBuilder sb = new StringBuilder();
sb.append(symbol.princToString());
sb.append(" \"");
if (className != null) {
@@ -273,8 +273,7 @@
sb.append(".class");
} else
sb.append(getFileName());
- sb.append("\">");
- return sb.toString();
+ return unreadableString(sb.toString());
}
// ### autoload
Modified: trunk/abcl/src/org/armedbear/lisp/AutoloadMacro.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/AutoloadMacro.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/AutoloadMacro.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -66,12 +66,11 @@
@Override
public String printObject()
{
- StringBuffer sb = new StringBuffer("#<AUTOLOAD-MACRO ");
+ StringBuilder sb = new StringBuilder();
sb.append(getSymbol().princToString());
sb.append(" \"");
sb.append(getFileName());
- sb.append("\">");
- return sb.toString();
+ return unreadableString(sb.toString());
}
// ### autoload-macro
Modified: trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/BuiltInClass.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -79,10 +79,7 @@
@Override
public String printObject()
{
- StringBuilder sb = new StringBuilder("#<BUILT-IN-CLASS ");
- sb.append(getName().printObject());
- sb.append('>');
- return sb.toString();
+ return unreadableString(getName().princToString());
}
private static BuiltInClass addClass(Symbol symbol)
Modified: trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/DoubleFloat.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -592,7 +592,7 @@
if (printReadably)
return "#.(progn \"Comment: create a NaN.\" (/ 0.0d0 0.0d0))";
else
- return "#<DOUBLE-FLOAT NaN>";
+ return unreadableString("DOUBLE-FLOAT NaN", false);
}
String s1 = String.valueOf(value);
if (printReadably ||
Modified: trunk/abcl/src/org/armedbear/lisp/EndOfFile.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/EndOfFile.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/EndOfFile.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -70,10 +70,4 @@
return T;
return super.typep(type);
}
-
- @Override
- public String getMessage()
- {
- return unreadableString("END-OF-STREAM");
- }
}
Modified: trunk/abcl/src/org/armedbear/lisp/Function.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Function.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/Function.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -317,17 +317,12 @@
{
LispObject name = getLambdaName();
if (name != null && name != NIL) {
- StringBuffer sb = new StringBuffer("#<FUNCTION ");
- sb.append(name.printObject());
- sb.append(" {");
- sb.append(Integer.toHexString(System.identityHashCode(this)).toUpperCase());
- sb.append("}>");
- return sb.toString();
+ return unreadableString(name.princToString());
}
// No name.
LispObject lambdaList = getLambdaList();
if (lambdaList != null) {
- StringBuffer sb = new StringBuffer("#<FUNCTION ");
+ StringBuilder sb = new StringBuilder("FUNCTION ");
sb.append("(LAMBDA ");
if (lambdaList == NIL) {
sb.append("()");
@@ -343,10 +338,7 @@
}
}
sb.append(")");
- sb.append(" {");
- sb.append(Integer.toHexString(System.identityHashCode(this)).toUpperCase());
- sb.append("}>");
- return sb.toString();
+ return unreadableString(sb.toString());
}
return unreadableString("FUNCTION");
}
Modified: trunk/abcl/src/org/armedbear/lisp/Lisp.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Lisp.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/Lisp.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -2705,7 +2705,7 @@
@Override
public String printObject()
{
- return "#<UNBOUND>";
+ return unreadableString("UNBOUND", false);
}
}
@@ -2715,7 +2715,7 @@
@Override
public String printObject()
{
- return "null";
+ return unreadableString("null", false);
}
}
Modified: trunk/abcl/src/org/armedbear/lisp/LispObject.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/LispObject.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/LispObject.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -757,6 +757,8 @@
/** Calls unreadableString(String s, boolean identity) with a default
* identity value of 'true'.
*
+ * This function is a helper for printObject()
+ *
* @param s String representation of this object.
* @return String enclosed in the non-readable #< ... > markers
*/
@@ -770,6 +772,8 @@
* If the current value of the variable *PRINT-READABLY* is T, a
* Lisp error is thrown and no value is returned.
*
+ * This function is a helper for printObject()
+ *
* @param s
* @param identity when 'true', includes Java's identityHash for the object
* in the output.
Modified: trunk/abcl/src/org/armedbear/lisp/Package.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Package.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/Package.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -855,10 +855,7 @@
return sb.toString();
} else {
if (name != null) {
- StringBuilder sb = new StringBuilder("#<PACKAGE \"");
- sb.append(name);
- sb.append("\">");
- return sb.toString();
+ return unreadableString("PACKAGE " + name, false);
} else
return unreadableString("PACKAGE");
}
Modified: trunk/abcl/src/org/armedbear/lisp/SingleFloat.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SingleFloat.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/SingleFloat.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -581,7 +581,7 @@
if (printReadably)
return "#.(progn \"Comment: create a NaN.\" (/ 0.0s0 0.0s0))";
else
- return "#<SINGLE-FLOAT NaN>";
+ return unreadableString("SINGLE-FLOAT NaN", false);
}
String s1 = String.valueOf(value);
if (printReadably ||
Modified: trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/SpecialOperator.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -148,10 +148,9 @@
@Override
public String printObject()
{
- StringBuffer sb = new StringBuffer("#<SPECIAL-OPERATOR ");
+ StringBuilder sb = new StringBuilder("SPECIAL-OPERATOR ");
sb.append(lambdaName.princToString());
- sb.append(">");
- return sb.toString();
+ return unreadableString(sb.toString(), false);
}
// Profiling.
Modified: trunk/abcl/src/org/armedbear/lisp/StructureClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/StructureClass.java Sat Aug 6 06:51:26 2011 (r13444)
+++ trunk/abcl/src/org/armedbear/lisp/StructureClass.java Sat Aug 6 07:46:28 2011 (r13445)
@@ -78,10 +78,9 @@
@Override
public String printObject()
{
- StringBuffer sb = new StringBuffer("#<STRUCTURE-CLASS ");
+ StringBuilder sb = new StringBuilder("STRUCTURE-CLASS ");
sb.append(getName().princToString());
- sb.append('>');
- return sb.toString();
+ return unreadableString(sb.toString(), false);
}
// ### make-structure-class name direct-slots slots include => class
More information about the armedbear-cvs
mailing list