cytpl.pxd 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. from cpython.string cimport va_list
  2. from libc.stdint cimport uint32_t
  3. cdef extern from 'tpl.h':
  4. ctypedef int tpl_print_fcn(const char *fmt, ...)
  5. ctypedef void *tpl_malloc_fcn(size_t sz)
  6. ctypedef void *tpl_realloc_fcn(void *ptr, size_t sz)
  7. ctypedef void tpl_free_fcn(void *ptr)
  8. ctypedef void tpl_fatal_fcn(const char *fmt, ...)
  9. cdef:
  10. int TPL_FILE
  11. int TPL_MEM
  12. int TPL_PREALLOCD
  13. int TPL_EXCESS_OK
  14. int TPL_FD
  15. int TPL_UFREE
  16. int TPL_DATAPEEK
  17. int TPL_FXLENS
  18. int TPL_GETSIZE
  19. struct tpl_hook_t:
  20. tpl_print_fcn *oops
  21. tpl_malloc_fcn *malloc
  22. tpl_realloc_fcn *realloc
  23. tpl_free_fcn *free
  24. tpl_fatal_fcn *fatal
  25. size_t gather_max
  26. struct tpl_node:
  27. int type
  28. void *addr
  29. void *data
  30. int num
  31. size_t ser_osz
  32. tpl_node *children
  33. tpl_node *next
  34. tpl_node *prev
  35. tpl_node *parent
  36. struct tpl_bin:
  37. void *addr
  38. uint32_t sz
  39. struct tpl_gather_t:
  40. char *img
  41. int len
  42. ctypedef int tpl_gather_cb(void *img, size_t sz, void *data)
  43. # Protoypes.
  44. tpl_node *tpl_map(char *fmt,...)
  45. void tpl_free(tpl_node *r)
  46. int tpl_pack(tpl_node *r, int i)
  47. int tpl_unpack(tpl_node *r, int i)
  48. int tpl_dump(tpl_node *r, int mode, ...)
  49. int tpl_load(tpl_node *r, int mode, ...)
  50. int tpl_Alen(tpl_node *r, int i)
  51. char* tpl_peek(int mode, ...)
  52. int tpl_gather( int mode, ...)
  53. int tpl_jot(int mode, ...)
  54. tpl_node *tpl_map_va(char *fmt, va_list ap)