📄 rcsbase.h
字号:
/* * RCS common definitions and data structures */#define RCSBASE "$Id: rcsbase.h,v 5.11 1991/10/07 17:32:46 eggert Exp $"/* Copyright (C) 1982, 1988, 1989 Walter Tichy Copyright 1990, 1991 by Paul Eggert Distributed under license by the Free Software Foundation, Inc.This file is part of RCS.RCS is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.RCS is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with RCS; see the file COPYING. If not, write tothe Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.Report problems and direct all questions to: rcs-bugs@cs.purdue.edu*//***************************************************************************** * INSTRUCTIONS: * ============= * See the Makefile for how to define C preprocessor symbols. * If you need to change the comment leaders, update the table comtable[] * in rcsfnms.c. (This can wait until you know what a comment leader is.) ***************************************************************************** *//* $Log: rcsbase.h,v $ * Revision 5.11 1991/10/07 17:32:46 eggert * Support piece tables even if !has_mmap. * * Revision 5.10 1991/09/24 00:28:39 eggert * Remove unexported functions. * * Revision 5.9 1991/08/19 03:13:55 eggert * Add piece tables and other tuneups, and NFS workarounds. * * Revision 5.8 1991/04/21 11:58:20 eggert * Add -x, RCSINIT, MS-DOS support. * * Revision 5.7 1991/02/28 19:18:50 eggert * Try setuid() if seteuid() doesn't work. * * Revision 5.6 1991/02/26 17:48:37 eggert * Support new link behavior. Move ANSI C / Posix declarations into conf.sh. * * Revision 5.5 1990/12/04 05:18:43 eggert * Use -I for prompts and -q for diagnostics. * * Revision 5.4 1990/11/01 05:03:35 eggert * Don't assume that builtins are functions; they may be macros. * Permit arbitrary data in logs. * * Revision 5.3 1990/09/26 23:36:58 eggert * Port wait() to non-Posix ANSI C hosts. * * Revision 5.2 1990/09/04 08:02:20 eggert * Don't redefine NAME_MAX, PATH_MAX. * Improve incomplete line handling. Standardize yes-or-no procedure. * * Revision 5.1 1990/08/29 07:13:53 eggert * Add -kkvl. Fix type typos exposed by porting. Clean old log messages too. * * Revision 5.0 1990/08/22 08:12:44 eggert * Adjust ANSI C / Posix support. Add -k, -V, setuid. Don't call access(). * Remove compile-time limits; use malloc instead. * Ansify and Posixate. Add support for ISO 8859. * Remove snoop and v2 support. * * Revision 4.9 89/05/01 15:17:14 narten * botched previous USG fix * * Revision 4.8 89/05/01 14:53:05 narten * changed #include <strings.h> -> string.h for USG systems. * * Revision 4.7 88/11/08 15:58:45 narten * removed defs for functions loaded from libraries * * Revision 4.6 88/08/09 19:12:36 eggert * Shrink stdio code size; remove lint; permit -Dhshsize=nn. * * Revision 4.5 87/12/18 17:06:41 narten * made removed BSD ifdef, now uses V4_2BSD * * Revision 4.4 87/10/18 10:29:49 narten * Updating version numbers * Changes relative to 1.1 are actually relative to 4.2 * * Revision 1.3 87/09/24 14:02:25 narten * changes for lint * * Revision 1.2 87/03/27 14:22:02 jenkins * Port to suns * * Revision 4.2 83/12/20 16:04:20 wft * merged 3.6.1.1 and 4.1 (SMALLOG, logsize). * moved setting of STRICT_LOCKING to Makefile. * changed DOLLAR to UNKN (conflict with KDELIM). * * Revision 4.1 83/05/04 09:12:41 wft * Added markers Id and RCSfile. * Added Dbranch for default branches. * * Revision 3.6.1.1 83/12/02 21:56:22 wft * Increased logsize, added macro SMALLOG. * * Revision 3.6 83/01/15 16:43:28 wft * 4.2 prerelease * * Revision 3.6 83/01/15 16:43:28 wft * Replaced dbm.h with BYTESIZ, fixed definition of rindex(). * Added variants of NCPFN and NCPPN for bsd 4.2, selected by defining V4_2BSD. * Added macro DELNUMFORM to have uniform format for printing delta text nodes. * Added macro DELETE to mark deleted deltas. * * Revision 3.5 82/12/10 12:16:56 wft * Added two forms of DATEFORM, one using %02d, the other %.2d. * * Revision 3.4 82/12/04 20:01:25 wft * added LOCKER, Locker, and USG (redefinition of rindex). * * Revision 3.3 82/12/03 12:22:04 wft * Added dbm.h, stdio.h, RCSBASE, RCSSEP, RCSSUF, WORKMODE, TMPFILE3, * PRINTDATE, PRINTTIME, map, and ctab; removed Suffix. Redefined keyvallength * using NCPPN. Changed putc() to abort on write error. * * Revision 3.2 82/10/18 15:03:52 wft * added macro STRICT_LOCKING, removed RCSUMASK. * renamed JOINFILE[1,2] to JOINFIL[1,2]. * * Revision 3.1 82/10/11 19:41:17 wft * removed NBPW, NBPC, NCPW. * added typdef int void to aid compiling */#include "conf.h"#define EXIT_TROUBLE DIFF_TROUBLE#ifdef PATH_MAX# define SIZEABLE_PATH PATH_MAX /* size of a large path; not a hard limit */#else# define SIZEABLE_PATH _POSIX_PATH_MAX#endif/* for traditional C hosts with unusual size arguments */#define Fread(p,s,n,f) fread(p, (freadarg_type)(s), (freadarg_type)(n), f)#define Fwrite(p,s,n,f) fwrite(p, (freadarg_type)(s), (freadarg_type)(n), f)/* * Parameters *//* backwards compatibility with old versions of RCS */#define VERSION_min 3 /* old output RCS format supported */#define VERSION_max 5 /* newest output RCS format supported */#ifndef VERSION_DEFAULT /* default RCS output format */# define VERSION_DEFAULT VERSION_max#endif#define VERSION(n) ((n) - VERSION_DEFAULT) /* internally, 0 is the default */#ifndef STRICT_LOCKING#define STRICT_LOCKING 1#endif /* 0 sets the default locking to non-strict; */ /* used in experimental environments. */ /* 1 sets the default locking to strict; */ /* used in production environments. */#define yearlength 16 /* (good through AD 9,999,999,999,999,999) */#define datesize (yearlength+16) /* size of output of DATEFORM */#define joinlength 20 /* number of joined revisions permitted */#define RCSTMPPREFIX '_' /* prefix for temp files in working dir */#define KDELIM '$' /* delimiter for keywords */#define VDELIM ':' /* separates keywords from values */#define DEFAULTSTATE "Exp" /* default state of revisions */#define true 1#define false 0#define nil 0/* * RILE - readonly file * declarecache; - declares local cache for RILE variable(s) * setupcache - sets up the local RILE cache, but does not initialize it * cache, uncache - caches and uncaches the local RILE; * (uncache,cache) is needed around functions that advance the RILE pointer * Igeteof(f,c,s) - get a char c from f, executing statement s at EOF * cachegeteof(c,s) - Igeteof applied to the local RILE * Iget(f,c) - like Igeteof, except EOF is an error * cacheget(c) - Iget applied to the local RILE * Ifileno, Irewind, Iseek, Itell - analogs to stdio routines */#if large_memory typedef unsigned char const *Iptr_type; typedef struct { Iptr_type ptr, lim; unsigned char *base; /* for lint, not Iptr_type even if has_mmap */# if has_mmap# define Ifileno(f) ((f)->fd) int fd;# else# define Ifileno(f) fileno((f)->stream) FILE *stream; unsigned char *readlim;# endif } RILE;# if has_mmap# define declarecache register Iptr_type ptr, lim# define setupcache(f) (lim = (f)->lim)# define Igeteof(f,c,s) if ((f)->ptr==(f)->lim) s else (c)= *(f)->ptr++# define cachegeteof(c,s) if (ptr==lim) s else (c)= *ptr++# else# define declarecache register Iptr_type ptr; register RILE *rRILE# define setupcache(f) (rRILE = (f))# define Igeteof(f,c,s) if ((f)->ptr==(f)->readlim && !Igetmore(f)) s else (c)= *(f)->ptr++# define cachegeteof(c,s) if (ptr==rRILE->readlim && !Igetmore(rRILE)) s else (c)= *ptr++# endif# define uncache(f) ((f)->ptr = ptr)# define cache(f) (ptr = (f)->ptr)# define Iget(f,c) Igeteof(f,c,Ieof();)# define cacheget(c) cachegeteof(c,Ieof();)# define Itell(f) ((f)->ptr)# define Iseek(f,p) ((f)->ptr = (p))# define Irewind(f) Iseek(f, (f)->base)# define cachetell() ptr#else# define RILE FILE# define declarecache register FILE *ptr# define setupcache(f) (ptr = (f))# define uncache(f)# define cache(f)# define Igeteof(f,c,s) if(((c)=getc(f))<0){testIerror(f);if(feof(f))s}else# define cachegeteof(c,s) Igeteof(ptr,c,s)# define Iget(f,c) if (((c)=getc(f))<0) testIeof(f); else# define cacheget(c) Iget(ptr,c)# define Ifileno(f) fileno(f)#endif/* Print a char, but abort on write error. */#define aputc(c,o) if (putc(c,o)<0) testOerror(o); else/* Get a character from an RCS file, perhaps copying to a new RCS file. */#define GETCeof(o,c,s) { cachegeteof(c,s); if (o) aputc(c,o); }#define GETC(o,c) { cacheget(c); if (o) aputc(c,o); }#define WORKMODE(RCSmode, writable) ((RCSmode)&~(S_IWUSR|S_IWGRP|S_IWOTH) | ((writable)?S_IWUSR:0))/* computes mode of working file: same as RCSmode, but write permission *//* determined by writable *//* character classes and token codes */enum tokens {/* classes */ DELIM, DIGIT, IDCHAR, NEWLN, LETTER, Letter, PERIOD, SBEGIN, SPACE, UNKN,/* tokens */ COLON, ID, NUM, SEMI, STRING};#define SDELIM '@' /* the actual character is needed for string handling*//* SDELIM must be consistent with ctab[], so that ctab[SDELIM]==SBEGIN. * there should be no overlap among SDELIM, KDELIM, and VDELIM */#define isdigit(c) ((unsigned)((c)-'0') <= 9) /* faster than ctab[c]==DIGIT *//*************************************** * Data structures for the symbol table ***************************************//* Buffer of arbitrary data */struct buf { char *string; size_t size;};struct cbuf { char const *string; size_t size;};/* Hash table entry */struct hshentry { char const * num; /* pointer to revision number (ASCIZ) */ char const * date; /* pointer to date of checkin */ char const * author; /* login of person checking in */ char const * lockedby; /* who locks the revision */ char const * state; /* state of revision (Exp by default) */ struct cbuf log; /* log message requested at checkin */ struct branchhead * branches; /* list of first revisions on branches*/ struct cbuf ig; /* ignored phrases of revision */ struct hshentry * next; /* next revision on same branch */ struct hshentry * nexthsh; /* next revision with same hash value */ unsigned long insertlns;/* lines inserted (computed by rlog) */ unsigned long deletelns;/* lines deleted (computed by rlog) */ char selector; /* true if selected, false if deleted */};/* list of hash entries */struct hshentries { struct hshentries *rest; struct hshentry *first;};/* list element for branch lists */struct branchhead { struct hshentry * hsh; struct branchhead * nextbranch;};/* accesslist element */struct access { char const * login;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -