Annotation of 43BSD/contrib/rcs/src/rcsbase.h, revision 1.1

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.