88 lines
2.4 KiB
C
88 lines
2.4 KiB
C
#ifndef CELL_H
|
|
#define CELL_H
|
|
|
|
#include "scanner.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef enum
|
|
{ BASE_CONT=0, ITER_CONT, ATTR_REF, MAX_PERSIST_TV = ATTR_REF,
|
|
CURR_VAL, RES_VAL,
|
|
CONTINGENT /* Must be last, marks end of many loops */
|
|
} TokVariety;
|
|
extern const char *TokVariety_Name[];
|
|
|
|
typedef enum { LEFT=0, RIGHT=1, CENTER=2, AUTOADJUST=3 } Adjust;
|
|
extern const char *Adjust_Name[];
|
|
#define MAX_ADJUST_NAME_LENGTH 16
|
|
extern const char Adjust_Char[];
|
|
|
|
typedef enum
|
|
{ FLT_DECIMAL=0, FLT_SCIENTIFIC, FLT_COMPACT, FLT_HEXACT }
|
|
FloatFormat;
|
|
extern const char *FloatFormat_Name[];
|
|
#define MAX_FLOATFORM_NAME_LENGTH 16
|
|
extern const char FloatFormat_Char[];
|
|
|
|
typedef unsigned char ColorNum;
|
|
#define MAX_MAX_COLORS UCHAR_MAX;
|
|
|
|
typedef enum { FOREGROUND = 0, BACKGROUND, NUM_COLOR_ASPECTS } ColorAspect;
|
|
extern const char *ColorAspect_Name[];
|
|
extern const ColorNum DefaultCN[];
|
|
|
|
typedef struct
|
|
{
|
|
Token tok[CONTINGENT];
|
|
char *label;
|
|
int precision;
|
|
Adjust adjust;
|
|
FloatFormat fform;
|
|
ColorNum aspect[NUM_COLOR_ASPECTS];
|
|
unsigned int updated:1;
|
|
unsigned int shadowed: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)
|
|
|
|
typedef enum {ALTER_LABEL, PRESERVE_LABEL} LabelHandling;
|
|
|
|
Token gettok(const Cell *cell, TokVariety 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);
|
|
FloatFormat getfltformat(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, LabelHandling lh);
|
|
|
|
typedef enum {DIRECT_STRING, QUOTE_STRING} StringFormat;
|
|
typedef enum {TRUNCATED_ERROR, VERBOSE_ERROR, RESTORE_ERROR} ErrorFormat;
|
|
size_t printtok(char *dest, size_t size, size_t field_width, StringFormat sf,
|
|
FloatFormat ff, int digits, ErrorFormat ef, const Token *tok);
|
|
const char *dbgprint(const Token *tok); /* for use in debugging */
|
|
void print(char *s, size_t size, size_t chars, StringFormat sf, FloatFormat ff,
|
|
int digits, Token **n);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|