teapot-spreadsheet/src/common/cell.h

66 lines
1.5 KiB
C

#ifndef CELL_H
#define CELL_H
#include "scanner.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum { LEFT=0, RIGHT=1, CENTER=2, AUTOADJUST=3 } Adjust;
typedef enum { BASE=0, ITERATIVE=1, CONTINGENT=2 } ContentVariety;
typedef unsigned char ColorNum;
#define MAX_MAX_COLORS UCHAR_MAX;
typedef enum { FOREGROUND = 0, BACKGROUND, NUM_COLOR_ASPECTS } ColorAspect;
extern const ColorNum DefaultCN[];
typedef struct
{
Token **contents[CONTINGENT];
char *label;
Token value;
Token resvalue;
Adjust adjust;
int precision;
ColorNum aspect[NUM_COLOR_ASPECTS];
unsigned int updated:1;
unsigned int shadowed:1;
unsigned int scientific:1;
unsigned int locked:1;
unsigned int transparent:1;
unsigned int ignored:1;
unsigned int clock_t0:1;
unsigned int clock_t1:1;
unsigned int clock_t2:1;
unsigned int bold:1;
unsigned int underline:1;
} Cell;
#define NULLCELL ((Cell*)0)
Token **getcont(const Cell *cell, ContentVariety v);
Adjust getadjust(const Cell *cell);
bool shadowed(const Cell *cell);
bool isbold(const Cell *cell);
bool underlined(const Cell *cell);
ColorNum getcolor(const Cell *cell, ColorAspect aspect);
bool locked(const Cell *cell);
bool transparent(const Cell *cell);
bool ignored(const Cell *cell);
bool getscientific(const Cell *cell);
int getprecision(const Cell* cell);
const char *getlabel(const Cell *cell);
void initcellcontents(Cell *cell);
void freecellcontents(Cell *cell);
void copycell(Cell *to, const Cell *from);
#ifdef __cplusplus
}
#endif
#endif