Пример #1
0
        public bool ApplyTargetDependencies(int tid, ArgCollector ac, IWarningLogger logger)
        {
            XmlNodeList nl = Select("/mbuild-graph/targets/t[@id={0}]/deps/*", tid);

            bool ret;

            ac.AddTargetName(GetTargetName(tid));

            foreach (XmlNode n in nl)
            {
                switch (n.Name)
                {
                case "dor":
                    ret = ac.AddDefaultOrdered(ReadResult(n), log);
                    break;

                case "dot":
                    ret = ac.AddDefaultOrdered(GetDepTarget(n), log);
                    break;

                case "nr":
                    ret = ac.Add(GetDepArg(n), ReadResult(n), log);
                    break;

                case "nt":
                    ret = ac.Add(GetDepArg(n), GetDepTarget(n), log);
                    break;

                case "ur":
                    ret = ac.Add(ReadResult(n), log);
                    break;

                case "ut":
                    ac.Add(GetDepTarget(n));
                    ret = false;
                    break;

                case "Dr":
                    ret = ac.SetDefault(GetDepArg(n), ReadResult(n), log);
                    break;

                case "Dt":
                    ret = ac.SetDefault(GetDepArg(n), GetDepTarget(n), log);
                    break;

                default:
                    throw new Exception("Unexpected dep element " + n.Name);
                }

                if (ret)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
	public bool ApplyTargetDependencies (int tid, ArgCollector ac, IWarningLogger logger)
	{
	    short pid = (short) ((((uint) tid) >> 16) & 0xFFFF);
	    int start, bound;
	    GetOffsetRange (tid & 0xFFFF, providers[pid].dep_offsets, 
			    providers[pid].dep_chunk_len, out start, out bound);

	    int cur_arg = -3;
	    bool res = true;

	    ac.AddTargetName (GetTargetName (tid));

	    // the dep_data chunk is encoded as a sequence of:
	    // [arg id] [default] [dep 0] [dep 1] ... [dep n]
	    //
	    // arg id's are negative. -1 means 'unnamed dep',
	    // -2 means 'assigned to arg 0', -3 means 'assigned
	    // to arg 1', etc.
	    //
	    // Deps are standard targets-or-results. If the high
	    // bits (provider ID) are 0x7FFF, the low bits are 
	    // treated as an index into the result table. Otherwise,
	    // the entire Int32 is treated as a target ID number.
	    //
	    // Defaults are encoded like deps; if negative, there is
	    // no default for the given arg.
	    //
	    // Since deps are always positive, we know that we've found
	    // the next arg id when we find a negative entry.

	    for (int i = start; i < bound; i++) {
		int v = dep_data[i];

		if (v < 0) {
		    cur_arg = (-v) - 3;

		    // Now read the default.
		    v = dep_data[++i];

		    if (v > 0 && cur_arg >= 0) {
			if ((v & 0x7FFF0000) == 0x7FFF0000) 
			    res = ac.SetDefault (cur_arg, ResultFromCode (v), logger);
			else
			    res = ac.SetDefault (cur_arg, v, logger);

			if (res)
			    return true;
		    }

		    continue;
		}

		bool is_res = (v & 0x7FFF0000) == 0x7FFF0000;

		if (cur_arg == -2) {
		    if (is_res)
			res = ac.Add (ResultFromCode (v), logger);
		    else {
			ac.Add (v);
			res = false;
		    }
		} else if (cur_arg == -1) {
		    if (is_res)
			res = ac.AddDefaultOrdered (ResultFromCode (v), logger);
		    else
			res = ac.AddDefaultOrdered (v, logger);
		} else {
		    if (is_res)
			res = ac.Add (cur_arg, ResultFromCode (v), logger);
		    else
			res = ac.Add (cur_arg, v, logger);
		}

		if (res)
		    return true;
	    }

	    return false;
	}
Пример #3
0
	public bool ApplyTargetDependencies (int tid, ArgCollector ac, IWarningLogger logger)
	{
	    XmlNodeList nl = Select ("/mbuild-graph/targets/t[@id={0}]/deps/*", tid);

	    bool ret;

	    ac.AddTargetName (GetTargetName (tid));

	    foreach (XmlNode n in nl) {
		switch (n.Name) {
		case "dor":
		    ret = ac.AddDefaultOrdered (ReadResult (n), log);
		    break;
		case "dot":
		    ret = ac.AddDefaultOrdered (GetDepTarget (n), log);
		    break;
		case "nr":
		    ret = ac.Add (GetDepArg (n), ReadResult (n), log);
		    break;
		case "nt":
		    ret = ac.Add (GetDepArg (n), GetDepTarget (n), log);
		    break;
		case "ur":
		    ret = ac.Add (ReadResult (n), log);
		    break;
		case "ut":
		    ac.Add (GetDepTarget (n));
		    ret = false;
		    break;
		case "Dr":
		    ret = ac.SetDefault (GetDepArg (n), ReadResult (n), log);
		    break;
		case "Dt":
		    ret = ac.SetDefault (GetDepArg (n), GetDepTarget (n), log);
		    break;
		default:
		    throw new Exception ("Unexpected dep element " + n.Name);
		}

		if (ret)
		    return true;
	    }

	    return false;
	}
Пример #4
0
        public bool ApplyTargetDependencies(int tid, ArgCollector ac, IWarningLogger logger)
        {
            short pid = (short)((((uint)tid) >> 16) & 0xFFFF);
            int   start, bound;

            GetOffsetRange(tid & 0xFFFF, providers[pid].dep_offsets,
                           providers[pid].dep_chunk_len, out start, out bound);

            int  cur_arg = -3;
            bool res     = true;

            ac.AddTargetName(GetTargetName(tid));

            // the dep_data chunk is encoded as a sequence of:
            // [arg id] [default] [dep 0] [dep 1] ... [dep n]
            //
            // arg id's are negative. -1 means 'unnamed dep',
            // -2 means 'assigned to arg 0', -3 means 'assigned
            // to arg 1', etc.
            //
            // Deps are standard targets-or-results. If the high
            // bits (provider ID) are 0x7FFF, the low bits are
            // treated as an index into the result table. Otherwise,
            // the entire Int32 is treated as a target ID number.
            //
            // Defaults are encoded like deps; if negative, there is
            // no default for the given arg.
            //
            // Since deps are always positive, we know that we've found
            // the next arg id when we find a negative entry.

            for (int i = start; i < bound; i++)
            {
                int v = dep_data[i];

                if (v < 0)
                {
                    cur_arg = (-v) - 3;

                    // Now read the default.
                    v = dep_data[++i];

                    if (v > 0 && cur_arg >= 0)
                    {
                        if ((v & 0x7FFF0000) == 0x7FFF0000)
                        {
                            res = ac.SetDefault(cur_arg, ResultFromCode(v), logger);
                        }
                        else
                        {
                            res = ac.SetDefault(cur_arg, v, logger);
                        }

                        if (res)
                        {
                            return(true);
                        }
                    }

                    continue;
                }

                bool is_res = (v & 0x7FFF0000) == 0x7FFF0000;

                if (cur_arg == -2)
                {
                    if (is_res)
                    {
                        res = ac.Add(ResultFromCode(v), logger);
                    }
                    else
                    {
                        ac.Add(v);
                        res = false;
                    }
                }
                else if (cur_arg == -1)
                {
                    if (is_res)
                    {
                        res = ac.AddDefaultOrdered(ResultFromCode(v), logger);
                    }
                    else
                    {
                        res = ac.AddDefaultOrdered(v, logger);
                    }
                }
                else
                {
                    if (is_res)
                    {
                        res = ac.Add(cur_arg, ResultFromCode(v), logger);
                    }
                    else
                    {
                        res = ac.Add(cur_arg, v, logger);
                    }
                }

                if (res)
                {
                    return(true);
                }
            }

            return(false);
        }