shithub: spread

ref: 1322210e058aee6327c77ea4acf8779d6620682f
dir: /spread.h/

View raw version
extern int debug;

typedef struct P P;
typedef struct Node Node;
typedef struct Cell Cell;
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*);

void addcell(P cell, char *value, int type);
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);

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;
};

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

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