Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef OXYL_CELL_H
- #define OXYL_CELL_H
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #ifndef OXYL_CELL_STRING_SIZE
- # define OXYL_CELL_STRING_SIZE 20
- #else
- # if OXYL_CELL_STRING_SIZE == 0
- # error "Cannot use size 0 strings with Oxyl"
- # endif
- #endif
- #define OXYL_CELL_HAS_NEXT(cell) (cell->next != NULL)
- #define OXYL_CELL_CLEAN(cell) memset(cell, 0, sizeof(struct __oxyl_cell))
- #ifdef __cplusplus
- extern "C" {
- #endif
- typedef enum __oxyl_cell_type
- {
- OXYL_CELL_TYPE_NONE,
- OXYL_CELL_TYPE_BOOL,
- OXYL_CELL_TYPE_NUMBER,
- OXYL_CELL_TYPE_STRING,
- OXYL_CELL_TYPE_INNER
- } oxyl_cell_type_t;
- struct __oxyl_cell;
- typedef union __oxyl_cell_value
- {
- char _string[OXYL_CELL_STRING_SIZE + 1];
- struct __oxyl_cell* _inner;
- double _number;
- int _boolean;
- } oxyl_cell_val_t;
- struct __oxyl_cell
- {
- oxyl_cell_type_t type;
- oxyl_cell_val_t val;
- struct __oxyl_cell* next;
- };
- typedef struct __oxyl_cell oxyl_cell_t;
- oxyl_cell_t* oxyl_cell_create(oxyl_cell_type_t type, void* data);
- void oxyl_cell_init(oxyl_cell_t* cell, oxyl_cell_type_t type, void* data);
- void oxyl_cell_del(oxyl_cell_t* cell);
- #ifdef __cplusplus
- }
- #endif // __cplusplus
- #endif // OXYL_CELL_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement