Пример #1
0
        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));
            }
        }
Пример #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();
            }
        }
Пример #3
0
        protected override TargetBuilder CreateTarget(string name)
        {
            WrenchTarget wt = new WrenchTarget(this, name, next_target_id++);

            targids[name] = wt.Id;

            return(wt);
        }
Пример #4
0
	protected override TargetBuilder CreateTarget (string name)
	{
	    WrenchTarget wt = new WrenchTarget (this, name, next_target_id++);

	    targids[name] = wt.Id;

	    return wt;
	}
Пример #5
0
            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);
            }
Пример #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);
 }
Пример #7
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;
        }
Пример #8
0
            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);
            }
Пример #9
0
            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 ...
                }
            }
Пример #10
0
 void FinishTarget()
 {
     cur_targ     = null;
     cur_arg_name = null;
 }
Пример #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;
	    }
Пример #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 ();
	    }
	}
Пример #13
0
	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));
	    }
	}
Пример #14
0
	void FinishTarget ()
	{
	    cur_targ = null;
	    cur_arg_name = null;
	}
Пример #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;
	}