public void CtorFileNotFoundException1 ()
		{
			string path = TempFolder + DSC + "thisfileshouldnotexists.test";
			DeleteFile (path);
			StdioFileStream stream = null;
			try {                		
				stream = new StdioFileStream (path, FileMode.Open);
			} finally {
				if (stream != null)
					stream.Close ();
				DeleteFile (path);
			}
		}			
		public void TestCtr ()
		{
			string path = TempFolder + DSC + "testfilestream.tmp.1";
			DeleteFile (path);
			StdioFileStream stream = null;
			try {
				stream = new StdioFileStream (path, FileMode.Create);
			} finally {

				if (stream != null)
					stream.Close ();
				DeleteFile (path);                	
			}
		}
		public void CtorAccess1Read2Read ()
		{
			StdioFileStream fs = null;
			StdioFileStream fs2 = null;
			try {
				if (!File.Exists ("temp")) {
					TextWriter tw = File.CreateText ("temp");
					tw.Write ("FOO");
					tw.Close ();
				}
				fs = new StdioFileStream ("temp", FileMode.Open, FileAccess.Read);
				fs2 = new StdioFileStream ("temp", FileMode.Open, FileAccess.Read);
			} finally {
				if (fs != null)
					fs.Close ();
				if (fs2 != null)
					fs2.Close ();
				if (File.Exists ("temp"))
					File.Delete ("temp");
			}
		}
		public void ReadBytePastEndOfStream () 
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);
			using (StdioFileStream stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Read)) {
				stream.Seek (0, SeekOrigin.End);
				Assert.AreEqual (-1, stream.ReadByte (), "ReadByte");
				stream.Close ();
			}
		}
		public void Seek_Disposed () 
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);
			StdioFileStream stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Write);
			stream.Close ();
			stream.Seek (0, SeekOrigin.Begin);
		}
		public void CtorArgumentException1 ()
		{
			StdioFileStream stream;
			stream = new StdioFileStream ("", FileMode.Create);
			stream.Close ();
		}			
		public void TestReadByteVerifyAccessMode ()
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);

			StdioFileStream stream = null;

			try {
				stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Write);
				int readByte = stream.ReadByte ();
			} finally {
				if (stream != null)
					stream.Close();
				DeleteFile (path);
			}
		}
		public void TestClose ()
		{
#if FALSE
			string path = TempFolder + Path.DirectorySeparatorChar + "TestClose";
			DeleteFile (path);

			StdioFileStream stream = new StdioFileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);

			stream.Write (new byte [] {1, 2, 3, 4}, 0, 4);
			stream.ReadByte ();                	
			stream.Close ();

			try {                	
				stream.ReadByte ();
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (ObjectDisposedException), e.GetType (), "test#01");
			}

			try {                	
				stream.WriteByte (64);
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (ObjectDisposedException), e.GetType (), "test#02");
			}

			try {                	
				stream.Flush ();
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (ObjectDisposedException), e.GetType (), "test#03");
			}

			try { 
				long l = stream.Length;
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (ObjectDisposedException), e.GetType (), "test#04");
			}

			try { 
				long l = stream.Position;
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (ObjectDisposedException), e.GetType (), "test#05");
			}

			try { 
				FilePosition fp = stream.FilePosition;
				fp.Dispose ();
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (ObjectDisposedException), e.GetType (), "test#05");
			}

			Assert.AreEqual (false, stream.CanRead, "test#06");
			Assert.AreEqual (false, stream.CanSeek, "test#07");
			Assert.AreEqual (false, stream.CanWrite, "test#08");                	

			DeleteFile (path);                	
#endif
		}
		public void CtorDirectoryNotFoundException ()
		{
			string path = TempFolder + DSC + "thisDirectoryShouldNotExists";
			if (Directory.Exists (path))
				Directory.Delete (path, true);

			StdioFileStream stream = null;				
			try {
				stream = new StdioFileStream (path + DSC + "eitherthisfile.test", FileMode.CreateNew);
			} finally {

				if (stream != null)
					stream.Close ();

				if (Directory.Exists (path))
					Directory.Delete (path, true);
			}                		
		}
