shithub: spread

ref: 1260c5c1735d5cf5a60890df7471bcd808b6231d
dir: /spread.h/

View raw version
extern int debug;

typedef struct P P;
typedef struct Node Node;
typedef struct Cell Cell;
typedef struct Width Width;
typedef struct Response Response;

#define INVALID 0
#define FUNCTION 1
#define STRING 2

int inithoc(void);
void interactivehoc(void);
int loadfile(char *file);
int writefile(char *file);
Response getvalue(P);
void freeresponse(Response*);
int getwidth(int);

void addcell(P cell, char *value, int type, int align);
void rmcell(P cell);
Cell* getcell(P cell);
void gccells(void);
void dumpcells(void);
void foreachcell(void (*f)(Cell*,void*), void*);
int sortcells(void);
int updatecells(void);
int preprocess(Cell*);

void toupperil(char*);
P atop(char*);
char* ptoa(P); // resulting char* is not mallocd
char* ntoa(int); // resulting char* is not mallocd

#define PEQ(a, b) ((a).x == (b).x && (a).y == (b).y)

struct P {
	int x;
	int y;
};

enum {
	Aleft,
	Aright,
	Acenter,
	Adot,
};

struct Cell {
	P p;
	char *value;
	int type;
	char *procvalue;
	char *buffered;
	int align;
	
	Cell **points;
	int size;
	int num;
	int indeg;
};

struct Width {
	int column;
	int width;
	Width *next;
};

struct Response {
	char *msg;
	int error;
};