4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * cscope - interactive C symbol cross-reference
29 * preprocessor macro and constant definitions
33 * Copyright (c) 1999 by Sun Microsystems, Inc.
34 * All rights reserved.
37 #pragma ident "%Z%%M% %I% %E% SMI"
41 #define ctrl(x) (x & 037) /* control character macro */
43 /* database output macros that update its offset */
44 #define dbputc(c) (++dboffset, (void) putc(c, newrefs))
45 #define dbfputs(s) (dboffset += fputs(s, newrefs))
46 #define dbfprintf(s, f, a) (dboffset += fprintf(s, f, a))
48 /* fast string equality tests (avoids most strcmp() calls) */
49 #define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0)
50 #define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0)
52 /* set the mark character for searching the cross-reference file */
53 #define setmark(c) (blockmark = c, block[blocklen] = blockmark)
55 /* get the next character in the cross-reference */
56 /* note that blockp is assumed not to be null */
57 #define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \
58 (readblock() != NULL ? *blockp : '\0'))
60 /* skip the next character in the cross-reference */
62 * note that blockp is assumed not to be null and that
63 * this macro will always be in a statement by itself
65 #define skiprefchar() if (*(++blockp + 1) == '\0') (void) readblock()
67 #define ESC '\033' /* escape character */
68 #define MSGLEN PATLEN + 80 /* displayed message length */
69 #define READ 4 /* access(2) parameter */
70 #define WRITE 2 /* access(2) parameter */
72 /* these also appear in the fscanf format string in countrefs() */
73 #define NUMLEN 6 /* line number length */
74 #define PATHLEN PATH_MAX /* file pathname length */
76 /* default file names */
77 #define INVNAME "cscope.in.out" /* inverted index to the database */
78 #define INVPOST "cscope.po.out" /* inverted index postings */
79 #define NAMEFILE "cscope.files" /* source file names and options */
80 #define REFFILE "cscope.out" /* symbol database */
83 * cross-reference database mark characters (when new ones are added,
84 * update the cscope.out format description in cscope.1)
86 #define ASSIGNMENT '='
100 #define PARAMETER 'p'
101 #define STRUCTDEF 's'
105 /* other scanner token types */
111 #define FLDLINE (LINES - FIELDS - 1) /* first input field line */
112 #define MSGLINE 0 /* message line */
113 #define PRLINE (LINES - 1) /* input prompt line */
114 #define REFLINE 3 /* first displayed reference line */
116 /* input fields (value matches field order on screen) */