|
|
1.1 ! root 1: ! 2: /* ! 3: * RCS common definitions and data structures ! 4: */ ! 5: #define RCSBASE "$Id: rcsbase.h,v 4.5 87/12/18 17:06:41 narten Exp $" ! 6: /***************************************************************************** ! 7: * INSTRUCTIONS: ! 8: * ============= ! 9: * The following should be handled in the Makefile: ! 10: * For USG Unix, define USG; for BSD Unix, don't (see ifdef USG). ! 11: * For 4.2 bsd, define V4_2BSD; this will replace the routines ! 12: * getwd() and rename() with the corresponding ones in the C-library. ! 13: * V4_2BSD also selects different definitions for the macros NCPFN and NCPPN ! 14: * (max. number of characters per filename, number of characters per path name). ! 15: * Define STRICT_LOCKING appropriately (see STRICT_LOCKING). ! 16: * The following need be changed for porting to a different machine: ! 17: * Define SMALLOG for a machine with small memory (like the PDP11). ! 18: * SMALLOG conserves space for log messages. ! 19: * Change BYTESIZ if necessary. ! 20: * If you need to change the comment leaders, update the table comtable[] ! 21: * in rcsfnms.c. (This can wait until you know what a comment leader is.) ! 22: ***************************************************************************** ! 23: * ! 24: * Copyright (C) 1982 by Walter F. Tichy ! 25: * Purdue University ! 26: * Computer Science Department ! 27: * West Lafayette, IN 47907 ! 28: * ! 29: * All rights reserved. No part of this software may be sold or distributed ! 30: * in any form or by any means without the prior written permission of the ! 31: * author. ! 32: * Report problems and direct all inquiries to Tichy@purdue (ARPA net). ! 33: */ ! 34: ! 35: ! 36: /* $Log: rcsbase.h,v $ ! 37: * Revision 4.5 87/12/18 17:06:41 narten ! 38: * made removed BSD ifdef, now uses V4_2BSD ! 39: * ! 40: * Revision 4.4 87/10/18 10:29:49 narten ! 41: * Updating version numbers ! 42: * Changes relative to 1.1 are actually relative to 4.2 ! 43: * ! 44: * Revision 1.3 87/09/24 14:02:25 narten ! 45: * changes for lint ! 46: * ! 47: * Revision 1.2 87/03/27 14:22:02 jenkins ! 48: * Port to suns ! 49: * ! 50: * Revision 1.1 84/01/23 14:50:14 kcs ! 51: * Initial revision ! 52: * ! 53: * Revision 4.2 83/12/20 16:04:20 wft ! 54: * merged 3.6.1.1 and 4.1 (SMALLOG, logsize). ! 55: * moved setting of STRICT_LOCKING to Makefile. ! 56: * changed DOLLAR to UNKN (conflict with KDELIM). ! 57: * ! 58: * Revision 4.1 83/05/04 09:12:41 wft ! 59: * Added markers Id and RCSfile. ! 60: * Added Dbranch for default branches. ! 61: * ! 62: * Revision 3.6.1.1 83/12/02 21:56:22 wft ! 63: * Increased logsize, added macro SMALLOG. ! 64: * ! 65: * Revision 3.6 83/01/15 16:43:28 wft ! 66: * 4.2 prerelease ! 67: * ! 68: * Revision 3.6 83/01/15 16:43:28 wft ! 69: * Replaced dbm.h with BYTESIZ, fixed definition of rindex(). ! 70: * Added variants of NCPFN and NCPPN for bsd 4.2, selected by defining V4_2BSD. ! 71: * Added macro DELNUMFORM to have uniform format for printing delta text nodes. ! 72: * Added macro DELETE to mark deleted deltas. ! 73: * ! 74: * Revision 3.5 82/12/10 12:16:56 wft ! 75: * Added two forms of DATEFORM, one using %02d, the other %.2d. ! 76: * ! 77: * Revision 3.4 82/12/04 20:01:25 wft ! 78: * added LOCKER, Locker, and USG (redefinition of rindex). ! 79: * ! 80: * Revision 3.3 82/12/03 12:22:04 wft ! 81: * Added dbm.h, stdio.h, RCSBASE, RCSSEP, RCSSUF, WORKMODE, TMPFILE3, ! 82: * PRINTDATE, PRINTTIME, map, and ctab; removed Suffix. Redefined keyvallength ! 83: * using NCPPN. Changed putc() to abort on write error. ! 84: * ! 85: * Revision 3.2 82/10/18 15:03:52 wft ! 86: * added macro STRICT_LOCKING, removed RCSUMASK. ! 87: * renamed JOINFILE[1,2] to JOINFIL[1,2]. ! 88: * ! 89: * Revision 3.1 82/10/11 19:41:17 wft ! 90: * removed NBPW, NBPC, NCPW. ! 91: * added typdef int void to aid compiling ! 92: */ ! 93: ! 94: ! 95: ! 96: #include <stdio.h> ! 97: #undef putc /* will be redefined */ ! 98: ! 99: ! 100: #ifdef USG ! 101: # define rindex strrchr ! 102: # define DATEFORM "%.2d.%.2d.%.2d.%.2d.%.2d.%.2d" ! 103: #else ! 104: # define DATEFORM "%02d.%02d.%02d.%02d.%02d.%02d" ! 105: #endif ! 106: /* Make sure one of %02d or %.2d prints a number with a field width 2, with ! 107: * leading zeroes. For example, 0, 1, and 22 must be printed as 00, 01, and ! 108: * 22. Otherwise, there will be problems with the dates. ! 109: */ ! 110: ! 111: #define PRINTDATE(file,date) fprintf(file,"%.2s/%.2s/%.2s",date,date+3,date+6) ! 112: #define PRINTTIME(file,date) fprintf(file,"%.2s:%.2s:%.2s",date+9,date+12,date+15) ! 113: /* print RCS format date and time in nice format from a string */ ! 114: ! 115: /* ! 116: * Parameters ! 117: */ ! 118: #define BYTESIZ 8 /* number of bits in a byte */ ! 119: ! 120: /*#define STRICT_LOCKING 0 /* 0 sets the default locking to non-strict; */ ! 121: /* used in experimental environments. */ ! 122: /* 1 sets the default locking to strict; */ ! 123: /* used in production environments. */ ! 124: /* STRICT_LOCKING is set in the Makefile! */ ! 125: #define hshsize 239 /* hashtable size; MUST be prime and -1 mod 4 */ ! 126: /* other choices: 547 or 719 */ ! 127: #define strtsize (hshsize * 50) /* string table size */ ! 128: #ifdef SMALLOG ! 129: # define logsize 1024 /* max. size of log message for pdp11 */ ! 130: #else ! 131: # define logsize 4096 /* max. size of log message for others */ ! 132: #endif ! 133: #define revlength 30 /* max. length of revision numbers */ ! 134: #define datelength 20 /* length of a date in RCS format */ ! 135: #define joinlength 20 /* number of joined revisions permitted */ ! 136: #define RCSDIR "RCS/" /* subdirectory for RCS files */ ! 137: #define RCSSUF 'v' /* suffix for RCS files */ ! 138: #define RCSSEP ',' /* separator for RCSSUF */ ! 139: #define KDELIM '$' /* delimiter for keywords */ ! 140: #define VDELIM ':' /* separates keywords from values */ ! 141: #define DEFAULTSTATE "Exp" /* default state of revisions */ ! 142: #ifdef V4_2BSD ! 143: # define NCPFN 256 /* number of characters per filename */ ! 144: # define NCPPN 1024 /* number of characters per pathname */ ! 145: #else ! 146: # define NCPFN 14 /* number of characters per filename */ ! 147: # define NCPPN 6*NCPFN /* number of characters per pathname */ ! 148: #endif ! 149: #define keylength 20 /* buffer length for expansion keywords */ ! 150: #define keyvallength NCPPN+revlength+datelength+60 ! 151: /* buffer length for keyword expansion */ ! 152: ! 153: ! 154: ! 155: #define true 1 ! 156: #define false 0 ! 157: #define nil 0 ! 158: #define elsif else if ! 159: #define elif else if ! 160: ! 161: ! 162: /* temporary file names */ ! 163: ! 164: #define NEWRCSFILE ",RCSnewXXXXXX" ! 165: #define DIFFILE ",RCSciXXXXXX" ! 166: #define TMPFILE1 ",RCSt1XXXXXX" ! 167: #define TMPFILE2 ",RCSt2XXXXXX" ! 168: #define TMPFILE3 ",RCSt3XXXXXX" ! 169: #define JOINFIL2 ",RCSj2XXXXXX" ! 170: #define JOINFIL3 ",RCSj3XXXXXX" ! 171: ! 172: ! 173: #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p)) ! 174: /* This version of putc prints a char, but aborts on write error */ ! 175: ! 176: #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in)) ! 177: /* GETC writes a del-character (octal 177) on end of file */ ! 178: ! 179: #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000) ! 180: /* computes mode of working file: same as RCSmode, but write permission */ ! 181: /* determined by lockflag and StrictLocks. */ ! 182: ! 183: ! 184: /* character classes and token codes */ ! 185: enum tokens { ! 186: /* char classes*/ DIGIT, IDCHAR, NEWLN, LETTER, PERIOD, SBEGIN, SPACE, UNKN, ! 187: /* tokens */ COLON, DATE, EOFILE, ID, KEYW, NUM, SEMI, STRING, ! 188: }; ! 189: ! 190: #define AT SBEGIN /* class SBEGIN (string begin) is returned by lex. anal. */ ! 191: #define SDELIM '@' /* the actual character is needed for string handling*/ ! 192: /* these must be changed consistently, for instance to: ! 193: * #define DQUOTE SBEGIN ! 194: * #define SDELIM '"' ! 195: * #define AT IDCHAR ! 196: * there should be no overlap among SDELIM, KDELIM, and VDELIM ! 197: */ ! 198: ! 199: /* other characters */ ! 200: ! 201: #define ACCENT IDCHAR ! 202: #define AMPER IDCHAR ! 203: #define BACKSL IDCHAR ! 204: #define BAR IDCHAR ! 205: #define COMMA UNKN ! 206: #define DIVIDE IDCHAR ! 207: #define DOLLAR UNKN /* overlap with KDELIM */ ! 208: #define DQUOTE IDCHAR ! 209: #define EQUAL IDCHAR ! 210: #define EXCLA IDCHAR ! 211: #define GREAT IDCHAR ! 212: #define HASH IDCHAR ! 213: #define INSERT UNKN ! 214: #define LBRACE IDCHAR ! 215: #define LBRACK IDCHAR ! 216: #define LESS IDCHAR ! 217: #define LPARN IDCHAR ! 218: #define MINUS IDCHAR ! 219: #define PERCNT IDCHAR ! 220: #define PLUS IDCHAR ! 221: #define QUEST IDCHAR ! 222: #define RBRACE IDCHAR ! 223: #define RBRACK IDCHAR ! 224: #define RPARN IDCHAR ! 225: #define SQUOTE IDCHAR ! 226: #define TILDE IDCHAR ! 227: #define TIMES IDCHAR ! 228: #define UNDER IDCHAR ! 229: #define UPARR IDCHAR ! 230: ! 231: ! 232: ! 233: ! 234: /*************************************** ! 235: * Data structures for the symbol table ! 236: ***************************************/ ! 237: ! 238: ! 239: /* Hash table entry */ ! 240: struct hshentry { ! 241: char * num; /* pointer to revision number (ASCIZ) */ ! 242: char * date; /* pointer to date of checking */ ! 243: char * author; /* login of person checking in */ ! 244: char * lockedby; /* who locks the revision */ ! 245: char * log; /* log message requested at checkin */ ! 246: char * state; /* state of revision (Exp by default) */ ! 247: struct branchhead * branches; /* list of first revisions on branches*/ ! 248: struct hshentry * next; /* next revision on same branch */ ! 249: int insertlns;/* lines inserted (computed by rlog) */ ! 250: int deletelns;/* lines deleted (computed by rlog) */ ! 251: char selector; /* marks entry for selection/deletion */ ! 252: }; ! 253: ! 254: /* list element for branch lists */ ! 255: struct branchhead { ! 256: struct hshentry * hsh; ! 257: struct branchhead * nextbranch; ! 258: }; ! 259: ! 260: /* accesslist element */ ! 261: struct access { ! 262: char * login; ! 263: struct access * nextaccess; ! 264: }; ! 265: ! 266: /* list element for locks */ ! 267: struct lock { ! 268: char * login; ! 269: struct hshentry * delta; ! 270: struct lock * nextlock; ! 271: }; ! 272: ! 273: /* list element for symbolic names */ ! 274: struct assoc { ! 275: char * symbol; ! 276: struct hshentry * delta; ! 277: struct assoc * nextassoc; ! 278: }; ! 279: ! 280: ! 281: /* common variables (getadmin and getdelta())*/ ! 282: extern char * Comment; ! 283: extern struct access * AccessList; ! 284: extern struct assoc * Symbols; ! 285: extern struct lock * Locks; ! 286: extern struct hshentry * Head; ! 287: extern struct hshentry * Dbranch; ! 288: extern int StrictLocks; ! 289: extern int TotalDeltas; ! 290: #ifndef lint ! 291: static char copyright[]="Copyright (C) 1982 by Walter F. Tichy"; ! 292: #endif ! 293: ! 294: /* common variables (lexical analyzer)*/ ! 295: extern enum tokens map[]; ! 296: #define ctab (&map[1]) ! 297: extern struct hshentry hshtab[]; ! 298: extern struct hshentry * nexthsh; ! 299: extern enum tokens nexttok; ! 300: extern int hshenter; ! 301: extern char * NextString; ! 302: extern char * cmdid; ! 303: ! 304: #if defined(USG) || defined(V4_2BSD) ! 305: #define VOID (void) ! 306: #else ! 307: typedef int void; ! 308: #define VOID ! 309: #endif ! 310: ! 311: /* common routines */ ! 312: extern int serror(); ! 313: extern int faterror(); ! 314: extern int fatserror(); ! 315: extern void ignoreints(); ! 316: extern void catchints(); ! 317: extern void restoreints(); ! 318: ! 319: extern char *strcpy(); ! 320: extern char *strcat(); ! 321: extern char *strncpy(); ! 322: ! 323: /* ! 324: * Markers for keyword expansion (used in co and ident) ! 325: */ ! 326: #define AUTHOR "Author" ! 327: #define DATE "Date" ! 328: #define HEADER "Header" ! 329: #define IDH "Id" ! 330: #define LOCKER "Locker" ! 331: #define LOG "Log" ! 332: #define RCSFILE "RCSfile" ! 333: #define REVISION "Revision" ! 334: #define SOURCE "Source" ! 335: #define STATE "State" ! 336: ! 337: enum markers { Nomatch, Author, Date, Header, Id, ! 338: Locker, Log, RCSfile, Revision, Source, State }; ! 339: ! 340: #define DELNUMFORM "\n\n%s\n%s\n" ! 341: /* used by putdtext and scanlogtext */ ! 342: #define DELETE 'D' ! 343: /* set by rcs -o and used by puttree() in rcssyn */ ! 344: ! 345:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.