Exemplo n.º 10
0
		public void CtorArgumentOutOfRangeException2 ()
		{
			StdioFileStream stream = null;
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);
			try {
				stream = new StdioFileStream ("test.test.test", FileMode.Append | FileMode.Open);
			} finally {
				if (stream != null)
					stream.Close ();
				DeleteFile (path);
			}                	
		}
Exemplo n.º 11
0
		public void CtorIOException1 ()
		{
			string path = TempFolder + DSC + "thisfileshouldexists.test";
			StdioFileStream stream = null;
			DeleteFile (path);
			try {
				stream = new StdioFileStream (path, FileMode.CreateNew);
				stream.Close ();
				stream = null;
				stream = new StdioFileStream (path, FileMode.CreateNew);
			} finally {

				if (stream != null)
					stream.Close ();
				DeleteFile (path);
			} 
		}
Exemplo n.º 12
0
        void parse(string file, string path)
        {
            objects = new Dictionary <int, obj> ();
            leaks   = new Dictionary <int, leak> ();

            Mono.Unix.StdioFileStream sfs = new Mono.Unix.StdioFileStream(file, FileMode.Open, FileAccess.Read);

            sr = new StreamReader(sfs);
            string s;
            int    count        = 0;
            bool   parsingLeaks = false;

            while (!sr.EndOfStream)
            {
                count++;
                s = sr.ReadLine().Trim();
                if (s.StartsWith("Deployment leak report:"))
                {
                    parsingLeaks = true;
                }
                if (s.StartsWith("End of leak report"))
                {
                    break;
                }
                if (parsingLeaks)
                {
                    parseReport(s);
                }
                else
                {
                    parseline(s);
                }
            }
            sfs.Close();

            if (!parsingLeaks)
            {
                foreach (KeyValuePair <int, obj> o in objects)
                {
                    leaks.Add(o.Value.ptr, new leak {
                        ptr = o.Value.ptr, name = o.Value.type
                    });
                    o.Value.leaked = true;
                }
            }
            else
            {
                foreach (KeyValuePair <int, obj> o in objects)
                {
                    if (leaks.ContainsKey(o.Key))
                    {
                        o.Value.leaked = true;
                    }
                }
            }

            StreamWriter sw;

            foreach (KeyValuePair <int, obj> list in objects)
            {
                obj o = list.Value;
                if (parsingLeaks && !o.leaked)
                {
                    continue;
                }

                sfs = new Mono.Unix.StdioFileStream(String.Format(path + "/" + "0x{0:x}_raw.dot", o.ptr),
                                                    FileMode.OpenOrCreate, FileAccess.Write);
                sw = new StreamWriter(sfs);

                sw.WriteLine("digraph " + o.type + " {");
                int cc = 0;

                foreach (action act in o.actions)
                {
                    sw.WriteLine("subgraph " + act.name + "_" + cc++ + " {");
                    int c = act.frames.Count;
                    for (int i = 0; i < act.frames.Count; i++)
                    {
                        Frame frame = act.frames[i];
                        if (i == 0)
                        {
                            sw.WriteLine(act.name + " [shape=box,style=bold,label=\"" + act.name + String.Format(" {0:x}", act.ptr) + "\"];");
                        }
                        else
                        {
                            sw.WriteLine(frame.name + "_{0:x} [label=\"{0:x}\\n" + frame.name + "\"];", frame.ptr);
                        }
                    }
                    for (int i = 0; i < act.frames.Count; i++)
                    {
                        Frame frame = act.frames[i];
                        if (i == 0)
                        {
                            sw.Write(act.name + "->");
                        }
                        if (i > 0)
                        {
                            sw.Write("->");
                        }
                        sw.Write(frame.name + "_{0:x}", frame.ptr);
                        if (i == 0)
                        {
                            sw.Write(" [label=\"ref=" + act.refcount + "\"]");
                        }
                        if (i < c - 1)
                        {
                            sw.Write(";" + frame.name + "_{0:x}", frame.ptr);
                        }
                    }
                    sw.WriteLine("\n}");
                }
                sw.WriteLine("\n}");
                sw.Close();
            }
        }
		public void SetLengthWithClosedBaseStream ()
		{
			StdioFileStream fs = new StdioFileStream ("temp", FileMode.Create);
			BufferedStream bs = new BufferedStream (fs);
			fs.Close ();

			bs.SetLength (1000);
		}
		public void Flush ()
		{
			string path = TempFolder + DSC + "StdioFileStreamTest.Flush";
			StdioFileStream stream = null;
			StdioFileStream stream2 = null;

			DeleteFile (path);

			try {
				stream = new StdioFileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);
				stream2 = new StdioFileStream (path, FileMode.Open, FileAccess.ReadWrite);

				stream.Write (new byte [] {1, 2, 3, 4, 5}, 0, 5);

				byte [] bytes = new byte [5];
				stream2.Read (bytes, 0, 5);

				Assert.AreEqual (0, bytes [0], "test#01");
				Assert.AreEqual (0, bytes [1], "test#02");
				Assert.AreEqual (0, bytes [2], "test#03");
				Assert.AreEqual (0, bytes [3], "test#04");

				stream.Flush ();
				stream2.Read (bytes, 0, 5);			
				Assert.AreEqual (1, bytes [0], "test#05");
				Assert.AreEqual (2, bytes [1], "test#06");
				Assert.AreEqual (3, bytes [2], "test#07");
				Assert.AreEqual (4, bytes [3], "test#08");
			} finally {
				if (stream != null)
					stream.Close ();
				if (stream2 != null)
					stream2.Close ();

				DeleteFile (path);
			}
		}
