Subject: AW: [clisp-list] on FFI:mark-invalid-foreign, malloc() and finali zati on

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Fri Mar 14 08:23:08 2003

Sam Steingold suggested:
>> another may also be :NEW, or :SESSION, not just a foreign-entity,
>> which is IMHO not compatible with the SETF idea. Returns the modified
>> entity. Maybe name it update-foreign-base?

>(defun (setf foreign-pointer) (new) (f-ent)
[...]
>      return fp;)
>    TheFpointer(foreign_pointer(f-ent))->fp_pointer = new))
I thought setf must always return the "new" argument. I'll have to check CLHS.

O(fp_zero) is not to be modified by set-foreign-base.

>(setf (foreign-pointer fa) 3)
That's not allowed. The idea is to share foreign-bases/pointers to achieve dependency tracking. An integer is not acceptable. It must be a foreign-entity, because that holds a foreign-POINTER object.
So set-foreign-base is first a dependency tracking mechanism than a mean to set a pointer to a given address.

It can accessorily be used to produce a pointer to a given address:
(set-foreign-base (unsigned-foreign-address N) :new)
:new yields an object pointing to the address, with 0 offset, a property that shall be documented.

Then you can restore the previous base into this object:
(set-foreign-base *[previous result] another-foreign)
-> a pointer to address N, with base another old foreign's base.

I find this set-foreign-base composes very well.

Regards,
	Jorg Hohle.

---

From: Sam Steingold <[email-masked]>
Date: Fri Mar 14 08:45:03 2003

> * In message <[email-masked]>
> * On the subject of "AW: [clisp-list] on FFI:mark-invalid-foreign, malloc() and finali zati on"
> * Sent on Fri, 14 Mar 2003 17:22:05 +0100
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> Sam Steingold suggested:

sure.

> O(fp_zero) is not to be modified by set-foreign-base.

why?  I thought you wanted that!
Isn't it possible that you would want to invalidate all current foreign
entities referring to O(fp_zero) and to start anew with a fresh O(fp_zero)?

> That's not allowed.

doesn't matter.
what if the new foreign-pointer has an address numerically larger that
the foreign-pointer+offset of this foreign entity?
keeping the address fixed would require using a negative offset.

> -> a pointer to address N, with base another old foreign's base.

I see.  so (setf (foreign-pointer f-ent) :new) just means "uncouple this
foreign entity from its foreign-pointer group".

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Any connection between your reality and mine is purely coincidental.