teapot-spreadsheet/src/common/cell.h

47 lines
971 B
C

#ifndef CELL_H
#define CELL_H
#include "scanner.h"
#include "style.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{ BASE_CONT=0, ITER_CONT, STYLE_CONT, MAX_PERSIST_TV = STYLE_CONT,
CURR_VAL, RES_VAL, STYLE_VAL,
CONTINGENT /* Must be last, marks end of many loops */
} TokVariety;
extern const char *TokVariety_Name[];
typedef struct
{
Token tok[CONTINGENT];
char *label;
unsigned int updated:1;
unsigned int locked:1;
unsigned int ignored:1;
unsigned int clock_t0:1;
unsigned int clock_t1:1;
unsigned int clock_t2:1;
} Cell;
#define NULLCELL ((Cell*)0)
typedef enum {ALTER_LABEL, PRESERVE_LABEL} LabelHandling;
Token gettok(const Cell *cell, TokVariety v);
bool locked(const Cell *cell);
bool ignored(const Cell *cell);
const char *getlabel(const Cell *cell);
void initcellcontents(Cell *cell);
void freecellcontents(Cell *cell);
void copycell(Cell *to, const Cell *from, LabelHandling lh);
#ifdef __cplusplus
}
#endif
#endif