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