Changeset 8405


Ignore:
Timestamp:
01/27/05 12:45:11 (17 years ago)
Author:
piso
Message:

writeToString(): use the print function specified in the DEFSTRUCT form (if any).

File:
1 edited

Legend:

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

    r8204 r8405  
    22 * StructureObject.java
    33 *
    4  * Copyright (C) 2003-2004 Peter Graves
    5  * $Id: StructureObject.java,v 1.42 2004-11-29 18:44:36 piso Exp $
     4 * Copyright (C) 2003-2005 Peter Graves
     5 * $Id: StructureObject.java,v 1.43 2005-01-27 12:45:11 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    150150            if (currentLevel >= maxLevel && slots.length > 0)
    151151                return "#";
     152            Symbol STRUCTURE_PRINT_FUNCTION =
     153                PACKAGE_SYS.intern("STRUCTURE-PRINT-FUNCTION");
     154            LispObject fun = STRUCTURE_PRINT_FUNCTION.getSymbolFunction();
     155            if (fun != null) {
     156                LispObject printFunction = thread.execute(fun, this);
     157                if (printFunction != NIL) {
     158                    StringOutputStream stream = new StringOutputStream();
     159                    thread.execute(printFunction, this, stream, currentPrintLevel);
     160                    return stream.getString().getStringValue();
     161                }
     162            }
    152163            StringBuffer sb = new StringBuffer("#S(");
    153164            sb.append(structureClass.getSymbol().writeToString());
Note: See TracChangeset for help on using the changeset viewer.