public void Comment(IAsm a) { if (Io.gendebug) { if (localsdone) { if (a != null && il != null) { if (!IsNextNonInsnGen(a)) { // Console.WriteLine("Line ("+a.getCommentLine().ToString()+")="+a.getComment()); int l = a.getCommentLine(); il.MarkSequencePoint(srcdoc, l, 0, l, 0); } } } } }
public void Comment(IAsm a) { String sp = a.getComment(); /* source ptr */ if (sp == null) return; // empty comment sp.Trim(); // remove extra whitespace if (sp == null || sp.Length == 0) /* sanity check, is there a comment? */ return; /* no, then nothing to do */ #if DEBUG Console.Write("Comment SP="); for (int _debug_i=0; _debug_i<sp.Length;_debug_i++) { int _debug_d = sp[_debug_i]; char _debug_c = (char) (_debug_d + 96); if (_debug_d < 32) Console.Write("^"+Char.ToString(_debug_c)); else Console.Write(sp[_debug_i]); Console.Write("["); Console.Write(_debug_d); Console.Write("],"); } Console.WriteLine(";"); #endif StringBuilder buf = new StringBuilder(MyC.MAXSTR); /* a buffer to work with */ buf.Append("//"); buf.Append(a.getCommentLine()); buf.Append(": "); int i = 0; int p = 0; while ((i = sp.IndexOf('\n', i)) >= 0) { i++; // move past the newline string ts = sp.Substring(p, i-p); String s = ts.Trim(); if (s.Length > 0) buf.Append(s); // copy the substr buf.Append("\r\n"); // add the line seperator if (i < sp.Length) buf.Append("//"); // insert the comment block p = i; } buf.Append(sp.Substring(p)); // append the remaining chars buf.Append("\r\n"); io.Out(buf.ToString()); /* output the comment */ }
public void Comment(IAsm a) { String sp = a.getComment(); /* source ptr */ if (sp == null) { return; // empty comment } sp.Trim(); // remove extra whitespace if (sp == null || sp.Length == 0) /* sanity check, is there a comment? */ { return; /* no, then nothing to do */ } #if DEBUG Console.Write("Comment SP="); for (int _debug_i = 0; _debug_i < sp.Length; _debug_i++) { int _debug_d = sp[_debug_i]; char _debug_c = (char)(_debug_d + 96); if (_debug_d < 32) { Console.Write("^" + Char.ToString(_debug_c)); } else { Console.Write(sp[_debug_i]); } Console.Write("["); Console.Write(_debug_d); Console.Write("],"); } Console.WriteLine(";"); #endif StringBuilder buf = new StringBuilder(MyC.MAXSTR); /* a buffer to work with */ buf.Append("//"); buf.Append(a.getCommentLine()); buf.Append(": "); int i = 0; int p = 0; while ((i = sp.IndexOf('\n', i)) >= 0) { i++; // move past the newline string ts = sp.Substring(p, i - p); String s = ts.Trim(); if (s.Length > 0) { buf.Append(s); // copy the substr } buf.Append("\r\n"); // add the line seperator if (i < sp.Length) { buf.Append("//"); // insert the comment block } p = i; } buf.Append(sp.Substring(p)); // append the remaining chars buf.Append("\r\n"); io.Out(buf.ToString()); /* output the comment */ }