示例#1
0
        // Response files

        void LoadResponseFile(TargetBuilder tb, string arg, string file)
        {
            string path = AddResourceFile(file);

            using (Stream stream = File.OpenRead(path)) {
                StreamReader reader = new StreamReader(stream);

                string line;

                while ((line = reader.ReadLine()) != null)
                {
                    // FIXME: enforce line chomping? ... sure!
                    line = line.Trim();

                    if (line == "" || line[0] == '#')
                    {
                        continue;
                    }

                    if (arg != null)
                    {
                        tb.AddDep(arg, line);
                    }
                    else
                    {
                        tb.AddDep(line);
                    }
                }
            }
        }
示例#2
0
            public void DecodeInto(TargetBuilder tb, IWarningLogger log)
            {
                // This limitation is only because I am lazy and want one character
                // per BooleanHelper command.

                if (targets.Length > 10)
                {
                    throw new InvalidOperationException("Limited to 10 or fewer boolean operands");
                }

                for (int i = 0; i < targets.Length; i++)
                {
                    tb.AddDefaultOrdered(targets[i]);
                }

                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < commands.Length; i++)
                {
                    switch (commands[i])
                    {
                    case (int)OpCode.Not: sb.Append('!'); break;

                    case (int)OpCode.And: sb.Append('&'); break;

                    case (int)OpCode.Or: sb.Append('|'); break;

                    case 0: sb.Append('0'); break;

                    case 1: sb.Append('1'); break;

                    case 2: sb.Append('2'); break;

                    case 3: sb.Append('3'); break;

                    case 4: sb.Append('4'); break;

                    case 5: sb.Append('5'); break;

                    case 6: sb.Append('6'); break;

                    case 7: sb.Append('7'); break;

                    case 8: sb.Append('8'); break;

                    case 9: sb.Append('9'); break;

                    default:
                        throw new ArgumentException("Don't know how to handle boolean ops command " +
                                                    commands[i].ToString());
                    }
                }

                tb.AddDep(new MBString(sb.ToString()));
            }
示例#3
0
        string AddResourceFile(string name)
        {
            string srcrel = Path.Combine(resource_subdir, name);
            string path   = Path.Combine(topsrc, srcrel);

            ((GraphBuilder)wp.Owner).AddDependentFile(srcrel, path);

            string target = ResourceTarget + nresource.ToString();

            nresource++;

            TargetBuilder tb = wp.DefineTarget(target, log);

            tb.RuleType = typeof(SourcefileRule);
            tb.AddDep(new MBString(name));   // override the name

            return(path);
        }
示例#4
0
	    public void DecodeInto (TargetBuilder tb, IWarningLogger log)
	    {
		// This limitation is only because I am lazy and want one character
		// per BooleanHelper command.

		if (targets.Length > 10)
		    throw new InvalidOperationException ("Limited to 10 or fewer boolean operands");

		for (int i = 0; i < targets.Length; i++) 
		    tb.AddDefaultOrdered (targets[i]);

		StringBuilder sb = new StringBuilder ();

		for (int i = 0; i < commands.Length; i++) {
		    switch (commands[i]) {
		    case (int) OpCode.Not: sb.Append ('!'); break;
		    case (int) OpCode.And: sb.Append ('&'); break;
		    case (int) OpCode.Or: sb.Append ('|'); break;
		    case 0: sb.Append ('0'); break;
		    case 1: sb.Append ('1'); break;
		    case 2: sb.Append ('2'); break;
		    case 3: sb.Append ('3'); break;
		    case 4: sb.Append ('4'); break;
		    case 5: sb.Append ('5'); break;
		    case 6: sb.Append ('6'); break;
		    case 7: sb.Append ('7'); break;
		    case 8: sb.Append ('8'); break;
		    case 9: sb.Append ('9'); break;
		    default:
			throw new ArgumentException ("Don't know how to handle boolean ops command " +
						     commands[i].ToString ());
		    }
		}

		tb.AddDep (new MBString (sb.ToString ()));
	    }
示例#5
0
	// Response files

	void LoadResponseFile (TargetBuilder tb, string arg, string file) 
	{
	    string path = AddResourceFile (file);

	    using (Stream stream = File.OpenRead (path)) {
		StreamReader reader = new StreamReader (stream);

		string line;

		while ((line = reader.ReadLine ()) != null) {
		    // FIXME: enforce line chomping? ... sure!
		    line = line.Trim ();

		    if (line == "" || line[0] == '#')
			continue;

		    if (arg != null)
			tb.AddDep (arg, line);
		    else
			tb.AddDep (line);
		}
	    }
	}