Changeset 3724


Ignore:
Timestamp:
Apr 17, 2008, 5:27:40 PM (13 years ago)
Author:
yura
Message:
  • Simplification of Channel and Box.
Location:
to-imperative/trunk/java/java
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/java/java/org/refal/plus/Expr.java

    r3685 r3724  
    4444        start = st;
    4545        length = len;
    46     }
    47 
    48     /**
    49      * Constructs empty expression.
    50      */
    51     public Expr () {
    52         terms = empty.terms;
    53         start = 0;
    54         length = 0;
    5546    }
    5647
  • to-imperative/trunk/java/java/org/refal/plus/Symbol.java

    r3723 r3724  
    33package org.refal.plus;
    44
    5 import java.io.InputStream;
    6 import java.io.OutputStream;
    75import java.math.BigInteger;
    86
     
    3432    }
    3533
    36     public static Comparable<?> newBox (String name, Comparable<?> term) {
    37         return new Reference<Box>(new Box(term));
    38     }
    39 
    4034    public static Comparable<?> newChannel (String name) {
    4135        return new Reference<Channel>(name, new Channel());
    42     }
    43 
    44     public static Comparable<?> newChannel (String name, InputStream is) {
    45         return new Reference<Channel>(name, new Channel(is));
    46     }
    47 
    48     public static Comparable<?> newChannel (String name, OutputStream os) {
    49         return new Reference<Channel>(name, new Channel(os));
    5036    }
    5137
  • to-imperative/trunk/java/java/org/refal/plus/objects/Box.java

    r3721 r3724  
    99
    1010    public Box () {
    11         expr = new Expr();
    12     }
    13 
    14     public Box (Expr e) {
    15         expr = e;
    16     }
    17 
    18     public Box (Comparable<?> obj) {
    19         expr = new Expr(obj);
     11        expr = Expr.empty;
    2012    }
    2113
  • to-imperative/trunk/java/java/org/refal/plus/objects/Channel.java

    r3721 r3724  
    1919    public Channel () {}
    2020
    21     public Channel (InputStream in) {
     21    public void set (InputStream in) {
    2222        reader = new BufferedReader(new InputStreamReader(in));
    2323    }
    2424
    25     public Channel (OutputStream out) {
     25    public void set (OutputStream out) {
    2626        writer = new PrintWriter(out, true); // autoflash
    2727    }
  • to-imperative/trunk/java/java/refal/plus/Box.java

    r3705 r3724  
    1616    @RefalFormat("$func Box e.expr = s.box;")
    1717    public static void Box (Expr expr, Result box) {
    18         Symbol.setToResult(new org.refal.plus.objects.Box(expr), box);
     18        org.refal.plus.objects.Box b = new org.refal.plus.objects.Box();
     19        b.expr = expr;
     20        Symbol.setToResult(b, box);
    1921    }
    2022
  • to-imperative/trunk/java/java/refal/plus/File.java

    r3723 r3724  
    1717    /** {@value} Ex: ':' or ';' */
    1818    @RefalFormat("$box PathSeparator;")
    19     public static final Expr PathSeparator = new Expr(Symbol.newBox("PathSeparator", new Character(java.io.File.pathSeparatorChar)));
     19    public static final Expr PathSeparator = new Expr(Symbol.newBox("PathSeparator"));
    2020
    2121    /** {@value} Ex: '/' or '\\' */
    2222    @RefalFormat("$box DirSeparator;")
    23     public static final Expr DirSeparator = new Expr(Symbol.newBox("DirSeparator", new Character(java.io.File.separatorChar)));
     23    public static final Expr DirSeparator = new Expr(Symbol.newBox("DirSeparator"));
     24   
     25    static {
     26        Symbol.getBox(PathSeparator).expr = new Expr(new Character(java.io.File.pathSeparatorChar));
     27        Symbol.getBox(DirSeparator).expr = new Expr(new Character(java.io.File.separatorChar));
     28    }
    2429
    2530    @RefalFormat("$func? Exists e.fname = ;")
  • to-imperative/trunk/java/java/refal/plus/StdIO.java

    r3721 r3724  
    1515public class StdIO {
    1616    @RefalFormat("$channel StdIn;")
    17     public static final Expr StdIn = new Expr(Symbol.newChannel("StdIn", java.lang.System.in));
     17    public static final Expr StdIn = new Expr(Symbol.newChannel("StdIn"));
    1818
    1919    @RefalFormat("$channel StdOut;")
    20     public static final Expr StdOut = new Expr(Symbol.newChannel("StdOut", java.lang.System.out));
     20    public static final Expr StdOut = new Expr(Symbol.newChannel("StdOut"));
    2121
    2222    @RefalFormat("$channel StdErr;")
    23     public static final Expr StdErr = new Expr(Symbol.newChannel("StdErr", java.lang.System.err));
     23    public static final Expr StdErr = new Expr(Symbol.newChannel("StdErr"));
     24   
     25    static {
     26        Symbol.getChannel(StdIn).set(java.lang.System.in);
     27        Symbol.getChannel(StdOut).set(java.lang.System.out);
     28        Symbol.getChannel(StdErr).set(java.lang.System.err);
     29    }
    2430
    2531    @RefalFormat("$func Channel = s.channel;")
Note: See TracChangeset for help on using the changeset viewer.