1 /*===========================================================================
2 Copyright (c) 1998-2000, The Santa Cruz Operation
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
8 *Redistributions of source code must retain the above copyright notice,
9 this list of conditions and the following disclaimer.
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.
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.
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
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
31 =========================================================================*/
33 /* $Id: constants.h,v 1.18 2012/04/07 14:12:07 broeker Exp $ */
35 /* cscope - interactive C symbol cross-reference
37 * preprocessor macro and constant definitions
40 #ifndef CSCOPE_CONSTANTS_H
41 #define CSCOPE_CONSTANTS_H
43 #include "config.h" /* Get OS defines */
45 #define ctrl(x) (x & 037) /* control character macro */
47 /* fast string equality tests (avoids most strcmp() calls) */
48 #define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0)
49 #define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0)
51 /* set the mark character for searching the cross-reference file */
52 #define setmark(c) (blockmark = c, block[blocklen] = blockmark)
54 /* get the next character in the cross-reference */
55 /* note that blockp is assumed not to be null */
56 #define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \
57 (read_block() != NULL ? *blockp : '\0'))
59 /* skip the next character in the cross-reference */
60 /* note that blockp is assumed not to be null and that
61 this macro will always be in a statement by itself */
62 #define skiprefchar() if (*(++blockp + 1) == '\0') (void) read_block()
64 #define ESC '\033' /* escape character */
65 #define DEL '\177' /* delete character */
66 #define DUMMYCHAR ' ' /* use space as a dummy character */
67 #define MSGLEN ((PATLEN) + 80) /* displayed message length */
68 #define NUMLEN 10 /* line number length */
69 #define PATHLEN 250 /* file pathname length */
70 #define PATLEN 250 /* symbol pattern length */
71 #define TEMPSTRING_LEN 8191 /* max strlen() of the global temp string */
72 #define REFFILE "cscope.out" /* cross-reference output file */
73 #define NAMEFILE "cscope.files" /* default list-of-files file */
74 #define INVNAME "cscope.in.out" /* inverted index to the database */
75 #define INVPOST "cscope.po.out" /* inverted index postings */
76 #define INVNAME2 "cscope.out.in"/* follows correct naming convention */
77 #define INVPOST2 "cscope.out.po"/* follows correct naming convention */
79 #define STMTMAX 10000 /* maximum source statement length */
82 #define STRINGIZE(x) STR2(x)
83 #define PATLEN_STR STRINGIZE(PATLEN)
84 #define PATHLEN_STR STRINGIZE(PATHLEN)
85 #define NUMLEN_STR STRINGIZE(NUMLEN)
86 #define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN)
89 #define FLDLINE (LINES - FIELDS - 1) /* first input field line */
90 #define MSGLINE 0 /* message line */
91 #define PRLINE (LINES - 1) /* input prompt line */
92 #define REFLINE 3 /* first displayed reference line */
94 /* input fields (value matches field order on screen) */
106 #if (BSD || V9) && !__NetBSD__ && !__FreeBSD__
107 # define TERMINFO 0 /* no terminfo curses */
115 # define KEY_BREAK 0400 /* easier to define than to add #if around the use */
118 # define KEY_ENTER 0401
120 # ifndef KEY_BACKSPACE
121 # define KEY_BACKSPACE 0402
125 # define cbreak() crmode() /* name change */
129 # define erasechar() (_tty.c_cc[VERASE]) /* equivalent */
130 # define killchar() (_tty.c_cc[VKILL]) /* equivalent */
132 # define erasechar() (_tty.sg_erase) /* equivalent */
133 # define killchar() (_tty.sg_kill) /* equivalent */
134 # endif /* if UNIXPC */
135 #endif /* if !TERMINFO */
137 #endif /* CSCOPE_CONSTANTS_H */