Jump to content

Why is int regarded as type INT64


JohnOne
 Share

Recommended Posts

$iStruct = DllStructCreate("int")
$vartype = VarGetType(DllStructGetData($istruct, 1))
ConsoleWrite("## int ##" & @LF)
ConsoleWrite("Type: " & $vartype & @LF)
ConsoleWrite("Size: " & DllStructGetSize($istruct) & @LF)

ConsoleWrite(@LF)

$iStruct = DllStructCreate("int64")
$vartype = VarGetType(DllStructGetData($istruct, 1))
ConsoleWrite("## int64 ##" & @LF)
ConsoleWrite("Type: " & $vartype & @LF)
ConsoleWrite("Size: " & DllStructGetSize($istruct) & @LF)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I got this >>

## int ##
Type: Int32
Size: 4

## int64 ##
Type: Int64
Size: 8

Seems correct to me.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

I have 8.1 x64, with a 64-bit processor and testing with AutoIt x64.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Never mind, it works as expected in latest release, I'm still using 3.8.1.

Classic!

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Do these all look correct?

BYTE: Int32 Size: 1
BOOLEAN: Int32 Size: 1
CHAR: String Size: 1
WCHAR: String Size: 2
short: Int32 Size: 2
USHORT: Int32 Size: 2
WORD: Int32 Size: 2
int: Int32 Size: 4
long: Int32 Size: 4
BOOL: Int32 Size: 4
UINT: Int64 Size: 4
ULONG: Int64 Size: 4
DWORD: Int64 Size: 4
INT64: Int64 Size: 8
UINT64: Int64 Size: 8
ptr: Ptr Size: 4
HWND: Ptr Size: 4
HANDLE: Ptr Size: 4
float: Double Size: 4
double: Double Size: 8
INT_PTR: Int32 Size: 4
LONG_PTR: Int32 Size: 4
LRESULT: Int32 Size: 4
LPARAM: Int32 Size: 4
UINT_PTR: Int64 Size: 4
ULONG_PTR: Int64 Size: 4
DWORD_PTR: Int64 Size: 4
WPARAM: Int64 Size: 4
$str = "BYTE,BOOLEAN,CHAR,WCHAR,short,USHORT,WORD,int,long,BOOL,UINT,ULONG,DWORD,INT64,UINT64,ptr,HWND,HANDLE,float,double,INT_PTR,LONG_PTR,LRESULT,LPARAM,UINT_PTR,ULONG_PTR,DWORD_PTR,WPARAM"

$asTructs = StringSplit($str, ",", 2)

For $i = 0 To UBound($asTructs) -1
    $struct = DllStructCreate($asTructs[$i])
    ConsoleWrite($asTructs[$i] & ": " & VarGetType(DllStructGetData($struct, 1)) & " Size: " & DllStructGetSize($struct) & @LF)
Next

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Why are BOOL and BOOLEAN different?

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

No Idea and I'd expect anything that VarGetType returns as INT64 to have a size of 8.

I understand that some say in help file "32 or 64bit signed integer (depending on if the x86 or x64 version of AutoIt is used)"

That's fair enough, but I would expect VarGetType to return using the same logic.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Look at their MSDN definitions.

Windows Data Types

typedef int BOOL;

typedef BYTE BOOLEAN;

Thanks. Makes sense now.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Here is a function where I've put some effort to dump variables (including structures) and their content as correctly as possible. Yet it needs significantly more work to detect alignment(s) within structures, but I'm not sure I'm ready to invest that much time into this.

#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Compile_Both=n
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Run_AU3Check=n



Global Const $_TAB = '      '

