Exemple #1
0
        //=====================================================================
        /// <summary>
        /// Writes a class definition line - object: class1, class2, ...
        /// </summary>
        public void WriteObjectDecl(StreamWriter w, ObjectOrClass o,
                                     bool isExt)
        {
            ClassDef c = o as ClassDef;
            ObjectDef obj = o as ObjectDef;

            // if it's a class with a macro declaration, write the original
            if (c != null && c.OrigDef != null)
                w.Write("<code>"  + c.OrigDef
                        + " &nbsp;&nbsp;&nbsp;&nbsp; "
                        + "<i>// original source text"
                        + "</i></code><br>");

            // it it's external, put it in a table with a link to the file
            if (isExt)
                w.Write("<table class=decl><tr><td align=left>");

            w.Write("<code>");

            if (c != null)
            {
                if (c.IsIntrinsic)
                    w.Write("intrinsic ");
                w.WriteLine((c.IsGrammar ? "grammar" : "class") + " ");
            }
            else if (obj != null)
            {
                if (obj.IsTransient)
                    w.Write("transient ");
            }

            // if it's external, link the class name to its file
            if (isExt)
            {
                w.Write("<b>"
                        + Hyperlink("../" + this.ObjectFileName(o), o.Name)
                        + "</b> : ");
            }
            else if (c != null && c.GrammarProdObj != null)
            {
                int n;

                // link to the GrammarProd object definition
                n = c.Name.IndexOf('(');
                String gpName = (n < 0 ? c.Name : c.Name.Substring(0, n));
                String tag = (n < 0 ? "" : c.Name.Substring(n));

                w.Write("<b>"
                        + Hyperlink("../"
                                    + this.ObjectFileName(c.GrammarProdObj),
                                    gpName)
                        + tag + "</b> : ");
            }
            else
                w.Write("<b>" + o.Name + "</b> : ");

            foreach (object bc in o.BaseClasses)
            {
                if (bc is ObjectOrClass)
                    w.Write(" &nbsp; " + Hyperlink(
                        "../"
                        + this.ObjectFileName((ObjectOrClass)bc),
                        ((ObjectOrClass)bc).Name));
                else
                    w.Write(" &nbsp; " + bc.ToString());
            }

            if (c != null)
            {
                if (c.OrigDef != null)
                    w.Write(" &nbsp;&nbsp;&nbsp;&nbsp; "
                            + "<i>// after macro expansion</i>");
            }

            w.WriteLine("</code>");

            if (isExt)
                w.Write("<td align=right><code>" + FileLinks(o.Source)
                        + "</code></table>");
        }
Exemple #2
0
 private void WriteParentTree(StreamWriter w, ObjectOrClass cd, String indent)
 {
     w.Write("<code>" + indent);
     if (indent == "")
         w.WriteLine("<b>" + cd.Name + "</b></code><br>");
     //  else w.WriteLine("<a href=\"" + cd.Name + ".html\">" + cd.Name + "</a></code><br>");
     else w.WriteLine(Hyperlink("../" + this.ObjectFileName(cd), cd.Name)
                      + "</code><br>");
     indent += " &nbsp; &nbsp; &nbsp; &nbsp; ";
     foreach (object parent in cd.BaseClasses)
     {
         if (parent is ClassDef)
             this.WriteParentTree(w, (ClassDef) parent, indent);
         else if (parent is ObjectDef)
             this.WriteParentTree(w, (ObjectDef) parent, indent);
         else
             w.WriteLine("<code>" + indent + parent.ToString() + "</code><br>");
     }
 }
Exemple #3
0
        //=====================================================================
        /// <summary>
        /// Writes a summary of methods.
        /// </summary>
        public void WriteMethodSummary(StreamWriter w, ObjectOrClass cd)
        {
            int count = 0;

            ArrayList methodsWritten = new ArrayList();

            w.WriteLine("<code>");
            foreach (MethodDef m in cd.Methods)
            {
                this.WriteSummaryEntry(w, m.Name, m.Name, "");
                methodsWritten.Add(m.Name);
                count++;
            }
            w.WriteLine("</code><p>");

            foreach (object o in cd.BaseClasses)
            {
                ObjectOrClass bc = o as ObjectOrClass;
                if (bc != null)
                    count += this.WriteInheritedMethodSummary(w, bc, methodsWritten);
            }

            if (count == 0)
                w.WriteLine("<i>(none)</i>");
        }
Exemple #4
0
        //=====================================================================
        /// <summary>
        /// Writes a summary of inherited properties.
        /// </summary>
        /// <param name="propsWritten">list of properties already written</param>
        /// <returns>the number of properties written</returns>
        private int WriteInheritedPropertySummary(StreamWriter w, ObjectOrClass cd, ArrayList propsWritten)
        {
            int count = 0;

            ArrayList propsToWrite = this.GetUnwrittenProps(cd, propsWritten);
            if (propsToWrite.Count > 0)
                w.WriteLine("<p>Inherited from <code>" + cd.Name
                            + "</code> :<br>");

            w.WriteLine("<code>");
            foreach (PropertyDef p in propsToWrite)
            {
                this.WriteSummaryEntry(w, p.Name, p.Name, "../" + this.ObjectFileName(cd));
                propsWritten.Add(p.Name);
                count++;
            }
            w.WriteLine("</code><p>");

            foreach (object o in cd.BaseClasses)
            {
                ObjectOrClass bc = o as ObjectOrClass;
                if (bc != null)
                    count += this.WriteInheritedPropertySummary(w, bc, propsWritten);
            }

            return count;
        }
