예제 #1
0
 /// <summary>
 /// Check useType node for defined-type reference, or call checkComplexType for complex node.
 /// </summary>
 /// <remarks>
 /// This check should apply to the following scenarios:
 /// <list>
 /// Wherever a useType element is found (in struct, array, union, dataset),
 /// Empty typeName attribute is given for a useType element
 /// The typeName given by the useType element is not already defined before this reference in the definitions section
 /// </list>
 /// </remarks>
 /// <param name="aNode"></param>
 /// <param name="defs"></param>
 /// <param name="report"></param>
 private static void checkUseType(AbstractNode aNode, Hashtable defs, ArrayList report)
 {
     if (aNode.GetType().Equals(typeof(UseTypeNode)))
     {
         string sTypeName = aNode.getTypeName();
         if (sTypeName == null || sTypeName.Length < 1)
         {
             report.Add("Error: invalid type name at '" + aNode.toNodeText() + "'.");
         }
         else if (sTypeName.Equals(typeNameJustDefined))
         {
             report.Add("Error: recursively referencing the type for '" + aNode.toNodeText() + "'.");
         }
         else
         {
             if (!defs.Contains(sTypeName))
             {
                 report.Add("Error: type '" + sTypeName + "' used before defined at '" + aNode.toNodeText() + "'.");
             }
         }
     }
     else if (aNode.isComplex())
     {
         checkComplexType((ComplexNode)aNode, defs, report);
     }
 }
예제 #2
0
 /// <summary>
 /// Update text to be displayed on the tree node with the text from the Data node.
 /// </summary>
 public void updateText()
 {
     if (dataNode_ != null)
     {
         this.Text = dataNode_.toNodeText();
     }
 }
예제 #3
0
        /// <summary>
        /// Text to show in a treeview node.
        /// array of type [][][]...
        /// </summary>
        /// <returns></returns>
        public override string toNodeText()
        {
            string s       = getTypeName();
            string VarName = getVarName();

            if (VarName != null && VarName.Length > 0)
            {
                s = VarName + " : " + s;
            }
            if (sizeRef_ != null)
            {
                s += "(" + sizeRef_.toNodeText() + ")";
            }
            return(s);
        }
예제 #4
0
 /// <summary>
 /// Check to see whether there's variable-sized construct in an array. These include arrayVariable, arrayStreamed, union, string.
 /// </summary>
 /// <remarks>
 /// This check should apply to the following scenarios:
 /// <list>
 /// Arrays contain arrayVariable, arrayStreamed, or union
 /// Arrays contain struct which contains any of the above three elements
 /// Arrays contain a number of embedded structs at least one of which contains any of the above three elements
 /// Arrays contain arrayFixed which contains one of the above as element
 /// Arrays contain a number of embedded arrayFixed any of which contains any of the above three elements
 /// </list>
 /// </remarks>
 /// <param name="node"></param>
 /// <param name="report"></param>
 private static void checkVariableConstruct(AbstractNode node, ArrayList report)
 {
     if (node.GetType().Equals(typeof(StructNode)))
     {
         foreach (AbstractNode aNode in ((StructNode)node).getMembers())
         {
             if (aNode.isComplex())
             {
                 checkVariableConstruct(aNode, report);
             }
         }
     }
     else if (node.GetType().Equals(typeof(UnionNode)))
     {
         report.Add("Warning: BinX library version 1.x does not support arrays containing union [" + node.toNodeText() + "].");
     }
     else if (node.GetType().Equals(typeof(ArrayNode)))
     {
         ArrayNode aNode = (ArrayNode)node;
         if (aNode.isArrayFixed() == false)
         {
             report.Add("Warning: BinX library version 1.x does not support arrays containing variable-sized arrays [" + aNode.toNodeText() + "].");
         }
         else
         {
             checkVariableConstruct(aNode.getElement(), report);
         }
     }
 }
예제 #5
0
        /// <summary>
        /// Check for duplicate variable names.
        /// </summary>
        /// <remarks>
        /// This check should apply to the following two scenarios:
        /// <list>
        /// Two or more data elements have the same variable name in the Dataset section
        /// Two or more data elements in a struct have the same variable name
        /// </list>
        /// </remarks>
        /// <param name="aNode"></param>
        /// <param name="varNames"></param>
        /// <param name="report"></param>
        private static void checkVarNames(AbstractNode aNode, Hashtable varNames, ArrayList report)
        {
            string sVarName = aNode.getVarName();

            if (sVarName != null && sVarName.Length > 0)
            {
                if (varNames.Contains(sVarName))
                {
                    report.Add("Warning: duplicate variable name '" + sVarName + "' in '" + aNode.toNodeText() + "'.");
                }
                else
                {
                    varNames.Add(sVarName, sVarName);
                }
            }
        }