Func _VarDump(ByRef $vVar, $iLimit = 10, $sIndent = '')
    Local $ret, $len, $ptr
    If $iLimit < 3 Then $iLimit = 0

    Select

        Case IsString($vVar)
            $len = StringLen($vVar)
            Return 'String       (' & $len & ") " & __DumpStr($vVar)

        Case VarGetType($vVar) = "Double"
            Return 'Double       ' & $vVar & (IsInt($vVar) ? '.0' : '')

        Case IsInt($vVar)
            Return VarGetType($vVar) & '        ' & $vVar

        Case IsArray($vVar)
            Local $iSubscripts = UBound($vVar, 0)
            Local $iCells = 1
            $ret = 'Array'
            $iSubscripts -= 1
            For $i = 0 To $iSubscripts
                $ret &= '[' & UBound($vVar, $i + 1) & ']'
                $iCells *= UBound($vVar, $i + 1)
            Next
            If $iCells = 0 Then
                Return $ret & $_TAB & '  (array is empty)'
            Else
                Return $ret & @CRLF & __VarDumpArray($vVar, $iLimit, $sIndent)
            EndIf

        Case IsBinary($vVar)
            $len = BinaryLen($vVar)
            $ret = 'Binary       (' & BinaryLen($vVar) & ') '
            Return($ret & ($len <= 32) ? $vVar : BinaryMid($vVar, 1, 16) & ' ... ' & StringTrimLeft(BinaryMid($vVar, $len - 15, 16), 2))

        Case IsBool($vVar)
            Return 'Boolean      ' & $vVar

        Case IsKeyword($vVar)
            Return('Keyword      ' & (($vVar = Null) ? 'Null' : 'Default'))

        Case IsPtr($vVar)
            Return 'Pointer      ' & $vVar

        Case IsObj($vVar)
            Return 'Object       ' & ObjName($vVar)

        Case IsHWnd($vVar)
            Return 'HWnd         ' & $vVar

        Case IsFunc($vVar)
            Return StringFormat('%-13s', VarGetType($vVar)) & FuncName($vVar)

        Case IsDllStruct($vVar)
            $len = DllStructGetSize($vVar)
            $ptr = DllStructGetPtr($vVar)
            $ret = 'Struct       (' & $len & ') @:' & Hex($ptr) & ' (structure alignment is unknown)' & @CRLF
            Local $nbElem = 1, $idx, $incr, $data, $type, $indent = $sIndent & $_TAB, $oldvalue, $readvalue, $field, $elem
            While 1
                $data = DllStructGetData($vVar, $nbElem)
                If @error = 2 Then ExitLoop
                $type = VarGetType($data)
                $idx = 1
                $incr = 0
                ; determine max index of element
                While 1
                    DllStructGetData($vVar, $nbElem, 2 * $idx)
                    If @error = 3 Then ExitLoop
                    $incr = $idx
                    $idx *= 2
                WEnd
                ; index is in [$idx, (2 * $idx) - 1]
                $idx += $incr
                Do
                    DllStructGetData($vVar, $nbElem, $idx)
                    If @error = 3 Then
                        ; approach is asymetric (upper bound is too big)
                        $idx -= ($incr = 1) ? 1 : $incr / 2
                    Else
                        $idx += Int($incr / 2)
                    EndIf
                    $incr = Int($incr / 2)
                Until $incr = 0
                Switch $type
                    Case "Int32", "Int64"
                        $ret &= $indent
                        $data = DllStructGetData($vVar, $nbElem, 1)
                        DllStructSetData($vVar, $nbElem, 0x7777666655554433, 1)
                        $readvalue = DllStructGetData($vVar, $nbElem, 1)
                        Switch $readvalue
                            Case 0x7777666655554433
                                $elem = "int64"
                                ; alias: uint64
                                ; alias: int_ptr(x64), long_ptr(x64), lresult(x64), lparam(x64)
                                ; alias: uint_ptr(x64), ulong_ptr(x64), dword_ptr(x64), wparam(x64)
                            Case 0x55554433
                                DllStructSetData($vVar, $nbElem, 0x88887777, 1)
                                $readvalue = DllStructGetData($vVar, $nbElem, 1)
                                $elem = ($readvalue > 0 ? "uint" : "int")
                                ; int aliases: long, bool, int_ptr(x86), long_ptr(x86), lresult(x86), lparam(x86);
                                ; uint aliases: ulong, dword, uint_ptr(x86), ulong_ptr(x86), dword_ptr(x86), wparam(x86)
                            Case 0x4433
                                DllStructSetData($vVar, $nbElem, 0x8888, 1)
                                $readvalue = DllStructGetData($vVar, $nbElem, 1)
                                $elem = ($readvalue > 0 ? "ushort" : "short")
                                ; ushort alias: word
                            Case 0x33
                                $elem = "byte"
                                ; alias: ubyte
                        EndSwitch
                        DllStructSetData($vVar, $nbElem, $data, 1)
                        If $idx = 1 Then
                            $ret &= StringFormat('%-' & 9 + StringLen($len) & 's ', $elem) & $data & @CRLF
                        Else
                            $ret &= $elem & "[" & $idx & "]" & @CRLF
                            For $i = 1 To $idx
                                If $iLimit And $idx > $iLimit And $i = $iLimit Then
                                    $ret &= $indent & StringFormat('%-' & 9 + StringLen($len) & 's ', '') & '... (' & $idx - $iLimit + 1 & ' more elements)' & @CRLF
                                    ExitLoop
                                Else
                                    $ret &= $indent & StringFormat('%-' & 9 + StringLen($len) & 's ', '') & DllStructGetData($vVar, $nbElem, $i) & @CRLF
                                EndIf
                            Next
                        EndIf
                    Case "String"
                        $oldvalue = DllStructGetData($vVar, $nbElem, 1)
                        DllStructSetData($vVar, $nbElem, ChrW(0x2573), 1)
                        $readvalue = DllStructGetData($vVar, $nbElem, 1)
                        DllStructSetData($vVar, $nbElem, $oldvalue, 1)
                        $elem = ($readvalue = ChrW(0x2573) ? "wchar" : "char")
                        If $idx > 1 Then $elem &= "[" & $idx & "]"
                        $ret &= $indent & StringFormat('%-' & 9 + StringLen($len) & 's ', $elem) & __DumpStr($data) & @CRLF
                    Case "Binary"
                        Local $blen = BinaryLen($data)
                        $elem = "byte"
                        If $idx > 1 Then $elem &= "[" & $idx & "]"
                        $ret &= $indent & StringFormat('%-' & 9 + StringLen($len) & 's ', $elem) & (($blen <= 32) ? $data : BinaryMid($data, 1, 16) & ' ... ' & StringTrimLeft(BinaryMid($data, $blen - 15, 16), 2)) & @CRLF
                    Case "Ptr"
                        $ret &= $indent
                        $elem = "ptr"
                        ; alias: hwnd, handle
                        If $idx = 1 Then
                            $ret &= StringFormat('%-' & 9 + StringLen($len) & 's ', $elem) & $data & @CRLF
                        Else
                            $ret &= $elem & "[" & $idx & "]" & @CRLF
                            For $i = 1 To $idx
                                $ret &= $indent & StringFormat('%-' & 9 + StringLen($len) & 's ', '') & DllStructGetData($vVar, $nbElem, $i) & @CRLF
                            Next
                        EndIf
                    Case "Double"
                        $ret &= $indent
                        $oldvalue = DllStructGetData($vVar, $nbElem, 1)
                        DllStructSetData($vVar, $nbElem, 10^-15, 1)
                        $readvalue = DllStructGetData($vVar, $nbElem, 1)
                        DllStructSetData($vVar, $nbElem, $oldvalue, 1)
                        $elem = ($readvalue = 10^-15 ? "double" : "float")
                        If $idx = 1 Then
                            $ret &= StringFormat('%-' & 9 + StringLen($len) & 's ', $elem) & $data & (IsInt($data) ? '.0' : '') & @CRLF
                        Else
                            $ret &= $elem & "[" & $idx & "]" & @CRLF
                            For $i = 1 To $idx
                                $ret &= $indent & StringFormat('%-' & 9 + StringLen($len) & 's %s', '', DllStructGetData($vVar, $nbElem, $i)) & (IsInt(DllStructGetData($vVar, $nbElem, $i)) ? '.0' : '') & @CRLF
                            Next
                        EndIf
                EndSwitch
                $nbElem += 1
            WEnd
            Return StringTrimRight($ret, 2)

