question about internals
Stefano Borini <[email protected]> Thu, 18 Mar 2004 09:29:32 +0100
| Newsgroups | gmane.comp.gnome.gdome |
|---|---|
| Organization | Comitato Rivoluzionario Pinguino |
| Message-ID | <[email protected]> |
hi all, I'm developing a fortran 77 binding to gdome2. You can find it at http://members.ferrara.linux.it/munehiro/f77xml/ The problem is quite tricky. Unfortunately Fortran compilers and platform are so variegate that the concept of pointer is very particular. To prevent messing up with architecture specific problems, and also to face the problem to unref the instances at the closing of the file, my current f77xml implementation store each reference to nodes, nodelists and so on in a cache, and returns an integer that refers to the cache position. My question arise from the problem that the same element _can_ have two different insertions in the cache, so you can refer to the same element with two different numbers. Also, if you empty the cache, thus unref'ing every element, a new get of the same element has a different number associated to. Doing some experiment with gdome2 in C, i noted that even ref'ing, then unref'ing and the ref'ing again the element, or accessing in different ways (from its parent or its child), the pointer that is returned is always the same. Is this consistence guaranteed by the DOM implementation of gdome, or it's simply a consequence of the small example i'm running? I tried to browse the sources, and as far as i understood the element is completely freed every time the refcount fall to zero, then subsequents access to the same node can return, in principle, a different memory pointer. If The refcount never fall to zero, the node is always referred with the same pointer, regardless the way used to obtain it. last question: if i obtain a nodelist, when unref'ing it the referred nodes are automatically unrefferred (refCount--) ? thanks