예제 #6
0
 public void setDataNode(AbstractNode val)
 {
     dataNode_ = val;
     this.Text = dataNode_.toNodeText();
 }
예제 #7
0
 public DataNode(AbstractNode dataNode)
 {
     this.dataNode_  = dataNode;
     this.Text       = dataNode.toNodeText();
     this.ImageIndex = this.SelectedImageIndex = getImageIndex(dataNode);
 }
예제 #8
0
 public DataNode(AbstractNode dataNode)
 {
     this.dataNode_ = dataNode;
     this.Text = dataNode.toNodeText();
     this.ImageIndex = this.SelectedImageIndex = getImageIndex(dataNode);
 }
예제 #9
0
 public void setDataNode(AbstractNode val)
 {
     dataNode_ = val;
     this.Text = dataNode_.toNodeText();
 }
예제 #10
0
 /// <summary>
 /// Check for duplicate variable names.
 /// </summary>
 /// <remarks>
 /// This check should apply to the following two scenarios:
 /// <list>
 /// Two or more data elements have the same variable name in the Dataset section
 /// Two or more data elements in a struct have the same variable name
 /// </list>
 /// </remarks>
 /// <param name="aNode"></param>
 /// <param name="varNames"></param>
 /// <param name="report"></param>
 private static void checkVarNames(AbstractNode aNode, Hashtable varNames, ArrayList report)
 {
     string sVarName = aNode.getVarName();
     if (sVarName!=null && sVarName.Length > 0)
     {
         if (varNames.Contains(sVarName))
         {
             report.Add("Warning: duplicate variable name '" + sVarName + "' in '" + aNode.toNodeText() + "'.");
         }
         else
         {
             varNames.Add(sVarName, sVarName);
         }
     }
 }
예제 #11
0
 /// <summary>
 /// Check to see whether there's variable-sized construct in an array. These include arrayVariable, arrayStreamed, union, string.
 /// </summary>
 /// <remarks>
 /// This check should apply to the following scenarios:
 /// <list>
 /// Arrays contain arrayVariable, arrayStreamed, or union
 /// Arrays contain struct which contains any of the above three elements
 /// Arrays contain a number of embedded structs at least one of which contains any of the above three elements
 /// Arrays contain arrayFixed which contains one of the above as element
 /// Arrays contain a number of embedded arrayFixed any of which contains any of the above three elements
 /// </list>
 /// </remarks>
 /// <param name="node"></param>
 /// <param name="report"></param>
 private static void checkVariableConstruct(AbstractNode node, ArrayList report)
 {
     if (node.GetType().Equals(typeof(StructNode)))
     {
         foreach (AbstractNode aNode in ((StructNode)node).getMembers())
         {
             if (aNode.isComplex())
             {
                 checkVariableConstruct(aNode, report);
             }
         }
     }
     else if (node.GetType().Equals(typeof(UnionNode)))
     {
         report.Add("Warning: BinX library version 1.x does not support arrays containing union ["+node.toNodeText()+"].");
     }
     else if (node.GetType().Equals(typeof(ArrayNode)))
     {
         ArrayNode aNode = (ArrayNode)node;
         if (aNode.isArrayFixed()==false)
         {
             report.Add("Warning: BinX library version 1.x does not support arrays containing variable-sized arrays ["+aNode.toNodeText()+"].");
         }
         else
         {
             checkVariableConstruct(aNode.getElement(), report);
         }
     }
 }
예제 #12
0
 /// <summary>
 /// Check useType node for defined-type reference, or call checkComplexType for complex node.
 /// </summary>
 /// <remarks>
 /// This check should apply to the following scenarios:
 /// <list>
 /// Wherever a useType element is found (in struct, array, union, dataset),
 /// Empty typeName attribute is given for a useType element
 /// The typeName given by the useType element is not already defined before this reference in the definitions section
 /// </list>
 /// </remarks>
 /// <param name="aNode"></param>
 /// <param name="defs"></param>
 /// <param name="report"></param>
 private static void checkUseType(AbstractNode aNode, Hashtable defs, ArrayList report)
 {
     if (aNode.GetType().Equals(typeof(UseTypeNode)))
     {
         string sTypeName = aNode.getTypeName();
         if (sTypeName==null || sTypeName.Length < 1)
         {
             report.Add("Error: invalid type name at '" + aNode.toNodeText() + "'.");
         }
         else if (sTypeName.Equals(typeNameJustDefined))
         {
             report.Add("Error: recursively referencing the type for '" + aNode.toNodeText() + "'.");
         }
         else
         {
             if (!defs.Contains(sTypeName))
             {
                 report.Add("Error: type '" + sTypeName + "' used before defined at '" + aNode.toNodeText() + "'.");
             }
         }
     }
     else if (aNode.isComplex())
     {
         checkComplexType((ComplexNode)aNode, defs, report);
     }
 }