SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef OXYL_CELL_H
  2. #define OXYL_CELL_H
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7.  
  8. #ifndef OXYL_CELL_STRING_SIZE
  9. #  define OXYL_CELL_STRING_SIZE 20
  10. #else
  11. #  if OXYL_CELL_STRING_SIZE == 0
  12. #    error "Cannot use size 0 strings with Oxyl"
  13. #  endif
  14. #endif
  15.  
  16. #define OXYL_CELL_HAS_NEXT(cell) (cell->next != NULL)
  17.  
  18. #define OXYL_CELL_CLEAN(cell) memset(cell, 0, sizeof(struct __oxyl_cell))
  19.  
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23.  
  24.     typedef enum __oxyl_cell_type
  25.     {
  26.         OXYL_CELL_TYPE_NONE,
  27.         OXYL_CELL_TYPE_BOOL,
  28.         OXYL_CELL_TYPE_NUMBER,
  29.         OXYL_CELL_TYPE_STRING,
  30.         OXYL_CELL_TYPE_INNER
  31.     } oxyl_cell_type_t;
  32.  
  33.     struct __oxyl_cell;
  34.  
  35.     typedef union __oxyl_cell_value
  36.     {
  37.         char _string[OXYL_CELL_STRING_SIZE + 1];
  38.         struct __oxyl_cell* _inner;
  39.         double _number;
  40.         int _boolean;
  41.     } oxyl_cell_val_t;
  42.  
  43.     struct __oxyl_cell
  44.     {
  45.         oxyl_cell_type_t type;
  46.         oxyl_cell_val_t val;
  47.         struct __oxyl_cell* next;
  48.     };
  49.  
  50.     typedef struct __oxyl_cell oxyl_cell_t;
  51.  
  52.     oxyl_cell_t* oxyl_cell_create(oxyl_cell_type_t type, void* data);
  53.  
  54.     void oxyl_cell_init(oxyl_cell_t* cell, oxyl_cell_type_t type, void* data);
  55.  
  56.     void oxyl_cell_del(oxyl_cell_t* cell);
  57.  
  58. #ifdef __cplusplus
  59. }
  60. #endif // __cplusplus
  61.  
  62. #endif // OXYL_CELL_H
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top