Пример #1
0
        public void AddMacroDefine(MacroDefine md)
        {
            if (GetMacroDefineByName(md.Name) != null)
            {
                throw new AnalysisException(String.Format("redefine {0} macro define", md.Name));
            }

            macro_define_.Add(md);
        }
Пример #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
        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", "");
        }