Ejemplo n.º 1
0
 protected void EvaluateStatementInner( Document doc )
 {
     foreach(IStatement st in m_children)
     {
         st.EvaluateStatement( doc );
     }
 }
Ejemplo n.º 2
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);
            string value = doc.Resolve(m_value);

            doc.AppendLineFormat("{0} = {1};", name, value);
        }
Ejemplo n.º 3
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);
            string options = doc.Resolve(m_options);

            doc.AppendLineFormat("        {0} {1}", name, options);
        } 
Ejemplo n.º 4
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);

            doc.AppendLineFormat("{0}", name);
            doc.AppendLine("{"); EvaluateStatementInner(doc);
            doc.AppendLine("}");
        }
Ejemplo n.º 5
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);
            string baseAddress = doc.Resolve(m_baseAddress);
            string options = doc.Resolve(m_options);
            string size = doc.Resolve(m_size);

            doc.AppendLineFormat("    {0} : ORIGIN = {1}, LENGTH = {2}", name, baseAddress, size);
        }
Ejemplo n.º 6
0
        public override void EvaluateStatement(Document doc)
        {
            string name        = doc.Resolve( m_name        );
            string baseAddress = doc.Resolve( m_baseAddress );
            string options     = doc.Resolve( m_options     );
            string size        = doc.Resolve( m_size        );

            doc.AppendLineFormat( "{0} {1} {2} {3}", name, baseAddress, options, size );
            doc.AppendLine      ( "{"                                               ); EvaluateStatementInner( doc );
            doc.AppendLine      ( "}"                                               );
        }
Ejemplo n.º 7
0
        protected void ParseInner( Document doc, System.Xml.XmlNode node, Type type )
        {
            foreach(System.Xml.XmlNode subnode in node.ChildNodes)
            {
                if(subnode is System.Xml.XmlElement)
                {
                    object o = doc.Parse( subnode );

                    if(type != null && type.IsInstanceOfType( o ) == false)
                    {
                        throw Document.ParseException( "{0} is not an instance of {1}", subnode.Name, type.FullName );
                    }

                    m_children.Add( o );
                }
            }
        }
Ejemplo n.º 8
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);
            string baseAddress = doc.Resolve(m_baseAddress);
            string align = doc.Resolve(m_align);
            string options = doc.Resolve(m_options);
            string size = doc.Resolve(m_size);

            if (align.Length > 0)
            {
                doc.AppendLineFormat("    {0} {1} : ALIGN({2})", name, baseAddress, align);
            }
            else
            {
                doc.AppendLineFormat("    {0} {1} :", name, baseAddress);
            }

            doc.AppendLine("    {"); EvaluateStatementInner(doc);
            doc.AppendLineFormat("    }}{0}", options);
        }
Ejemplo n.º 9
0
 public void Parse( Document doc, System.Xml.XmlNode node )
 {
     m_name  = node.Attributes["Name" ].Value;
     m_value = node.Attributes["Value"].Value;
 }
Ejemplo n.º 10
0
        public void Parse( Document doc, System.Xml.XmlNode node )
        {
            m_name        = Document.ReadAttribute( node, "Name"    );
            m_baseAddress = Document.ReadAttribute( node, "Base"    );
            m_options     = Document.ReadAttribute( node, "Options" );
            m_size        = Document.ReadAttribute( node, "Size"    );

            ParseInner( doc, node, typeof(IStatement) );
        }
Ejemplo n.º 11
0
		public void EvaluateStatement( Document doc )
		{
			doc.AddVariable( m_name, doc.Resolve( m_value ) );
		}
Ejemplo n.º 12
0
        static public Document Load( string file, IEnvironment e )
        {
            Document doc = null;

            Console.WriteLine("Processing file: " + file);

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
            
            XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlDoc.NameTable);

            nsMgr.AddNamespace("ScatterNSOld", "http://tempuri.org/ScatterfileSchema.xsd");
            nsMgr.AddNamespace("ScatterNS",    "http://schemas.microsoft.com/netmf/ScatterfileSchema.xsd");

            xmlDoc.Load( file );

            try { doc = new Document(xmlDoc.SelectSingleNode("ScatterNS:ScatterFile", nsMgr), e);    } catch { }
            try { doc = new Document(xmlDoc.SelectSingleNode("ScatterNSOld:ScatterFile", nsMgr), e); } catch { }

            if (doc == null)
            {
                doc = new Document(xmlDoc.SelectSingleNode("ScatterFile"), e);
            }

            return doc;
        }
Ejemplo n.º 13
0
		public bool EvaluateCondition( Document doc )
		{
			foreach(ICondition c in m_children)
			{
				if(c.EvaluateCondition( doc ) == false) return false;
			}

			return true;
		}
Ejemplo n.º 14
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);

            doc.AppendLineFormat("        PROVIDE({0} = .);", name);
        }
Ejemplo n.º 15
0
        public override void EvaluateStatement(Document doc)
        {
            string name = doc.Resolve(m_name);

            doc.AppendLineFormat("ENTRY({0})", name);
        }
Ejemplo n.º 16
0
 public override void EvaluateStatement(Document doc)
 {
     // Nothing to do here for RVDS
 }
