ErosOlmi
25-04-2007, 10:32
Another thing we are working on is full support of variable pointers and pointer dereferenciation.
Dereferencing is a powerful way to access data using pointers. Many 3rd party library returns pointers to internal structures to access them. Right now the only way to get/set real data values from a pointer is using PEEK/POKE knowing the exact position of a structure element and element type. If we will success it will be easy to use pointers both for standard scripts or for script accessing external data.
But what is dedereferenciation? A little example, I will be more precise in further posts.
Imagine you have a dynamic string.
DIM MyString as string
now you have a pointer to that string
dim MyStrPtr as long
MyStrPtr = strptr(MyString)
The only way to acces the string using that generic pointer will be something like:
Dim aBuffer as string
aBuffer = peek$(MyStrPtr, len(MyString))
Using a pointer it will be something like:
dim MyString as string
dim MyStrPtr as string PTR = varptr(MyString)
Acessing the string data will be something like:
dim aBuffer as string = @MyStrPtr
I will add further info on them. We are trying to solve some internal programming strategy we need to change from current one in order to add those functionalities.
As a reference, please see Power Basic explanation of what is a pointer at http://www.powerbasic.com/support/help/pbwin/html/Pointers_(@).htm
We are trying to follow those indications.
Regards
eros
Dereferencing is a powerful way to access data using pointers. Many 3rd party library returns pointers to internal structures to access them. Right now the only way to get/set real data values from a pointer is using PEEK/POKE knowing the exact position of a structure element and element type. If we will success it will be easy to use pointers both for standard scripts or for script accessing external data.
But what is dedereferenciation? A little example, I will be more precise in further posts.
Imagine you have a dynamic string.
DIM MyString as string
now you have a pointer to that string
dim MyStrPtr as long
MyStrPtr = strptr(MyString)
The only way to acces the string using that generic pointer will be something like:
Dim aBuffer as string
aBuffer = peek$(MyStrPtr, len(MyString))
Using a pointer it will be something like:
dim MyString as string
dim MyStrPtr as string PTR = varptr(MyString)
Acessing the string data will be something like:
dim aBuffer as string = @MyStrPtr
I will add further info on them. We are trying to solve some internal programming strategy we need to change from current one in order to add those functionalities.
As a reference, please see Power Basic explanation of what is a pointer at http://www.powerbasic.com/support/help/pbwin/html/Pointers_(@).htm
We are trying to follow those indications.
Regards
eros