Changeset 628 for trunk/ab5.0
- Timestamp:
- Sep 21, 2008, 2:01:36 AM (16 years ago)
- Location:
- trunk/ab5.0/ablib/src
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/ablib/src/api_system.sbp
r599 r628 3 3 #ifdef UNICODE 4 4 Const _FuncName_AddAtom = "AddAtomW" 5 Const _FuncName_CompareString = "CompareStringW"6 5 Const _FuncName_CopyFile = "CopyFileW" 7 6 Const _FuncName_CreateDirectory = "CreateDirectoryW" … … 28 27 Const _FuncName_GetComputerName = "GetComputerNameW" 29 28 Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryW" 30 Const _FuncName_GetDateFormat = "GetDateFormatW"31 29 Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceW" 32 30 Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExW" … … 50 48 Const _FuncName_GetTempFileName = "GetTempFileNameW" 51 49 Const _FuncName_GetTempPath = "GetTempPathW" 52 Const _FuncName_GetTimeFormat = "GetTimeFormatW"53 50 Const _FuncName_GetUserName = "GetUserNameW" 54 51 Const _FuncName_GetVersionEx = "GetVersionExW" 55 52 Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryW" 56 Const _FuncName_LCMapString = "LCMapStringW"57 53 Const _FuncName_LoadLibrary = "LoadLibraryW" 58 54 Const _FuncName_LoadLibraryEx = "LoadLibraryExW" … … 76 72 #else 77 73 Const _FuncName_AddAtom = "AddAtomA" 78 Const _FuncName_CompareString = "CompareStringA"79 74 Const _FuncName_CopyFile = "CopyFileA" 80 75 Const _FuncName_CreateDirectory = "CreateDirectoryA" … … 105 100 Const _FuncName_GetComputerName = "GetComputerNameA" 106 101 Const _FuncName_GetCurrentDirectory = "GetCurrentDirectoryA" 107 Const _FuncName_GetDateFormat = "GetDateFormatA"108 102 Const _FuncName_GetDiskFreeSpace = "GetDiskFreeSpaceA" 109 103 Const _FuncName_GetDiskFreeSpaceEx = "GetDiskFreeSpaceExA" … … 123 117 Const _FuncName_GetTempFileName = "GetTempFileNameA" 124 118 Const _FuncName_GetTempPath = "GetTempPathA" 125 Const _FuncName_GetTimeFormat = "GetTimeFormatA"126 119 Const _FuncName_GetUserName = "GetUserNameA" 127 120 Const _FuncName_GetVersionEx = "GetVersionExA" 128 121 Const _FuncName_GetWindowsDirectory = "GetWindowsDirectoryA" 129 Const _FuncName_LCMapString = "LCMapStringA"130 122 Const _FuncName_LoadLibrary = "LoadLibraryA" 131 123 Const _FuncName_LoadLibraryEx = "LoadLibraryExA" … … 207 199 Const GPTR = GMEM_FIXED or GMEM_ZEROINIT 208 200 Const GMEM_DISCARDED = &H4000 209 210 ' Locale flag211 Const LOCALE_NOUSEROVERRIDE = &H80000000212 201 213 202 'Critical Section … … 272 261 #endif 273 262 274 275 263 Declare Function Beep Lib "kernel32" (dwFreq As DWord, dwDuration As DWord) As BOOL 276 264 Declare Function CloseHandle Lib "kernel32" (hObject As HANDLE) As BOOL 277 265 278 266 Declare Function CompareFileTime Lib "kernel32" (ByRef FileTime1 As FILETIME, ByRef FileTime2 As FILETIME) As Long 279 280 Const NORM_IGNORECASE = &H00000001281 Const NORM_IGNORENONSPACE = &H00000002282 Const NORM_IGNORESYMBOLS = &H00000004283 Const SORT_STRINGSORT = &H00001000284 Const NORM_IGNOREKANATYPE = &H00010000285 Const NORM_IGNOREWIDTH = &H00020000286 Const CSTR_LESS_THAN = 1287 Const CSTR_EQUAL = 2288 Const CSTR_GREATER_THAN = 3289 Declare Function CompareString Lib "kernel32" Alias _FuncName_CompareString (Locale As LCID, dwCmpFlags As DWord, pString1 As PCTSTR, cchCount1 As Long, pString2 As PCTSTR, cchCount2 As Long) As Long290 267 291 268 Declare Function CopyFile Lib "kernel32" Alias _FuncName_CopyFile (pExistingFileName As PCTSTR, pNewFileName As PCTSTR, bFailIfExists As BOOL) As BOOL … … 294 271 Declare Function CreateMutex Lib "kernel32" Alias _FuncName_CreateMutex (lpMutexAttributes As *SECURITY_ATTRIBUTES, bInitialOwner As BOOL, lpName As PCTSTR) As HANDLE 295 272 Declare Function CreatePipe Lib "Kernel32" ( 296 297 298 299 273 ByRef hReadPipe As HANDLE, 274 ByRef hWritePipe As HANDLE, 275 ByVal pPipeAttributes As *SECURITY_ATTRIBUTES, 276 ByVal nSize As DWord) As Long 300 277 Declare Function CreateSemaphore Lib "kernel32" Alias _FuncName_CreateSemaphore (pSemaphoreAttributes As *SECURITY_ATTRIBUTES, lInitialCount As Long, lMaximumCount As Long, pName As PCTSTR) As HANDLE 301 278 … … 517 494 Declare Function GetCurrentThreadId Lib "kernel32" () As DWord 518 495 519 Const DATE_SHORTDATE = &H00000001520 Const DATE_LONGDATE = &H00000002521 Const DATE_USE_ALT_CALENDAR = &H00000004522 Declare Function GetDateFormat Lib "kernel32" Alias _FuncName_GetDateFormat (Locale As LCID, dwFlags As DWord, ByRef Date As SYSTEMTIME, pFormat As PCTSTR, pDateStr As PTSTR, cchDate As Long) As Long523 524 496 Declare Function GetDiskFreeSpace Lib "kernel32" Alias _FuncName_GetDiskFreeSpace (pRootPathName As PCTSTR, lpSectorsPerCluster As *DWord, pBytesPerSector As *DWord, pNumberOfFreeClusters As *DWord, pTotalNumberOfClusters As *DWord) As BOOL 525 497 Declare Function GetDiskFreeSpaceEx Lib "kernel32" Alias _FuncName_GetDiskFreeSpaceEx (pDirectoryName As PCTSTR, ByRef lpFreeBytesAvailableToCaller As ULARGE_INTEGER, ByRef TotalNumberOfBytes As ULARGE_INTEGER, ByRef TotalNumberOfFreeBytes As ULARGE_INTEGER) As BOOL … … 656 628 Declare Function GetTickCount Lib "kernel32" () As DWord 657 629 658 Const TIME_NOMINUTESORSECONDS = &H00000001659 Const TIME_NOSECONDS = &H00000002660 Const TIME_NOTIMEMARKER = &H00000004661 Const TIME_FORCE24HOURFORMAT = &H00000008662 Declare Function GetTimeFormat Lib "kernel32" Alias _FuncName_GetTimeFormat (Locale As LCID, dwFlags As DWord, ByRef Time As SYSTEMTIME, lpFormat As PCTSTR, lpTimeStr As PTSTR, cchTime As DWord) As BOOL663 Declare Function GetUserDefaultLCID Lib "kernel32" () As LCID664 630 Declare Function GetUserName Lib "advapi32" Alias _FuncName_GetUserName (pBuffer As PTSTR, ByRef nSize As DWord) As BOOL 665 631 Declare Function GetVersionEx Lib "kernel32" Alias _FuncName_GetVersionEx (ByRef VersionInformation As OSVERSIONINFO) As BOOL … … 696 662 Declare Function IsBadReadPtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL 697 663 Declare Function IsBadWritePtr Lib "kernel32" (lp As VoidPtr, ucb As ULONG_PTR) As BOOL 698 Declare Function IsDBCSLeadByte Lib "kernel32" (TestChar As Byte) As BOOL699 664 700 665 #ifdef _WIN64 701 666 Declare Function IsWow64Process Lib "kernel32" (hProcess As HANDLE, ByRef bWow64Process As BOOL) As BOOL 702 667 #endif 703 704 Const LCMAP_LOWERCASE = &H00000100 ' lower case letters705 Const LCMAP_UPPERCASE = &H00000200 ' upper case letters706 Const LCMAP_SORTKEY = &H00000400 ' WC sort key (normalize)707 Const LCMAP_BYTEREV = &H00000800 ' byte reversal708 Const LCMAP_HIRAGANA = &H00100000 ' map katakana to hiragana709 Const LCMAP_KATAKANA = &H00200000 ' map hiragana to katakana710 Const LCMAP_HALFWIDTH = &H00400000 ' map double byte to single byte711 Const LCMAP_FULLWIDTH = &H00800000 ' map single byte to double byte712 Const LCMAP_LINGUISTIC_CASING = &H01000000 ' use linguistic rules for casing713 Const LCMAP_SIMPLIFIED_CHINESE = &H02000000 ' map traditional chinese to simplified chinese714 Const LCMAP_TRADITIONAL_CHINESE = &H04000000 ' map simplified chinese to traditional chinese715 Declare Function LCMapString Lib "kernel32" Alias _FuncName_LCMapString (Locale As LCID, dwMapFlags As DWord, lpSrcStr As LPCTSTR, cchSrc As Long, lpDestStr As LPTSTR, cchDest As Long) As Long716 668 717 669 Declare Sub LeaveCriticalSection Lib "kernel32" (ByRef lpCriticalSection As CRITICAL_SECTION) … … 755 707 ) As Long 756 708 757 Const CP_ACP = 0 'default to ANSI code page758 Const CP_OEMCP = 1 'default to OEM code page759 Const CP_MACCP = 2 'default to MAC code page760 Const CP_THREAD_ACP = 3 'current thread's ANSI code page761 Const CP_SYMBOL = 42 'SYMBOL translations762 Const CP_UTF7 = 65000 'UTF-7 translation763 Const CP_UTF8 = 65001 'UTF-8 translation764 765 Declare Function MultiByteToWideChar Lib "kernel32" (CodePage As DWord, dwFlags As DWord, pMultiByteStr As PCSTR, cchMultiByte As Long, pWideCharStr As PWSTR, cchWideChar As Long) As Long766 709 Declare Function OpenEvent Lib "kernel32" Alias _FuncName_OpenEvent (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE 767 710 Declare Function OpenMutex Lib "kernel32" Alias _FuncName_OpenMutex (dwDesiredAccess As DWord, bInheritHandle As BOOL, lpName As LPCTSTR) As HANDLE … … 831 774 Declare Function TerminateProcess Lib "kernel32" (hProcess As HANDLE, dwExitCode As DWord) As BOOL 832 775 Declare Function TerminateThread Lib "kernel32" (hThread As HANDLE, dwExitCode As DWord) As BOOL 776 777 Const TLS_OUT_OF_INDEXES = &hffffffff As DWord 833 778 Declare Function TlsAlloc Lib "kernel32" () As DWord 834 779 Declare Function TlsFree Lib "kernel32" (dwTlsIndex As DWord) As BOOL … … 870 815 Declare Function WaitForSingleObjectEx Lib "kernel32" (hHandle As HANDLE, dwMilliseconds As DWord, bAlertable As BOOL) As DWord 871 816 872 Const WC_COMPOSITECHECK = &H00000200873 Const WC_DISCARDNS = &H00000010874 Const WC_SEPCHARS = &H00000020875 Const WC_DEFAULTCHAR = &H00000040876 Const WC_NO_BEST_FIT_CHARS = &H00000400877 Declare Function WideCharToMultiByte Lib "Kernel32" (878 CodePage As DWord,879 dwFlags As DWord,880 pWideCharStr As PCWSTR,881 cchWideChar As Long,882 pMultiByteStr As PSTR,883 cbMultiByte As Long,884 pDefaultChar As PCSTR,885 pUsedDefaultChar As *BOOL886 ) As Long887 888 817 Declare Function WriteFile Lib "kernel32" (hFile As HANDLE, lpBuffer As VoidPtr, nNumberOfBytesToWrite As DWord, lpNumberOfBytesWritten As *DWord, ByRef pOverlapped As OVERLAPPED) As BOOL 889 818 Declare Sub ZeroMemory Lib "kernel32" Alias "RtlZeroMemory" (Destination As VoidPtr, dwLength As DWord) -
trunk/ab5.0/ablib/src/basic/command.sbp
r497 r628 59 59 60 60 Macro MSGBOX(hwnd As HWND, str As String)(title As String, boxType As DWord, ByRef retAns As DWord) 61 'Dim ret = MessageBox(hwnd, ToTCStr(str), ToTCStr(title), boxType)62 'If VarPtr(retAns) Then63 'retAns = ret64 'End If61 Dim ret = MessageBox(hwnd, ToTCStr(str), ToTCStr(title), boxType) 62 If VarPtr(retAns) Then 63 retAns = ret 64 End If 65 65 End Macro 66 66 … … 136 136 Macro CLOSE()(FileNumber As Long) 137 137 FileNumber-- 138 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNumber) 138 139 139 140 If _System_hFile(FileNumber) Then … … 148 149 Sub INPUT_FromFile(FileNumber As Long) 149 150 FileNumber-- 151 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNumber) 150 152 151 153 Dim i = 0 As Long … … 238 240 Dim dwAccessByte As DWord 239 241 FileNumber-- 242 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNumber) 240 243 241 244 WriteFile(_System_hFile(FileNumber), StrPtr(buf), Len(buf), VarPtr(dwAccessByte), ByVal 0) … … 404 407 Macro FIELD(FileNumber As Long, FieldSize As Long) 405 408 FileNumber-- 409 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNumber) 406 410 _System_FieldSize(FileNumber)=FieldSize 407 411 End Macro … … 410 414 411 415 FileNumber-- 416 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNumber) 412 417 RecodeNumber-- 413 418 … … 425 430 426 431 FileNumber-- 432 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNumber) 427 433 RecodeNumber-- 428 434 -
trunk/ab5.0/ablib/src/basic/function.sbp
r589 r628 123 123 */ 124 124 Function Sgn(n As Double) As Long 125 ' Sgn = ActiveBasic. .Math.Sign(n)125 ' Sgn = ActiveBasic.Math.Sign(n) 126 126 End Function 127 127 … … 205 205 Return New String(t, 2) 206 206 Else 207 Throw New System.ArgumentOutOfRangeException("ChrW: c is invalid Unicode code point.", "c")207 Throw New System.ArgumentOutOfRangeException("ChrW: c is invalid unicode code point.", "c") 208 208 End If 209 209 End Function … … 665 665 Function Eof(FileNum As Long) As Long 666 666 FileNum-- 667 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNum) 667 668 Dim dwCurrent = SetFilePointer(_System_hFile(FileNum), 0,NULL, FILE_CURRENT) 668 669 Dim dwEnd = SetFilePointer(_System_hFile(FileNum), 0, NULL, FILE_END) … … 677 678 678 679 Function Lof(FileNum As Long) As Long 679 Lof = GetFileSize(_System_hFile(FileNum-1), 0) 680 FileNum-- 681 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNum) 682 Lof = GetFileSize(_System_hFile(FileNum), 0) 680 683 End Function 681 684 682 685 Function Loc(FileNum As Long) As Long 683 686 FileNum-- 684 687 ActiveBasic.Detail.ThrowIfInvaildFileNum(FileNum) 685 688 Dim NowPos = SetFilePointer(_System_hFile(FileNum), 0, 0, FILE_CURRENT) 686 689 Dim BeginPos = SetFilePointer(_System_hFile(FileNum), 0, 0, FILE_BEGIN) … … 690 693 End Function 691 694 695 Namespace ActiveBasic 696 Namespace Detail 697 698 Sub ThrowIfInvaildFileNum(n As Long) 699 If n < 0 Or n > 255 Then 700 Throw New System.ArgumentOutOfRangeException("FileNum", "Invalid file number") 701 ElseIf _System_hFile(n) = 0 Then 702 Throw New System.InvalidOperationException("File number " & Str$(n + 1) & "is not opend.") 703 End If 704 End Sub 705 706 End Namespace 707 End Namespace 692 708 693 709 '------------------ -
trunk/ab5.0/ablib/src/windows.sbp
r575 r628 4 4 TypeDef LPOLESTR = *OLECHAR 5 5 TypeDef LPCOLESTR = *OLECHAR 6 7 TypeDef LANGID = Word8 TypeDef LCID = DWord9 TypeDef LCTYPE = DWord10 TypeDef LGRPID = DWord11 6 12 7 TypeDef PROPID = DWord … … 17 12 #require <api_gdi.sbp> 18 13 #require <api_window.sbp> 14 #require <winnls.ab> 19 15 #require <api_shell.sbp> 20 16 #require <api_msg.sbp> … … 26 22 27 23 #require <api_mmsys.sbp> 24 #require <api_commdlg.sbp> 28 25 #require <ole2.ab> 29 #require <api_commdlg.sbp> 30 26 #require <winsvc.ab> 31 27 #require <api_imm.sbp> 32 28
Note:
See TracChangeset
for help on using the changeset viewer.