/* */
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.2 2012/10/13 07:01:59 shigio Exp $ */
34
35 /** @file
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 /** @name
50 * fast string equality tests (avoids most @NAME{strcmp()} calls)
51 */
52 /** @{ */
53 #define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0)
54 #define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0)
55 /** @} */
56
57 /** set the mark character for searching the cross-reference file */
58 #define setmark(c) (blockmark = c, block[blocklen] = blockmark)
59
60 /** get the next character in the cross-reference.
61 @STRONG{note} that @CODE{blockp} is assumed not to be null */
62 #define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \
63 (read_block() != NULL ? *blockp : '\0'))
64
65 /** skip the next character in the cross-reference.
66 @STRONG{note} that @CODE{blockp} is assumed not to be null and that
67 this macro will always be in a statement by itself */
68 #define skiprefchar() if (*(++blockp + 1) == '\0') (void) read_block()
69
70 /** escape character */
71 #define ESC '\033'
72
73 /** delete character */
74 #define DEL '\177'
75
76 /** use space as a dummy character */
77 #define DUMMYCHAR ' '
78
79 /** displayed message length */
80 #define MSGLEN ((PATLEN) + 80)
81
82 /** line number length */
83 #define NUMLEN 5
84
85 /** file pathname length */
86 #define PATHLEN 250
87
88 /** symbol pattern length */
89 #define PATLEN 250
90
91 /** max @NAME{strlen()} of the global temp string */
92 #define TEMPSTRING_LEN 8191
93
94 /** cross-reference output file */
95 #define REFFILE "cscope.out"
96
97 /** default list-of-files file */
98 #define NAMEFILE "cscope.files"
99
100 /** inverted index to the database */
101 #define INVNAME "cscope.in.out"
102
103 /** inverted index postings */
104 #define INVPOST "cscope.po.out"
105
106 /** follows correct naming convention */
107 #define INVNAME2 "cscope.out.in"
108
109 /** follows correct naming convention */
110 #define INVPOST2 "cscope.out.po"
111
112
113 /** maximum source statement length */
114 #define STMTMAX 10000
115
116 #define STR2(x) #x
117 #define STRINGIZE(x) STR2(x)
118 #define PATLEN_STR STRINGIZE(PATLEN)
119 #define PATHLEN_STR STRINGIZE(PATHLEN)
120 #define NUMLEN_STR STRINGIZE(NUMLEN)
121 #define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN)
122
123 /** @name screen lines */
124 /** @{ */
125 /** first input field line */
126 #define FLDLINE (LINES - FIELDS - 1)
127
128 /** message line */
129 #define MSGLINE 0
130
131 /** input prompt line */
132 #define PRLINE (LINES - 1)
133
134 /** first displayed reference line */
135 #define REFLINE 3
136 /** @} */
137
138 /** @name input fields (value matches field order on screen) */
139 /** @{ */
140 #define SYMBOL 0
141 #define DEFINITION 1
142 #define CALLEDBY 2
143 #define CALLING 3
144 #define STRING 4
145 #define CHANGE 5
146 #define REGEXP 6
147 #define FILENAME 7
148 #define INCLUDES 8
149 #define FIELDS 9
150 /** @} */
151
152 #if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
153 /** no terminfo curses */
154 # define TERMINFO 0
155 #else
156 # define TERMINFO 1
157 #endif
158
159
160 #if !TERMINFO
161 # ifndef KEY_BREAK
162 # define KEY_BREAK 0400 /* easier to define than to add #if around the use */
163 # endif
164 # ifndef KEY_ENTER
165 # define KEY_ENTER 0401
166 # endif
167 # ifndef KEY_BACKSPACE
168 # define KEY_BACKSPACE 0402
169 # endif
170
171 # if !sun
172 /** name change */
173 # define cbreak() crmode()
174 # endif
175
176 # if UNIXPC
177 # define erasechar() (_tty.c_cc[VERASE]) /* equivalent */
178 # define killchar() (_tty.c_cc[VKILL]) /* equivalent */
179 # else
180 # define erasechar() (_tty.sg_erase) /* equivalent */
181 # define killchar() (_tty.sg_kill) /* equivalent */
182 # endif /* if UNIXPC */
183 #endif /* if !TERMINFO */
184
185 #endif /* CSCOPE_CONSTANTS_H */
/* */