Changed function calls to throw if too many parameters are passed.
as a means to permit but not store surplus parameters.
Changed StrPut to return byte count rather than character count.
to reflect some of the planned changes
Added BufferAlloc() and Buffer object.
Changed NumPut, NumGet, File.RawRead, File.RawWrite, StrPut and StrGet to allow passing a Buffer-like object; that is, any object with Ptr
and Size properties. Optimizations are in place for the native Buffer object. Testing showed that passing a native Buffer object is as fast as passing a pointer.
I recommend reading the updated documentation
for NumPut, NumGet, File.RawRead and File.RawWrite. Support for passing a variable to use as a buffer may be removed from these functions/methods. The general use of VarSetCapacity for binary data is to be discouraged.
Added a new mode to NumPut which allows a sequence of numbers to be written, as in NumPut("int", a, "ptr", b, buf)
. (NumPut's parameters can be compared to the input parameters of a DllCall, while NumGet's type parameter can be compared to DllCall's return type.) Currently the old syntax is also permitted, but it may be removed.
Changed DllCall Ptr args to allow passing any object with a Ptr
property. An exception is thrown if an object is passed to any other type of arg, or if this property does not exist.
Changed FileRead(File, "RAW")
to return a Buffer object. Note that Buffer.Size returns an exact byte count, whereas the old return value was always an even number of bytes as it was contained within a UTF-16 string.
Improved validation and error messages for ProcessWait, ProcessWaitClose, NumGet, NumPut and DllCall Str args.
Fixed File.RawRead/RawWrite second parameter to be optional as noted in v2-changes.
Merged pull request #138