Changeset 4049


Ignore:
Timestamp:
09/25/03 14:33:57 (19 years ago)
Author:
piso
Message:

resetIO()

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

Legend:

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

    r3929 r4049  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Interpreter.java,v 1.36 2003-09-20 17:02:04 piso Exp $
     5 * $Id: Interpreter.java,v 1.37 2003-09-25 14:33:57 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    7171    private Interpreter()
    7272    {
    73         CharacterInputStream in = new CharacterInputStream(System.in);
    74         _STANDARD_INPUT_.setSymbolValue(in);
    75         CharacterOutputStream out = new CharacterOutputStream(System.out);
    76         _STANDARD_OUTPUT_.setSymbolValue(out);
    77         _ERROR_OUTPUT_.setSymbolValue(out);
    78         _TRACE_OUTPUT_.setSymbolValue(out);
    7973        jlisp = false;
    8074    }
    8175
    8276    private Interpreter(InputStream inputStream, OutputStream outputStream,
    83         String initialDirectory)
    84     {
    85         CharacterInputStream in = new CharacterInputStream(inputStream);
    86         _STANDARD_INPUT_.setSymbolValue(in);
    87         CharacterOutputStream out = new CharacterOutputStream(outputStream);
    88         _STANDARD_OUTPUT_.setSymbolValue(out);
    89         _ERROR_OUTPUT_.setSymbolValue(out);
    90         _TRACE_OUTPUT_.setSymbolValue(out);
    91         _DEFAULT_PATHNAME_DEFAULTS_.setSymbolValue(
    92             new LispString(initialDirectory));
     77                        String initialDirectory)
     78    {
     79        resetIO(new CharacterInputStream(inputStream),
     80                new CharacterOutputStream(outputStream));
    9381        jlisp = true;
    9482    }
  • trunk/j/src/org/armedbear/lisp/Lisp.java

    r4028 r4049  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Lisp.java,v 1.148 2003-09-23 15:44:03 piso Exp $
     5 * $Id: Lisp.java,v 1.149 2003-09-25 14:33:32 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    948948    }
    949949
     950    private static CharacterInputStream stdin =
     951        new CharacterInputStream(System.in);
     952
     953    private static CharacterOutputStream stdout =
     954        new CharacterOutputStream(System.out);
     955
     956    public static final Symbol _STANDARD_INPUT_ =
     957        exportSpecial("*STANDARD-INPUT*", PACKAGE_CL, stdin);
     958
     959    public static final Symbol _STANDARD_OUTPUT_ =
     960        exportSpecial("*STANDARD-OUTPUT*", PACKAGE_CL, stdout);
     961
     962    public static final Symbol _ERROR_OUTPUT_ =
     963        exportSpecial("*ERROR-OUTPUT*", PACKAGE_CL, stdout);
     964
     965    public static final Symbol _TRACE_OUTPUT_ =
     966        exportSpecial("*TRACE-OUTPUT*", PACKAGE_CL, stdout);
     967
    950968    public static final Symbol _TERMINAL_IO_ =
    951969        exportSpecial("*TERMINAL-IO*", PACKAGE_CL,
    952                       new TwoWayStream(new CharacterInputStream(System.in),
    953                                        new CharacterOutputStream(System.out)));
     970                      new TwoWayStream(stdin, stdout));
    954971
    955972    public static final Symbol _QUERY_IO_ =
    956973        exportSpecial("*QUERY-IO*", PACKAGE_CL,
    957                       new TwoWayStream(new CharacterInputStream(System.in),
    958                                        new CharacterOutputStream(System.out)));
     974                      new TwoWayStream(stdin, stdout));
    959975
    960976    public static final Symbol _DEBUG_IO_ =
    961977        exportSpecial("*DEBUG-IO*", PACKAGE_CL,
    962                       new TwoWayStream(new CharacterInputStream(System.in),
    963                                        new CharacterOutputStream(System.out)));
    964 
    965     public static final Symbol _STANDARD_INPUT_ =
    966         exportSpecial("*STANDARD-INPUT*", PACKAGE_CL,
    967                       new CharacterInputStream(System.in));
    968 
    969     public static final Symbol _STANDARD_OUTPUT_ =
    970         exportSpecial("*STANDARD-OUTPUT*", PACKAGE_CL,
    971                       new CharacterOutputStream(System.out));
    972 
    973     public static final Symbol _ERROR_OUTPUT_ =
    974         exportSpecial("*ERROR-OUTPUT*", PACKAGE_CL,
    975                       new CharacterOutputStream(System.out));
    976 
    977     public static final Symbol _TRACE_OUTPUT_ =
    978         exportSpecial("*TRACE-OUTPUT*", PACKAGE_CL,
    979                       new CharacterOutputStream(System.out));
     978                      new TwoWayStream(stdin, stdout));
     979
     980    public void resetIO(CharacterInputStream in, CharacterOutputStream out)
     981    {
     982        stdin = in;
     983        stdout = out;
     984        _STANDARD_INPUT_.setSymbolValue(stdin);
     985        _STANDARD_OUTPUT_.setSymbolValue(stdout);
     986        _ERROR_OUTPUT_.setSymbolValue(stdout);
     987        _TRACE_OUTPUT_.setSymbolValue(stdout);
     988        _TERMINAL_IO_.setSymbolValue(new TwoWayStream(stdin, stdout));
     989        _QUERY_IO_.setSymbolValue(new TwoWayStream(stdin, stdout));
     990        _DEBUG_IO_.setSymbolValue(new TwoWayStream(stdin, stdout));
     991    }
    980992
    981993    public static final TwoWayStream getTerminalIO()
Note: See TracChangeset for help on using the changeset viewer.