1 /*===========================================================================
2  Copyright (c) 1998-2000, The Santa Cruz Operation
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without
6  modification, are permitted provided that the following conditions are met:
7 
8  *Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 
11  *Redistributions in binary form must reproduce the above copyright notice,
12  this list of conditions and the following disclaimer in the documentation
13  and/or other materials provided with the distribution.
14 
15  *Neither name of The Santa Cruz Operation nor the names of its contributors
16  may be used to endorse or promote products derived from this software
17  without specific prior written permission.
18 
19  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
20  IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
23  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  INTERRUPTION)
27  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
30  DAMAGE.
31  =========================================================================*/
32 
33 /* $Id: constants.h,v 1.4 2018/08/01 01:43:21 shigio Exp $ */
34 
35 /*
36  *	preprocessor macro and constant definitions
37  *
38  *	cscope - interactive C symbol cross-reference
39  */
40 
41 #ifndef CSCOPE_CONSTANTS_H
42 #define CSCOPE_CONSTANTS_H
43 
44 #include "config.h"		/* Get OS defines */
45 
46 /** control character macro */
47 #define ctrl(x)	(x & 037)
48 
49 /*
50  *	fast string equality tests (avoids most strcmp() calls)
51  */
52 #define	strequal(s1, s2)	(*(s1) == *(s2) && strcmp(s1, s2) == 0)
53 #define	strnotequal(s1, s2)	(*(s1) != *(s2) || strcmp(s1, s2) != 0)
54 
55 /** set the mark character for searching the cross-reference file */
56 #define	setmark(c)	(blockmark = c, block[blocklen] = blockmark)
57 
58 /** get the next character in the cross-reference.
59 	note that blockp is assumed not to be null */
60 #define	getrefchar()	(*(++blockp + 1) != '\0' ? *blockp : \
61 			(read_block() != NULL ? *blockp : '\0'))
62 
63 /** skip the next character in the cross-reference.
64    note that blockp is assumed not to be null and that
65    this macro will always be in a statement by itself */
66 #define	skiprefchar()	if (*(++blockp + 1) == '\0') (void) read_block()
67 
68 /** escape character */
69 #define	ESC	'\033'
70 
71 /** delete character */
72 #define	DEL	'\177'
73 
74 /** use space as a dummy character */
75 #define	DUMMYCHAR	' '
76 
77 /** displayed message length */
78 #define	MSGLEN	((PATLEN) + 80)
79 
80 /** line number length */
81 #define	NUMLEN	5
82 
83 /** file pathname length */
84 #define	PATHLEN	250
85 
86 /** symbol pattern length */
87 #define	PATLEN	250
88 
89 /** max strlen() of the global temp string */
90 #define TEMPSTRING_LEN 8191
91 
92 /** cross-reference output file */
93 #define	REFFILE	"cscope.out"
94 
95 /** default list-of-files file */
96 #define	NAMEFILE "cscope.files"
97 
98 /** inverted index to the database */
99 #define	INVNAME	"cscope.in.out"
100 
101 /** inverted index postings */
102 #define	INVPOST	"cscope.po.out"
103 
104 /** follows correct naming convention */
105 #define	INVNAME2 "cscope.out.in"
106 
107 /** follows correct naming convention */
108 #define	INVPOST2 "cscope.out.po"
109 
110 
111 /** maximum source statement length */
112 #define	STMTMAX	10000
113 
114 #define STR2(x) #x
115 #define STRINGIZE(x) STR2(x)
116 #define PATLEN_STR STRINGIZE(PATLEN)
117 #define PATHLEN_STR STRINGIZE(PATHLEN)
118 #define NUMLEN_STR STRINGIZE(NUMLEN)
119 #define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN)
120 
121 /* screen lines */
122 /** first input field line */
123 #define	FLDLINE	(LINES - FIELDS - 1)
124 
125 /** message line */
126 #define	MSGLINE	0
127 
128 /** input prompt line */
129 #define	PRLINE	(LINES - 1)
130 
131 /** first displayed reference line */
132 #define REFLINE	3
133 
134 /* input fields (value matches field order on screen) */
135 #define	SYMBOL		0
136 #define DEFINITION	1
137 #define	CALLEDBY	2
138 #define	CALLING		3
139 #define	STRING		4
140 #define	CHANGE		5
141 #define	REGEXP		6
142 #define FILENAME	7
143 #define INCLUDES	8
144 #define ASSIGN		9
145 #define	FIELDS		10
146 
147 #if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
148 	/** no terminfo curses */
149 # define TERMINFO	0
150 #else
151 # define TERMINFO	1
152 #endif
153 
154 
155 #if !TERMINFO
156 # ifndef KEY_BREAK
157 #  define	KEY_BREAK	0400	/* easier to define than to add #if around the use */
158 # endif
159 # ifndef KEY_ENTER
160 #  define	KEY_ENTER	0401
161 # endif
162 # ifndef KEY_BACKSPACE
163 #  define	KEY_BACKSPACE	0402
164 # endif
165 
166 # if !sun
167 	/** name change */
168 #  define cbreak()	crmode()
169 # endif
170 
171 # if UNIXPC
172 #  define erasechar() (_tty.c_cc[VERASE])		/* equivalent */
173 #  define killchar()  (_tty.c_cc[VKILL])		/* equivalent */
174 # else
175 #  define erasechar() (_tty.sg_erase)			/* equivalent */
176 #  define killchar()  (_tty.sg_kill)			/* equivalent */
177 # endif /* if UNIXPC */
178 #endif	/* if !TERMINFO */
179 
180 #endif /* CSCOPE_CONSTANTS_H */
181