Changeset 7936


Ignore:
Timestamp:
10/09/04 13:28:42 (17 years ago)
Author:
piso
Message:

writeToString()

Location:
trunk/j/src/org/armedbear/lisp
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/JavaObject.java

    r6995 r7936  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: JavaObject.java,v 1.16 2004-06-04 16:18:23 piso Exp $
     5 * $Id: JavaObject.java,v 1.17 2004-10-09 13:28:18 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8181        if (obj instanceof ConditionThrowable)
    8282            return obj.toString();
    83         StringBuffer sb = new StringBuffer("#<JAVAOBJECT ");
    84         if (obj == null)
    85             sb.append("null");
    86         else {
    87             sb.append(obj.getClass().getName());
    88             sb.append(" @ #x");
    89             sb.append(Integer.toHexString(System.identityHashCode(obj)));
    90         }
    91         sb.append(">");
    92         return sb.toString();
     83        StringBuffer sb = new StringBuffer("JAVAOBJECT ");
     84        sb.append(obj == null ? "null" : obj.getClass().getName());
     85        return unreadableString(sb.toString());
    9386    }
    9487}
  • trunk/j/src/org/armedbear/lisp/LispThread.java

    r7902 r7936  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: LispThread.java,v 1.59 2004-10-03 17:17:30 piso Exp $
     5 * $Id: LispThread.java,v 1.60 2004-10-09 13:28:42 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    638638    public String writeToString() throws ConditionThrowable
    639639    {
    640         StringBuffer sb = new StringBuffer("#<THREAD ");
     640        StringBuffer sb = new StringBuffer("THREAD");
    641641        if (name != NIL) {
    642             sb.append('"');
     642            sb.append(" \"");
    643643            sb.append(name.getStringValue());
    644             sb.append("\" ");
    645         }
    646         sb.append("@ #x");
    647         sb.append(Integer.toHexString(System.identityHashCode(this)));
    648         sb.append(">");
    649         return sb.toString();
     644            sb.append("\"");
     645        }
     646        return unreadableString(sb.toString());
    650647    }
    651648
  • trunk/j/src/org/armedbear/lisp/Mailbox.java

    r7675 r7936  
    33 *
    44 * Copyright (C) 2004 Peter Graves
    5  * $Id: Mailbox.java,v 1.3 2004-09-13 18:10:30 asimon Exp $
     5 * $Id: Mailbox.java,v 1.4 2004-10-09 13:25:09 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2121
    2222package org.armedbear.lisp;
     23
    2324import java.util.LinkedList;
    2425import java.util.NoSuchElementException;
     
    2627public final class Mailbox extends LispObject
    2728{
     29    private LinkedList box = new LinkedList();
    2830
    29     private LinkedList box = new LinkedList(); 
    30 
    31     private void send (LispObject o)
     31    private void send (LispObject o)
    3232    {
    3333        synchronized(this) {
     
    3939    private LispObject read ()
    4040    {
    41         while (box.isEmpty()) 
     41        while (box.isEmpty())
    4242            synchronized(this) {
    4343                try {
     
    6666    }
    6767
    68     public String toString()
     68    public String writeToString()
    6969    {
    70         StringBuffer sb = new StringBuffer("#<MAILBOX @ #x");
    71         sb.append(Integer.toHexString(hashCode()));
    72         sb.append(">");
    73         return sb.toString();
     70        return unreadableString("MAILBOX");
    7471    }
    7572
     
    8986        new Primitive2("mailbox-send", PACKAGE_EXT, true, "mailbox object")
    9087    {
    91         public LispObject execute(LispObject first, LispObject second) throws ConditionThrowable
     88        public LispObject execute(LispObject first, LispObject second)
     89            throws ConditionThrowable
    9290        {
    9391            if (first instanceof Mailbox) {
     
    9593                mbox.send(second);
    9694                return T;
    97             } else 
    98                 return signal(new TypeError(first, "Mailbox"));
     95            } else
     96                return signal(new TypeError(first, "MAILBOX"));
    9997        }
    10098    };
     
    109107                Mailbox mbox = (Mailbox) arg;
    110108                return mbox.read();
    111             } else 
    112                 return signal(new TypeError(arg, "Mailbox"));
     109            } else
     110                return signal(new TypeError(arg, "MAILBOX"));
    113111        }
    114112    };
     
    123121                Mailbox mbox = (Mailbox) arg;
    124122                return mbox.peek();
    125             } else 
    126                 return signal(new TypeError(arg, "Mailbox"));
     123            } else
     124                return signal(new TypeError(arg, "MAILBOX"));
    127125        }
    128126    };
     
    137135                Mailbox mbox = (Mailbox) arg;
    138136                return mbox.empty();
    139             } else 
    140                 return signal(new TypeError(arg, "Mailbox"));
     137            } else
     138                return signal(new TypeError(arg, "MAILBOX"));
    141139        }
    142140    };
    143141}
    144 
  • trunk/j/src/org/armedbear/lisp/StandardObject.java

    r7872 r7936  
    33 *
    44 * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: StandardObject.java,v 1.21 2004-09-30 11:25:04 piso Exp $
     5 * $Id: StandardObject.java,v 1.22 2004-10-09 13:27:10 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    110110        if (currentLevel >= maxLevel)
    111111            return "#";
    112         StringBuffer sb = new StringBuffer("#<");
    113112        LispClass cls = layout.getLispClass();
    114         if (cls != null)
    115             sb.append(cls.getSymbol().getName());
    116         else
    117             sb.append("STANDARD-OBJECT");
    118         sb.append(" @ #x");
    119         sb.append(Integer.toHexString(hashCode()));
    120         sb.append(">");
    121         return sb.toString();
     113        return unreadableString(cls != null ? cls.getSymbol().getName() : "STANDARD-OBJECT");
    122114    }
    123115
  • trunk/j/src/org/armedbear/lisp/ThreadLock.java

    r7620 r7936  
    33 *
    44 * Copyright (C) 2004 Peter Graves
    5  * $Id: ThreadLock.java,v 1.2 2004-09-09 10:51:15 piso Exp $
     5 * $Id: ThreadLock.java,v 1.3 2004-10-09 13:25:50 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5353    }
    5454
    55     public String toString()
     55    public String writeToString()
    5656    {
    57         StringBuffer sb = new StringBuffer("#<THREAD-LOCK @ #x");
    58         sb.append(Integer.toHexString(hashCode()));
    59         sb.append(">");
    60         return sb.toString();
     57        return unreadableString("THREAD-LOCK");
    6158    }
    6259
Note: See TracChangeset for help on using the changeset viewer.