view cy_works/qu.pyx @ 69:157f012ffab7 default tip

from local
author Henry S Thompson <ht@inf.ed.ac.uk>
date Fri, 17 Jan 2025 15:45:26 +0000
parents eb91fd5d49b3
children
line wrap: on
line source

# distutils: sources = c-algorithms/src/queue.c
# distutils: include_dirs = c-algorithms/src/

cimport cqu

cdef class Queue:
    cdef cqu.Queue* _c_queue

    def __cinit__(self):
        self._c_queue = cqu.queue_new()
        if self._c_queue == NULL:
            raise MemoryError()

    def __dealloc__(self):
        if self._c_queue != NULL:
            cqu.queue_free(self._c_queue)

cdef testMe():
    print('testing...')
    q = Queue()
    print(cqu.queue_is_empty(q._c_queue))
    print('tested')

testMe()