[fpc-devel] hacking strings/dyn array...

Martin lazarus at mfriebe.de
Fri Dec 7 16:29:24 CET 2012


On 07/12/2012 13:34, Jonas Maebe wrote:
>
> On 06 Dec 2012, at 22:45, Martin wrote:
>
>> I am currently fixing some of the PascalScript issues. When working 
>> with strings, it sometimes needs to inc/dec the refcount (or access 
>> the length)
>>
>> Current code does calculate the position of that data as either 1 or 
>> 2 times sizeof(Pointer) in front of the actual data. (Not guaranteed 
>> for the future, but currently it is there)
>
> Not in svn trunk.
Actually strings are done without hacking. typecasting the pointer, and 
have fpc deal with it.

Have arrays also changed?

The problem are arrays. Arrays may be of a type, that is not even 
declared in the running app. Because in pascal script, the script can 
define its own type. Then the scripts runtime, must be able to finalize it.
Well if it is never given to the compiled code, then layout does not matter.

But if a compiled function "Procedure Foo(a: Array of TPoint)" is used 
from the script, then the type must be declared for the script too. And 
then script and and exe must be able to deal with this data.

But the script engine currently has no access to a low level 
finalize/initialize/incref/decref/...  for that specific data type.

Yes it be nice to get a real solution for that. But I also need to find 
a solution that works now.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20121207/5a894393/attachment.html>


More information about the fpc-devel mailing list