xref: /titanic_41/usr/src/tools/cscope-fast/constants.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1988 AT&T	*/
23*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate /*
27*7c478bd9Sstevel@tonic-gate  *	cscope - interactive C symbol cross-reference
28*7c478bd9Sstevel@tonic-gate  *
29*7c478bd9Sstevel@tonic-gate  *	preprocessor macro and constant definitions
30*7c478bd9Sstevel@tonic-gate  */
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1999 by Sun Microsystems, Inc.
34*7c478bd9Sstevel@tonic-gate  * All rights reserved.
35*7c478bd9Sstevel@tonic-gate  */
36*7c478bd9Sstevel@tonic-gate 
37*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #include <limits.h>
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #define	ctrl(x)	(x & 037)	/* control character macro */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /* database output macros that update its offset */
44*7c478bd9Sstevel@tonic-gate #define	dbputc(c)		(++dboffset, (void) putc(c, newrefs))
45*7c478bd9Sstevel@tonic-gate #define	dbfputs(s)		(dboffset += fputs(s, newrefs))
46*7c478bd9Sstevel@tonic-gate #define	dbfprintf(s, f, a)	(dboffset += fprintf(s, f, a))
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate /* fast string equality tests (avoids most strcmp() calls) */
49*7c478bd9Sstevel@tonic-gate #define	strequal(s1, s2)	(*(s1) == *(s2) && strcmp(s1, s2) == 0)
50*7c478bd9Sstevel@tonic-gate #define	strnotequal(s1, s2)	(*(s1) != *(s2) || strcmp(s1, s2) != 0)
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /* set the mark character for searching the cross-reference file */
53*7c478bd9Sstevel@tonic-gate #define	setmark(c)	(blockmark = c, block[blocklen] = blockmark)
54*7c478bd9Sstevel@tonic-gate 
55*7c478bd9Sstevel@tonic-gate /* get the next character in the cross-reference */
56*7c478bd9Sstevel@tonic-gate /* note that blockp is assumed not to be null */
57*7c478bd9Sstevel@tonic-gate #define	getrefchar()	(*(++blockp + 1) != '\0' ? *blockp : \
58*7c478bd9Sstevel@tonic-gate 			(readblock() != NULL ? *blockp : '\0'))
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate /* skip the next character in the cross-reference */
61*7c478bd9Sstevel@tonic-gate /*
62*7c478bd9Sstevel@tonic-gate  * note that blockp is assumed not to be null and that
63*7c478bd9Sstevel@tonic-gate  * this macro will always be in a statement by itself
64*7c478bd9Sstevel@tonic-gate  */
65*7c478bd9Sstevel@tonic-gate #define	skiprefchar()	if (*(++blockp + 1) == '\0') (void) readblock()
66*7c478bd9Sstevel@tonic-gate 
67*7c478bd9Sstevel@tonic-gate #define	ESC	'\033'		/* escape character */
68*7c478bd9Sstevel@tonic-gate #define	MSGLEN	PATLEN + 80	/* displayed message length */
69*7c478bd9Sstevel@tonic-gate #define	READ	4		/* access(2) parameter */
70*7c478bd9Sstevel@tonic-gate #define	WRITE	2		/* access(2) parameter */
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate /* these also appear in the fscanf format string in countrefs() */
73*7c478bd9Sstevel@tonic-gate #define	NUMLEN	6		/* line number length */
74*7c478bd9Sstevel@tonic-gate #define	PATHLEN	PATH_MAX	/* file pathname length */
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate /* default file names */
77*7c478bd9Sstevel@tonic-gate #define	INVNAME		"cscope.in.out"	/* inverted index to the database */
78*7c478bd9Sstevel@tonic-gate #define	INVPOST		"cscope.po.out"	/* inverted index postings */
79*7c478bd9Sstevel@tonic-gate #define	NAMEFILE	"cscope.files"	/* source file names and options */
80*7c478bd9Sstevel@tonic-gate #define	REFFILE		"cscope.out"	/* symbol database */
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /*
83*7c478bd9Sstevel@tonic-gate  * cross-reference database mark characters (when new ones are added,
84*7c478bd9Sstevel@tonic-gate  * update the cscope.out format description in cscope.1)
85*7c478bd9Sstevel@tonic-gate  */
86*7c478bd9Sstevel@tonic-gate #define	ASSIGNMENT	'='
87*7c478bd9Sstevel@tonic-gate #define	CLASSDEF	'c'
88*7c478bd9Sstevel@tonic-gate #define	DEFINE		'#'
89*7c478bd9Sstevel@tonic-gate #define	DEFINEEND	')'
90*7c478bd9Sstevel@tonic-gate #define	ENUMDEF		'e'
91*7c478bd9Sstevel@tonic-gate #define	ESUEND		';'
92*7c478bd9Sstevel@tonic-gate #define	FCNCALL		'`'
93*7c478bd9Sstevel@tonic-gate #define	FCNDEF		'$'
94*7c478bd9Sstevel@tonic-gate #define	FCNEND		'}'
95*7c478bd9Sstevel@tonic-gate #define	GLOBALDEF	'g'
96*7c478bd9Sstevel@tonic-gate #define	INCLUDE		'~'
97*7c478bd9Sstevel@tonic-gate #define	LOCALDEF	'l'
98*7c478bd9Sstevel@tonic-gate #define	MEMBERDEF	'm'
99*7c478bd9Sstevel@tonic-gate #define	NEWFILE		'@'
100*7c478bd9Sstevel@tonic-gate #define	PARAMETER	'p'
101*7c478bd9Sstevel@tonic-gate #define	STRUCTDEF	's'
102*7c478bd9Sstevel@tonic-gate #define	TYPEDEF		't'
103*7c478bd9Sstevel@tonic-gate #define	UNIONDEF	'u'
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate /* other scanner token types */
106*7c478bd9Sstevel@tonic-gate #define	LEXEOF	0
107*7c478bd9Sstevel@tonic-gate #define	IDENT	1
108*7c478bd9Sstevel@tonic-gate #define	NEWLINE	2
109*7c478bd9Sstevel@tonic-gate 
110*7c478bd9Sstevel@tonic-gate /* screen lines */
111*7c478bd9Sstevel@tonic-gate #define	FLDLINE	(LINES - FIELDS - 1)	/* first input field line */
112*7c478bd9Sstevel@tonic-gate #define	MSGLINE	0			/* message line */
113*7c478bd9Sstevel@tonic-gate #define	PRLINE	(LINES - 1)		/* input prompt line */
114*7c478bd9Sstevel@tonic-gate #define	REFLINE	3			/* first displayed reference line */
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate /* input fields (value matches field order on screen) */
117*7c478bd9Sstevel@tonic-gate #define	SYMBOL		0
118*7c478bd9Sstevel@tonic-gate #define	DEFINITION	1
119*7c478bd9Sstevel@tonic-gate #define	CALLEDBY	2
120*7c478bd9Sstevel@tonic-gate #define	CALLING		3
121*7c478bd9Sstevel@tonic-gate #define	ASSIGN		4
122*7c478bd9Sstevel@tonic-gate #define	CHANGE		5
123*7c478bd9Sstevel@tonic-gate #define	STRING		6
124*7c478bd9Sstevel@tonic-gate #define	FILENAME	7
125*7c478bd9Sstevel@tonic-gate #define	INCLUDES	8
126*7c478bd9Sstevel@tonic-gate #define	FIELDS		9
127