Exemplo n.º 15
0
		public void Seek ()
		{
			string path = TempFolder + DSC + "FST.Seek.Test";
			DeleteFile (path);			

			StdioFileStream stream = new StdioFileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);
			StdioFileStream stream2 = new StdioFileStream (path, FileMode.Open, FileAccess.ReadWrite);

			stream.Write (new byte [] {1, 2, 3, 4, 5, 6, 7, 8, 10}, 0, 9);
			Assert.AreEqual (5, stream2.Seek (5, SeekOrigin.Begin), "test#01");
			Assert.AreEqual (-1, stream2.ReadByte (), "test#02");

			Assert.AreEqual (2, stream2.Seek (-3, SeekOrigin.Current), "test#03");
			Assert.AreEqual (-1, stream2.ReadByte (), "test#04");

			Assert.AreEqual (12, stream.Seek (3, SeekOrigin.Current), "test#05");
			Assert.AreEqual (-1, stream.ReadByte (), "test#06");

			Assert.AreEqual (5, stream.Seek (-7, SeekOrigin.Current), "test#07");
			Assert.AreEqual (6, stream.ReadByte (), "test#08");

			Assert.AreEqual (5, stream2.Seek (5, SeekOrigin.Begin), "test#09");
			Assert.AreEqual (6, stream2.ReadByte (), "test#10");

			stream.Close ();
			stream2.Close ();

			DeleteFile (path);
		}
Exemplo n.º 16
0
		public void CtorArgumentException3 ()
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			StdioFileStream stream = null;

			DeleteFile (path);

			try {
				stream = new StdioFileStream (".test.test.test.2", FileMode.Truncate, FileAccess.Read);
			} finally {
				if (stream != null)
					stream.Close ();

				DeleteFile (path);
			}                	
		}
