1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
#ifndef MXDIFF_H
#define MXDIFF_H
#if 0
static char rcsid_mgdiff_h[] = "mgdiff.h,v 2.0 1994/05/19 02:01:15 dan Exp";
#endif
/*
* Copyright (c) 1994 Daniel Williams
*
* The X Consortium, and any party obtaining a copy of these files from
* the X Consortium, directly or indirectly, is granted, free of charge,
* a full and unrestricted irrevocable, world-wide, paid up,
* royalty-free, nonexclusive right and license to deal in this software
* and documentation files (the "Software"), including without limitation
* the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons
* who receive copies from any such party to do so. This license
* includes without limitation a license to do the foregoing actions
* under any patents of the party supplying this software to the X
* Consortium. The following conditions apply:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL DANIEL WILLIAMS OR SYSTEMS & SCIENTIFIC SOFTWARE BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* these are the types of each chunk as identified by the difference
* algorithm and map to different colors for display purposes.
*/
typedef enum {DIFF = 0, SAME, INSERT, BLANK} ChunkType;
/*
* each file compared is broken up into a list of chunks, which are
* the smallest set of contiguous lines identified by the difference
* algorithm.
*/
typedef struct {
ChunkType type; /* what kind of chunk is this? */
int fline; /* file address (linenumber) */
int fsize; /* number of lines in file */
char **text; /* the text to display */
char **wtext; /* the text to write */
short *tlen; /* the lengths of each line */
} Chunk;
/*
** LEFT and RIGHT must be 0 and 1 respectively as they are used
** to index as array.
*/
typedef enum {LEFT = 0, RIGHT, NEITHER, BOTH} Side;
/*
* a block is an element of a doubly linked list containing a left chunk
* and a right chunk
*/
typedef struct block {
struct block *prev, *next;
Side selected; /* which chunk of the Block is selected */
int sline; /* screen address (linenumber) */
int ssize; /* number of lines on screen */
Chunk arr[2]; /* left and right Chunks */
} Block;
/*
* the results of a file comparison
*/
typedef struct {
int status; /* return value from diff */
char **etext; /* any error text from diff */
int errors; /* number of lines of error text */
int lines; /* total number of screen lines */
int maxcols; /* maximum length of any text line */
char *longline; /* longest string of characters to be rendered */
int flines[2]; /* total number of file lines for each file */
Block *first; /* the first block in the block list */
Block *last; /* the last block in the block list */
} DiffInfo;
/*
* True if we are compiling under Release 5 or above of the Intrinsics
*/
#define X11R5 (defined(XtSpecificationRelease) && (XtSpecificationRelease >= 5))
/*
* According to IETF RFC 2279, byte values of 0xfe and 0xff are
* not legal utf-8, but all others bytes are legal.
*/
#define islatin(c) (isprint((c)) || ((((unsigned char)(c)) <= 0xfd)))
#define isallowed(c) (isascii((c)) || islatin((c)))
#endif
|