Changeset 3721


Ignore:
Timestamp:
Apr 17, 2008, 4:18:50 PM (13 years ago)
Author:
yura
Message:
  • Do not import java.lang;
Location:
to-imperative/trunk/java/java
Files:
10 edited

Legend:

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

    r3718 r3721  
    22
    33package org.refal.plus.objects;
    4 
    5 import java.lang.String;
    64
    75import org.refal.plus.Expr;
     
    2321
    2422    @Override
    25     public String toString () {
     23    public java.lang.String toString () {
    2624        return expr.toString();
    2725    }
  • to-imperative/trunk/java/java/org/refal/plus/objects/Channel.java

    r3718 r3721  
    1212import java.io.OutputStream;
    1313import java.io.PrintWriter;
    14 import java.lang.String;
    1514
    1615public class Channel {
     
    4443    }
    4544
    46     public void openFileReader (String fname) throws IOException {
     45    public void openFileReader (java.lang.String fname) throws IOException {
    4746        close();
    4847        reader = new BufferedReader(new FileReader(fname));
    4948    }
    5049
    51     public void openFileWriter (String fname, boolean append) throws IOException {
     50    public void openFileWriter (java.lang.String fname, boolean append) throws IOException {
    5251        close();
    5352        writer = new PrintWriter(new BufferedWriter(new FileWriter(fname, append)));
  • to-imperative/trunk/java/java/org/refal/plus/objects/Table.java

    r3718 r3721  
    33package org.refal.plus.objects;
    44
    5 import java.lang.String;
    65import java.util.Map;
    76import java.util.TreeMap;
     
    2625
    2726        @Override
    28         public String toString () {
     27        public java.lang.String toString () {
    2928            return toExpr().toString();
    3029        }
     
    5352
    5453    @Override
    55     public String toString () {
     54    public java.lang.String toString () {
    5655        return toExpr().toString();
    5756    }
  • to-imperative/trunk/java/java/org/refal/plus/objects/Vector.java

    r3718 r3721  
    33package org.refal.plus.objects;
    44
    5 import java.lang.String;
    65import java.util.ArrayList;
    76
     
    3433
    3534    @Override
    36     public String toString () {
     35    public java.lang.String toString () {
    3736        return toExpr().toString();
    3837    }
  • to-imperative/trunk/java/java/refal/plus/Class.java

    r3713 r3721  
    33package refal.plus;
    44
    5 import java.lang.String;
    65import java.math.BigInteger;
    76
     
    1211import org.refal.plus.objects.Box;
    1312import org.refal.plus.objects.Channel;
     13import org.refal.plus.objects.String;
    1414import org.refal.plus.objects.Table;
    1515import org.refal.plus.objects.Vector;
     
    2828    /** Returns <code>null</code> if argument is not the Reference */
    2929    private static Object getObject (Expr expr) {
    30         if (expr.length() == 1) {
    31             Comparable<?> term = expr.at(0);
    32             if (term instanceof Reference)
    33                 return ((Reference<?>) expr.at(0)).object;
    34         }
     30        Comparable<?> term = getTerm(expr);
     31        if (term instanceof Reference)
     32            return ((Reference<?>) term).object;
    3533        return null;
    3634    }
     
    6462    @RefalFormat("$func? IsWord e.expr = ;")
    6563    public static boolean IsWord (Expr expr) {
    66         return getTerm(expr) instanceof String;
     64        return getTerm(expr) instanceof java.lang.String;
    6765    }
    6866
     
    7775    }
    7876
     77    @RefalFormat("$func? IsFunc e.expr = ;")
     78    public static boolean IsFunc (Expr expr) {
     79        return getObject(expr) instanceof Func;
     80    }
     81
    7982    @RefalFormat("$func? IsString e.expr = ;")
    8083    public static boolean IsString (Expr expr) {
    81         return getObject(expr) instanceof StringBuffer;
     84        return getObject(expr) instanceof String;
    8285    }
    8386
     
    9295    }
    9396
    94     @RefalFormat("$func? IsFunc e.expr = ;")
    95     public static boolean IsFunc (Expr expr) {
    96         return getObject(expr) instanceof Func;
    97     }
    9897}
  • to-imperative/trunk/java/java/refal/plus/Dir.java

    r3701 r3721  
    1 /*
    2  * $Id$
    3  *
    4  * vim: set syntax=java expandtab shiftwidth=4 tabstop=4:
    5  */
     1// $Id$
    62
    73package refal.plus;
    84
    95import java.io.File;
    10 import java.lang.String;
    116
    127import org.refal.plus.Expr;
     
    1712
    1813public final class Dir implements Comparable<Dir> {
    19     private String[] files;
     14    private java.lang.String[] files;
    2015    private int pointer;
    2116
    22     public Dir (String name) throws RefalException {
     17    public Dir (java.lang.String name) throws RefalException {
    2318        files = (new File(name)).list();
    2419        if (files == null)
  • to-imperative/trunk/java/java/refal/plus/Dos.java

    r3707 r3721  
    33package refal.plus;
    44
    5 import java.lang.String;
    6 import java.lang.System;
    75import java.math.BigInteger;
    86import java.util.Calendar;
     
    1816
    1917public class Dos {
    20     private static final String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
     18    private static final java.lang.String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct",
    2119            "Nov", "Dec" };
    2220    private static final Character space = new Character(' ');
     
    6159    @RefalFormat("$func GetEnv e.varName = e.value;")
    6260    public static void GetEnv (Expr varName, Result value) {
    63         String str = System.getenv(varName.toChars().toString());
     61        java.lang.String str = java.lang.System.getenv(varName.toChars().toString());
    6462        if (str != null)
    6563            value.assign(str);
     
    7169    public static void Exit (Expr returnCode) throws RefalException {
    7270        try {
    73             System.exit(Symbol.intValue(returnCode));
     71            java.lang.System.exit(Symbol.intValue(returnCode));
    7472        } catch (ClassCastException _) {
    7573            throw new RefalException("Dos", "Exit", "Invalid argument");
  • to-imperative/trunk/java/java/refal/plus/File.java

    r3698 r3721  
    33package refal.plus;
    44
    5 import java.lang.String;
    6 import java.lang.System;
    75import java.math.BigInteger;
    86
     
    5755        // Meanwhile just check that the file exists.
    5856        try {
    59             String s = name.toChars().toString();
     57            java.lang.String s = name.toChars().toString();
    6058            if (!(new java.io.File(s)).exists())
    6159                return false;
    62             SecurityManager sm = System.getSecurityManager();
     60            SecurityManager sm = java.lang.System.getSecurityManager();
    6361            if (sm != null)
    6462                sm.checkExec(s);
  • to-imperative/trunk/java/java/refal/plus/StdIO.java

    r3705 r3721  
    55import java.io.File;
    66import java.io.IOException;
    7 import java.lang.String;
    8 import java.lang.System;
    97import java.math.BigInteger;
    108
     
    1715public class StdIO {
    1816    @RefalFormat("$channel StdIn;")
    19     public static final Expr StdIn = new Expr(Symbol.newChannel("StdIn", System.in));
     17    public static final Expr StdIn = new Expr(Symbol.newChannel("StdIn", java.lang.System.in));
    2018
    2119    @RefalFormat("$channel StdOut;")
    22     public static final Expr StdOut = new Expr(Symbol.newChannel("StdOut", System.out));
     20    public static final Expr StdOut = new Expr(Symbol.newChannel("StdOut", java.lang.System.out));
    2321
    2422    @RefalFormat("$channel StdErr;")
    25     public static final Expr StdErr = new Expr(Symbol.newChannel("StdErr", System.err));
     23    public static final Expr StdErr = new Expr(Symbol.newChannel("StdErr", java.lang.System.err));
    2624
    2725    @RefalFormat("$func Channel = s.channel;")
     
    3331    public static boolean PrimOpenFile (Expr channel, Expr file, Expr mode) {
    3432        try {
    35             String m = mode.at(0).toString();
     33            java.lang.String m = mode.at(0).toString();
    3634            if (m.equalsIgnoreCase("r"))
    3735                Symbol.getChannel(channel).openFileReader(file.toChars().toString());
     
    5351            Symbol.getChannel(channel).close();
    5452        } catch (IOException x) {
    55             String s = x.getMessage();
    56             if (s != null)
    57                 throw new RefalException("StdIO", "CloseChannel", s);
    58             throw new RefalException("StdIO", "CloseChannel", x.toString());
     53            java.lang.String s = x.getMessage();
     54            throw new RefalException("StdIO", "CloseChannel", s != null ? s : x.toString());
    5955        }
    6056    }
     
    6359    public static boolean PrimRead (Expr channel, Expr len, Result chars) throws RefalException {
    6460        try {
    65             //int n = Util.uintValue(len);
     61            // int n = Util.uintValue(len);
    6662            int n = ((BigInteger) len.at(0)).intValue();
    6763            char[] buf = new char[n];
     
    7571            return true;
    7672        } catch (IOException x) {
    77             String s = x.getMessage();
    78             if (s != null)
    79                 throw new RefalException("StdIO", "PrimRead", s);
    80             throw new RefalException("StdIO", "PrimRead", x.toString());
     73            java.lang.String s = x.getMessage();
     74            throw new RefalException("StdIO", "PrimRead", s != null ? s : x.toString());
    8175        }
    8276    }
     
    8478    @RefalFormat("$func Write e.Expr = ;")
    8579    public static void Write (Expr e) {
    86         System.out.print(e.toString());
     80        java.lang.System.out.print(e.toString());
    8781    }
    8882
    8983    @RefalFormat("$func WriteLn e.Expr = ;")
    9084    public static void WriteLn (Expr e) {
    91         System.out.println(e.toString());
     85        java.lang.System.out.println(e.toString());
    9286    }
    9387
     
    9993            throw new RefalException("StdIO", "WriteCh", "Invalid argument");
    10094        } catch (IOException x) {
    101             String s = x.getMessage();
    102             if (s != null)
    103                 throw new RefalException("StdIO", "WriteCh", s);
    104             throw new RefalException("StdIO", "WriteCh", x.toString());
     95            java.lang.String s = x.getMessage();
     96            throw new RefalException("StdIO", "WriteCh", s != null ? s : x.toString());
    10597        }
    10698    }
     
    113105            throw new RefalException("StdIO", "WriteLnCh", "Invalid argument");
    114106        } catch (IOException x) {
    115             String s = x.getMessage();
    116             if (s != null)
    117                 throw new RefalException("StdIO", "WriteLnCh", s);
    118             throw new RefalException("StdIO", "WriteLnCh", x.toString());
     107            java.lang.String s = x.getMessage();
     108            throw new RefalException("StdIO", "WriteLnCh", s != null ? s : x.toString());
    119109        }
    120110    }
     
    122112    @RefalFormat("$func Print e.Expr = ;")
    123113    public static void Print (Expr e) {
    124         System.out.print(e.toChars());
     114        java.lang.System.out.print(e.toChars());
    125115    }
    126116
    127117    @RefalFormat("$func PrintLn e.Expr = ;")
    128118    public static void PrintLn (Expr e) {
    129         System.out.println(e.toChars());
     119        java.lang.System.out.println(e.toChars());
    130120    }
    131121
     
    137127            throw new RefalException("StdIO", "PrintCh", "Invalid argument");
    138128        } catch (IOException x) {
    139             String s = x.getMessage();
    140             if (s != null)
    141                 throw new RefalException("StdIO", "PrintCh", s);
    142             throw new RefalException("StdIO", "PrintCh", x.toString());
     129            java.lang.String s = x.getMessage();
     130            throw new RefalException("StdIO", "PrintCh", s != null ? s : x.toString());
    143131        }
    144132    }
     
    151139            throw new RefalException("StdIO", "PrintLnCh", "Invalid argument");
    152140        } catch (IOException x) {
    153             String s = x.getMessage();
    154             if (s != null)
    155                 throw new RefalException("StdIO", "PrintLnCh", s);
    156             throw new RefalException("StdIO", "PrintLnCh", x.toString());
     141            java.lang.String s = x.getMessage();
     142            throw new RefalException("StdIO", "PrintLnCh", s != null ? s : x.toString());
    157143        }
    158144    }
     
    165151            throw new RefalException("StdIO", "Flush", "Invalid argument");
    166152        } catch (IOException x) {
    167             String s = x.getMessage();
    168             if (s != null)
    169                 throw new RefalException("StdIO", "Flush", s);
    170             throw new RefalException("StdIO", "Flush", x.toString());
     153            java.lang.String s = x.getMessage();
     154            throw new RefalException("StdIO", "Flush", s != null ? s : x.toString());
    171155        }
    172156    }
  • to-imperative/trunk/java/java/refal/plus/System.java

    r3693 r3721  
    1 /*
    2  * $Id$
    3  *
    4  * vim: set syntax=java expandtab shiftwidth=4 tabstop=4:
    5  */
     1// $Id$
    62
    73package refal.plus;
     
    117import java.io.InputStream;
    128import java.io.InputStreamReader;
    13 import java.lang.String;
    149import java.math.BigInteger;
    1510
     
    3328            try {
    3429                BufferedReader reader = new BufferedReader(new InputStreamReader(s));
    35                 String line;
     30                java.lang.String line;
    3631                while ((line = reader.readLine()) != null)
    3732                    java.lang.System.out.println(line);
     
    5247            Thread.yield();
    5348        } catch (InterruptedException e) {
    54             String s = e.getMessage();
     49            java.lang.String s = e.getMessage();
    5550            throw new RefalException("System", "System", s != null ? s : "Interrupted");
    5651        } catch (IOException e) {
    57             String s = e.getMessage();
     52            java.lang.String s = e.getMessage();
    5853            throw new RefalException("System", "System", s != null ? s : "Can't execute command");
    5954        } catch (SecurityException _) {
Note: See TracChangeset for help on using the changeset viewer.