Exemplo n.º 17
0
		public void TestSeek ()
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "TestSeek";
			DeleteFile (path);

			StdioFileStream stream = new StdioFileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);
			stream.Write (new byte[] {1, 2, 3, 4, 5, 6, 7, 8 , 9, 10}, 0, 10);

			stream.Seek (5, SeekOrigin.End);
			Assert.AreEqual (-1, stream.ReadByte (), "test#01");

			stream.Seek (-5, SeekOrigin.End);
			Assert.AreEqual (6, stream.ReadByte (), "test#02");

			try {
				stream.Seek (-11, SeekOrigin.End);
				Assert.Fail ();
			} catch (Exception e) {
				Assert.AreEqual (typeof (IOException), e.GetType (), "test#03");
			}

			stream.Seek (19, SeekOrigin.Begin);
			Assert.AreEqual (-1, stream.ReadByte (), "test#04");

			stream.Seek (1, SeekOrigin.Begin);
			Assert.AreEqual (2, stream.ReadByte (), "test#05");

			stream.Seek (3, SeekOrigin.Current);
			Assert.AreEqual (6, stream.ReadByte (), "test#06");

			stream.Seek (-2, SeekOrigin.Current);
			Assert.AreEqual (5, stream.ReadByte (), "test#07");

			stream.Flush ();

			// Test that seeks work correctly when seeking inside the buffer
			stream.Seek (0, SeekOrigin.Begin);
			stream.WriteByte (0);
			stream.WriteByte (1);
			stream.Seek (0, SeekOrigin.Begin);
			byte[] buf = new byte [1];
			buf [0] = 2;
			stream.Write (buf, 0, 1);
			stream.Write (buf, 0, 1);
			stream.Flush ();
			stream.Seek (0, SeekOrigin.Begin);
			Assert.AreEqual (2, stream.ReadByte (), "test#08");
			Assert.AreEqual (2, stream.ReadByte (), "test#09");

			stream.Close ();

			DeleteFile (path);
		}
Exemplo n.º 18
0
		public void CtorIOException ()
		{			
			string path = TempFolder + DSC + "CTorIOException.Test";
			StdioFileStream stream = null;
			StdioFileStream stream2 = null;
			DeleteFile (path);

			try {
				stream = new StdioFileStream (path, FileMode.CreateNew);

				// used by an another process
				stream2 = new StdioFileStream (path, FileMode.OpenOrCreate);
			} finally {
				if (stream != null)
					stream.Close ();
				if (stream2 != null)
					stream2.Close ();
				DeleteFile (path);
			}
		}
Exemplo n.º 19
0
		public void TestWriteVerifyAccessMode ()
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);

			StdioFileStream stream = null;
			byte[] buffer;

			try {
				buffer = Encoding.ASCII.GetBytes ("test");
				stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Read);
				stream.Write (buffer, 0, buffer.Length);
			} finally {
				if (stream != null)
					stream.Close();
				DeleteFile (path);
			}
		}
Exemplo n.º 20
0
		public void CtorAccess1Read2Read ()
		{
			StdioFileStream fs = null;
			StdioFileStream fs2 = null;
			string tempPath = Path.Combine (TempFolder, "temp");
			try {
				if (!File.Exists (tempPath)) {
					TextWriter tw = File.CreateText (tempPath);
					tw.Write ("FOO");
					tw.Close ();
				}
				fs = new StdioFileStream (tempPath, FileMode.Open, FileAccess.Read);
				fs2 = new StdioFileStream (tempPath, FileMode.Open, FileAccess.Read);
			} finally {
				if (fs != null)
					fs.Close ();
				if (fs2 != null)
					fs2.Close ();
			}
		}
Exemplo n.º 21
0
		public void TestReadVerifyAccessMode ()
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);

			StdioFileStream stream = null;
			byte[] buffer = new byte [100];

			try {
				stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Write);
				stream.Read (buffer, 0, buffer.Length);
			} finally {
				if (stream != null)
					stream.Close ();
			}
		}
Exemplo n.º 22
0
		public void Write ()
		{
			string path = TempFolder + DSC + "StdioFileStreamTest.Write";

			DeleteFile (path);

			StdioFileStream stream = new StdioFileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);

			byte[] outbytes = new byte [] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
			byte[] bytes = new byte [15];

			// Check that the data is flushed when we overflow the buffer
			// with a large amount of data
			stream.Write (outbytes, 0, 5);
			stream.Write (outbytes, 5, 10);
			stream.Seek (0, SeekOrigin.Begin);

			stream.Read (bytes, 0, 15);
			for (int i = 0; i < 15; ++i)
				Assert.AreEqual (i + 1, bytes [i]);

			// Check that the data is flushed when we overflow the buffer
			// with a small amount of data
			stream.Write (outbytes, 0, 7);
			stream.Write (outbytes, 7, 7);
			stream.Write (outbytes, 14, 1);

			stream.Seek (15, SeekOrigin.Begin);
			Array.Clear (bytes, 0, bytes.Length);
			stream.Read (bytes, 0, 15);
			for (int i = 0; i < 15; ++i)
				Assert.AreEqual (i + 1, bytes [i]);
			stream.Close ();
		}
