|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 using System; |
|
18 using System.IO; |
|
19 using System.Text; |
|
20 using System.Text.RegularExpressions; |
|
21 using System.Collections.Generic; |
|
22 |
|
23 namespace SymbianStructuresLib.CodeSegments |
|
24 { |
|
25 public static class CodeSegDefinitionParser |
|
26 { |
|
27 #region API |
|
28 public static CodeSegDefinition ParseDefinition( string aLine ) |
|
29 { |
|
30 CodeSegDefinition ret = null; |
|
31 // |
|
32 Match m = KCodeSegRegEx.Match( aLine ); |
|
33 if ( m.Success ) |
|
34 { |
|
35 ret = new CodeSegDefinition(); |
|
36 // |
|
37 string gpAddressStart = m.Groups[ "StartAddress" ].Value; |
|
38 string gpAddressEnd = m.Groups[ "EndAddress" ].Value; |
|
39 string gpBinary = m.Groups[ "Binary" ].Value; |
|
40 // |
|
41 ret.Base = uint.Parse( gpAddressStart, System.Globalization.NumberStyles.HexNumber ); |
|
42 ret.Limit = uint.Parse( gpAddressEnd, System.Globalization.NumberStyles.HexNumber ); |
|
43 ret.FileName = gpBinary; |
|
44 } |
|
45 // |
|
46 return ret; |
|
47 } |
|
48 #endregion |
|
49 |
|
50 #region Properties |
|
51 #endregion |
|
52 |
|
53 #region Internal constants |
|
54 private static readonly Regex KCodeSegRegEx = new Regex( |
|
55 @"(?<StartAddress>[a-fA-F0-9]{8})-(?<EndAddress>[a-fA-F0-9]{8})\s{1}(?<Binary>.+)", |
|
56 RegexOptions.IgnoreCase |
|
57 ); |
|
58 private const int KBaseHex = 16; |
|
59 #endregion |
|
60 |
|
61 #region Data members |
|
62 #endregion |
|
63 } |
|
64 } |