shithub: spread

ref: f929a0437dcb977136c0318ca851bfb49a254a51
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 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*);
void sortcells(void);
void 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;
};