void ScanTags(WrenchTarget wt)
        {
            foreach (KeyValuePair <string, SingleValue <TargetBuilder> > kvp in wt.Tags)
            {
                int tagid = gb.GetTagId(kvp.Key);

                if (tagid < 0)
                {
                    throw ExHelp.Argument("tag", "Invalid tag name {0}", kvp.Key);
                }

                List <int> list;

                if (tag_items.ContainsKey(tagid))
                {
                    list = tag_items[tagid];
                }
                else
                {
                    list             = new List <int> ();
                    tag_items[tagid] = list;
                }

                list.Add(wt.Id);
                list.Add(CompileSingleValue(kvp.Value));
            }
        }
Beispiel #2
0
        static void WriteTargetTags(GraphBuilder gb, WrenchTarget wt, XmlTextWriter tw)
        {
            foreach (KeyValuePair <string, SingleValue <int> > kvp in wt.IdTags)
            {
                int tagid = gb.GetTagId(kvp.Key);

                if (tagid < 0)
                {
                    throw ExHelp.Argument("tag", "Invalid tag name {0}", kvp.Key);
                }

                if (kvp.Value.IsResult)
                {
                    tw.WriteStartElement("rt");
                    tw.WriteAttributeString("id", tagid.ToString());
                    ((Result)kvp.Value).ExportXml(tw, "r");
                }
                else
                {
                    tw.WriteStartElement("tt");
                    tw.WriteAttributeString("id", tagid.ToString());
                    tw.WriteAttributeString("target", ((int)kvp.Value).ToString());
                }

                tw.WriteEndElement();
            }
        }
Beispiel #3
0
        protected override TargetBuilder CreateTarget(string name)
        {
            WrenchTarget wt = new WrenchTarget(this, name, next_target_id++);

            targids[name] = wt.Id;

            return(wt);
        }
Beispiel #4
0
	protected override TargetBuilder CreateTarget (string name)
	{
	    WrenchTarget wt = new WrenchTarget (this, name, next_target_id++);

	    targids[name] = wt.Id;

	    return wt;
	}
            int WriteNameForTarget(BinaryGraphSerializer bsg, int lowid, int offset)
            {
                WrenchTarget tb = targids[lowid];

                byte[] data = bsg.enc.GetBytes(tb.Name);
                bsg.bw.Write(data);

                return(data.Length);
            }
Beispiel #6
0
 bool WriteTarget(string elt, int aid, WrenchTarget targ)
 {
     tw.WriteStartElement(elt);
     if (aid >= 0)
     {
         tw.WriteAttributeString("arg", aid.ToString());
     }
     tw.WriteAttributeString("id", targ.Id.ToString());
     tw.WriteEndElement();
     return(false);
 }
        void StartTarget(string name)
        {
            if (CheckTargetName(name))
            {
                return;
            }

            cur_targ = (WrenchTarget)wp.DefineTarget(name, log);
            // FIXME: if the fails we log an error but the rest of the code
            // will nullref almost instantly. Gets the job done, but ugly.
            cur_arg_name = null;
        }
            int WriteDepsForTarget(BinaryGraphSerializer bsg, int tid, int offset)
            {
                WrenchTarget tb       = targids[tid];
                int          nwritten = 0;

                DepsCollector dc = new DepsCollector(bsg);

                tb.VisitDependencies(dc);
                nwritten = dc.Write();

                return(nwritten);
            }
            public void WriteProviderData(BinaryGraphSerializer bsg)
            {
                bsg.bw.Write(dep_offsets.Length);
                bsg.bw.Write(pb.Basis);
                bsg.bw.Write(pb.DeclarationLoc);
                bsg.bw.Write(dep_chunk_len);
                BinaryHelper.WriteRaw(bsg.bw, dep_offsets);
                bsg.bw.Write(name_chunk_len);
                BinaryHelper.WriteRaw(bsg.bw, name_offsets);

                for (int i = 0; i < dep_offsets.Length; i++)
                {
                    WrenchTarget tb = targids[i];
                    BinaryHelper.WriteRaw(bsg.bw, bsg.RegisterType(tb.RuleType));
                    bsg.ScanTags(tb);  // For later ...
                }
            }
Beispiel #10
0
 void FinishTarget()
 {
     cur_targ     = null;
     cur_arg_name = null;
 }
Beispiel #11
0
	    bool WriteTarget (string elt, int aid, WrenchTarget targ)
	    {
		tw.WriteStartElement (elt);
		if (aid >= 0)
		    tw.WriteAttributeString ("arg", aid.ToString ());
		tw.WriteAttributeString ("id", targ.Id.ToString ());
		tw.WriteEndElement ();
		return false;
	    }
Beispiel #12
0
	static void WriteTargetTags (GraphBuilder gb, WrenchTarget wt, XmlTextWriter tw)
	{
	    foreach (KeyValuePair<string,SingleValue<int>> kvp in wt.IdTags) {
		int tagid = gb.GetTagId (kvp.Key);
		
		if (tagid < 0)
		    throw ExHelp.Argument ("tag", "Invalid tag name {0}", kvp.Key);
		
		if (kvp.Value.IsResult) {
		    tw.WriteStartElement ("rt");
		    tw.WriteAttributeString ("id", tagid.ToString ());
		    ((Result) kvp.Value).ExportXml (tw, "r");
		} else {
		    tw.WriteStartElement ("tt");
		    tw.WriteAttributeString ("id", tagid.ToString ());
		    tw.WriteAttributeString ("target", ((int) kvp.Value).ToString ());
		}
		
		tw.WriteEndElement ();
	    }
	}
	void ScanTags (WrenchTarget wt)
	{
	    foreach (KeyValuePair<string,SingleValue<TargetBuilder>> kvp in wt.Tags) {
		int tagid = gb.GetTagId (kvp.Key);

		if (tagid < 0)
		    throw ExHelp.Argument ("tag", "Invalid tag name {0}", kvp.Key);

		List<int> list;

		if (tag_items.ContainsKey (tagid))
		    list = tag_items[tagid];
		else {
		    list = new List<int> ();
		    tag_items[tagid] = list;
		}

		list.Add (wt.Id);
		list.Add (CompileSingleValue (kvp.Value));
	    }
	}
Beispiel #14
0
	void FinishTarget ()
	{
	    cur_targ = null;
	    cur_arg_name = null;
	}
Beispiel #15
0
	void StartTarget (string name)
	{
	    if (CheckTargetName (name))
		return;

	    cur_targ = (WrenchTarget) wp.DefineTarget (name, log);
	    // FIXME: if the fails we log an error but the rest of the code
	    // will nullref almost instantly. Gets the job done, but ugly.
	    cur_arg_name = null;
	}