Changeset 4085


Ignore:
Timestamp:
09/27/03 19:24:15 (20 years ago)
Author:
piso
Message:

MAKE-STRING-INPUT-STREAM

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

Legend:

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

    r4051 r4085  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Autoload.java,v 1.76 2003-09-25 15:37:08 piso Exp $
     5 * $Id: Autoload.java,v 1.77 2003-09-27 19:24:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    212212        autoload("logxor", "logxor");
    213213        autoload("make-condition", "make_condition");
     214        autoload("make-string-input-stream", "StringInputStream");
    214215        autoload("make-string-output-stream", "StringOutputStream");
    215216        autoload("namestring", "Pathname");
  • trunk/j/src/org/armedbear/lisp/StringInputStream.java

    r862 r4085  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StringInputStream.java,v 1.1 2003-02-23 01:35:00 piso Exp $
     5 * $Id: StringInputStream.java,v 1.2 2003-09-27 19:23:56 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2828        super(s);
    2929    }
     30
     31    // ### make-string-input-stream
     32    // make-string-input-stream string &optional start end => string-stream
     33    private static final Primitive MAKE_STRING_OUTPUT_STREAM =
     34        new Primitive("make-string-input-stream") {
     35        public LispObject execute(LispObject arg) throws ConditionThrowable
     36        {
     37            return new StringInputStream(LispString.getValue(arg));
     38        }
     39        public LispObject execute(LispObject first, LispObject second)
     40            throws ConditionThrowable
     41        {
     42            String s = LispString.getValue(first);
     43            int start = Fixnum.getValue(second);
     44            return new StringInputStream(s.substring(start));
     45        }
     46        public LispObject execute(LispObject first, LispObject second,
     47                                  LispObject third)
     48            throws ConditionThrowable
     49        {
     50            String s = LispString.getValue(first);
     51            int start = Fixnum.getValue(second);
     52            if (third == NIL)
     53                return new StringInputStream(s.substring(start));
     54            int end = Fixnum.getValue(third);
     55            return new StringInputStream(s.substring(start, end));
     56        }
     57    };
    3058}
Note: See TracChangeset for help on using the changeset viewer.