Exemple #5
0
 //=====================================================================
 /// <summary>
 /// Writes the tree of parent classes.
 /// </summary>
 private void WriteParentTree(StreamWriter w, ObjectOrClass cd)
 {
     this.WriteParentTree(w, cd, "");
 }
Exemple #6
0
        //=====================================================================
        /// <summary>
        /// Returns a list of the properties in the given class which are not
        /// in the given list of properties already written.
        /// </summary>
        private ArrayList GetUnwrittenProps(ObjectOrClass cd, ArrayList propsWritten)
        {
            ArrayList retList = new ArrayList();

            foreach (PropertyDef p in cd.Properties)
            {
                if (! propsWritten.Contains(p.Name))
                {
                    propsWritten.Add(p);
                    retList.Add(p);
                }
            }

            return retList;
        }
Exemple #7
0
        //=====================================================================
        /// <summary>
        /// Writes a summary of inherited methods.
        /// </summary>
        /// <param name="propsWritten">list of methods already written</param>
        /// <returns>the number of properties written</returns>
        private int WriteInheritedMethodSummary(StreamWriter w, ObjectOrClass cd, 
                                    ArrayList methodsWritten)
        {
            int count = 0;

            ArrayList methodsToWrite = this.GetUnwrittenMethods(cd, methodsWritten);
            if (methodsToWrite.Count > 0)
                w.WriteLine("<p>Inherited from <code>" + cd.Name + "</code> :<br>");

            w.WriteLine("<code>");
            foreach (MethodDef m in methodsToWrite)
            {
                this.WriteSummaryEntry(w, m.Name, m.Name, "../" + this.ObjectFileName(cd));
                methodsWritten.Add(m.Name);
                count++;
            }
            w.WriteLine("</code><p>");

            foreach (object o in cd.BaseClasses)
            {
                ObjectOrClass bc = o as ObjectOrClass;
                if (bc != null)
                    count += this.WriteInheritedMethodSummary(w, bc, methodsWritten);
            }

            return count;
        }
Exemple #8
0
        //=====================================================================
        /// <summary>
        /// Returns a list of the methods in the given class which are not
        /// in the given list of methods already written.
        /// </summary>
        private ArrayList GetUnwrittenMethods(ObjectOrClass cd, ArrayList methodsWritten)
        {
            ArrayList retList = new ArrayList();

            foreach (MethodDef m in cd.Methods)
            {
                if (! methodsWritten.Contains(m.Name))
                {
                    methodsWritten.Add(m);
                    retList.Add(m);
                }
            }

            return retList;
        }
Exemple #9
0
        //=====================================================================
        /// <summary>
        /// Writes a summary of properties.
        /// </summary>
        public void WritePropertySummary(StreamWriter w, ObjectOrClass cd)
        {
            int count = 0;

            ArrayList propsWritten = new ArrayList();

            w.WriteLine("<code>");
            foreach (PropertyDef p in cd.Properties)
            {
                this.WriteSummaryEntry(w, p.Name, p.Name, "");
                propsWritten.Add(p.Name);
                count++;
            }
            w.WriteLine("</code><p>");

            foreach (object o in cd.BaseClasses)
            {
                ObjectOrClass bc = o as ObjectOrClass;
                if (bc != null)
                    count += this.WriteInheritedPropertySummary(w, bc, propsWritten);
            }

            if (count == 0)
                w.WriteLine("<i>(none)</i>");
        }
Exemple #10
0
 //=====================================================================
 /// <summary>
 /// Checks for overridden methods.
 /// </summary>
 private bool _CheckForOverridden(ObjectOrClass baseClass)
 {
     foreach (MethodDef m in baseClass.Methods)
         if (m.Name == this.Name)
             return true;
     foreach (object o in baseClass.BaseClasses)
     {
         if (o is ClassDef)
             if (this._CheckForOverridden((ClassDef) o))
                 return true;
     }
     return false;
 }
Exemple #11
0
 //=====================================================================
 /// <summary>
 /// Checks for overridden methods.
 /// </summary>
 public void CheckForOverridden(ObjectOrClass baseClass)
 {
     foreach (object o in baseClass.BaseClasses)
     {
         if ((o is ClassDef) && (this._CheckForOverridden((ClassDef) o)))
         {
             this.Overridden = true;
             return;
         }
     }
 }
Exemple #12
0
 //=====================================================================
 /// <summary>
 /// Checks for overridden properties.
 /// </summary>
 private bool _CheckForOverridden(ObjectOrClass baseClass)
 {
     foreach (PropertyDef p in baseClass.Properties)
         if (p.Name == this.Name)
             return true;
     foreach (object o in baseClass.BaseClasses)
     {
         if (o is ClassDef)
             if (this._CheckForOverridden((ClassDef) o))
                 return true;
     }
     return false;
 }