2023-07-27 14:04:50 -04:00
|
|
|
/*===========================================================================
|
|
|
|
Copyright (c) 1998-2000, The Santa Cruz Operation
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
*Redistributions of source code must retain the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
*Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
this list of conditions and the following disclaimer in the documentation
|
|
|
|
and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
*Neither name of The Santa Cruz Operation nor the names of its contributors
|
|
|
|
may be used to endorse or promote products derived from this software
|
|
|
|
without specific prior written permission.
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
|
|
|
|
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
|
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
INTERRUPTION)
|
|
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
|
|
DAMAGE.
|
|
|
|
=========================================================================*/
|
|
|
|
|
2023-08-04 13:49:03 -04:00
|
|
|
/* cscope - interactive C symbol cross-reference
|
2023-07-27 14:04:50 -04:00
|
|
|
*
|
2023-08-04 13:49:03 -04:00
|
|
|
* preprocessor macro and constant definitions
|
2023-07-27 14:04:50 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CSCOPE_CONSTANTS_H
|
|
|
|
#define CSCOPE_CONSTANTS_H
|
|
|
|
|
2023-08-04 13:49:03 -04:00
|
|
|
#define ctrl(x) (x & 037) /* control character macro */
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
/* fast string equality tests (avoids most strcmp() calls) */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define strequal(s1, s2) (*(s1) == *(s2) && strcmp(s1, s2) == 0)
|
|
|
|
#define strnotequal(s1, s2) (*(s1) != *(s2) || strcmp(s1, s2) != 0)
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
/* set the mark character for searching the cross-reference file */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define setmark(c) (blockmark = c, block[blocklen] = blockmark)
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
/* get the next character in the cross-reference */
|
|
|
|
/* note that blockp is assumed not to be null */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define getrefchar() (*(++blockp + 1) != '\0' ? *blockp : \
|
|
|
|
(read_block() != NULL ? *blockp : '\0'))
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
/* skip the next character in the cross-reference */
|
|
|
|
/* note that blockp is assumed not to be null and that
|
|
|
|
this macro will always be in a statement by itself */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define skiprefchar() if (*(++blockp + 1) == '\0') (void) read_block()
|
2023-07-27 14:04:50 -04:00
|
|
|
|
2023-08-04 13:12:06 -04:00
|
|
|
#ifndef ESC
|
2023-08-04 13:49:03 -04:00
|
|
|
# define ESC '\033' /* escape character */
|
2023-08-04 13:12:06 -04:00
|
|
|
#endif
|
2023-08-04 13:49:03 -04:00
|
|
|
#define DEL '\177' /* delete character */
|
|
|
|
#define DUMMYCHAR ' ' /* use space as a dummy character */
|
|
|
|
#define MSGLEN ((PATLEN) + 80) /* displayed message length */
|
|
|
|
#define NUMLEN 10 /* line number length */
|
|
|
|
#define PATHLEN 250 /* file pathname length */
|
|
|
|
#define PATLEN 250 /* symbol pattern length */
|
2023-07-27 14:04:50 -04:00
|
|
|
#define TEMPSTRING_LEN 8191 /* max strlen() of the global temp string */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define REFFILE "cscope.out" /* cross-reference output file */
|
|
|
|
#define NAMEFILE "cscope.files" /* default list-of-files file */
|
|
|
|
#define INVNAME "cscope.in.out" /* inverted index to the database */
|
|
|
|
#define INVPOST "cscope.po.out" /* inverted index postings */
|
|
|
|
#define INVNAME2 "cscope.out.in"/* follows correct naming convention */
|
|
|
|
#define INVPOST2 "cscope.out.po"/* follows correct naming convention */
|
2023-07-27 14:04:50 -04:00
|
|
|
|
2023-08-04 13:49:03 -04:00
|
|
|
#define STMTMAX 10000 /* maximum source statement length */
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
#define STR2(x) #x
|
|
|
|
#define STRINGIZE(x) STR2(x)
|
|
|
|
#define PATLEN_STR STRINGIZE(PATLEN)
|
|
|
|
#define PATHLEN_STR STRINGIZE(PATHLEN)
|
|
|
|
#define NUMLEN_STR STRINGIZE(NUMLEN)
|
|
|
|
#define TEMPSTRING_LEN_STR STRINGIZE(TEMPSTRING_LEN)
|
|
|
|
|
|
|
|
/* screen lines */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define FLDLINE (LINES - FIELDS - 1 - 1) /* first input field line */
|
|
|
|
#define MSGLINE 0 /* message line */
|
|
|
|
#define PRLINE (LINES - 1) /* input prompt line */
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
/* input fields (value matches field order on screen) */
|
2023-08-04 13:49:03 -04:00
|
|
|
#define SYMBOL 0
|
|
|
|
#define DEFINITION 1
|
|
|
|
#define CALLEDBY 2
|
|
|
|
#define CALLING 3
|
|
|
|
#define STRING 4
|
|
|
|
#define CHANGE 5
|
|
|
|
#define REGEXP 6
|
|
|
|
#define FILENAME 7
|
|
|
|
#define INCLUDES 8
|
|
|
|
#define FIELDS 10
|
2023-07-27 14:04:50 -04:00
|
|
|
|
2023-07-29 09:40:48 -04:00
|
|
|
/* file open modes */
|
|
|
|
#ifndef R_OK
|
2023-08-04 13:49:03 -04:00
|
|
|
# define READ R_OK
|
2023-07-29 09:40:48 -04:00
|
|
|
#else
|
2023-08-04 13:49:03 -04:00
|
|
|
# define READ 4
|
2023-07-29 09:40:48 -04:00
|
|
|
#endif
|
|
|
|
#ifdef W_OK
|
2023-08-04 13:49:03 -04:00
|
|
|
# define WRITE W_OK
|
2023-07-29 09:40:48 -04:00
|
|
|
#else
|
2023-08-04 13:49:03 -04:00
|
|
|
# define WRITE 2
|
2023-07-29 09:40:48 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define O_TEXT 0x00
|
|
|
|
#define O_BINARY 0x00
|
|
|
|
|
|
|
|
/* Key macros */
|
|
|
|
/* These macros are not guaranteed to be defined,
|
|
|
|
* however we wish to test for these anyways while
|
|
|
|
* interpretting user commands.
|
|
|
|
* Input values are guaranteed to be postive,
|
|
|
|
* so setting them to -1 means the test always just silently fail,
|
|
|
|
* but compile when the they are not supported means of input.
|
|
|
|
*/
|
|
|
|
#ifndef KEY_DOWN
|
|
|
|
# define KEY_DOWN KEY_UNDEF_BASE-1
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_UP
|
|
|
|
# define KEY_UP KEY_UNDEF_BASE-2
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_LEFT
|
|
|
|
# define KEY_LEFT KEY_UNDEF_BASE-3
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_RIGHT
|
|
|
|
# define KEY_RIGHT KEY_UNDEF_BASE-4
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_HOME
|
|
|
|
# define KEY_HOME _KEY_UNDEF_BASE-5
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_LL
|
2023-08-04 13:49:03 -04:00
|
|
|
# define KEY_LL KEY_UNDEF_BASE-6
|
2023-07-29 09:40:48 -04:00
|
|
|
#endif
|
|
|
|
#ifndef KEY_PPAGE
|
|
|
|
# define KEY_PPAGE KEY_UNDEF_BASE-7
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_NPAGE
|
|
|
|
# define KEY_NPAGE KEY_UNDEF_BASE-8
|
|
|
|
#endif
|
|
|
|
#ifdef KEY_ENTER
|
|
|
|
# define KEY_ENTER KEY_UNDEF_BASE-9
|
|
|
|
#endif
|
|
|
|
#ifndef KEY_CLEAR
|
|
|
|
# define KEY_CLEAR KEY_UNDEF_BASE-10
|
|
|
|
#endif
|
2023-08-04 13:12:06 -04:00
|
|
|
#ifndef KEY_RESIZE
|
|
|
|
# define KEY_RESIZE KEY_UNDEF_BASE-11
|
|
|
|
#endif
|
2023-07-29 09:40:48 -04:00
|
|
|
|
|
|
|
/**/
|
2023-07-27 14:04:50 -04:00
|
|
|
#if (BSD || V9) && !__NetBSD__ && !__FreeBSD__ && !__APPLE__
|
2023-08-04 13:49:03 -04:00
|
|
|
# define TERMINFO 0 /* no terminfo curses */
|
2023-07-27 14:04:50 -04:00
|
|
|
#else
|
2023-08-04 13:49:03 -04:00
|
|
|
# define TERMINFO 1
|
2023-07-27 14:04:50 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if !TERMINFO
|
|
|
|
# ifndef KEY_BREAK
|
2023-08-04 13:49:03 -04:00
|
|
|
# define KEY_BREAK 0400 /* easier to define than to add #if around the use */
|
2023-07-27 14:04:50 -04:00
|
|
|
# endif
|
|
|
|
# ifndef KEY_ENTER
|
2023-08-04 13:49:03 -04:00
|
|
|
# define KEY_ENTER 0401
|
2023-07-27 14:04:50 -04:00
|
|
|
# endif
|
|
|
|
# ifndef KEY_BACKSPACE
|
2023-08-04 13:49:03 -04:00
|
|
|
# define KEY_BACKSPACE 0402
|
2023-07-27 14:04:50 -04:00
|
|
|
# endif
|
|
|
|
|
|
|
|
# if !sun
|
2023-08-04 13:49:03 -04:00
|
|
|
# define cbreak() crmode() /* name change */
|
2023-07-27 14:04:50 -04:00
|
|
|
# endif
|
|
|
|
|
|
|
|
# if UNIXPC
|
2023-08-04 13:49:03 -04:00
|
|
|
# define erasechar() (_tty.c_cc[VERASE]) /* equivalent */
|
|
|
|
# define killchar() (_tty.c_cc[VKILL]) /* equivalent */
|
2023-07-27 14:04:50 -04:00
|
|
|
# else
|
2023-08-04 13:49:03 -04:00
|
|
|
# define erasechar() (_tty.sg_erase) /* equivalent */
|
|
|
|
# define killchar() (_tty.sg_kill) /* equivalent */
|
2023-07-27 14:04:50 -04:00
|
|
|
# endif /* if UNIXPC */
|
2023-08-04 13:49:03 -04:00
|
|
|
#endif /* if !TERMINFO */
|
2023-07-27 14:04:50 -04:00
|
|
|
|
|
|
|
#endif /* CSCOPE_CONSTANTS_H */
|