Exemplo n.º 1
0
    public static int Main(string[] argv)
    {
        Hdf h = new Hdf();

          h.setValue("foo.1","1");
          h.setValue("foo.2","2");

          h.registerFileLoad(new Hdf.loadFileDelegate(loadFileHandler));

          h.readFile("test.hdf");

          Console.WriteLine("foo.2 = {0}", h.getValue("foo.2","def"));

          CSTContext cs = new CSTContext(h);

          Console.WriteLine("parsing file");
          h.setValue("hdf.loadpaths.0", ".");
          cs.registerFileLoad(new CSTContext.loadFileDelegate(loadFileHandler));
          try {
          cs.parseFile("test.cst");
          } catch (NeoException e) {
          Console.WriteLine("error: {0}", e.reason);
          Console.WriteLine("tb: {0}", e.full_traceback);
          }

          // cs.parseString(" foo.1 = <?cs var:foo.1 ?> ");
          // cs.parseString("this is a big tesT............ this is a big tesT............ this is a big tesT............ this is a big tesT............ this is a big tesT............ this is a big tesT............ this is a big tesT............ this is a big tesT............ .");

          Console.WriteLine("render file");
          Console.WriteLine(cs.render());
          return 0;
    }
Exemplo n.º 2
0
   public static unsafe int Main(string[] argv) {
      Hdf h = new Hdf();

      h.setValue("foo.1","1");
      h.setValue("foo.2","2");
      Console.WriteLine("foo.2 = {0}", h.getValue("foo.2","def"));

      CSTContext cs = new CSTContext(h);
//      cs.parseFile("test.cst");
      Console.WriteLine(cs.render());
      
      return 0;
   }
Exemplo n.º 3
0
   public static unsafe int Main(string[] argv) {
      Console.WriteLine("C# Clearsilver wrapper performance test");
      Hdf h = new Hdf();

      h.setValue("foo.1","1");
      h.setValue("foo.2","2");

      int call_count = 100000;
      int start = Environment.TickCount;
      for (int i=0;i<call_count;i++) {
         h.setValue(String.Format("foo.{0}",i),"5");
      }
      int end = Environment.TickCount;

      Console.WriteLine("call count = {0}, time = {1} ms - time per call {2} ns", 
           call_count, end-start, (((float)end-start)/call_count) * 1000);
      

      CSTContext cs = new CSTContext(h);
//      cs.parseFile("test.cst");
      Console.WriteLine(cs.render());
      
      return 0;
   }