knhx.h 570 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef KNHX_H_
  2. #define KNHX_H_
  3. #define KNERR_MISSING_LEFT 0x01
  4. #define KNERR_MISSING_RGHT 0x02
  5. #define KNERR_BRACKET 0x04
  6. #define KNERR_COLON 0x08
  7. typedef struct {
  8. int parent, n;
  9. int *child;
  10. char *name;
  11. double d;
  12. } knhx1_t;
  13. #ifndef KSTRING_T
  14. #define KSTRING_T kstring_t
  15. typedef struct __kstring_t {
  16. size_t l, m;
  17. char *s;
  18. } kstring_t;
  19. #endif
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. knhx1_t *kn_parse(const char *nhx, int *_n, int *_error);
  24. void kn_format(const knhx1_t *node, int root, kstring_t *s);
  25. #ifdef __cplusplus
  26. }
  27. #endif
  28. #endif