Ejemplo n.º 17
0
        public bool EvaluateCondition( Document doc )
        {
            Regex re = new Regex( m_value, RegexOptions.IgnoreCase );

            return re.IsMatch( doc.GetVariable( m_name ) );
        }
Ejemplo n.º 18
0
        public void EvaluateStatement( Document doc )
        {
            string name = doc.GetVariable( m_name );
            bool   fRes = (name != null);


            if(fRes && m_fOnlyDefined == false)
            {
                if(m_value != null)
                {
                    fRes = Regex.IsMatch( name, m_value, RegexOptions.IgnoreCase );
                }

                if(m_set != null)
                {
                    fRes = false;

                    foreach(string word in m_set.Split( ' ' ))
                    {
                        if(word != null && word.Length > 0)
                        {
                            if(String.Compare( name, word, true ) == 0)
                            {
                                fRes = true;
                                break;
                            }
                        }
                    }
                }
            }

            if(fRes == m_fPass)
            {
                EvaluateStatementInner( doc );
            }
        }
Ejemplo n.º 19
0
        public void Parse( Document doc, System.Xml.XmlNode node )
        {
            ParseInner( doc, node, typeof(IStatement) );

            m_name = node.Attributes["Name" ].Value;

            if(m_fOnlyDefined == false)
            {
                System.Xml.XmlAttribute attr;

                attr = node.Attributes["Value"]; if(attr != null) m_value = attr.Value;
                attr = node.Attributes["In"   ]; if(attr != null) m_set   = attr.Value;
            }
        }
Ejemplo n.º 20
0
		public bool EvaluateCondition( Document doc )
		{
			return m_child.EvaluateCondition( doc ) == false;
		}
Ejemplo n.º 21
0
		public void Parse( Document doc, System.Xml.XmlNode node )
		{
            ParseInner( doc, node, typeof(ICondition) );

            if(m_children.Count != 1)
            {
                throw Document.ParseException( "Not elements only accept one child condition" );
            }

            m_child = (ICondition)m_children[0];
        }
Ejemplo n.º 22
0
 public void EvaluateStatement( Document doc )
 {
     Console.WriteLine( "Error: {0}", m_message );
     throw new Exception( m_message );
 }
Ejemplo n.º 23
0
		public void EvaluateStatement( Document doc )
		{
			if(m_condition.EvaluateCondition( doc ))
			{
				if(m_positive != null) m_positive.EvaluateStatement( doc );
			}
			else
			{
				if(m_negative != null) m_negative.EvaluateStatement( doc );
			}
		}
Ejemplo n.º 24
0
		public void Parse( Document doc, System.Xml.XmlNode node )
		{
			m_name  = Document.ReadAttribute( node, "Name"  );
			m_value = Document.ReadAttribute( node, "Value" );
		}
Ejemplo n.º 25
0
		public void Parse( Document doc, System.Xml.XmlNode node )
		{
			foreach(System.Xml.XmlNode subnode in node.ChildNodes)
			{
				if(subnode.NodeType == System.Xml.XmlNodeType.Element)
				{
					object st = doc.Parse( subnode );

                    if(st is IStatement)
                    {
                        if     (subnode.Name == "Positive" ) m_positive = (IStatement)st;
                        else if(subnode.Name == "Negative" ) m_negative = (IStatement)st;
                        else                                 throw Document.ParseException( "{0} should be either Positive or Negative", subnode.Name );
                    }
                    else if(st is ICondition)
                    {
                        m_condition = (ICondition)st;
                    }
                    else
                    {
                        throw Document.ParseException( "{0} is not allowed in a conditional statement", subnode.Name );
                    }
                }
			}
		}
Ejemplo n.º 26
0
        //--//

        static public Document Load( string file, Document doc )
        {
            Document docRet = null;

            Console.WriteLine("Processing file: " + file);

            System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();

            XmlNamespaceManager nsMgr = new XmlNamespaceManager(xmlDoc.NameTable);

            nsMgr.AddNamespace("ScatterNSOld", "http://tempuri.org/ScatterfileSchema.xsd");
            nsMgr.AddNamespace("ScatterNS",    "http://schemas.microsoft.com/netmf/ScatterfileSchema.xsd");

            xmlDoc.Load( file );

            try { docRet = new Document(xmlDoc.GetElementsByTagName("ScatterFile", "ScatterNS").Item(0), doc);    } catch{}
            try { docRet = new Document(xmlDoc.GetElementsByTagName("ScatterFile", "ScatterNSOld").Item(0), doc); } catch{}

            if (docRet == null)
            {
                docRet = new Document(xmlDoc.GetElementsByTagName("ScatterFile").Item(0), doc);
            }

            return docRet;
        }
Ejemplo n.º 27
0
 public void Parse( Document doc, System.Xml.XmlNode node )
 {
     ParseInner( doc, node, typeof(IStatement) );
 }
Ejemplo n.º 28
0
		public void Parse( Document doc, System.Xml.XmlNode node )
		{
            ParseInner( doc, node, typeof(ICondition) );
		}
Ejemplo n.º 29
0
 public void EvaluateStatement( Document doc )
 {
     EvaluateStatementInner( doc );
 }
Ejemplo n.º 30
0
 public void Parse( Document doc, System.Xml.XmlNode node )
 {
     m_message = Document.ReadAttribute( node, "Message" );
 }