Exemplo n.º 1
0
    public override object Apply(object a)
    {
        StreamWrapper wrapper = (StreamWrapper)CommonOp.Sync(a);

        ((StreamReader)wrapper.Stream).Close();
        return(Alice.Prebound.unit);
    }
Exemplo n.º 2
0
    public override object Apply(object a)
    {
        StreamWrapper wrapper = (StreamWrapper)CommonOp.Sync(a);

        try {
            return(((StreamReader)wrapper.Stream).ReadToEnd());
        } catch (System.Exception e) {
            object[] ar = new object[3] {
                e, "inputAll", wrapper.Name
            };                                                         //--**
            throw new Alice.Values.Exception(new ConVal(Prebound.IO_Io, ar));
        }
    }
Exemplo n.º 3
0
    public override object Apply(object a, object b)
    {
        StreamWrapper wrapper = (StreamWrapper)CommonOp.Sync(a);

        try {
            ((StreamWriter)wrapper.Stream).Write((Char)CommonOp.Sync(b));
            return(Alice.Prebound.unit);
        } catch (System.Exception e) {
            object[] ar = new object[3] {
                e, "output1", wrapper.Name
            };                                                        //--**
            throw new Alice.Values.Exception(new ConVal(Prebound.IO_Io, ar));
        }
    }
Exemplo n.º 4
0
    public override object Apply(object a)
    {
        string res =
            Environment.GetEnvironmentVariable((string)CommonOp.Sync(a));

        if (res == null)
        {
            return(Prebound.Option_NONE);
        }
        else
        {
            return(new TagVal(1, res));
        }
    }
Exemplo n.º 5
0
 public override object Apply(object a)
 {
     System.String name = "";
     try {
         name = (string)CommonOp.Sync(a);
         FileStream fs =
             new FileStream(name, FileMode.Open, FileAccess.Read);
         return(new StreamWrapper(name, new StreamReader(fs)));
     } catch (System.Exception e) {
         object[] ar = new object[3] {
             e, "openIn", name
         };                                               //--**
         throw new Alice.Values.Exception(new ConVal(Prebound.IO_Io, ar));
     }
 }
Exemplo n.º 6
0
    public static int[] NextTerms(int count, int term0, int term1)
    {
        Procedure nextTerms =
            (Procedure)CommonOp.Sync(((object[])CommonOp.Sync(Module))[1]);

        object[] array =
            (object[])CommonOp.Sync(nextTerms.Apply(count, term0, term1));

        int[] res = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            res[i] = (int)array[i];
        }
        return(res);
    }
Exemplo n.º 7
0
    public override object Apply(object a)
    {
        StreamWrapper wrapper = (StreamWrapper)CommonOp.Sync(a);

        try {
            System.String line = ((StreamReader)wrapper.Stream).ReadLine();
            if (line == null)
            {
                return("");
            }
            else
            {
                return(line + "\n");
            }
        } catch (System.Exception e) {
            object[] ar = new object[3] {
                e, "inputLine", wrapper.Name
            };                                                          //--**
            throw new Alice.Values.Exception(new ConVal(Prebound.IO_Io, ar));
        }
    }
Exemplo n.º 8
0
 public override object Apply(object a)
 {
     Console.Write((string)CommonOp.Sync(a));
     return(Alice.Prebound.unit);
 }
Exemplo n.º 9
0
 public override object Apply(object obj)
 {
     Environment.Exit((Int32)CommonOp.Sync(obj));
     return(Prebound.unit);
 }