Changeset 175 for Include/Classes/System
- Timestamp:
- Mar 21, 2007, 7:06:34 PM (18 years ago)
- Location:
- Include/Classes/System
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
Include/Classes/System/OperatingSystem.ab
r173 r175 1 1 ' System/OperatingSystem.ab 2 3 #ifndef _SYSYTEM_OPERATINGSYSTEM_AB_ 4 #define _SYSYTEM_OPERATINGSYSTEM_AB_ 2 5 3 6 #require <Classes/System/Version.ab> … … 79 82 Unix = 4 80 83 End Enum 84 85 #endif '_SYSYTEM_OPERATINGSYSTEM_AB_ -
Include/Classes/System/String.ab
r143 r175 233 233 End Sub 234 234 235 Sub AssignFromStrChar(text As *StrChar, textLength As Long) 236 If text = Chars Then Exit Sub 237 If AllocStringBuffer(textLength) <> 0 Then 238 memcpy(Chars, text, SizeOf (StrChar) * textLength) 239 Chars[m_Length] = 0 240 End If 241 End Sub 242 #ifdef __STRCHAR_IS_NOT_UNICODE 243 Sub AssignFromWideChar(text As PCWSTR, textLengthW As Long) 235 Sub Assign(text As PCSTR, textLengthA As Long) 236 #ifdef __STRING_IS_NOT_UNICODE 237 AssignFromStrChar(text, textLengthA) 238 #else 239 Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0) 240 If AllocStringBuffer(textLengthW) <> 0 Then 241 MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW) 242 End If 243 #endif 244 End Sub 245 246 Sub Assign(text As PCWSTR, textLengthW As Long) 247 #ifdef __STRING_IS_NOT_UNICODE 244 248 Dim textLengthA = WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, 0, 0, 0, 0) 245 249 If AllocStringBuffer(textLengthA) <> 0 Then 246 250 WideCharToMultiByte(CP_THREAD_ACP, 0, text, textLengthW, Chars, textLengthA, 0, 0) 247 251 End If 248 End Sub249 252 #else 250 Sub AssignFromMultiByte(text As PCSTR, textLengthA As Long) 251 Dim textLengthW = MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, 0, 0) 252 If AllocStringBuffer(textLengthW) <> 0 Then 253 MultiByteToWideChar(CP_THREAD_ACP, 0, text, textLengthA, Chars, textLengthW) 254 End If 255 End Sub 256 #endif 257 Sub Assign(text As PCSTR, textLength As Long) 258 #ifdef __STRING_IS_NOT_UNICODE 259 AssignFromStrChar(text, textLength) 260 #else 261 AssignFromMultiByte(text, textLength) 262 #endif 263 End Sub 264 265 Sub Assign(text As PCWSTR, textLength As Long) 266 #ifdef __STRING_IS_NOT_UNICODE 267 AssignFromWideChar(text, textLength) 268 #else 269 AssignFromStrChar(text, textLength) 253 AssignFromStrChar(text, textLengthW) 270 254 #endif 271 255 End Sub … … 571 555 Dim size = m_Length 572 556 #endif 573 Dim hash = 0 As DWord 574 Dim p = Chars As *Word 575 Dim i As Long 576 For i = 0 To ELM(size) 577 hash = ((hash << 16) + p[i]) Mod &h7fffffff 578 Next 579 Return hash As Long 557 Return _System_GetHashFromWordArray(Chars As *Word, size) 580 558 End Function 581 559 Private … … 617 595 End Function 618 596 597 Sub AssignFromStrChar(text As *StrChar, textLength As Long) 598 If text = Chars Then Exit Sub 599 If AllocStringBuffer(textLength) <> 0 Then 600 memcpy(Chars, text, SizeOf (StrChar) * textLength) 601 Chars[m_Length] = 0 602 End If 603 End Sub 619 604 End Class -
Include/Classes/System/Version.ab
r161 r175 1 1 ' System/Version.ab 2 3 #ifndef __SYSTEM_VERSION_AB__ 4 #define __SYSTEM_VERSION_AB__ 5 6 #require <api_winsock2.sbp> 2 7 3 8 Class Version … … 75 80 76 81 Override Function GetHashCode() As Long 77 Return htonl(major) Xor minor Xor build Xor htonl(rivision)82 Return _System_BSwap(major As DWord) Xor minor Xor build Xor _System_BSwap(rivision As DWord) 78 83 End Function 79 84 … … 143 148 rivision As Long 144 149 End Class 150 151 #endif '__SYSTEM_VERSION_AB__ -
Include/Classes/System/index.ab
r142 r175 1 #require "DateTime.ab"2 #require "Math.ab"3 #require "Object.ab"4 #require "String.ab"5 #require "TimeSpan.ab"6 #require "OperatingSystem.ab"7 #require "Version.ab"8 #require "Environment.ab"1 #require <Classes/System/DateTime.ab> 2 #require <Classes/System/Math.ab> 3 #require <Classes/System/Object.ab> 4 #require <Classes/System/String.ab. 5 #require <Classes/System/TimeSpan.ab> 6 #require <Classes/System/OperatingSystem.ab> 7 #require <Classes/System/Version.ab> 8 #require <Classes/System/Environment.ab>
Note:
See TracChangeset
for help on using the changeset viewer.