guile-gi
guile-gi copied to clipboard
Implement and test hash types
Implement scheme-to-GHashTable conversion functions and ensure that all the libmarshall tests pass for hash tables.
So it appears that in the GIR and Typelib files, all of the GHashTable constructors are marked as not introspectable, so there is no way to construct a GHashTable via introspected methods. However, the type itself and many methods are introspectable. Thus, any GHashTable constructors will need to be supplied by this project.
I've implemented a minimal interface. It is primitive, but, it provides the minimum functionality and tracks the C API. I'm not sure about what higher-level API would be appropriate, since so much depends on interpreting the pointers that GHashTables use as their keys and values.
These patches always convert a Guile hashtable to a GHashTable and vice versa as required by a function call. OUT and INOUT are handled correctly. The next problem is that a GHashTable can be marked as IN only in a function call, but, the function can still modify the hashtable. (see g_hash_table_insert)
Two strategies
- Return a Guile representation of the
GHashTableas output, as if it were an INOUT parameter. (But can't use INOUT handling directly because of the extra level of indirection of INOUT parameters) - After the function call, modify the Guile hashtable to match the
GHashTable