File notation_att.h
File List > note-algebraic_tangle_tree > src > notation_att.h
Go to the documentation of this file
#ifndef NOTATION_ATT_H
#define NOTATION_ATT_H
/******************************************************************************/
/*******************************Includes***************************************/
/******************************************************************************/
#include "notation_defs.h"
#include "notation_tv.h"
#include "stdbool.h"
#include "stdint.h"
#include "stdlib.h"
#include "string.h"
/******************************************************************************/
/*******************************Defines***************************************/
/******************************************************************************/
/*
*
| Flv | NA | NA | NA | NA | NA | NA | Op | Op |
|----------|-----|-----|-----|-----|-----|-----|-----|-----|
| uninit | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
|----------|-----|-----|-----|-----|-----|-----|-----|-----|
| Plus | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
|----------|-----|-----|-----|-----|-----|-----|-----|-----|
| Vee | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |
|
*/
#define NOTE_ATT_OP_SHIFT_LEN (0x00u)
#define NOTE_ATT_OP_UNINIT (0x00u << NOTE_ATT_OP_SHIFT_LEN)
#define NOTE_ATT_OP_PLUS (0x01u << NOTE_ATT_OP_SHIFT_LEN)
#define NOTE_ATT_OP_VEE (0x02u << NOTE_ATT_OP_SHIFT_LEN)
#define NOTE_ATT_CLR_OP(FLV) \
(FLV = ((FLV)&(~(0x03u << NOTE_ATT_OP_SHIFT_LEN))))
#define NOTE_ATT_SET_OP(FLV, OP) (FLV = (((FLV) | (OP))))
#define NOTE_ATT_CHK_OP(FLVR, OP) \
(((FLVR) & (0x03u << NOTE_ATT_OP_SHIFT_LEN)) == (OP) ? (true) : (false))
#define NOTE_ATT_TRAVERSE_FAIL (0x01u)
#define NOTE_ATT_TRAVERSE_SUCCESS (0x00u)
/******************************************************************************/
/*******************************Typedefs***************************************/
/******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct note_att_node_t {
struct note_att_node_t *L_child;
struct note_att_node_t *R_child;
note_tv_t * L_tv;
note_tv_t * R_tv;
uint8_t operation;
} note_att_node_t;
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct {
note_att_node_t *root;
note_att_node_t *node_buffer;
size_t node_buffer_len;
note_tv_t * tv_buffer;
size_t tv_buffer_len;
} note_att_t;
#ifdef __cplusplus
}
#endif
/******************************************************************************/
/***************************Function Declarations******************************/
/******************************************************************************/
#ifdef __cplusplus
extern "C"
{
#endif
uint8_t note_att_decode(char *str, note_att_t *att);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C"
{
#endif
uint8_t note_att_encode(note_att_t att, char *str, size_t buffer_size);
#ifdef __cplusplus
}
#endif
#endif /* end NOTATION_ATT_H */