Exemplo n.º 23
0
		public void TestFlushNotOwningHandle ()
		{
			string path = Path.Combine (TempFolder, "TestFlushNotOwningHandle");
			DeleteFile (path);

			StdioFileStream s = new StdioFileStream (path, FileMode.Create);
			using (StdioFileStream s2 = new StdioFileStream (s.Handle, FileAccess.Write, false)) {
				byte[] buf = new byte [2];
				buf [0] = (int)'1';
				s2.Write (buf, 0, 1);
			}

			s.Position = 0;
			Assert.AreEqual (s.ReadByte (), (int)'1');
			s.Close ();
		}
Exemplo n.º 24
0
		public void Length ()
		{
			// Test that the Length property takes into account the data
			// in the buffer
			string path = TempFolder + DSC + "StdioFileStreamTest.Length";

			DeleteFile (path);

			StdioFileStream stream = new StdioFileStream (path, FileMode.CreateNew);

			byte[] outbytes = new byte [] {1, 2, 3, 4};

			stream.Write (outbytes, 0, 4);
			Assert.AreEqual (stream.Length, 4);
			stream.Close ();
		}
Exemplo n.º 25
0
		public void Position_Disposed () 
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			DeleteFile (path);
			StdioFileStream stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Read);
			stream.Close ();
			stream.Position = 0;
		}
Exemplo n.º 26
0
		public void Flush ()
		{
#if XXX
		    // This test depends too much on the internal implementation of stdio's FILE
		    
			string path = TempFolder + DSC + "StdioFileStreamTest.Flush";
			StdioFileStream stream = null;
			StdioFileStream stream2 = null;

			DeleteFile (path);

			try {
				stream = new StdioFileStream (path, FileMode.CreateNew, FileAccess.ReadWrite);
				stream2 = new StdioFileStream (path, FileMode.Open, FileAccess.ReadWrite);

				stream.Write (new byte [] {1, 2, 3, 4, 5}, 0, 5);

				byte [] bytes = new byte [5];
				stream2.Read (bytes, 0, 5);

				Assert.AreEqual (0, bytes [0], "test#01");
				Assert.AreEqual (0, bytes [1], "test#02");
				Assert.AreEqual (0, bytes [2], "test#03");
				Assert.AreEqual (0, bytes [3], "test#04");

				stream.Flush ();
				stream2.Read (bytes, 0, 5);			
				Assert.AreEqual (1, bytes [0], "test#05");
				Assert.AreEqual (2, bytes [1], "test#06");
				Assert.AreEqual (3, bytes [2], "test#07");
				Assert.AreEqual (4, bytes [3], "test#08");
			} finally {
				if (stream != null)
					stream.Close ();
				if (stream2 != null)
					stream2.Close ();

				Console.WriteLine ("P: " + path);
				//DeleteFile (path);
			}
#endif
		}
Exemplo n.º 27
0
		public void CtorArgumentNullException ()
		{
			StdioFileStream stream = new StdioFileStream (null, FileMode.Create);
			stream.Close ();
		}
Exemplo n.º 28
0
		public void TestDefaultProperties ()
		{
#if XXX
			string path = TempFolder + Path.DirectorySeparatorChar + "testStdioFileStream.tmp.2";
			DeleteFile (path);

			StdioFileStream stream = new StdioFileStream (path, FileMode.Create);

			Assert.AreEqual (true, stream.CanRead, "test#01");
			Assert.AreEqual (true, stream.CanSeek, "test#02");
			Assert.AreEqual (true, stream.CanWrite, "test#03");
			Assert.AreEqual (0, stream.Position, "test#06");
			Assert.AreEqual ("Mono.Unix.StdioFileStream", stream.ToString(), "test#07");
			stream.Close ();
			DeleteFile (path);

			stream = new StdioFileStream (path, FileMode.OpenOrCreate, FileAccess.Read);
			Assert.AreEqual (true, stream.CanRead, "test#08");
			Assert.AreEqual (true, stream.CanSeek, "test#09");
			Assert.AreEqual (false, stream.CanWrite, "test#10");
			Assert.AreEqual (0, stream.Position, "test#13");
			Assert.AreEqual ("Mono.Unix.StdioFileStream", stream.ToString(), "test#14");                	
			stream.Close ();

			stream = new StdioFileStream (path, FileMode.Truncate, FileAccess.Write);
			Assert.AreEqual (false, stream.CanRead, "test#15");
			Assert.AreEqual (true, stream.CanSeek, "test#16");
			Assert.AreEqual (true, stream.CanWrite, "test#17");
			Assert.AreEqual (0, stream.Position, "test#20");
			Assert.AreEqual ("Mono.Unix.StdioFileStream", stream.ToString(), "test#21");                	
			stream.Close ();
			DeleteFile (path);
#endif
		}
