xref: /openbsd-src/usr.bin/rcs/diff.h (revision 7bb3ddb082eb2d269769c325550cc5d14ba24224)
1*7bb3ddb0Sray /*	$OpenBSD: diff.h,v 1.9 2010/07/23 21:46:05 ray Exp $	*/
22dc36bedSjoris /*
32dc36bedSjoris  * Copyright (C) Caldera International Inc.  2001-2002.
42dc36bedSjoris  * All rights reserved.
52dc36bedSjoris  *
62dc36bedSjoris  * Redistribution and use in source and binary forms, with or without
72dc36bedSjoris  * modification, are permitted provided that the following conditions
82dc36bedSjoris  * are met:
92dc36bedSjoris  * 1. Redistributions of source code and documentation must retain the above
102dc36bedSjoris  *    copyright notice, this list of conditions and the following disclaimer.
112dc36bedSjoris  * 2. Redistributions in binary form must reproduce the above copyright
122dc36bedSjoris  *    notice, this list of conditions and the following disclaimer in the
132dc36bedSjoris  *    documentation and/or other materials provided with the distribution.
142dc36bedSjoris  * 3. All advertising materials mentioning features or use of this software
152dc36bedSjoris  *    must display the following acknowledgement:
162dc36bedSjoris  *	This product includes software developed or owned by Caldera
172dc36bedSjoris  *	International, Inc.
182dc36bedSjoris  * 4. Neither the name of Caldera International, Inc. nor the names of other
192dc36bedSjoris  *    contributors may be used to endorse or promote products derived from
202dc36bedSjoris  *    this software without specific prior written permission.
212dc36bedSjoris  *
222dc36bedSjoris  * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
232dc36bedSjoris  * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
242dc36bedSjoris  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
252dc36bedSjoris  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
262dc36bedSjoris  * IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE FOR ANY DIRECT,
272dc36bedSjoris  * INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
282dc36bedSjoris  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
292dc36bedSjoris  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
302dc36bedSjoris  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
312dc36bedSjoris  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
322dc36bedSjoris  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
332dc36bedSjoris  * POSSIBILITY OF SUCH DAMAGE.
342dc36bedSjoris  */
352dc36bedSjoris /*-
362dc36bedSjoris  * Copyright (c) 1991, 1993
372dc36bedSjoris  *	The Regents of the University of California.  All rights reserved.
382dc36bedSjoris  * Copyright (c) 2004 Jean-Francois Brousseau.  All rights reserved.
392dc36bedSjoris  *
402dc36bedSjoris  * Redistribution and use in source and binary forms, with or without
412dc36bedSjoris  * modification, are permitted provided that the following conditions
422dc36bedSjoris  * are met:
432dc36bedSjoris  * 1. Redistributions of source code must retain the above copyright
442dc36bedSjoris  *    notice, this list of conditions and the following disclaimer.
452dc36bedSjoris  * 2. Redistributions in binary form must reproduce the above copyright
462dc36bedSjoris  *    notice, this list of conditions and the following disclaimer in the
472dc36bedSjoris  *    documentation and/or other materials provided with the distribution.
482dc36bedSjoris  * 3. Neither the name of the University nor the names of its contributors
492dc36bedSjoris  *    may be used to endorse or promote products derived from this software
502dc36bedSjoris  *    without specific prior written permission.
512dc36bedSjoris  *
522dc36bedSjoris  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
532dc36bedSjoris  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
542dc36bedSjoris  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
552dc36bedSjoris  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
562dc36bedSjoris  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
572dc36bedSjoris  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
582dc36bedSjoris  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
592dc36bedSjoris  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
602dc36bedSjoris  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
612dc36bedSjoris  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
622dc36bedSjoris  * SUCH DAMAGE.
632dc36bedSjoris  *
642dc36bedSjoris  *	@(#)diffreg.c   8.1 (Berkeley) 6/6/93
652dc36bedSjoris  */
66*7bb3ddb0Sray #ifndef DIFF_H
67*7bb3ddb0Sray #define DIFF_H
682dc36bedSjoris 
694781e2faSxsa #include <sys/queue.h>
704781e2faSxsa 
714781e2faSxsa #include <regex.h>
724781e2faSxsa 
732dc36bedSjoris #include "buf.h"
742dc36bedSjoris #include "rcs.h"
752dc36bedSjoris 
762dc36bedSjoris /*
772dc36bedSjoris  * Output format options
782dc36bedSjoris  */
792dc36bedSjoris #define	D_NORMAL	0	/* Normal output */
802dc36bedSjoris #define	D_CONTEXT	1	/* Diff with context */
812dc36bedSjoris #define	D_UNIFIED	2	/* Unified context diff */
822dc36bedSjoris #define	D_IFDEF		3	/* Diff with merged #ifdef's */
832dc36bedSjoris #define	D_BRIEF		4	/* Say if the files differ */
842dc36bedSjoris #define	D_RCSDIFF	5       /* Reverse editor output: RCS format */
852dc36bedSjoris 
862dc36bedSjoris /*
87f5f501bbSmillert  * Command line flags
88f5f501bbSmillert  */
89f5f501bbSmillert #define	D_FORCEASCII	0x01	/* Treat file as ascii regardless of content */
90f5f501bbSmillert #define	D_FOLDBLANKS	0x02	/* Treat all white space as equal */
91f5f501bbSmillert #define	D_MINIMAL	0x04	/* Make diff as small as possible */
92f5f501bbSmillert #define	D_IGNORECASE	0x08	/* Case-insensitive matching */
93f5f501bbSmillert #define	D_PROTOTYPE	0x10	/* Display C function prototype */
94f5f501bbSmillert #define	D_EXPANDTABS	0x20	/* Expand tabs to spaces */
95f5f501bbSmillert #define	D_IGNOREBLANKS	0x40	/* Ignore white space changes */
96f5f501bbSmillert 
97f5f501bbSmillert /*
98f049f428Sray  * Status values for diffreg() return values
992dc36bedSjoris  */
1002dc36bedSjoris #define	D_SAME		0	/* Files are the same */
1012dc36bedSjoris #define	D_DIFFER	1	/* Files are different */
1021fb625bfSxsa #define	D_ERROR		2	/* An error occurred */
1032dc36bedSjoris 
1047602a44eSxsa /*
1057602a44eSxsa  * Status values for rcs_diff3() return values
1067602a44eSxsa  */
1077602a44eSxsa #define D_OVERLAPS	1	/* Overlaps during merge */
1087602a44eSxsa 
1092dc36bedSjoris struct rcs_lines;
1102dc36bedSjoris 
1112dc36bedSjoris BUF		*rcs_diff3(RCSFILE *, char *, RCSNUM *, RCSNUM *, int);
1121bed6b5dSxsa BUF		*merge_diff3(char **, int);
1132dc36bedSjoris void		diff_output(const char *, ...);
114f049f428Sray int		diffreg(const char *, const char *, BUF *, int);
1152dc36bedSjoris int		ed_patch_lines(struct rcs_lines *, struct rcs_lines *);
1162dc36bedSjoris 
117f5f501bbSmillert extern int       diff_context;
1182dc36bedSjoris extern int       diff_format;
1192dc36bedSjoris extern int	 diff3_conflicts;
120c4f8605dSjsg extern char	*diff_file;
121f5f501bbSmillert extern char	 diffargs[512]; /* XXX */
1222dc36bedSjoris extern BUF	*diffbuf;
1232dc36bedSjoris extern RCSNUM	*diff_rev1;
1242dc36bedSjoris extern RCSNUM	*diff_rev2;
125f5f501bbSmillert extern regex_t	*diff_ignore_re;
1262dc36bedSjoris 
127*7bb3ddb0Sray #endif	/* DIFF_H */
128