;~      Case VarGetType($vVar) = "Table"
;~          Return 'Table '     ; TODO: enumerate contents

        Case Else
            Return StringFormat('%-13s', VarGetType($vVar)) & $vVar

    EndSelect
EndFunc   ;==>_VarDump


Func __VarDumpArray(ByRef $aArray, $iLimit, $sIndent = $_TAB)
    Local $sDump
    Local $sArrayFetch, $sArrayRead, $bDone
    Local $iSubscripts = UBound($aArray, 0)
    Local $aUBounds[$iSubscripts]
    Local $aCounts[$iSubscripts]
    $iSubscripts -= 1
    For $i = 0 To $iSubscripts
        $aUBounds[$i] = UBound($aArray, $i + 1) - 1
        $aCounts[$i] = 0
    Next
    $sIndent &= $_TAB
    While 1
        $bDone = True
        $sArrayFetch = ''
        For $i = 0 To $iSubscripts
            $sArrayFetch &= '[' & $aCounts[$i] & ']'
            If $aCounts[$i] < $aUBounds[$i] Then $bDone = False
        Next
        $sArrayRead = Execute('$aArray' & $sArrayFetch)
        If @error Then
            ExitLoop
        Else
            $sDump &= $sIndent & $sArrayFetch & ' => ' & _VarDump($sArrayRead, $iLimit, $sIndent)
            If Not $bDone Then
                $sDump &= @CRLF
            Else
                Return $sDump
            EndIf
        EndIf

        For $i = $iSubscripts To 0 Step -1
            $aCounts[$i] += 1
            If $aCounts[$i] > $aUBounds[$i] Then
                $aCounts[$i] = 0
            Else
                ExitLoop
            EndIf
        Next
    WEnd
EndFunc   ;==>_VarDumpArray


Func __DumpStr(ByRef $vVar)
    Local $len = StringLen($vVar)
    $vVar = Execute("'" & StringRegExpReplace($vVar, "([\p{Cc}])", "<0x' & Hex(AscW('$1'), 2) & '>") & "'")
    Return "'" & (($len <= 64) ? $vVar : StringMid($vVar, 1, 32) & ' ... ' & StringTrimLeft(StringMid($vVar, $len - 31, 32), 2)) & "'"