Exemplo n.º 29
0
		public void SetLengthWithClosedBaseStream ()
		{
			string path = TempFolder + Path.DirectorySeparatorChar + "temp";
			StdioFileStream fs = new StdioFileStream (path, FileMode.Create);
			BufferedStream bs = new BufferedStream (fs);
			fs.Close ();

			bs.SetLength (1000);
		}
Exemplo n.º 30
0
		void parse (string file, string path) {
			objects = new Dictionary<int, obj> ();
			leaks = new Dictionary<int, leak> ();

			Mono.Unix.StdioFileStream sfs = new Mono.Unix.StdioFileStream (file, FileMode.Open, FileAccess.Read);

			sr = new StreamReader(sfs);
			string s;
			int count = 0;
			bool parsingLeaks = false;
			while (!sr.EndOfStream) {
				count++;
				s = sr.ReadLine ().Trim();
				if (s.StartsWith ("Deployment leak report:"))
					parsingLeaks = true;
				if (s.StartsWith ("End of leak report"))
					break;
				if (parsingLeaks)
					parseReport (s);
				else
					parseline (s);
				
			}
			sfs.Close ();

			if (!parsingLeaks) {
				foreach (KeyValuePair<int, obj> o in objects) {
					leaks.Add (o.Value.ptr, new leak {ptr = o.Value.ptr, name = o.Value.type});
					o.Value.leaked = true;
				}
			} else {
				foreach (KeyValuePair<int, obj> o in objects) {
					if (leaks.ContainsKey (o.Key))
						o.Value.leaked = true;
				}
			}
			
			StreamWriter sw;
			foreach (KeyValuePair<int, obj> list in objects) {
				obj o = list.Value;
				if (parsingLeaks && !o.leaked)
					continue;

				sfs = new Mono.Unix.StdioFileStream (String.Format (path + "/" + "0x{0:x}_raw.dot", o.ptr), 
				                                     FileMode.OpenOrCreate, FileAccess.Write);
				sw = new StreamWriter (sfs);
				
				sw.WriteLine ("digraph " + o.type + " {");
				int cc = 0;
				
				foreach (action act in o.actions) {
					sw.WriteLine ("subgraph " + act.name + "_" + cc++ + " {");
					int c = act.frames.Count;
					for (int i = 0; i < act.frames.Count; i++) {
						Frame frame = act.frames[i];
						if (i == 0)
							sw.WriteLine (act.name + " [shape=box,style=bold,label=\"" + act.name + String.Format (" {0:x}", act.ptr) + "\"];");
						else
							sw.WriteLine (frame.name + "_{0:x} [label=\"{0:x}\\n" + frame.name + "\"];", frame.ptr);
					}
					for (int i = 0; i < act.frames.Count; i++) {
						Frame frame = act.frames[i];
						if (i == 0)
							sw.Write (act.name + "->");
						if (i > 0)
							sw.Write ("->");
						sw.Write (frame.name + "_{0:x}", frame.ptr);
						if (i == 0)
							sw.Write (" [label=\"ref=" + act.refcount  +"\"]");
						if (i < c - 1)
							sw.Write (";" + frame.name + "_{0:x}", frame.ptr);
					}
					sw.WriteLine ("\n}");
				}
				sw.WriteLine ("\n}");
				sw.Close ();
			}

		}