Mercurial > projects > dwt2
comparison org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/Library.d @ 51:c01d033c633a
[swt lin]
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 27 Mar 2009 19:58:06 +0100 |
parents | f589fc20a5f9 |
children |
comparison
equal
deleted
inserted
replaced
50:d5075f5226e5 | 51:c01d033c633a |
---|---|
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module org.eclipse.swt.internal.Library; | 13 module org.eclipse.swt.internal.Library; |
14 | 14 |
15 import java.lang.all; | 15 import java.lang.all; |
16 | 16 |
17 version(Tango){ | |
18 import tango.util.Convert; | |
19 } else { // Phobos | |
20 import std.conv; | |
21 } | |
22 | |
23 // do it here, so it can be evaluated at compile time | 17 // do it here, so it can be evaluated at compile time |
24 // this saves a static ctor. | 18 // this saves a static ctor. |
25 private int buildSWT_VERSION (int major, int minor) { | 19 private int buildSWT_VERSION (int major, int minor) { |
26 return major * 1000 + minor; | 20 return major * 1000 + minor; |
27 } | 21 } |
67 bool isDigit( char c ){ | 61 bool isDigit( char c ){ |
68 return c >= '0' && c <= '9'; | 62 return c >= '0' && c <= '9'; |
69 } | 63 } |
70 while (index < length && isDigit(aVersion[index])) index++; | 64 while (index < length && isDigit(aVersion[index])) index++; |
71 try { | 65 try { |
72 if (start < length) major = to!(int)( aVersion[start .. index] ); | 66 if (start < length) major = Integer.parseInt( aVersion[start .. index] ); |
73 } catch (ConversionException e) {} | 67 } catch (NumberFormatException e) {} |
74 start = ++index; | 68 start = ++index; |
75 while (index < length && isDigit(aVersion[index])) index++; | 69 while (index < length && isDigit(aVersion[index])) index++; |
76 try { | 70 try { |
77 if (start < length) minor = to!(int)(aVersion[start .. index]); | 71 if (start < length) minor = Integer.parseInt(aVersion[start .. index]); |
78 } catch (ConversionException e) {} | 72 } catch (NumberFormatException e) {} |
79 start = ++index; | 73 start = ++index; |
80 while (index < length && isDigit(aVersion[index])) index++; | 74 while (index < length && isDigit(aVersion[index])) index++; |
81 try { | 75 try { |
82 if (start < length) micro = to!(int)(aVersion[start .. index]); | 76 if (start < length) micro = Integer.parseInt(aVersion[start .. index]); |
83 } catch (ConversionException e) {} | 77 } catch (NumberFormatException e) {} |
84 return buildJAVA_VERSION(major, minor, micro); | 78 return buildJAVA_VERSION(major, minor, micro); |
85 } | 79 } |
86 | 80 |
87 /** | 81 /** |
88 * Returns the Java version number as an integer. | 82 * Returns the Java version number as an integer. |