xref: /titanic_51/usr/src/tools/cscope-fast/constants.h (revision 09fe1b16b0d85a4b43987628152f516df3ae9838)
1 /*
2  * CDDL HEADER START
3  *
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
7  * with the License.
8  *
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.
13  *
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]
19  *
20  * CDDL HEADER END
21  */
22 /*	Copyright (c) 1988 AT&T	*/
23 /*	  All Rights Reserved  	*/
24 
25 
26 /*
27  *	cscope - interactive C symbol cross-reference
28  *
29  *	preprocessor macro and constant definitions
30  */
31 
32 /*
33  * Copyright (c) 1999 by Sun Microsystems, Inc.
34  * All rights reserved.
35  */
36 
37 #pragma ident	"%Z%%M%	%I%	%E% SMI"
38 
39 #include <limits.h>
40 
41 #define	ctrl(x)	(x & 037)	/* control character macro */
42 
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))
47 
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)
51 
52 /* set the mark character for searching the cross-reference file */
53 #define	setmark(c)	(blockmark = c, block[blocklen] = blockmark)
54 
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'))
59 
60 /* skip the next character in the cross-reference */
61 /*
62  * note that blockp is assumed not to be null and that
63  * this macro will always be in a statement by itself
64  */
65 #define	skiprefchar()	if (*(++blockp + 1) == '\0') (void) readblock()
66 
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 */
71 
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 */
75 
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 */
81 
82 /*
83  * cross-reference database mark characters (when new ones are added,
84  * update the cscope.out format description in cscope.1)
85  */
86 #define	ASSIGNMENT	'='
87 #define	CLASSDEF	'c'
88 #define	DEFINE		'#'
89 #define	DEFINEEND	')'
90 #define	ENUMDEF		'e'
91 #define	ESUEND		';'
92 #define	FCNCALL		'`'
93 #define	FCNDEF		'$'
94 #define	FCNEND		'}'
95 #define	GLOBALDEF	'g'
96 #define	INCLUDE		'~'
97 #define	LOCALDEF	'l'
98 #define	MEMBERDEF	'm'
99 #define	NEWFILE		'@'
100 #define	PARAMETER	'p'
101 #define	STRUCTDEF	's'
102 #define	TYPEDEF		't'
103 #define	UNIONDEF	'u'
104 
105 /* other scanner token types */
106 #define	LEXEOF	0
107 #define	IDENT	1
108 #define	NEWLINE	2
109 
110 /* screen lines */
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 */
115 
116 /* input fields (value matches field order on screen) */
117 #define	SYMBOL		0
118 #define	DEFINITION	1
119 #define	CALLEDBY	2
120 #define	CALLING		3
121 #define	ASSIGN		4
122 #define	CHANGE		5
123 #define	STRING		6
124 #define	FILENAME	7
125 #define	INCLUDES	8
126 #define	FIELDS		9
127