Hi,

I would also appreciate an example for the hash table too. I don't mind
writing documentation for it, if someone can help me out getting it to work.

I am unsure how and were to declare the arguments that hash_table_new takes.

In the documentation
http://c-algorithms.sourceforge.net/doc/hash-table_8h.html#e361c4c0256ec6c74
1ecfeabef33d891 , I can find:

HashTable* hash_table_new       (       HashTableHashFunc       hash_func,
                HashTableEqualFunc      equal_func       
        )                       

To create a new hash table. But I can't find were the HashTableHashFunc and
HashTableEqualFunc are declared. The only thing I can find is in the header
file which state:

typedef unsigned long(* HashTableHashFunc)(HashTableKey value)
typedef unsigned long(* HashTableHashFunc)(HashTableKey value)

Does this mean I have to write these functions myself? In c? And how then do
I call them from cython?

My guess: 

hashtable.pyx

cdef extern from "hash_table.h":

        object HashTable hash_table_new(object hash_func, object equal_func)


wrapper.py

Import hashtable
HT = hashtable.hash_table_new() //is this wrong? the c hash table is not a
//class but a collection of methods it seems



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Stefan Behnel
Sent: woensdag 2 september 2009 20:08
To: [email protected]
Subject: Re: [Cython] FW: cython and hash tables / dictionary


Sebastien Binet wrote:
> I'd recommand using this C library:
> http://c-algorithms.sourceforge.net/

Interesting. That would certainly make a nice C-level standard library.

Would you have ready-made .pxd files for this library? Or even some Cython
example code that you could post somewhere?

Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to