コード例 #1
0
ファイル: WrenchTarget.cs プロジェクト: retahc/old-code
        internal bool DoFixup(NameLookupContext nlc, IWarningLogger log)
        {
            log.PushLocation(FullName);

            try {
                if (ResolveTemplate(nlc, log))
                {
                    return(true);
                }

                ApplyWaitTags();

                // Now register our tags with the GraphBuilder

                GraphBuilder gb = (GraphBuilder)Owner.Owner;

                foreach (string tag in TagsWithValues)
                {
                    if (gb.GetTagId(tag) < 0)
                    {
                        return(true);
                    }
                }

                // Now make sure that all of our argument names are valid.

                Rule rinst = (Rule)Activator.CreateInstance(Rule);
                Dictionary <string, int> argmap = rinst.MakeArgNameMap();

                foreach (string arg in ArgsWithDeps)
                {
                    if (argmap.ContainsKey(arg))
                    {
                        continue;
                    }

                    string s = String.Format("Argument `{0}' does not exist in rule " +
                                             "`{1}'", arg, Rule);
                    log.Error(2024, s, null);
                    return(true);
                }
            } finally {
                log.PopLocation();
            }

            return(false);
        }
コード例 #2
0
ファイル: WarningLoggerProxy.cs プロジェクト: retahc/old-code
    // IWarningLogger

    public void PushLocation(string loc)
    {
        real.PushLocation(loc);
    }
コード例 #3
0
 void Warning(int category, string text, string detail)
 {
     log.PushLocation(Location);
     log.Warning(category, text, detail);
     log.PopLocation();
 }
コード例 #4
0
ファイル: WrenchTarget.cs プロジェクト: emtees/old-code
	internal bool DoFixup (NameLookupContext nlc, IWarningLogger log) 
	{
	    log.PushLocation (FullName);

	    try {
		if (ResolveTemplate (nlc, log))
		    return true;

		ApplyWaitTags ();

		// Now register our tags with the GraphBuilder

		GraphBuilder gb = (GraphBuilder) Owner.Owner;

		foreach (string tag in TagsWithValues) {
		    if (gb.GetTagId (tag) < 0)
			return true;
		}
		
		// Now make sure that all of our argument names are valid.
		
		Rule rinst = (Rule) Activator.CreateInstance (Rule);
		Dictionary<string,int> argmap = rinst.MakeArgNameMap ();
		
		foreach (string arg in ArgsWithDeps) {
		    if (argmap.ContainsKey (arg))
			continue;
			
		    string s = String.Format ("Argument `{0}' does not exist in rule " +
					      "`{1}'", arg, Rule);
		    log.Error (2024, s, null);
		    return true;
		}
	    } finally {
		log.PopLocation ();
	    }

	    return false;
	}
コード例 #5
0
ファイル: Result.cs プロジェクト: emtees/old-code
		public static Result ImportXml (XmlReader xr, out string id, IWarningLogger log) {
			id = null;

			if (xr.Name != "result") {
				log.Warning (3019, "Expected 'result' node but got " + xr.Name + " on XML import", null);
				return null;
			}

			id = xr.GetAttribute ("id");

			if (id == null) {
				log.Warning (3019, "No 'id' attribute on result element during XML import", null);
				return null;
			}

			log.PushLocation (id);

			string type = xr.GetAttribute ("type");

			if (type == null) {
				log.Warning (3019, "No 'type' attribute on result element during XML import", null);
				log.PopLocation ();
				return null;
			}

			int depth = xr.Depth;
			Result r;

			while (xr.Read ())
				if (xr.NodeType != XmlNodeType.Attribute &&
				    xr.NodeType != XmlNodeType.Whitespace)
					break;

			//Console.WriteLine ("here: id {0}, type {1}", id, type);
			//Console.WriteLine ("here: {0}: {1} = \"{2}\"; ac = {3}, d = {4} (vs {5})", xr.NodeType, xr.Name, xr.Value,
			//		   xr.AttributeCount, xr.Depth, depth);

			try {
				Type t;

				t = System.Type.GetType (type, false);

				if (t == null) {
					log.Warning (3019, "Unknown result type during XML import", type);
					log.PopLocation ();
					return null;
				}

				if (!t.IsSubclassOf (typeof (Result))) {
					log.Warning (3019, "Type is not a subclass of Result", t.FullName);
					log.PopLocation ();
					return null;
				}
				
				r = MyCreateInstance (t);

				if (r.ImportXml (xr, log)) {
					log.PopLocation ();
					// error will be reported
					return null;
				}
				log.PopLocation ();
			} finally {
				while (xr.Depth > depth) {
					if (!xr.Read ()) {
						log.Warning (3019, "Unexpected end of XML document", null);
						break;
					}
				}
			}

			return r;
		}
コード例 #6
0
ファイル: ActionLog.cs プロジェクト: retahc/old-code
 public void PushLocation(string loc)
 {
     uilog.PushLocation(loc);
 }
コード例 #7
0
        public static Result ImportXml(XmlReader xr, out string id, IWarningLogger log)
        {
            id = null;

            if (xr.Name != "result")
            {
                log.Warning(3019, "Expected 'result' node but got " + xr.Name + " on XML import", null);
                return(null);
            }

            id = xr.GetAttribute("id");

            if (id == null)
            {
                log.Warning(3019, "No 'id' attribute on result element during XML import", null);
                return(null);
            }

            log.PushLocation(id);

            string type = xr.GetAttribute("type");

            if (type == null)
            {
                log.Warning(3019, "No 'type' attribute on result element during XML import", null);
                log.PopLocation();
                return(null);
            }

            int    depth = xr.Depth;
            Result r;

            while (xr.Read())
            {
                if (xr.NodeType != XmlNodeType.Attribute &&
                    xr.NodeType != XmlNodeType.Whitespace)
                {
                    break;
                }
            }

            //Console.WriteLine ("here: id {0}, type {1}", id, type);
            //Console.WriteLine ("here: {0}: {1} = \"{2}\"; ac = {3}, d = {4} (vs {5})", xr.NodeType, xr.Name, xr.Value,
            //		   xr.AttributeCount, xr.Depth, depth);

            try {
                Type t;

                t = System.Type.GetType(type, false);

                if (t == null)
                {
                    log.Warning(3019, "Unknown result type during XML import", type);
                    log.PopLocation();
                    return(null);
                }

                if (!t.IsSubclassOf(typeof(Result)))
                {
                    log.Warning(3019, "Type is not a subclass of Result", t.FullName);
                    log.PopLocation();
                    return(null);
                }

                r = MyCreateInstance(t);

                if (r.ImportXml(xr, log))
                {
                    log.PopLocation();
                    // error will be reported
                    return(null);
                }
                log.PopLocation();
            } finally {
                while (xr.Depth > depth)
                {
                    if (!xr.Read())
                    {
                        log.Warning(3019, "Unexpected end of XML document", null);
                        break;
                    }
                }
            }

            return(r);
        }