示例#1
0
        public override void LoadFromXml(XmlElement e)
        {
            base.LoadFromXml(e);

            if (Type == ProMetaConst.DATATYPE_LOCALSTRUCT)
            {
                string lstr = XmlUtil.GetAttrStrVal(e, "struct-name", "");
                if (lstr == "")
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=local-struct must define struct-name property", owner_.Name));
                }

                ref_local_struct_ = owner_.GetLocalStructByName(lstr);
                if (ref_local_struct_ == null)
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=local-struct define struct-name[{1}] not exist", owner_.Name, lstr));
                }
            }

            if (Type == ProMetaConst.DATATYPE_GLOBALSTRUCT)
            {
                string lstr = XmlUtil.GetAttrStrVal(e, "struct-name", "");
                if (lstr == "")
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=global-struct must define struct-name property", owner_.Name));
                }

                ref_global_struct_ = ProMetaHelper.Instance().GetGlobalStructByName(lstr);
                if (ref_global_struct_ == null)
                {
                    throw new exception.AnalysisException(String.Format("pro-meta/pro[{0}]/members/member type=global-struct define struct-name[{1}] not exist", owner_.Name, lstr));
                }
            }
        }
示例#2
0
        protected void AnalyseMacroDefine(XmlElement e)
        {
            string name = XmlUtil.GetAttrStrVal(e, "name", "");

            if (name == "")
            {
                throw new exception.AnalysisException(String.Format("pro-region/macro-define/macro node must define a name"));
            }
            MacroDefine md = new MacroDefine(name, this);

            md.LoadFromXml(e);

            ProMetaHelper.Instance().AddMacroDefine(md);
        }
示例#3
0
        protected void AnalyseGlobalEnum(XmlElement e)
        {
            string name = XmlUtil.GetAttrStrVal(e, "name", "");

            if (name == "")
            {
                throw new exception.AnalysisException(String.Format("pro-region/global-enum/enum node must define a name"));
            }
            EnumStruct es = new EnumStruct(name, this);

            es.LoadFromXml(e);

            ProMetaHelper.Instance().AddGlobalEnum(es);
        }
示例#4
0
        public virtual void LoadFromXml(XmlElement e)
        {
            name_ = XmlUtil.GetAttrStrVal(e, "name", "");
            if (name_ == "")
            {
                throw new exception.AnalysisException(String.Format("member node must defined a name property"));
            }

            islist_ = XmlUtil.GetAttrBoolValByYesNo(e, "islist", false);

            isbasearray_ = XmlUtil.GetAttrBoolValByYesNo(e, "isarray", false);
            if (isbasearray_)
            {
                array_ref_ = XmlUtil.GetAttrStrVal(e, "array-ref", "");
                if (array_ref_ == "")
                {
                    throw new exception.AnalysisException(String.Format("array-ref[{0}] of the member node defined not defined", array_ref_));
                }
            }

            type_ = XmlUtil.GetAttrStrVal(e, "type", ProMetaConst.DATATYPE_NOTSUPPORT);
            if (!ProMetaConst.IsValidDataType(type_))
            {
                throw new exception.AnalysisException(String.Format("type property[{0}] of the member node defined not supported by system", type_));
            }

            //basic type array or static string , need to define macrolen or ilen
            if (type_ == ProMetaConst.DATATYPE_STATICSTRING || isbasearray_)
            {
                string mstr = XmlUtil.GetAttrStrVal(e, "macrolen", "");
                if (mstr != "")
                {
                    macrolen_ = ProMetaHelper.Instance().GetMacroDefineByName(mstr);
                    if (macrolen_ == null)
                    {
                        throw new exception.AnalysisException(String.Format("macrolen property[{0}] of the member node defined not defined", mstr));
                    }
                }

                ilen_ = XmlUtil.GetAttrIntVal(e, "ilen", ProMetaConst.INVALIDE_VALUE);

                if (ilen_ == ProMetaConst.INVALIDE_VALUE && macrolen_ == null)
                {
                    throw new exception.AnalysisException(String.Format("the member[{0}] of the static string type must define macrolen or ilen property", name_));
                }
            }

            desc_ = XmlUtil.GetAttrStrVal(e, "desc", "");
        }