EndFunc   ;==>__DumpStr

Local $tTest = DllStructCreate("byte;byte[3];char;char[3];wchar;wchar[3];short;short[3];ushort;ushort[3];int;int[3];uint;uint[3];int64;int64[3];uint64;uint64[3];float;float[3];double;double[3];handle;handle[3];boolean;bool;hwnd;handle;int_ptr;long_ptr;lresult;lparam;uint_ptr;ulong_ptr;dword_ptr;wparam")
DllStructSetData($tTest, 2, '€')
DllStructSetData($tTest, 6, '€')
ConsoleWrite('Test structure types' & @LF & _VarDump($tTest) & @LF & @LF)

Local $struct = DllStructCreate("char[3];handle[3];uint[35];byte[128];wchar[190000]; double[3];int64[3];char[3];float;double;byte;byte;short;ushort;int;uint;char")
DllStructSetData($struct, 1, 'sos')
DllStructSetData($struct, 2, Ptr(123456789))
DllStructSetData($struct, 3, 8, 1)
DllStructSetData($struct, 3, 0x87654321, 2)
DllStructSetData($struct, 3, 256, 5)
DllStructSetData($struct, 4, Binary('sos'))
DllStructSetData($struct, 5, 'gno' & @CRLF & 'ji' & @TAB & 'o')
DllStructSetData($struct, 6, 3.1415926, 2)
DllStructSetData($struct, 7, 17, 1)
DllStructSetData($struct, 7, -1, 2)
DllStructSetData($struct, 8, 'end')
DllStructSetData($struct, 9, 2.7182818284590452353602874713527)
DllStructSetData($struct, 10, 2.7182818284590452353602874713527)
DllStructSetData($struct, 11, 107)
DllStructSetData($struct, 12, -108)
DllStructSetData($struct, 13, 109)
DllStructSetData($struct, 14, 110)
DllStructSetData($struct, 15, 111)
DllStructSetData($struct, 16, 112)

Local $f = _VarDump

Local $c[2][0]
Local $e = [[Null, Default], [__DumpStr, MsgBox]]
Local Enum $p = 33333333333333
Opt("WinTitleMatchMode", 2)
Local $a[3][4] = [ _
    [$c, $e, ObjCreate("shell.application"), WinGetHandle("Dump.au3")], _
    ['zzz', 1/3, True, 0x123456], _
    [$struct, 93, Null, $p] _
]

ConsoleWrite('Test example of moderate complexity' & @LF & $f($a) & @LF)

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

I have some concerns regarding this, and several other things, before upgrading. Some  projects are on hold (and have been for a long time) until I get to the bottom of these concerns. Looking at AutoIt limits (online docs), I see the following information:

0x8000000000000000 to 0x7FFFFFFFFFFFFFFF Hexadecimal number range (32-bit/64-bit signed integer).

This would seem to imply that every number in the range 0x80000000 to 0xFFFFFFFF has two values (one positive and the other negative). I also notice that there has been no change to the 15 digit limitation for floats. This seems to be a sticky whatchamacallit. Bitwise functions are documented to only work on 32-bit integers. So how does this work? It seems implausible.

Edited by czardas
Link to comment
Share on other sites

Where did you find this Limit statement? I'm unable to locate it anywhere.

When there exist two implementations for a variant (e.g. int32 and int64) then there exist 2 representations for all values, not only negative ones.

I can't find what you're refereing to about floats: where can I read that prose?

Bitwise functions are unfortunately still limited to work on int32.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

It's in the FAQ: http://www.autoitscript.com/autoit3/docs/faq.htm#11

If this is untrue, then it needs changing. Judging by the above docs, the largest integer the interpreter can safely handle would be: 0x38D7EA4C67FFF. If there are two interpretations for all, or rather for a set of, values; how can the interpreter handle hexadecimal ranges? Surely it's impossible. :

Edited by czardas
Link to comment
Share on other sites

Ha! I didn't look in the FAQ.

I confess I have hard time figuring out where 0x38D7EA4C67FFF is coming out and why you say it is the "largest integer the interpreter can safely handle".

I also admit having no clue about what your last § means: which hex ranges?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Don't confuse the floating-point 15 to 16 max digits with the value range of integral type(s).

The problem I can see -and it's a true bug from my view- is when the interpretor sees a 4-byte hex literal having the leftmost bit set: it interprets it as a 32-bit negative value.

Local $aTest = [0xFFFFFFFF, 0x80000000, 0x8FFFFFFF, 0x0080000000, 0x00FFFFFFFF, 0x008FFFFFFF]
For $i In $aTest
    ConsoleWrite($i & @LF)
Next

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...