Changeset 3329


Ignore:
Timestamp:
08/11/03 16:11:25 (18 years ago)
Author:
piso
Message:

WRITE-CHAR

File:
1 edited

Legend:

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

    r3323 r3329  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.319 2003-08-11 01:45:16 piso Exp $
     5 * $Id: Primitives.java,v 1.320 2003-08-11 16:11:25 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    36813681    };
    36823682
     3683    // ### write-char
     3684    // write-char character &optional output-stream => character
     3685    private static final Primitive WRITE_CHAR =
     3686        new Primitive("write-char") {
     3687        public LispObject execute(LispObject[] args) throws LispError
     3688        {
     3689            if (args.length < 1 || args.length > 2)
     3690                throw new WrongNumberOfArgumentsException(this);
     3691            char c = LispCharacter.getValue(args[0]);
     3692            CharacterOutputStream out = null;
     3693            if (args.length == 1)
     3694                out = getStandardOutput();
     3695            else {
     3696                LispObject streamArg = args[1];
     3697                if (streamArg instanceof CharacterOutputStream)
     3698                    out = (CharacterOutputStream) streamArg;
     3699                else if (streamArg == T || streamArg == NIL)
     3700                    out = getStandardOutput();
     3701                else
     3702                    throw new TypeError(args[1],
     3703                                        "character output stream");
     3704            }
     3705            out.writeChar(c);
     3706            return args[0];
     3707        }
     3708    };
     3709
    36833710    // ### write-string
    36843711    // write-string string &optional output-stream &key start end => string
Note: See TracChangeset for help on using the changeset viewer.