public void PrintHtml(StreamWriterLevel wr, int p) { wr.WriteLine("<div style=\"width: 100%\">"); wr.WriteLine(string.Format("<h2 >Module : {0}</h2>", m_moduleID)); wr.WriteLine("<font face=\"Courier\" color=\"DimGray\"><pre>"); wr.WriteLine(wr.BR(m_comments)); wr.WriteLine("</pre></font>"); List<TypeAssigment> topLevelPDUs = GetTopLevelTypes(); if (!DefaultBackend.displayTypesAsAppearInAsn1Grammar) { foreach (ICDTypeAssigment tas in topLevelPDUs) tas.PrintHtml(wr, p + 1); } foreach (ICDTypeAssigment tas in m_typeAssigments.Values) if (!topLevelPDUs.Contains(tas)) { tas.PrintHtml(wr, p + 1); } wr.WriteLine("</div>"); }
//Default implementation of PrintHtml for all types public static void PrintHtml(Asn1Type pThis, PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints) { o.WriteLine("<a name=\"{0}\"></a>", "ICD_" + tas.m_name.Replace("-", "_")); o.WriteLine("<table border=\"0\" width=\"100%\" >"); o.WriteLine("<tbody>"); o.WriteLine("<tr bgcolor=\"{0}\">", (tas.m_createdThroughTabulization ? "#379CEE" : "#FF8f00")); o.WriteLine("<td height=\"35\" colspan=\"2\" >"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"4\">{0}</font><font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">({1}) </font>", tas.m_name, pThis.Name); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\"><a href=\"#{0}\">ASN.1</a></font>", "ASN1_" + tas.m_name.Replace("-", "_")); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" align=\"center\">"); o.WriteLine(" <font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">min = {0} bytes</font>", (pThis.MinBytesInPER == -1 ? "∞" : pThis.MinBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" align=\"center\">"); o.WriteLine(" <font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">max = {0} bytes{1}</font>", (pThis.MaxBytesInPER == -1 ? "∞" : pThis.MaxBytesInPER.ToString()), pThis.MaxBitsInPER_Explained); o.WriteLine("</td>"); o.WriteLine("</tr>"); IInternalContentsInHtml pICIH = pThis as IInternalContentsInHtml; string tmp = string.Empty; if (pICIH != null) tmp = pICIH.InternalContentsInHtml(additonalConstraints); if (comment.Count > 0 || tmp.Length > 0) { o.WriteLine("<tr class=\"CommentRow\">"); o.WriteLine("<td class=\"comment2\" colspan=\"4\">" + o.BR(comment) + tmp + "</td>"); o.WriteLine("</tr>"); } o.WriteLine("<tr class=\"headerRow\">"); o.WriteLine("<td class=\"hrconstraint2\" colspan=\"2\">Constraints</td>"); o.WriteLine("<td class=\"hrMin2\">Min Length (bits)</td>"); o.WriteLine("<td class=\"hrMax2\">Max Length (bits)</td>"); o.WriteLine("</tr>"); o.WriteLine("<tr class=\"OddRow\">"); o.WriteLine(" <td class=\"constraint\" colspan=\"2\">{0}</td>", o.Constraint(pThis.Constraints + BaseConstraint.AsString(additonalConstraints))); o.WriteLine(" <td class=\"min\" >{0}</td>", pThis.MinBitsInPER); o.WriteLine(" <td class=\"max\" >{0}{1}</td>", pThis.MaxBitsInPER, pThis.MaxBitsInPER_Explained); o.WriteLine("</tr>"); o.WriteLine("</tbody>"); o.WriteLine("</table>"); }
public static void PrintHtml(SizeableType pThis, PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints) { WithComponentConstraint withComp = null; if (additonalConstraints != null && additonalConstraints.Count > 0) withComp = additonalConstraints[0] as WithComponentConstraint; o.WriteLine("<a name=\"{0}\"></a>", "ICD_" + tas.m_name.Replace("-", "_")); o.WriteLine("<table border=\"0\" width=\"100%\" >"); o.WriteLine("<tbody>"); o.WriteLine("<tr bgcolor=\"{0}\">", (tas.m_createdThroughTabulization ? "#379CEE" : "#FF8f00")); o.WriteLine("<td height=\"35\" colspan=\"3\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"4\">{0}</font><font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">({1}) </font>", tas.m_name, pThis.Name); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\"><a href=\"#{0}\">ASN.1</a></font>", "ASN1_" + tas.m_name.Replace("-", "_")); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" colspan=\"2\" align=\"center\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">min = {0} bytes</font>", (pThis.MinBytesInPER == -1 ? "∞" : pThis.MinBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" colspan=\"2\" align=\"center\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">max = {0} bytes</font>", (pThis.MaxBytesInPER == -1 ? "∞" : pThis.MaxBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("</tr>"); IInternalContentsInHtml pICIH = pThis as IInternalContentsInHtml; if (pICIH != null) comment.Add(pICIH.InternalContentsInHtml(additonalConstraints)); if (comment.Count > 0) { o.WriteLine("<tr class=\"CommentRow\">"); o.WriteLine("<td class=\"comment\" colspan=\"7\">" + o.BR(comment) + "</td>"); o.WriteLine("</tr>"); } o.WriteLine("<tr class=\"headerRow\">"); o.WriteLine("<td class=\"hrNo\">No</td>"); o.WriteLine("<td class=\"hrField\">Field</td>"); o.WriteLine("<td class=\"hrComment\">Comment</td>"); o.WriteLine("<td class=\"hrType\">Type</td>"); o.WriteLine("<td class=\"hrconstraint\">Constraint</td>"); o.WriteLine("<td class=\"hrMin\">Min Length (bits)</td>"); o.WriteLine("<td class=\"hrMax\">Max Length (bits)</td>"); o.WriteLine("</tr>"); IConstraint innerTypeConstraint = null; if (withComp != null) innerTypeConstraint = withComp.m_innerTypeConstraint; PrintSizeLengthHtml(pThis, cns, o, lev + 1, BaseConstraint.AsString(additonalConstraints)); PrintItemHtml(pThis, cns, o, 1, innerTypeConstraint); long mxItems = pThis.maxItems(cns); if (mxItems > 2 || mxItems==-1) { o.WriteLine("<tr class=\"CommentRow\">"); o.WriteLine("<td class=\"threeDots\" colspan=\"7\"> <p>. . .</p> </td>"); o.WriteLine("</tr>"); } if (pThis.maxItems(cns) >= 2 || mxItems==-1) PrintItemHtml(pThis, cns, o, pThis.maxItems(cns), innerTypeConstraint); o.WriteLine("</tbody>"); o.WriteLine("</table>"); }
public void PrintHtml(StreamWriterLevel o, int p, int index, WithComponentsConstraint.Component cmp) { IInternalContentsInHtml intCont = m_type as IInternalContentsInHtml; string cssClass = "OddRow"; if (index % 2 == 0) cssClass = "EvenRow"; o.WriteLine("<tr class=\"" + cssClass + "\">"); o.WriteLine("<td class=\"no\">{0}</td>", index); o.WriteLine("<td class=\"field\">{0}</td>", m_childVarName); if (intCont == null) o.WriteLine("<td class=\"comment\">{0}</td>", o.BR(m_comments)); else o.WriteLine("<td class=\"comment\">{0}</td>", o.BR(m_comments) + intCont.InternalContentsInHtml(m_type.m_constraints)); if (m_optional) o.WriteLine("<td class=\"optional\">Yes</td>"); else if (m_default) o.WriteLine("<td class=\"optional\">Def</td>"); else o.WriteLine("<td class=\"optional\">No</td>"); if (m_type is ReferenceType) o.WriteLine("<td class=\"type\"> <a href=\"#ICD_{0}\">{1}</a></td>", m_type.Name.Replace("-", "_"), m_type.Name); else o.WriteLine("<td class=\"type\">{0}</td>", m_type.Name); string withComponentPart = string.Empty; if (cmp != null) { withComponentPart = "<span style=\"color: yellow\">"; if (cmp.m_valueConstraint != null) withComponentPart += " (" + cmp.m_valueConstraint.ToString() + ")"; if (cmp.m_presenceConstraint != WithComponentsConstraint.Component.PresenseConstraint.None) withComponentPart += " " + cmp.m_presenceConstraint.ToString(); withComponentPart += "</span>" + ICDBType.WithComponentWhy; ICDBackend.m_WithComponentMustBeExplained = true; } o.WriteLine("<td class=\"constraint\">{0}</td>", o.Constraint(m_type.Constraints + withComponentPart)); if (m_type.GetFinalType() is IntegerType && m_type.MinBitsInPER == 0 && m_type.MaxBitsInPER == 0) { o.WriteLine("<td class=\"min\">0{0}</td>", ICDBType.ZeroBitsWhy); o.WriteLine("<td class=\"max\">0{0}</td>", ICDBType.ZeroBitsWhy); ICDBackend.m_ZeroBitsMustBeExplained = true; } else { o.WriteLine("<td class=\"min\">{0}</td>", (m_type.MinBitsInPER == -1 ? "∞" : m_type.MinBitsInPER.ToString())); o.WriteLine("<td class=\"max\">{0}{1}</td>", (m_type.MaxBitsInPER == -1 ? "∞" : m_type.MaxBitsInPER.ToString()), m_type.MaxBitsInPER_Explained); } o.WriteLine("</tr>"); }
public static void PrintHtml(SequenceOrSetType pThis, PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints) { WithComponentsSeqConstraint withCom = null; if (additonalConstraints!=null && additonalConstraints.Count > 0) withCom = additonalConstraints[0] as WithComponentsSeqConstraint; o.WriteLine("<a name=\"{0}\"></a>", "ICD_" + tas.m_name.Replace("-", "_")); o.WriteLine("<table border=\"0\" width=\"100%\" >"); o.WriteLine("<tbody>"); o.WriteLine("<tr bgcolor=\"{0}\">", (tas.m_createdThroughTabulization ? "#379CEE" : "#FF8f00")); o.WriteLine("<td height=\"35\" colspan=\"4\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"4\">{0}</font><font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">({1}) </font>", tas.m_name, pThis.Name); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\"><a href=\"#{0}\">ASN.1</a></font>", "ASN1_" + tas.m_name.Replace("-", "_")); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" colspan=\"2\" align=\"center\">"); long minBytesInPER = pThis.MinBytesInPER; o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">min = {0} bytes</font>", (minBytesInPER == -1 ? "∞" : minBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" colspan=\"2\" align=\"center\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">max = {0} bytes</font>", (pThis.MaxBytesInPER == -1 ? "∞" : pThis.MaxBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("</tr>"); if (comment.Count > 0) { o.WriteLine("<tr class=\"CommentRow\">"); o.WriteLine("<td class=\"comment\" colspan=\"8\">" + o.BR(comment) + "</td>"); o.WriteLine("</tr>"); } o.WriteLine("<tr class=\"headerRow\">"); o.WriteLine("<td class=\"hrNo\">No</td>"); o.WriteLine("<td class=\"hrField\">Field</td>"); o.WriteLine("<td class=\"hrComment\">Comment</td>"); o.WriteLine("<td class=\"hrOptional\">Optional</td>"); o.WriteLine("<td class=\"hrType\">Type</td>"); o.WriteLine("<td class=\"hrconstraint\">Constraint</td>"); o.WriteLine("<td class=\"hrMin\">Min Length (bits)</td>"); o.WriteLine("<td class=\"hrMax\">Max Length (bits)</td>"); o.WriteLine("</tr>"); int index = 0; if (pThis.PreambleLength > 0) { PrintPreambleHtml(pThis, o, lev + 1); index = 1; } foreach (ICDSequenceOrSetTypeChild ch in pThis.m_children.Values) { WithComponentsConstraint.Component component = null; if (withCom != null && withCom.m_components.ContainsKey(ch.m_childVarName)) component = withCom.m_components[ch.m_childVarName]; ch.PrintHtml(o, lev + 1, ++index, component); } o.WriteLine("</tbody>"); o.WriteLine("</table>"); }
public void PrintHtml(PEREffectiveConstraint cns, StreamWriterLevel o, int lev, List<string> comment, TypeAssigment tas, List<IConstraint> additonalConstraints) { WithComponentsChConstraint withCom = null; if (additonalConstraints != null && additonalConstraints.Count > 0) withCom = additonalConstraints[0] as WithComponentsChConstraint; o.WriteLine("<a name=\"{0}\"></a>", "ICD_" + tas.m_name.Replace("-", "_")); o.WriteLine("<table border=\"0\" width=\"100%\" >"); o.WriteLine("<tbody>"); o.WriteLine("<tr bgcolor=\"{0}\">", (tas.m_createdThroughTabulization ? "#379CEE" : "#FF8f00")); o.WriteLine("<td height=\"35\" colspan=\"3\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"4\">{0}</font><font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">({1}) </font>", tas.m_name, Name); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\"><a href=\"#{0}\">ASN.1</a></font>", "ASN1_" + tas.m_name.Replace("-", "_")); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" colspan=\"2\" align=\"center\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">min = {0} bytes</font>", (MinBytesInPER == -1 ? "∞" : MinBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("<td height=\"35\" colspan=\"2\" align=\"center\">"); o.WriteLine("<font face=\"Verdana\" color=\"#FFFFFF\" size=\"2\">max = {0} bytes</font>", (MaxBytesInPER == -1 ? "∞" : MaxBytesInPER.ToString())); o.WriteLine("</td>"); o.WriteLine("</tr>"); if (comment.Count > 0) { o.WriteLine("<tr class=\"CommentRow\">"); o.WriteLine("<td class=\"comment\" colspan=\"7\">" + o.BR(comment) + "</td>"); o.WriteLine("</tr>"); } o.WriteLine("<tr class=\"headerRow\">"); o.WriteLine("<td class=\"hrNo\">No</td>"); o.WriteLine("<td class=\"hrField\">Field</td>"); o.WriteLine("<td class=\"hrComment\">Comment</td>"); o.WriteLine("<td class=\"hrType\">Type</td>"); o.WriteLine("<td class=\"hrconstraint\">Constraint</td>"); o.WriteLine("<td class=\"hrMin\">Min Length (bits)</td>"); o.WriteLine("<td class=\"hrMax\">Max Length (bits)</td>"); o.WriteLine("</tr>"); int index = 1; int chFldNo = 1; if (IsPERExtensible()) { PrintChoiceExtBitHtml(o, index, chFldNo); chFldNo++; index++; } if (m_children.Count > 1) { PrintChoiceIndexHtml(o, lev + 1, index, chFldNo); chFldNo++; index++; } foreach (ICDChoiceChild ch in m_children.Values) { WithComponentsConstraint.Component component = null; if (withCom != null && withCom.m_components.ContainsKey(ch.m_childVarName)) component = withCom.m_components[ch.m_childVarName]; ch.PrintHtml(o, lev + 1, index, chFldNo, component); index++; } o.WriteLine("</tbody>"); o.WriteLine("</table>"); }