OLD | NEW |
1 using System; | 1 using System; |
2 using System.Collections.Generic; | 2 using System.Collections.Generic; |
3 using System.Linq; | 3 using System.Linq; |
4 using System.Text; | 4 using System.Text; |
5 | 5 |
6 using System.IO; | 6 using System.IO; |
7 using System.Text.RegularExpressions; | 7 using System.Text.RegularExpressions; |
8 | 8 |
9 namespace NaCl.Build.CPPTasks | 9 namespace NaCl.Build.CPPTasks |
10 { | 10 { |
11 class GCCUtilities | 11 class GCCUtilities |
12 { | 12 { |
13 public const int s_CommandLineLength = 256; | 13 public const int s_CommandLineLength = 256; |
14 | 14 |
15 public static string Convert_Path_Windows_To_Posix(string path) | 15 public static string ConvertPathWindowsToPosix(string path) |
16 { | 16 { |
17 return path.Replace('\\', '/'); | 17 return path.Replace('\\', '/'); |
18 } | 18 } |
19 | 19 |
20 public static string Convert_Path_Posix_To_Windows(string path) | 20 public static string ConvertPathPosixToWindows(string path) |
21 { | 21 { |
22 path = path.Replace('/', '\\'); | 22 path = path.Replace('/', '\\'); |
23 // also make double backslashes a single slash | 23 // also make double backslashes a single slash |
24 // TODO: speed this up by iterating instead of two replaces | 24 // TODO: speed this up by iterating instead of two replaces |
25 return path.Replace("\\\\", "\\"); | 25 return path.Replace("\\\\", "\\"); |
26 } | 26 } |
27 | 27 |
28 // replace GCC error are warning output to Visual Studio format to suppo
rt going to source code from error output. | 28 // replace GCC error are warning output to Visual Studio format to suppo
rt going to source code from error output. |
29 public static string Convert_Output_GCC_to_VS(string line) | 29 public static string ConvertGCCOutput(string line) |
30 { | 30 { |
31 string result; | 31 string result; |
32 foreach (GCCRegexLineConverter converter in s_RegexConverters) | 32 foreach (GCCRegexLineConverter converter in s_RegexConverters) |
33 { | 33 { |
34 result = converter.Convert(line); | 34 result = converter.Convert(line); |
35 if (result.Length > 0) | 35 if (result.Length > 0) |
36 { | 36 { |
37 return result; | 37 return result; |
38 } | 38 } |
39 } | 39 } |
(...skipping 29 matching lines...) Expand all Loading... |
69 } | 69 } |
70 catch | 70 catch |
71 { | 71 { |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 return string.Empty; | 75 return string.Empty; |
76 } | 76 } |
77 } // GCCRegexLineConverter | 77 } // GCCRegexLineConverter |
78 | 78 |
79 private static readonly List<GCCRegexLineConverter> s_RegexConverters =
new List<GCCRegexLineConverter> | 79 private static readonly List<GCCRegexLineConverter> s_RegexConverters =
new List<GCCRegexLineConverter> |
80 { | 80 { |
81 new GCCRegexLineConverter | 81 new GCCRegexLineConverter |
82 { | 82 { |
83 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*
):([1-9]\d*):(.*$)"), | 83 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*
):([1-9]\d*):(.*$)"), |
84 FilenameIdentifier = @"$1", | 84 FilenameIdentifier = @"$1", |
85 RemainderIdentifier = @"($2,$3):$4" | 85 RemainderIdentifier = @"($2,$3):$4" |
86 }, | 86 }, |
87 new GCCRegexLineConverter | 87 new GCCRegexLineConverter |
88 { | 88 { |
89 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*
):(.*$)"), | 89 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):([1-9]\d*
):(.*$)"), |
90 FilenameIdentifier = @"$1", | 90 FilenameIdentifier = @"$1", |
91 RemainderIdentifier = @"($2):$3" | 91 RemainderIdentifier = @"($2):$3" |
92 }, | 92 }, |
93 new GCCRegexLineConverter | 93 new GCCRegexLineConverter |
94 { | 94 { |
95 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):(.?.?[^:]
*.*?):([1-9]\d*):(.*$)"), | 95 OutputExpression = new Regex(@"^\s*(.?.?[^:]*.*?):(.?.?[^:]
*.*?):([1-9]\d*):(.*$)"), |
96 FilenameIdentifier = @"$2", | 96 FilenameIdentifier = @"$2", |
97 RemainderIdentifier = @"($3):'$1' $4" | 97 RemainderIdentifier = @"($3):'$1' $4" |
98 } | 98 } |
99 }; | 99 }; |
100 } // GCCUtilities | 100 } // GCCUtilities |
101 } // namespace | 101 } // namespace |
OLD | NEW |