Welcome to the homepage of MC# language!
MC# Project
Home page 
MC# language 
Documentation 
Publications 
 Code examples 
FAQ 

 
Downloads
MC# Programming 
System
 

 
Related links
Parallel C# 
Polyphonic C# 
SKIF Project 

 
Contacts
 Contacts 


Mono powered

Microsoft .Net powered


 
   What's new in MC#.Cluster Programming System v.1.4.3

Release notes. What’s new in version 1.4.3

 

 

You can download the latest version of MC#.Cluster Programming System <<< here >>>

 

 

Async keyword

 

Compiler now supports async keyword for launching methods in new threads. For example, now instead of writing the following code:

 

void SomeLoad()

{

...

}

 

public static void Main(string[] args)

{

 LoadTest lt = new LoadTest();

 Thread t = new Thread( new ThreadStart( lt.SomeLoad ) );

 t.Start();

}

 

you can write:

 

async SomeLoad()

{

...

}

 

public static void Main(string[] args)

{

 LoadTest lt = new LoadTest();

 lt.SomeLoad();

}

 

The most important thing is that it is possible to pass parameters to asynchronous methods:

 

async SomeLoad(int x, string y)

{

...

}

 

public static void Main(string[] args)

{

 LoadTest lt = new LoadTest();

 lt.SomeLoad(1, “qwerty”);

}

 

Please note that currently it is not possible to declare static async methods, but this will be available in the next release.

 

More info about asynchronous methods >>>

 

Runtime API

 

Our users requested the API for managing the cluster environment from their own C# programs. Now we’ve added a special Runtime class in the MCSharp namespace which contains the following methods:

 

public static bool Init( string[] args, out string output );

public static bool GetNodesList( out string output );

public static bool Finalize( bool force, out string output );

 

After installation of Windows version you can find the example in folder “C:\Program Files\MC# Group\ MC#.Cluster Programming System\examples\runtimeapi\” which demonstrates the usage of these methods. In Linux version it is located in folder “$MCSHARPPATH/examples/runtimeapi/”. Here is the copy of this example:

 

using System;

using System.Collections.Generic;

using System.Text;

using MCSharp;

 

namespace Examples.runtimeapi

{

 public class RuntimeAPITest

 {

  public static void Usage()

  {

   Console.WriteLine("This example demostrates how to boot or halt” +

    “ MC# Runtime Environment programatically");

   Console.WriteLine("Usage:");

   Console.WriteLine(" To start Runtime System run command:");

   Console.WriteLine("  RuntimeAPITest.exe boot [<fileName>]");

   Console.WriteLine(" To halt Runtime System run command(this fails” +

    “ if there are running applications):");

   Console.WriteLine("  RuntimeAPITest.exe halt");

   Console.WriteLine(" To halt Runtime System and stop all running” +

    “ applications run command:");

   Console.WriteLine("  RuntimeAPITest.exe halt force");

   Console.WriteLine(" To display the list of currently loaded” +

    “ nodes run command:");

   Console.WriteLine("  RuntimeAPITest.exe nodes");

  }

  public static void Main(string[] args)

  {

   if (args.Length == 0)

   {

    Usage();

    return;

   }

   Runtime.RMPort = 25001;

   Runtime.WNPort = 25002;

 

   if (args[0] == "boot")

   {

    // Booting Cluster Environment

    string output = "";

    if (args.Length > 1)

    {

     bool res =

      MCSharp.Runtime.Init(new string[] { args[1] }, out output);

     Console.WriteLine("Result of operation: " + res);

     Console.WriteLine("Description: \n" + output);

    }

    else

    {

     bool res = MCSharp.Runtime.Init(new string[] {}, out output);

     Console.WriteLine("Result of operation: " + res);

     Console.WriteLine("Description: \n" + output);

    }

   }

   else if (args[0] == "nodes")

   {

    string output = "";

    bool res = MCSharp.Runtime.GetNodesList(out output);

    Console.WriteLine("Result of operation: " + res);

    Console.WriteLine("Description: \n" + output);

   }

   else if (args[0] == "halt")

   {

    // Halting Runtime Environment

    if (args.Length > 1)

    {

     // Halt all running user applications...

     string output = "";

     bool res = MCSharp.Runtime.Finalize(true, out output);

     Console.WriteLine("Result of operation: " + res);

     Console.WriteLine("Description: \n" + output);

    }

    else

    {

     // Halt only if there aren't running user applications

     string output = "";

     bool res = MCSharp.Runtime.Finalize(false, out output);

     Console.WriteLine("Result of operation: " + res);

     Console.WriteLine("Description: \n" + output);

    }

   }

 

  }

 }

}

 



Interfaces support

 

Now MC# compiler supports interfaces:

 

using System;

 

interface A

{

 int b(int x);

}

 

class C : A

{

 public int b(int x)

 {

  return x + 1;

 }

}

 

public class test

{

 public static void Main(string[] args)

 {

  A a = new C();

  Console.WriteLine(a.b(5));

 }

}

 

Enumerations support

 

Now MC# compiler supports enumerations:

 

using System;

 

public class EnumTest

{

 enum Colors

 {

  Black = 1,

  Red = 2

 };

 

 public static void Main(string[] args)

 {

  Console.WriteLine(Colors.Black);

 }

}

 

Properties support

 

Now MC# compiler supports properties:

 

using System;

 

public class PropertiesTest

{

 private int _someProp;

 public int SomeProp

 {

  get

  {

   return _someProp;

  }

  set

  {

   this._someProp = value * 2;

  }

 }

 

 public static void Main(string[] args)

 {

  PropertiesTest pt = new PropertiesTest();

  pt.SomeProp = 5;

  Console.WriteLine(pt.SomeProp);

 }

}

 

Switch keyword support

 

Now MC# compiler supportsswitchanddefaultkeywords:

 

using System;

 

public class test

{

 public static void Main(string[] args)

 {

  int x = 5;

  switch (x)

  {

   case 3: Console.WriteLine("3"); break;

   case 5: Console.WriteLine("5"); break;

   default: Console.WriteLine("unknown"); break;

  }

 }

}

 

Throw keyword support

 

Now MC# compiler supportsthrowkeyword:

 

using System;

 

public class test

{

 public static void Main(string[] args)

 {

  try

  {

   throw new Exception("My exception");

  }

  catch (Exception e)

  {

   Console.WriteLine(e.ToString());

  }

 }

}

 

Using keyword support

 

Now MC# compiler has complete support forusingkeyword:

 

using System;

using System.IO;

 

class Test

{

 public static void Main()

 {

  try

  {

   // Create an instance of StreamReader to read from a file.

   // The using statement also closes the StreamReader.

   using (StreamReader sr = new StreamReader("TestFile.txt"))

   {

    String line;

    // Read and display lines from the file until the end of

    // the file is reached.

    while ((line = sr.ReadLine()) != null)

    {

     Console.WriteLine(line);

    }

   }

  }

  catch (Exception e)

  {

   // Let the user know what went wrong.

   Console.WriteLine("The file could not be read:");

   Console.WriteLine(e.Message);

  }

 }

}

 

 

 

 

You can download the latest version of MC#.Cluster Programming System <<< here >>>

 

 


Âåñü Ïåðåñëàâëü