shithub: diff

ref: 33d0b194f3b0df7b830e643c5a9847b6f9a1f74c
dir: /diff.h/

View raw version
typedef struct Line	Line;
typedef struct Cand	Cand;
typedef struct Diff	Diff;
typedef struct Change	Change;

struct Line {
	int	serial;
	int	value;
};

struct Cand {
	int x;
	int y;
	int pred;
};

struct Change
{
	int a;
	int b;
	int c;
	int d;
};

struct Diff {
	Cand cand;
	Line *file[2], line;
	int len[2];
	int binary;
	Line *sfile[2];	/*shortened by pruning common prefix and suffix*/
	int slen[2];
	int pref, suff;	/*length of prefix and suffix*/
	int *class;	/*will be overlaid on file[0]*/
	int *member;	/*will be overlaid on file[1]*/
	int *klist;	/*will be overlaid on file[0] after class*/
	Cand *clist;	/* merely a free storage pot for candidates */
	int clen;
	int *J;		/*will be overlaid on class*/
	long *ixold;	/*will be overlaid on klist*/
	long *ixnew;	/*will be overlaid on file[1]*/
	char *file1;
	char *file2;
	Biobuf *input[2];
	int firstchange;
	Change *changes;
	int nchanges;
};

extern char mode;
extern char bflag;
extern char rflag;
extern char mflag;
extern int anychange;
extern Biobuf	stdout;

#define MAXPATHLEN	1024

int mkpathname(char *, char *, char *);
void *emalloc(unsigned);
void *erealloc(void *, unsigned);
void diff(char *, char *, int);
void diffdir(char *, char *, int);
void diffreg(char *, char *, char *, char *);
Biobuf *prepare(Diff*, int, char *, char *);
void panic(int, char *, ...);
void check(Diff *, Biobuf *, Biobuf *);
void change(Diff *, int, int, int, int);
void flushchanges(Diff *d);