rcs.h revision 25839
1/*
2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 * Copyright (c) 1989-1992, Brian Berliner
4 *
5 * You may distribute under the terms of the GNU General Public License as
6 * specified in the README file that comes with the CVS 1.4 kit.
7 *
8 * RCS source control definitions needed by rcs.c and friends
9 */
10
11#define	RCS		"rcs"
12#define	RCS_CI		"ci"
13#define	RCS_DIFF	"rcsdiff"
14#define	RCS_RCSMERGE	"rcsmerge"
15
16/* String which indicates a conflict if it occurs at the start of a line.  */
17#define	RCS_MERGE_PAT ">>>>>>> "
18
19#define	RCSEXT		",v"
20#define RCSPAT		"*,v"
21#define	RCSHEAD		"head"
22#define	RCSBRANCH	"branch"
23#define	RCSSYMBOLS	"symbols"
24#define	RCSDATE		"date"
25#define	RCSDESC		"desc"
26#define RCSEXPAND	"expand"
27
28/* Used by the version of death support which resulted from old
29   versions of CVS (e.g. 1.5 if you define DEATH_SUPPORT and not
30   DEATH_STATE).  Only a hacked up RCS (used by those old versions of
31   CVS) will put this into RCS files.  Considered obsolete.  */
32#define RCSDEAD		"dead"
33
34#define	DATEFORM	"%02d.%02d.%02d.%02d.%02d.%02d"
35#define	SDATEFORM	"%d.%d.%d.%d.%d.%d"
36
37/*
38 * Opaque structure definitions used by RCS specific lookup routines
39 */
40#define VALID	0x1			/* flags field contains valid data */
41#define	INATTIC	0x2			/* RCS file is located in the Attic */
42#define PARTIAL 0x4			/* RCS file not completly parsed */
43#define NODELTA 0x8			/* delta_pos no longer valid */
44
45struct rcsnode
46{
47    int refcount;
48    int flags;
49
50    /* File name of the RCS file.  This is not necessarily the name
51       as specified by the user, but it is a name which can be passed to
52       system calls and a name which is OK to print in error messages
53       (the various names might differ in case).  */
54    char *path;
55
56    char *head;
57    char *branch;
58    char *symbols_data;
59    char *expand;
60    List *symbols;
61    List *versions;
62    long delta_pos;
63    List *other;
64};
65
66typedef struct rcsnode RCSNode;
67
68struct rcsversnode
69{
70    char *version;
71    char *date;
72    char *author;
73    char *state;
74    char *next;
75    int dead;
76    List *branches;
77    List *other;
78};
79typedef struct rcsversnode RCSVers;
80
81/*
82 * CVS reserves all even-numbered branches for its own use.  "magic" branches
83 * (see rcs.c) are contained as virtual revision numbers (within symbolic
84 * tags only) off the RCS_MAGIC_BRANCH, which is 0.  CVS also reserves the
85 * ".1" branch for vendor revisions.  So, if you do your own branching, you
86 * should limit your use to odd branch numbers starting at 3.
87 */
88#define	RCS_MAGIC_BRANCH	0
89
90/* The type of a function passed to RCS_checkout.  */
91typedef void (*RCSCHECKOUTPROC) PROTO ((void *, const char *, size_t));
92
93/*
94 * exported interfaces
95 */
96RCSNode *RCS_parse PROTO((const char *file, const char *repos));
97RCSNode *RCS_parsercsfile PROTO((char *rcsfile));
98void RCS_fully_parse PROTO((RCSNode *));
99char *RCS_check_kflag PROTO((const char *arg));
100char *RCS_getdate PROTO((RCSNode * rcs, char *date, int force_tag_match));
101char *RCS_gettag PROTO((RCSNode * rcs, char *symtag, int force_tag_match,
102			int *simple_tag));
103char *RCS_getversion PROTO((RCSNode * rcs, char *tag, char *date,
104		      int force_tag_match, int *simple_tag));
105char *RCS_magicrev PROTO((RCSNode *rcs, char *rev));
106int RCS_isbranch PROTO((RCSNode *rcs, const char *rev));
107int RCS_nodeisbranch PROTO((RCSNode *rcs, const char *tag));
108char *RCS_whatbranch PROTO((RCSNode *rcs, const char *tag));
109char *RCS_head PROTO((RCSNode * rcs));
110int RCS_datecmp PROTO((char *date1, char *date2));
111time_t RCS_getrevtime PROTO((RCSNode * rcs, char *rev, char *date, int fudge));
112List *RCS_symbols PROTO((RCSNode *rcs));
113void RCS_check_tag PROTO((const char *tag));
114void freercsnode PROTO((RCSNode ** rnodep));
115char *RCS_getbranch PROTO((RCSNode * rcs, char *tag, int force_tag_match));
116
117int RCS_isdead PROTO((RCSNode *, const char *));
118char *RCS_getexpand PROTO ((RCSNode *));
119int RCS_checkout PROTO ((RCSNode *, char *, char *, char *, char *, char *,
120			 RCSCHECKOUTPROC, void *));
121int RCS_cmp_file PROTO ((RCSNode *, char *, char *, const char *));
122int RCS_settag PROTO ((RCSNode *, const char *, const char *));
123int RCS_deltag PROTO ((RCSNode *, const char *, int));
124int RCS_setbranch PROTO((RCSNode *, const char *));
125int RCS_lock PROTO ((RCSNode *, const char *, int));
126int RCS_unlock PROTO ((RCSNode *, const char *, int));
127int rcs_change_text PROTO ((const char *, char *, size_t, const char *,
128			    size_t, char **, size_t *));
129