import ctypes import tempfile import os import base_wrapper import helpers # ctypes wrapper list_lib = helpers.get_lib('list.so') # TADs class __List(ctypes.Structure): pass _List = ctypes.POINTER(__List) # list_t list_empty(void) list_empty = helpers.wrap_func(list_lib.list_empty, _List, []) # list_t list_destroy(list_t list) list_destroy = helpers.wrap_func(list_lib.list_destroy, _List, [_List]) # unsigned int list_length(list_t list) list_length = helpers.wrap_func(list_lib.list_length, ctypes.c_uint, [_List]) # bool list_is_equal(list_t list, list_t other) list_is_equal = helpers.wrap_func(list_lib.list_is_equal, ctypes.c_bool, [_List, _List])
import ctypes import helpers from base_wrapper import Edge, _Edge # ctypes wrapper stack_lib = helpers.get_lib('stack.so') # TADs class __Stack(ctypes.Structure): pass _Stack = ctypes.POINTER(__Stack) # Wrappers # stack_t stack_empty(void) stack_empty = helpers.maybe_implemented(stack_lib, 'stack_empty', _Stack, []) # stack_t stack_destroy(stack_t stack) stack_destroy = helpers.maybe_implemented(stack_lib, 'stack_destroy', _Stack, [_Stack]) # stack_t stack_push(stack_t stack, stack_elem_t elem) stack_push = helpers.maybe_implemented(stack_lib, 'stack_push', _Stack, [_Stack, _Edge])
import ctypes import helpers from base_wrapper import Edge, _Edge # ctypes wrapper heap_lib = helpers.get_lib('heap.so') # TADs class __Heap(ctypes.Structure): pass _Heap = ctypes.POINTER(__Heap) # heap_t heap_empty(unsigned int max_size) heap_empty = helpers.maybe_implemented( heap_lib, 'heap_empty', _Heap, [ctypes.c_uint]) # heap_t heap_destroy(heap_t heap) heap_destroy = helpers.maybe_implemented( heap_lib, 'heap_destroy', _Heap, [_Heap]) # heap_t heap_insert(heap_t heap, heap_elem_t elem)
import ctypes import helpers # ctypes wrapper uf_lib = helpers.get_lib('union_find.so') # TADs class __UnionFind(ctypes.Structure): pass _UnionFind = ctypes.POINTER(__UnionFind) # Wrappers # union_find_t union_find_create(unsigned int max_size) uf_create = helpers.maybe_implemented(uf_lib, 'union_find_create', _UnionFind, [ctypes.c_uint]) # union_find_t union_find_destroy(union_find_t uf) uf_destroy = helpers.maybe_implemented(uf_lib, 'union_find_destroy', _UnionFind, [_UnionFind]) # union_find_t union_find_push(union_find_t uf, union_find_elem_t elem) uf_push = helpers.maybe_implemented(uf_lib, 'union_find_push', _UnionFind, [_UnionFind, ctypes.c_uint]) # union_find_t union_find_union(union_find_t uf,
import ctypes import helpers from base_wrapper import Edge, _Edge # ctypes wrapper pq_lib = helpers.get_lib('priority_queue.so') # TADs class __PriorityQueue(ctypes.Structure): pass _PriorityQueue = ctypes.POINTER(__PriorityQueue) # Wrappers # priority_queue_t priority_queue_empty(unsigned int max_size) pq_empty = helpers.maybe_implemented(pq_lib, 'priority_queue_empty', _PriorityQueue, [ctypes.c_uint]) # priority_queue_t priority_queue_destroy(priority_queue_t pq) pq_destroy = helpers.maybe_implemented(pq_lib, 'priority_queue_destroy', _PriorityQueue, [_PriorityQueue]) # priority_queue_t priority_queue_enqueue(priority_queue_t pq, # priority_queue_elem_t elem) pq_enqueue = helpers.maybe_implemented(pq_lib, 'priority_queue_enqueue',
import ctypes import os import tempfile from functools import partial import helpers # ctypes wrapper dict_lib = helpers.get_lib('dict.so') # TADs class __Dictionary(ctypes.Structure): pass _Dictionary = ctypes.POINTER(__Dictionary) _Word = ctypes.c_char_p _Definition = ctypes.c_char_p # Wrappers # dict_t dict_empty(void) dict_empty = helpers.maybe_implemented(dict_lib, 'dict_empty', _Dictionary, []) # dict_t dict_destroy(dict_t dict) dict_destroy = helpers.maybe_implemented(dict_lib, 'dict_destroy', _Dictionary, [_Dictionary])
import ctypes import helpers # ctypes wrapper graph_lib = helpers.get_lib('graph.so') # TADs class __Vertex(ctypes.Structure): pass _Vertex = ctypes.POINTER(__Vertex) class __Edge(ctypes.Structure): pass _Edge = ctypes.POINTER(__Edge) # vertex_t vertex_create(label_t label) vertex_create = helpers.maybe_implemented(graph_lib, 'vertex_create', _Vertex, [ctypes.c_uint]) # vertex_t vertex_destroy(vertex_t vertex) vertex_destroy = helpers.maybe_implemented(graph_lib, 'vertex_destroy', _Vertex, [_Vertex])
import ctypes import helpers # ctypes wrapper sort_lib = helpers.get_lib('sort.so') # void selection_sort(int *a, unsigned int length); selection_sort = helpers.maybe_implemented( sort_lib, 'selection_sort', None, [helpers.int_ptr, ctypes.c_uint]) # void insertion_sort(int *a, unsigned int length); insertion_sort = helpers.maybe_implemented( sort_lib, 'insertion_sort', None, [helpers.int_ptr, ctypes.c_uint]) # void quick_sort(int *a, unsigned int length); quick_sort = helpers.maybe_implemented( sort_lib, 'quick_sort', None, [helpers.int_ptr, ctypes.c_uint]) # void rand_quick_sort(int *a, unsigned int length); rand_quick_sort = helpers.maybe_implemented( sort_lib, 'rand_quick_sort', None, [helpers.int_ptr, ctypes.c_uint]) # void bubble_sort(int *a, unsigned int length); bubble_sort = helpers.maybe_implemented( sort_lib, 'bubble_sort', None, [helpers.int_ptr, ctypes.c_uint]) # unsigned long int get_comp_counter(void); get_comp_counter = helpers.maybe_implemented(
import ctypes import base_wrapper import helpers import list_wrapper # ctypes wrapper bst_lib = helpers.get_lib('bst.so') # TADs class __BST(ctypes.Structure): pass _BST = ctypes.POINTER(__BST) # bst_t bst_empty(void); bst_empty = helpers.maybe_implemented(bst_lib, 'bst_empty', _BST, []) # bst_t bst_destroy(bst_t bst); bst_destroy = helpers.maybe_implemented(bst_lib, 'bst_destroy', _BST, [_BST]) # unsigned int bst_length(bst_t bst); bst_length = helpers.maybe_implemented(bst_lib, 'bst_length', ctypes.c_uint, [_BST]) # bool bst_is_equal(bst_t bst, bst_t other); bst_is_equal = helpers.maybe_implemented(bst_lib, 'bst_is_equal', ctypes.c_bool, [_BST, _BST])