Merge branch 'emil'
This commit is contained in:
commit
d3ceaebbf3
10
Makefile
10
Makefile
@ -1,11 +1,11 @@
|
||||
CC=gcc
|
||||
CFLAGS:=-ggdb
|
||||
LDLIBS=-I ${CHDRD} $$(pkg-config --libs ncurses readline)
|
||||
# CC=gcc
|
||||
CFLAGS:=-Wall -Wextra -Wpedantic -ggdb $(shell pkg-config --cflags ncurses readline)
|
||||
LDLIBS=-I ${CHDRD} $(shell pkg-config --libs ncurses readline)
|
||||
LEX:=flex
|
||||
|
||||
LEXD:=src/
|
||||
LEXF:=$(shell find ${LEXD} -iname '*.l')
|
||||
GENLEX:=$(subst .l,.c,${LEXF})
|
||||
GENLEX:=$(subst .l,.c,${LEXF})
|
||||
|
||||
SRCD:=src/
|
||||
OBJD:=obj/
|
||||
@ -20,7 +20,7 @@ CHDR:=$(addsuffix .gch,$(subst ${HDRD},${CHDRD},${HDR}))
|
||||
OUTPUT:=csope
|
||||
|
||||
main: ${CHDR} ${OBJ}
|
||||
${LINK.c} ${LDLIBS} ${OBJ} -o ${OUTPUT}
|
||||
${LINK.c} ${OBJ} -o ${OUTPUT} ${LDLIBS}
|
||||
|
||||
obj/%.o: src/%.c
|
||||
${COMPILE.c} $< -o $@
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
96
src/build.c
96
src/build.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -54,9 +54,9 @@
|
||||
|
||||
/* Exported variables: */
|
||||
|
||||
BOOL buildonly = NO; /* only build the database */
|
||||
BOOL unconditional = NO; /* unconditionally build database */
|
||||
BOOL fileschanged; /* assume some files changed */
|
||||
bool buildonly = false; /* only build the database */
|
||||
bool unconditional = false; /* unconditionally build database */
|
||||
bool fileschanged; /* assume some files changed */
|
||||
|
||||
/* variable copies of the master strings... */
|
||||
char invname_buf[] = INVNAME;
|
||||
@ -90,7 +90,7 @@ static void movefile(char *new, char *old);
|
||||
static void putheader(char *dir);
|
||||
static void fetch_include_from_dbase(char *, size_t);
|
||||
static void putlist(char **names, int count);
|
||||
static BOOL samelist(FILE *oldrefs, char **names, int count);
|
||||
static bool samelist(FILE *oldrefs, char **names, int count);
|
||||
|
||||
|
||||
/* Error handling routine if inverted index creation fails */
|
||||
@ -99,8 +99,8 @@ cannotindex(void)
|
||||
{
|
||||
fprintf(stderr, "\
|
||||
cscope: cannot create inverted index; ignoring -q option\n");
|
||||
invertedindex = NO;
|
||||
errorsfound = YES;
|
||||
invertedindex = false;
|
||||
errorsfound = true;
|
||||
fprintf(stderr, "\
|
||||
cscope: removed files %s and %s\n",
|
||||
newinvname, newinvpost);
|
||||
@ -110,7 +110,7 @@ cscope: removed files %s and %s\n",
|
||||
|
||||
|
||||
/* see if the name list is the same in the cross-reference file */
|
||||
static BOOL
|
||||
static bool
|
||||
samelist(FILE *oldrefs, char **names, int count)
|
||||
{
|
||||
char oldname[PATHLEN + 1]; /* name in old cross-reference */
|
||||
@ -120,16 +120,16 @@ samelist(FILE *oldrefs, char **names, int count)
|
||||
/* see if the number of names is the same */
|
||||
if (fscanf(oldrefs, "%d", &oldcount) != 1 ||
|
||||
oldcount != count) {
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
/* see if the name list is the same */
|
||||
for (i = 0; i < count; ++i) {
|
||||
if ((1 != fscanf(oldrefs," %[^\n]",oldname)) ||
|
||||
strnotequal(oldname, names[i])) {
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
@ -167,10 +167,10 @@ opendatabase(void)
|
||||
blocknumber = -1; /* force next seek to read the first block */
|
||||
|
||||
/* open any inverted index */
|
||||
if (invertedindex == YES &&
|
||||
if (invertedindex == true &&
|
||||
invopen(&invcontrol, invname, invpost, INVAVAIL) == -1) {
|
||||
askforreturn(); /* so user sees message */
|
||||
invertedindex = NO;
|
||||
invertedindex = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ void
|
||||
rebuild(void)
|
||||
{
|
||||
close(symrefs);
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
invclose(&invcontrol);
|
||||
nsrcoffset = 0;
|
||||
npostings = 0;
|
||||
@ -215,7 +215,7 @@ build(void)
|
||||
int built = 0; /* built crossref for these files */
|
||||
int copied = 0; /* copied crossref for these files */
|
||||
unsigned long fileindex; /* source file name index */
|
||||
BOOL interactive = YES; /* output progress messages */
|
||||
bool interactive = true; /* output progress messages */
|
||||
|
||||
/* normalize the current directory relative to the home directory so
|
||||
the cross-reference is not rebuilt when the user's login is moved */
|
||||
@ -231,7 +231,7 @@ build(void)
|
||||
/* if there is an old cross-reference and its current directory matches */
|
||||
/* or this is an unconditional build */
|
||||
if ((oldrefs = vpfopen(reffile, "rb")) != NULL
|
||||
&& unconditional == NO
|
||||
&& unconditional == false
|
||||
&& fscanf(oldrefs, "cscope %d %" PATHLEN_STR "s", &fileversion, olddir) == 2
|
||||
&& (strcmp(olddir, currentdir) == 0 /* remain compatible */
|
||||
|| strcmp(olddir, newdir) == 0)) {
|
||||
@ -239,9 +239,9 @@ build(void)
|
||||
fstat(fileno(oldrefs), &statstruct);
|
||||
reftime = statstruct.st_mtime;
|
||||
if (fileversion >= 8) {
|
||||
BOOL oldcompress = YES;
|
||||
BOOL oldinvertedindex = NO;
|
||||
BOOL oldtruncate = NO;
|
||||
bool oldcompress = true;
|
||||
bool oldinvertedindex = false;
|
||||
bool oldtruncate = false;
|
||||
int c;
|
||||
|
||||
/* see if there are options in the database */
|
||||
@ -254,14 +254,14 @@ build(void)
|
||||
}
|
||||
switch (getc(oldrefs)) {
|
||||
case 'c': /* ASCII characters only */
|
||||
oldcompress = NO;
|
||||
oldcompress = false;
|
||||
break;
|
||||
case 'q': /* quick search */
|
||||
oldinvertedindex = YES;
|
||||
oldinvertedindex = true;
|
||||
fscanf(oldrefs, "%ld", &totalterms);
|
||||
break;
|
||||
case 'T': /* truncate symbols to 8 characters */
|
||||
oldtruncate = YES;
|
||||
oldtruncate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@ cscope: -c or -T option mismatch between command line and old symbol database\n"
|
||||
if (oldinvertedindex != invertedindex) {
|
||||
posterr("\
|
||||
cscope: -q option mismatch between command line and old symbol database\n");
|
||||
if (invertedindex == NO) {
|
||||
if (invertedindex == false) {
|
||||
posterr("cscope: removed files %s and %s\n",
|
||||
invname, invpost);
|
||||
unlink(invname);
|
||||
@ -290,12 +290,12 @@ cscope: -q option mismatch between command line and old symbol database\n");
|
||||
}
|
||||
}
|
||||
/* if assuming that some files have changed */
|
||||
if (fileschanged == YES) {
|
||||
if (fileschanged == true) {
|
||||
goto outofdate;
|
||||
}
|
||||
/* see if the directory lists are the same */
|
||||
if (samelist(oldrefs, srcdirs, nsrcdirs) == NO
|
||||
|| samelist(oldrefs, incdirs, nincdirs) == NO
|
||||
if (samelist(oldrefs, srcdirs, nsrcdirs) == false
|
||||
|| samelist(oldrefs, incdirs, nincdirs) == false
|
||||
/* get the old number of files */
|
||||
|| fscanf(oldrefs, "%lu", &oldnum) != 1
|
||||
/* skip the string space size */
|
||||
@ -331,7 +331,7 @@ cscope: converting to new symbol database file format\n");
|
||||
/* reopen the old cross-reference file for fast scanning */
|
||||
if ((symrefs = vpopen(reffile, O_BINARY | O_RDONLY)) == -1) {
|
||||
postfatal("cscope: cannot open file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* get the first file name in the old cross-reference */
|
||||
blocknumber = -1;
|
||||
@ -346,16 +346,16 @@ cscope: converting to new symbol database file format\n");
|
||||
/* open the new cross-reference file */
|
||||
if ((newrefs = myfopen(newreffile, "wb")) == NULL) {
|
||||
postfatal("cscope: cannot open file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
if (invertedindex == YES && (postings = myfopen(temp1, "wb")) == NULL) {
|
||||
if (invertedindex == true && (postings = myfopen(temp1, "wb")) == NULL) {
|
||||
cannotwrite(temp1);
|
||||
cannotindex();
|
||||
}
|
||||
putheader(newdir);
|
||||
fileversion = FILEVERSION;
|
||||
if (buildonly == YES && verbosemode != YES && !isatty(0)) {
|
||||
interactive = NO;
|
||||
if (buildonly == true && verbosemode != true && !isatty(0)) {
|
||||
interactive = false;
|
||||
} else {
|
||||
searchcount = 0;
|
||||
}
|
||||
@ -366,20 +366,20 @@ cscope: converting to new symbol database file format\n");
|
||||
included files is processed */
|
||||
firstfile = 0;
|
||||
lastfile = nsrcfiles;
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
srcoffset = malloc((nsrcfiles + 1u) * sizeof(*srcoffset));
|
||||
}
|
||||
for (;;) {
|
||||
progress("Building symbol database", (long)built,
|
||||
(long)lastfile);
|
||||
if (linemode == NO)
|
||||
if (linemode == false)
|
||||
refresh();
|
||||
|
||||
/* get the next source file name */
|
||||
for (fileindex = firstfile; fileindex < lastfile; ++fileindex) {
|
||||
|
||||
/* display the progress about every three seconds */
|
||||
if (interactive == YES && fileindex % 10 == 0) {
|
||||
if (interactive == true && fileindex % 10 == 0) {
|
||||
progress("Building symbol database", fileindex, lastfile);
|
||||
}
|
||||
/* if the old file has been deleted get the next one */
|
||||
@ -406,7 +406,7 @@ cscope: converting to new symbol database file format\n");
|
||||
} else {
|
||||
/* copy its cross-reference */
|
||||
putfilename(file);
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
copyinverted();
|
||||
} else {
|
||||
copydata();
|
||||
@ -421,7 +421,7 @@ cscope: converting to new symbol database file format\n");
|
||||
}
|
||||
firstfile = lastfile;
|
||||
lastfile = nsrcfiles;
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
srcoffset = realloc(srcoffset, (nsrcfiles + 1) * sizeof(*srcoffset));
|
||||
}
|
||||
/* sort the included file names */
|
||||
@ -441,16 +441,16 @@ cscope: converting to new symbol database file format\n");
|
||||
if (fflush(newrefs) == EOF) {
|
||||
/* rewind doesn't check for write failure */
|
||||
cannotwrite(newreffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
/* create the inverted index if requested */
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
char sortcommand[PATHLEN + 1];
|
||||
|
||||
if (fflush(postings) == EOF) {
|
||||
cannotwrite(temp1);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
fstat(fileno(postings), &statstruct);
|
||||
fclose(postings);
|
||||
@ -504,11 +504,11 @@ seek_to_trailer(FILE *f)
|
||||
{
|
||||
if (fscanf(f, "%ld", &traileroffset) != 1) {
|
||||
postfatal("cscope: cannot read trailer offset from file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
if (fseek(f, traileroffset, SEEK_SET) == -1) {
|
||||
postfatal("cscope: cannot seek to trailer in file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,10 +550,10 @@ static void
|
||||
putheader(char *dir)
|
||||
{
|
||||
dboffset = fprintf(newrefs, "cscope %d %s", FILEVERSION, dir);
|
||||
if (compress == NO) {
|
||||
if (compress == false) {
|
||||
dboffset += fprintf(newrefs, " -c");
|
||||
}
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
dboffset += fprintf(newrefs, " -q %.10ld", totalterms);
|
||||
} else {
|
||||
/* leave space so if the header is overwritten without -q
|
||||
@ -561,7 +561,7 @@ putheader(char *dir)
|
||||
* is the same length */
|
||||
dboffset += fprintf(newrefs, " ");
|
||||
}
|
||||
if (trun_syms == YES) {
|
||||
if (trun_syms == true) {
|
||||
dboffset += fprintf(newrefs, " -T");
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ putlist(char **names, int count)
|
||||
if (fputs(names[i], newrefs) == EOF ||
|
||||
putc('\n', newrefs) == EOF) {
|
||||
cannotwrite(newreffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -721,7 +721,7 @@ movefile(char *new, char *old)
|
||||
myperror("cscope");
|
||||
postfatal("cscope: cannot rename file %s to file %s\n",
|
||||
new, old);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
|
12
src/build.h
12
src/build.h
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -44,9 +44,9 @@
|
||||
|
||||
/* declarations for globals defined in build.c */
|
||||
|
||||
extern BOOL buildonly; /* only build the database */
|
||||
extern BOOL unconditional; /* unconditionally build database */
|
||||
extern BOOL fileschanged; /* assume some files changed */
|
||||
extern bool buildonly; /* only build the database */
|
||||
extern bool unconditional; /* unconditionally build database */
|
||||
extern bool fileschanged; /* assume some files changed */
|
||||
|
||||
extern char *reffile; /* cross-reference file path name */
|
||||
extern char *invname; /* inverted index to the database */
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -59,9 +59,9 @@ extern const void const* wmode;
|
||||
extern const void const* wresult;
|
||||
extern const void const* const* current_window;
|
||||
|
||||
BOOL caseless; /* ignore letter case when searching */
|
||||
BOOL *change; /* change this line */
|
||||
BOOL changing; /* changing text */
|
||||
bool caseless; /* ignore letter case when searching */
|
||||
bool *change; /* change this line */
|
||||
bool changing; /* changing text */
|
||||
char newpat[PATLEN + 1]; /* new pattern */
|
||||
|
||||
/* Internal prototypes: */
|
||||
@ -80,7 +80,7 @@ clearprompt(void)
|
||||
|
||||
/* read references from a file */
|
||||
|
||||
BOOL
|
||||
bool
|
||||
readrefs(char *filename)
|
||||
{
|
||||
FILE *file;
|
||||
@ -88,16 +88,16 @@ readrefs(char *filename)
|
||||
|
||||
if ((file = myfopen(filename, "rb")) == NULL) {
|
||||
cannotopen(filename);
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
if ((c = getc(file)) == EOF) { /* if file is empty */
|
||||
fclose(file);
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
totallines = 0;
|
||||
disprefs = 0;
|
||||
nextline = 1;
|
||||
if (writerefsfound() == YES) {
|
||||
if (writerefsfound() == true) {
|
||||
putc(c, refsfound);
|
||||
while ((c = getc(file)) != EOF) {
|
||||
putc(c, refsfound);
|
||||
@ -106,12 +106,12 @@ readrefs(char *filename)
|
||||
fclose(refsfound);
|
||||
if ( (refsfound = myfopen(temp1, "rb")) == NULL) {
|
||||
cannotopen(temp1);
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
countrefs();
|
||||
} else
|
||||
fclose(file);
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
|
||||
/* mark/unmark this displayed line to be changed */
|
||||
@ -124,11 +124,11 @@ mark(unsigned int i)
|
||||
if (j < totallines) {
|
||||
move(displine[i], 1);
|
||||
|
||||
if (change[j] == NO) {
|
||||
change[j] = YES;
|
||||
if (change[j] == false) {
|
||||
change[j] = true;
|
||||
addch('>');
|
||||
} else {
|
||||
change[j] = NO;
|
||||
change[j] = false;
|
||||
addch(' ');
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ countrefs(void)
|
||||
/* count the references found and find the length of the file,
|
||||
function, and line number display fields */
|
||||
|
||||
/* HBB NOTE 2012-04-07: it may look like we shouldn't assing tempstring here,
|
||||
/* HBB falseTE 2012-04-07: it may look like we shouldn't assing tempstring here,
|
||||
* since it's not used. But it has to be assigned just so the return value
|
||||
* of fscanf will actually reach 4. */
|
||||
while (EOF != (i = fscanf(refsfound,
|
||||
@ -210,7 +210,7 @@ countrefs(void)
|
||||
if ((i = strlen(pathcomponents(file, dispcomponents))) > filelen) {
|
||||
filelen = i;
|
||||
}
|
||||
if (ogs == YES) {
|
||||
if (ogs == true) {
|
||||
ogsnames(file, &subsystem, &book);
|
||||
if ((i = strlen(subsystem)) > subsystemlen) {
|
||||
subsystemlen = i;
|
||||
@ -232,7 +232,7 @@ countrefs(void)
|
||||
/* restrict the width of displayed columns */
|
||||
/* HBB FIXME 20060419: magic number alert! */
|
||||
i = (COLS - 5) / 3;
|
||||
if (ogs == YES) {
|
||||
if (ogs == true) {
|
||||
i = (COLS - 7) / 5;
|
||||
}
|
||||
if (filelen > i && i > 4) {
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -64,7 +64,7 @@ do { \
|
||||
#define SYMBOLINC 20 /* symbol list size increment */
|
||||
|
||||
long dboffset; /* new database offset */
|
||||
BOOL errorsfound; /* prompt before clearing messages */
|
||||
bool errorsfound; /* prompt before clearing messages */
|
||||
long lineoffset; /* source line database offset */
|
||||
long npostings; /* number of postings */
|
||||
int nsrcoffset; /* number of file name database offsets */
|
||||
@ -100,7 +100,7 @@ crossref(char *srcfile)
|
||||
if (! ((stat(srcfile, &st) == 0)
|
||||
&& S_ISREG(st.st_mode))) {
|
||||
cannotopen(srcfile);
|
||||
errorsfound = YES;
|
||||
errorsfound = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ crossref(char *srcfile)
|
||||
/* open the source file */
|
||||
if ((yyin = myfopen(srcfile, "r")) == NULL) {
|
||||
cannotopen(srcfile);
|
||||
errorsfound = YES;
|
||||
errorsfound = true;
|
||||
return;
|
||||
}
|
||||
filename = srcfile; /* save the file name for warning messages */
|
||||
@ -130,7 +130,7 @@ crossref(char *srcfile)
|
||||
default:
|
||||
/* if requested, truncate C symbols */
|
||||
length = last - first;
|
||||
if (trun_syms == YES && length > 8 &&
|
||||
if (trun_syms == true && length > 8 &&
|
||||
token != INCLUDE && token != NEWFILE) {
|
||||
length = 8;
|
||||
last = first + 8;
|
||||
@ -220,10 +220,10 @@ putfilename(char *srcfile)
|
||||
/* note: dbputc is not used to avoid lint complaint */
|
||||
if (putc(NEWFILE, newrefs) == EOF) {
|
||||
cannotwrite(newreffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
++dboffset;
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
srcoffset[nsrcoffset++] = dboffset;
|
||||
}
|
||||
dbfputs(srcfile);
|
||||
@ -237,7 +237,7 @@ putcrossref(void)
|
||||
{
|
||||
unsigned int i, j;
|
||||
unsigned char c;
|
||||
BOOL blank; /* blank indicator */
|
||||
bool blank; /* blank indicator */
|
||||
unsigned int symput = 0; /* symbols output */
|
||||
int type;
|
||||
|
||||
@ -251,18 +251,18 @@ putcrossref(void)
|
||||
/* HBB 20010425: added this line: */
|
||||
my_yytext[my_yyleng] = '\0';
|
||||
|
||||
blank = NO;
|
||||
blank = false;
|
||||
for (i = 0; i < my_yyleng; ++i) {
|
||||
|
||||
/* change a tab to a blank and compress blanks */
|
||||
if ((c = my_yytext[i]) == ' ' || c == '\t') {
|
||||
blank = YES;
|
||||
blank = true;
|
||||
} else if (symput < symbols && i == symbol[symput].first) {
|
||||
/* look for the start of a symbol */
|
||||
|
||||
/* check for compressed blanks */
|
||||
if (blank == YES) {
|
||||
blank = NO;
|
||||
if (blank == true) {
|
||||
blank = false;
|
||||
dbputc(' ');
|
||||
}
|
||||
dbputc('\n'); /* symbols start on a new line */
|
||||
@ -278,7 +278,7 @@ putcrossref(void)
|
||||
j = symbol[symput].last;
|
||||
c = my_yytext[j];
|
||||
my_yytext[j] = '\0';
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
putposting(my_yytext + i, type);
|
||||
}
|
||||
writestring(my_yytext + i);
|
||||
@ -289,10 +289,10 @@ putcrossref(void)
|
||||
} else {
|
||||
/* HBB: try to save some time by early-out handling of
|
||||
* non-compressed mode */
|
||||
if (compress == NO) {
|
||||
if (blank == YES) {
|
||||
if (compress == false) {
|
||||
if (blank == true) {
|
||||
dbputc(' ');
|
||||
blank = NO;
|
||||
blank = false;
|
||||
}
|
||||
j = i + strcspn(my_yytext+i, "\t ");
|
||||
if (symput < symbols
|
||||
@ -308,7 +308,7 @@ putcrossref(void)
|
||||
}
|
||||
|
||||
/* check for compressed blanks */
|
||||
if (blank == YES) {
|
||||
if (blank == true) {
|
||||
if (dicode2[c]) {
|
||||
c = DICODE_COMPRESS(' ', c);
|
||||
} else {
|
||||
@ -322,7 +322,7 @@ putcrossref(void)
|
||||
++i;
|
||||
}
|
||||
dbputc((int) c);
|
||||
blank = NO;
|
||||
blank = false;
|
||||
|
||||
/* skip compressed characters */
|
||||
if (c < ' ') {
|
||||
@ -450,7 +450,7 @@ putposting(char *term, int type)
|
||||
}
|
||||
if (putc('\n', postings) == EOF) {
|
||||
cannotwrite(temp1);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
++npostings;
|
||||
}
|
||||
@ -463,7 +463,7 @@ writestring(char *s)
|
||||
unsigned char c;
|
||||
int i;
|
||||
|
||||
if (compress == NO) {
|
||||
if (compress == false) {
|
||||
/* Save some I/O overhead by using puts() instead of putc(): */
|
||||
dbfputs(s);
|
||||
return;
|
||||
@ -488,5 +488,5 @@ warning(char *text)
|
||||
|
||||
(void) fprintf(stderr, "cscope: \"%s\", line %d: warning: %s\n", filename,
|
||||
myylineno, text);
|
||||
errorsfound = YES;
|
||||
errorsfound = true;
|
||||
}
|
||||
|
88
src/dir.c
88
src/dir.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -72,11 +72,11 @@ static struct listitem { /* source file names without view pathing */
|
||||
} *srcnames[HASHMOD];
|
||||
|
||||
/* Internal prototypes: */
|
||||
static BOOL accessible_file(char *file);
|
||||
static BOOL issrcfile(char *file);
|
||||
static bool accessible_file(char *file);
|
||||
static bool issrcfile(char *file);
|
||||
static void addsrcdir(char *dir);
|
||||
static void addincdir(char *name, char *path);
|
||||
static void scan_dir(const char *dirfile, BOOL recurse);
|
||||
static void scan_dir(const char *dirfile, bool recurse);
|
||||
static void makevpsrcdirs(void);
|
||||
|
||||
|
||||
@ -262,7 +262,7 @@ freeinclist()
|
||||
void
|
||||
makefilelist(void)
|
||||
{
|
||||
static BOOL firstbuild = YES; /* first time through */
|
||||
static bool firstbuild = true; /* first time through */
|
||||
FILE *names; /* name file pointer */
|
||||
char dir[PATHLEN + 1];
|
||||
char path[PATHLEN + 1];
|
||||
@ -273,19 +273,19 @@ makefilelist(void)
|
||||
|
||||
makevpsrcdirs(); /* make the view source directory list */
|
||||
|
||||
/* if -i was NOT given and there are source file arguments */
|
||||
/* if -i was falseT given and there are source file arguments */
|
||||
if (namefile == NULL && fileargc > 0) {
|
||||
|
||||
/* put them in a list that can be expanded */
|
||||
for (i = 0; i < fileargc; ++i) {
|
||||
file = fileargv[i];
|
||||
if (infilelist(file) == NO) {
|
||||
if (infilelist(file) == false) {
|
||||
if ((s = inviewpath(file)) != NULL) {
|
||||
addsrcfile(s);
|
||||
} else {
|
||||
fprintf(stderr, "cscope: cannot find file %s\n",
|
||||
file);
|
||||
errorsfound = YES;
|
||||
errorsfound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ makefilelist(void)
|
||||
char *point_in_line = line + (strlen(line) - 1);
|
||||
size_t length_of_name = 0;
|
||||
int unfinished_option = 0;
|
||||
BOOL done = NO;
|
||||
bool done = false;
|
||||
|
||||
/* Kill away \n left at end of fgets()'d string: */
|
||||
if (*point_in_line == '\n')
|
||||
@ -346,16 +346,16 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
|
||||
i = path[1];
|
||||
switch (i) {
|
||||
case 'c': /* ASCII characters only in crossref */
|
||||
compress = NO;
|
||||
compress = false;
|
||||
break;
|
||||
case 'k': /* ignore DFLT_INCDIR */
|
||||
kernelmode = YES;
|
||||
kernelmode = true;
|
||||
break;
|
||||
case 'q': /* quick search */
|
||||
invertedindex = YES;
|
||||
invertedindex = true;
|
||||
break;
|
||||
case 'T': /* truncate symbols to 8 characters */
|
||||
trun_syms = YES;
|
||||
trun_syms = true;
|
||||
break;
|
||||
case 'I': /* #include file directory */
|
||||
case 'p': /* file path components to display */
|
||||
@ -372,13 +372,13 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
|
||||
#define HANDLE_OPTION_ARGUMENT(i, s) \
|
||||
switch (i) { \
|
||||
case 'I': /* #include file directory */ \
|
||||
if (firstbuild == YES) { \
|
||||
if (firstbuild == true) { \
|
||||
/* expand $ and ~ */ \
|
||||
shellpath(dir, sizeof(dir), (s)); \
|
||||
includedir(dir); \
|
||||
} \
|
||||
unfinished_option = 0; \
|
||||
done = YES; \
|
||||
done = true; \
|
||||
break; \
|
||||
case 'p': /* file path components to display */ \
|
||||
if (*(s) < '0' || *(s) > '9') { \
|
||||
@ -388,10 +388,10 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
|
||||
} \
|
||||
dispcomponents = atoi(s); \
|
||||
unfinished_option = 0; \
|
||||
done = YES; \
|
||||
done = true; \
|
||||
break; \
|
||||
default: \
|
||||
done = NO; \
|
||||
done = false; \
|
||||
} /* switch(i) */
|
||||
|
||||
/* ... and now call it for the first time */
|
||||
@ -439,7 +439,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
|
||||
} else {
|
||||
fprintf(stderr, "cscope: cannot find file %s\n",
|
||||
newpath);
|
||||
errorsfound = YES;
|
||||
errorsfound = true;
|
||||
}
|
||||
}
|
||||
free(newpath);
|
||||
@ -456,7 +456,7 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
|
||||
} else {
|
||||
fprintf(stderr, "cscope: cannot find file %s\n",
|
||||
path);
|
||||
errorsfound = YES;
|
||||
errorsfound = true;
|
||||
}
|
||||
}
|
||||
} /* else(ordinary name) */
|
||||
@ -471,14 +471,14 @@ cscope: Syntax error in namelist file %s: unfinished -I or -p option\n",
|
||||
clearerr(stdin);
|
||||
else
|
||||
fclose(names);
|
||||
firstbuild = NO;
|
||||
firstbuild = false;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/* scan a directory (recursively?) for source files */
|
||||
static void
|
||||
scan_dir(const char *adir, BOOL recurse_dir)
|
||||
scan_dir(const char *adir, bool recurse_dir)
|
||||
{
|
||||
DIR *dirfile;
|
||||
int adir_len = strlen(adir);
|
||||
@ -503,7 +503,7 @@ scan_dir(const char *adir, BOOL recurse_dir)
|
||||
&& S_ISDIR(buf.st_mode) ) {
|
||||
scan_dir(path, recurse_dir);
|
||||
} else if (issrcfile(path)
|
||||
&& infilelist(path) == NO
|
||||
&& infilelist(path) == false
|
||||
&& access(path, R_OK) == 0) {
|
||||
addsrcfile(path);
|
||||
}
|
||||
@ -517,24 +517,24 @@ scan_dir(const char *adir, BOOL recurse_dir)
|
||||
|
||||
|
||||
/* see if this is a source file */
|
||||
static BOOL
|
||||
static bool
|
||||
issrcfile(char *path)
|
||||
{
|
||||
struct stat statstruct;
|
||||
char *file = basename(path);
|
||||
char *s = strrchr(file, '.');
|
||||
BOOL looks_like_source = NO;
|
||||
bool looks_like_source = false;
|
||||
|
||||
/* ensure there is some file suffix */
|
||||
if (s == NULL || *++s == '\0')
|
||||
return NO;
|
||||
return false;
|
||||
|
||||
/* if an SCCS or versioned file */
|
||||
if (file[1] == '.' && file + 2 != s) { /* 1 character prefix */
|
||||
switch (*file) {
|
||||
case 's':
|
||||
case 'S':
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -548,7 +548,7 @@ issrcfile(char *path)
|
||||
case 'G':
|
||||
case 'H':
|
||||
case 'L':
|
||||
looks_like_source = YES;
|
||||
looks_like_source = true;
|
||||
}
|
||||
} else if ((s[2] == '\0') /* 2 char suffix */
|
||||
&& ((s[0] == 'b' && s[1] == 'p') /* breakpoint listing */
|
||||
@ -557,7 +557,7 @@ issrcfile(char *path)
|
||||
|| (s[0] == 's' && s[1] == 'd') /* SDL */
|
||||
|| (s[0] == 'c' && s[1] == 'c') /* C++ source */
|
||||
|| (s[0] == 'h' && s[1] == 'h'))) { /* C++ header */
|
||||
looks_like_source = YES;
|
||||
looks_like_source = true;
|
||||
|
||||
} else if((s[3] == '\0') /* 3 char suffix */
|
||||
/* C++ template source */
|
||||
@ -568,18 +568,18 @@ issrcfile(char *path)
|
||||
|| (s[0] == 'h' && s[1] == 'p' && s[2] == 'p' )
|
||||
|| (s[0] == 'h' && s[1] == 'x' && s[2] == 'x' ))
|
||||
) {
|
||||
looks_like_source = YES;
|
||||
looks_like_source = true;
|
||||
}
|
||||
|
||||
if (looks_like_source != YES)
|
||||
return NO;
|
||||
if (looks_like_source != true)
|
||||
return false;
|
||||
|
||||
/* make sure it is a file */
|
||||
if (lstat(path, &statstruct) == 0 &&
|
||||
S_ISREG(statstruct.st_mode)) {
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
return NO;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -594,7 +594,7 @@ incfile(char *file, char *type)
|
||||
|
||||
assert(file != NULL); /* should never happen, but let's make sure anyway */
|
||||
/* see if the file is already in the source file list */
|
||||
if (infilelist(file) == YES) {
|
||||
if (infilelist(file) == true) {
|
||||
return;
|
||||
}
|
||||
/* look in current directory if it was #include "file" */
|
||||
@ -609,7 +609,7 @@ incfile(char *file, char *type)
|
||||
snprintf(name, sizeof(name), "%.*s/%s",
|
||||
(int)(PATHLEN - 2 - file_len), incnames[i],
|
||||
file);
|
||||
if (infilelist(name) == YES) {
|
||||
if (infilelist(name) == true) {
|
||||
break;
|
||||
}
|
||||
/* make sure it exists and is readable */
|
||||
@ -626,7 +626,7 @@ incfile(char *file, char *type)
|
||||
|
||||
|
||||
/* see if the file is already in the list */
|
||||
BOOL
|
||||
bool
|
||||
infilelist(char *path)
|
||||
{
|
||||
struct listitem *p;
|
||||
@ -635,16 +635,16 @@ infilelist(char *path)
|
||||
p != NULL;
|
||||
p = p->next) {
|
||||
if (strequal(path, p->text)) {
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
|
||||
|
||||
/* check if a file is readable enough to be allowed in the
|
||||
* database */
|
||||
static BOOL
|
||||
static bool
|
||||
accessible_file(char *file)
|
||||
{
|
||||
if (access(compath(file), READ) == 0) {
|
||||
@ -652,10 +652,10 @@ accessible_file(char *file)
|
||||
|
||||
if (lstat(file, &stats) == 0
|
||||
&& S_ISREG(stats.st_mode)) {
|
||||
return YES;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* search for the file in the view path */
|
||||
@ -719,7 +719,7 @@ freefilelist(void)
|
||||
int i;
|
||||
|
||||
/* if '-d' option is used a string space block is allocated */
|
||||
if (isuptodate == NO) {
|
||||
if (isuptodate == false) {
|
||||
while (nsrcfiles > 0) {
|
||||
free (srcfiles[--nsrcfiles]);
|
||||
}
|
||||
|
146
src/display.c
146
src/display.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -93,7 +93,7 @@ static int mode_window_height;
|
||||
|
||||
int window_change = CH_ALL;
|
||||
|
||||
const char dispchars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
const char dispchars[] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMfalsePQRSTUVWXYZ";
|
||||
|
||||
static int fldline; /* input field line */
|
||||
static sigjmp_buf env; /* setjmp/longjmp buffer */
|
||||
@ -148,7 +148,7 @@ dispinit(void)
|
||||
|
||||
if (mdisprefs <= 0) {
|
||||
postfatal("%s: screen too small\n", argv0);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
if(mdisprefs > strlen(dispchars)){
|
||||
mdisprefs = strlen(dispchars);
|
||||
@ -188,7 +188,7 @@ static inline void display_frame(){
|
||||
const int LEFT_PADDING = 5;
|
||||
wmove(stdscr, 0, LEFT_PADDING);
|
||||
#if CCS
|
||||
if (displayversion == YES) {
|
||||
if (displayversion == true) {
|
||||
wprintw(stdscr, "cscope %s", ESG_REL);
|
||||
}
|
||||
else {
|
||||
@ -236,11 +236,11 @@ static inline void display_results(){
|
||||
/* redisplay the last message */
|
||||
waddstr(wresult, lastmsg);
|
||||
return;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
/* display the pattern */
|
||||
if (changing == YES) {
|
||||
if (changing == true) {
|
||||
wprintw(wresult, "Change \"%s\" to \"%s\"", input_line, newpat);
|
||||
} else {
|
||||
wprintw(wresult, "%c%s: %s", toupper((unsigned char)fields[field].text2[0]),
|
||||
@ -248,7 +248,7 @@ static inline void display_results(){
|
||||
}
|
||||
/* display the column headings */
|
||||
wmove(wresult, 2, 2);
|
||||
if (ogs == YES && field != FILENAME) {
|
||||
if (ogs == true && field != FILENAME) {
|
||||
wprintw(wresult, "%-*s ", subsystemlen, "Subsystem");
|
||||
wprintw(wresult, "%-*s ", booklen, "Book");
|
||||
}
|
||||
@ -265,10 +265,10 @@ static inline void display_results(){
|
||||
wmove(wresult, WRESULT_TABLE_BODY_START, 0);
|
||||
|
||||
/* calculate the source text column */
|
||||
/* NOTE: the +1s are column gaps */
|
||||
/* falseTE: the +1s are column gaps */
|
||||
srctxtw = second_col_width;
|
||||
srctxtw -= 1+1; // dispchars
|
||||
if (ogs == YES) {
|
||||
if (ogs == true) {
|
||||
srctxtw -= subsystemlen+1 + booklen+1;
|
||||
}
|
||||
if (dispcomponents > 0) {
|
||||
@ -306,8 +306,8 @@ static inline void display_results(){
|
||||
wprintw(wresult, "%c", dispchars[disprefs]);
|
||||
|
||||
/* display any change mark */
|
||||
if (changing == YES && change[topline + disprefs - 1] == YES) {
|
||||
waddch(wresult, '>');
|
||||
if (changing == true && change[topline + disprefs - 1] == true) {
|
||||
waddch(wresult, '>');
|
||||
} else {
|
||||
waddch(wresult, ' ');
|
||||
}
|
||||
@ -317,7 +317,7 @@ static inline void display_results(){
|
||||
wprintw(wresult, "%-*s ", filelen, file);
|
||||
} else {
|
||||
/* if OGS, display the subsystem and book names */
|
||||
if (ogs == YES) {
|
||||
if (ogs == true) {
|
||||
ogsnames(file, &subsystem, &book);
|
||||
wprintw(wresult, "%-*.*s ", subsystemlen, subsystemlen, subsystem);
|
||||
wprintw(wresult, "%-*.*s ", booklen, booklen, book);
|
||||
@ -476,7 +476,7 @@ display(void)
|
||||
wrefresh(wresult);
|
||||
}
|
||||
|
||||
window_change = CH_NONE;
|
||||
window_change = CH_falseNE;
|
||||
}
|
||||
|
||||
void
|
||||
@ -510,22 +510,22 @@ jumpback(int sig)
|
||||
siglongjmp(env, 1);
|
||||
}
|
||||
|
||||
BOOL
|
||||
bool
|
||||
search(void)
|
||||
{
|
||||
char *findresult = NULL; /* find function output */
|
||||
BOOL funcexist = YES; /* find "function" error */
|
||||
FINDINIT rc = NOERROR; /* findinit return code */
|
||||
sighandler_t savesig; /* old value of signal */
|
||||
FP f; /* searching function */
|
||||
char *findresult = NULL; /* find function output */
|
||||
bool funcexist = true; /* find "function" error */
|
||||
FINDINIT rc = falseERROR; /* findinit return code */
|
||||
sighandler_t savesig; /* old value of signal */
|
||||
FP f; /* searching function */
|
||||
int c;
|
||||
|
||||
/* open the references found file for writing */
|
||||
if (writerefsfound() == NO) {
|
||||
return(NO);
|
||||
if (writerefsfound() == false) {
|
||||
return(false);
|
||||
}
|
||||
/* find the pattern - stop on an interrupt */
|
||||
if (linemode == NO) {
|
||||
if (linemode == false) {
|
||||
postmsg("Searching");
|
||||
}
|
||||
searchcount = 0;
|
||||
@ -535,29 +535,29 @@ search(void)
|
||||
if (f == findregexp || f == findstring) {
|
||||
findresult = (*f)(input_line);
|
||||
} else {
|
||||
if ((nonglobalrefs = myfopen(temp2, "wb")) == NULL) {
|
||||
cannotopen(temp2);
|
||||
return(NO);
|
||||
}
|
||||
if ((rc = findinit(input_line)) == NOERROR) {
|
||||
(void) dbseek(0L); /* read the first block */
|
||||
findresult = (*f)(input_line);
|
||||
if (f == findcalledby)
|
||||
funcexist = (*findresult == 'y');
|
||||
findcleanup();
|
||||
if ((nonglobalrefs = myfopen(temp2, "wb")) == NULL) {
|
||||
cannotopen(temp2);
|
||||
return(false);
|
||||
}
|
||||
if ((rc = findinit(input_line)) == falseERROR) {
|
||||
(void) dbseek(0L); /* read the first block */
|
||||
findresult = (*f)(input_line);
|
||||
if (f == findcalledby)
|
||||
funcexist = (*findresult == 'y');
|
||||
findcleanup();
|
||||
|
||||
/* append the non-global references */
|
||||
(void) fclose(nonglobalrefs);
|
||||
if ((nonglobalrefs = myfopen(temp2, "rb"))
|
||||
== NULL) {
|
||||
cannotopen(temp2);
|
||||
return(NO);
|
||||
}
|
||||
while ((c = getc(nonglobalrefs)) != EOF) {
|
||||
(void) putc(c, refsfound);
|
||||
}
|
||||
}
|
||||
(void) fclose(nonglobalrefs);
|
||||
/* append the non-global references */
|
||||
(void) fclose(nonglobalrefs);
|
||||
if ((nonglobalrefs = myfopen(temp2, "rb"))
|
||||
== NULL) {
|
||||
cannotopen(temp2);
|
||||
return(false);
|
||||
}
|
||||
while ((c = getc(nonglobalrefs)) != EOF) {
|
||||
(void) putc(c, refsfound);
|
||||
}
|
||||
}
|
||||
(void) fclose(nonglobalrefs);
|
||||
}
|
||||
}
|
||||
signal(SIGINT, savesig);
|
||||
@ -569,7 +569,7 @@ search(void)
|
||||
(void) fclose(refsfound);
|
||||
if ((refsfound = myfopen(temp1, "rb")) == NULL) {
|
||||
cannotopen(temp1);
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
nextline = 1;
|
||||
totallines = 0;
|
||||
@ -578,23 +578,23 @@ search(void)
|
||||
/* see if it is empty */
|
||||
if ((c = getc(refsfound)) == EOF) {
|
||||
if (findresult != NULL) {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "Egrep %s in this pattern: %s",
|
||||
findresult, input_line);
|
||||
} else if (rc == NOTSYMBOL) {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "This is not a C symbol: %s",
|
||||
input_line);
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "Egrep %s in this pattern: %s",
|
||||
findresult, input_line);
|
||||
} else if (rc == falseTSYMBOL) {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "This is not a C symbol: %s",
|
||||
input_line);
|
||||
} else if (rc == REGCMPERROR) {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "Error in this regcomp(3) regular expression: %s",
|
||||
input_line);
|
||||
|
||||
} else if (funcexist == NO) {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "Function definition does not exist: %s",
|
||||
input_line);
|
||||
} else if (funcexist == false) {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "Function definition does not exist: %s",
|
||||
input_line);
|
||||
} else {
|
||||
(void) snprintf(lastmsg, sizeof(lastmsg), "Could not find the %s: %s",
|
||||
fields[field].text2, input_line);
|
||||
}
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
/* put back the character read */
|
||||
(void) ungetc(c, refsfound);
|
||||
@ -603,7 +603,7 @@ search(void)
|
||||
|
||||
window_change |= CH_RESULT;
|
||||
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
|
||||
/* display search progress with default custom format */
|
||||
@ -621,7 +621,7 @@ progress(char *what, long current, long max)
|
||||
}
|
||||
if ((now = time(NULL)) - start >= 1)
|
||||
{
|
||||
if (linemode == NO)
|
||||
if (linemode == false)
|
||||
{
|
||||
wmove(wresult, MSGLINE, 0);
|
||||
wclrtoeol(wresult);
|
||||
@ -634,13 +634,13 @@ progress(char *what, long current, long max)
|
||||
waddstr(wresult, msg);
|
||||
refresh();
|
||||
}
|
||||
else if (verbosemode == YES)
|
||||
else if (verbosemode == true)
|
||||
{
|
||||
snprintf(msg, sizeof(msg), "> %s %ld of %ld", what, current, max);
|
||||
}
|
||||
|
||||
start = now;
|
||||
if ((linemode == NO) && (incurses == YES))
|
||||
if ((linemode == false) && (incurses == true))
|
||||
{
|
||||
wmove(wresult, MSGLINE, 0);
|
||||
i = (float)COLS * (float)current / (float)max;
|
||||
@ -652,8 +652,8 @@ progress(char *what, long current, long max)
|
||||
refresh();
|
||||
}
|
||||
else
|
||||
if (linemode == NO || verbosemode == YES)
|
||||
postmsg(msg);
|
||||
if (linemode == false || verbosemode == true)
|
||||
postmsg(msg);
|
||||
}
|
||||
++searchcount;
|
||||
}
|
||||
@ -676,7 +676,7 @@ myperror(char *text)
|
||||
void
|
||||
postmsg(char *msg)
|
||||
{
|
||||
if (linemode == YES || incurses == NO) {
|
||||
if (linemode == true || incurses == false) {
|
||||
(void) printf("%s\n", msg);
|
||||
fflush(stdout);
|
||||
}
|
||||
@ -701,7 +701,7 @@ clearmsg(void)
|
||||
void
|
||||
clearmsg2(void)
|
||||
{
|
||||
if (linemode == NO) {
|
||||
if (linemode == false) {
|
||||
wmove(wresult, MSGLINE + 1, 0);
|
||||
wclrtoeol(wresult);
|
||||
}
|
||||
@ -711,7 +711,7 @@ clearmsg2(void)
|
||||
void
|
||||
postmsg2(char *msg)
|
||||
{
|
||||
if (linemode == YES) {
|
||||
if (linemode == true) {
|
||||
(void) printf("%s\n", msg);
|
||||
}
|
||||
else {
|
||||
@ -729,7 +729,7 @@ posterr(char *msg, ...)
|
||||
char errbuf[MSGLEN];
|
||||
|
||||
va_start(ap, msg);
|
||||
if (linemode == YES || incurses == NO)
|
||||
if (linemode == true || incurses == false)
|
||||
{
|
||||
(void) vfprintf(stderr, msg, ap);
|
||||
(void) fputc('\n', stderr);
|
||||
@ -750,7 +750,7 @@ postfatal(const char *msg, ...)
|
||||
va_start(ap, msg);
|
||||
vsnprintf(errbuf, sizeof(errbuf), msg, ap);
|
||||
/* restore the terminal to its original mode */
|
||||
if (incurses == YES) {
|
||||
if (incurses == true) {
|
||||
exitcurses();
|
||||
}
|
||||
|
||||
@ -831,20 +831,20 @@ pathcomponents(char *path, int components)
|
||||
}
|
||||
|
||||
/* open the references found file for writing */
|
||||
BOOL
|
||||
bool
|
||||
writerefsfound(void)
|
||||
{
|
||||
if (refsfound == NULL) {
|
||||
if ((refsfound = myfopen(temp1, "wb")) == NULL) {
|
||||
cannotopen(temp1);
|
||||
return(NO);
|
||||
cannotopen(temp1);
|
||||
return(false);
|
||||
}
|
||||
} else {
|
||||
(void) fclose(refsfound);
|
||||
if ( (refsfound = myfopen(temp1, "wb")) == NULL) {
|
||||
postmsg("Cannot reopen temporary file");
|
||||
return(NO);
|
||||
postmsg("Cannot reopen temporary file");
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -83,7 +83,7 @@ editall(void)
|
||||
/* get each file name and line number */
|
||||
while (fscanf(refsfound, "%" PATHLEN_STR "s%*s%" NUMLEN_STR "s%*[^\n]", file, linenum) == 2) {
|
||||
edit(file, linenum); /* edit it */
|
||||
if (editallprompt == YES) {
|
||||
if (editallprompt == true) {
|
||||
addstr("Type ^D to stop editing all lines, or any other character to continue: ");
|
||||
if ((c = mygetch()) == EOF || c == ctrl('D') || c == ctrl('Z')) {
|
||||
break;
|
||||
|
622
src/egrep.c
622
src/egrep.c
@ -88,11 +88,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -110,53 +110,53 @@
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <setjmp.h> /* jmp_buf */
|
||||
#include <setjmp.h> /* jmp_buf */
|
||||
|
||||
#define nextch() (*input++)
|
||||
#define nextch() (*input++)
|
||||
|
||||
#define MAXLIN 350
|
||||
#define MAXPOS 4000
|
||||
#define NCHARS 256
|
||||
#define NSTATES 128
|
||||
#define FINAL -1
|
||||
static char gotofn[NSTATES][NCHARS];
|
||||
static int state[NSTATES];
|
||||
static char out[NSTATES];
|
||||
static unsigned int line;
|
||||
static int name[MAXLIN];
|
||||
static unsigned int left[MAXLIN];
|
||||
static unsigned int right[MAXLIN];
|
||||
static unsigned int parent[MAXLIN];
|
||||
static int foll[MAXLIN];
|
||||
static int positions[MAXPOS];
|
||||
static char chars[MAXLIN];
|
||||
static int nxtpos;
|
||||
static int nxtchar;
|
||||
static int tmpstat[MAXLIN];
|
||||
static int initstat[MAXLIN];
|
||||
static int xstate;
|
||||
static int count;
|
||||
static int icount;
|
||||
static char *input;
|
||||
static long lnum;
|
||||
static int iflag;
|
||||
static jmp_buf env; /* setjmp/longjmp buffer */
|
||||
static char *message; /* error message */
|
||||
static char gotofn[NSTATES][NCHARS];
|
||||
static int state[NSTATES];
|
||||
static char out[NSTATES];
|
||||
static unsigned int line;
|
||||
static int name[MAXLIN];
|
||||
static unsigned int left[MAXLIN];
|
||||
static unsigned int right[MAXLIN];
|
||||
static unsigned int parent[MAXLIN];
|
||||
static int foll[MAXLIN];
|
||||
static int positions[MAXPOS];
|
||||
static char chars[MAXLIN];
|
||||
static int nxtpos;
|
||||
static int nxtchar;
|
||||
static int tmpstat[MAXLIN];
|
||||
static int initstat[MAXLIN];
|
||||
static int xstate;
|
||||
static int count;
|
||||
static int icount;
|
||||
static char *input;
|
||||
static long lnum;
|
||||
static int iflag;
|
||||
static jmp_buf env; /* setjmp/longjmp buffer */
|
||||
static char *message; /* error message */
|
||||
|
||||
/* Internal prototypes: */
|
||||
static void cfoll(int v);
|
||||
static void cgotofn(void);
|
||||
static int cstate(int v);
|
||||
static int member(int symb, int set, int torf);
|
||||
static int notin(int n);
|
||||
static void synerror(void);
|
||||
static void overflo(void);
|
||||
static void add(int *array, int n);
|
||||
static void follow(unsigned int v);
|
||||
static int unary(int x, int d);
|
||||
static int node(int x, int l, int r);
|
||||
static unsigned int cclenter(int x);
|
||||
static unsigned int enter(int x);
|
||||
static void cfoll(int v);
|
||||
static void cgotofn(void);
|
||||
static int cstate(int v);
|
||||
static int member(int symb, int set, int torf);
|
||||
static int notin(int n);
|
||||
static void synerror(void);
|
||||
static void overflo(void);
|
||||
static void add(int *array, int n);
|
||||
static void follow(unsigned int v);
|
||||
static int unary(int x, int d);
|
||||
static int node(int x, int l, int r);
|
||||
static unsigned int cclenter(int x);
|
||||
static unsigned int enter(int x);
|
||||
|
||||
static int yylex(void);
|
||||
static int yyerror(char *);
|
||||
@ -1242,8 +1242,8 @@ yyreduce:
|
||||
case 2: /* s: t */
|
||||
#line 104 "src/egrep.y"
|
||||
{ unary(FINAL, yyvsp[0]);
|
||||
line--;
|
||||
}
|
||||
line--;
|
||||
}
|
||||
#line 1248 "y.tab.c"
|
||||
break;
|
||||
|
||||
@ -1274,7 +1274,7 @@ yyreduce:
|
||||
case 7: /* b: %empty */
|
||||
#line 118 "src/egrep.y"
|
||||
{ yyval = enter(DOT);
|
||||
yyval = unary(STAR, yyval); }
|
||||
yyval = unary(STAR, yyval); }
|
||||
#line 1279 "y.tab.c"
|
||||
break;
|
||||
|
||||
@ -1537,9 +1537,9 @@ yyreturnlab:
|
||||
static int
|
||||
yyerror(char *s)
|
||||
{
|
||||
message = s;
|
||||
longjmp(env, 1);
|
||||
return 1; /* silence a warning */
|
||||
message = s;
|
||||
longjmp(env, 1);
|
||||
return 1; /* silence a warning */
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1551,66 +1551,66 @@ yylex(void)
|
||||
switch(c = nextch()) {
|
||||
case '|':
|
||||
case '\n':
|
||||
return (OR);
|
||||
return (OR);
|
||||
case '*':
|
||||
return (STAR);
|
||||
return (STAR);
|
||||
case '+':
|
||||
return (PLUS);
|
||||
return (PLUS);
|
||||
case '?':
|
||||
return (QUEST);
|
||||
return (QUEST);
|
||||
case '(':
|
||||
case ')':
|
||||
return (c);
|
||||
return (c);
|
||||
case '.':
|
||||
return (DOT);
|
||||
return (DOT);
|
||||
case '\0':
|
||||
return (0);
|
||||
return (0);
|
||||
case '[':
|
||||
x = CCL;
|
||||
cclcnt = 0;
|
||||
count = nxtchar++;
|
||||
if ((c = nextch()) == '^') {
|
||||
x = NCCL;
|
||||
c = nextch();
|
||||
}
|
||||
do {
|
||||
if (c == '\0')
|
||||
synerror();
|
||||
if ( (c == '-')
|
||||
&& (cclcnt > 0)
|
||||
&& (chars[nxtchar-1] != 0)
|
||||
) {
|
||||
if ((d = nextch()) != 0) {
|
||||
c = chars[nxtchar-1];
|
||||
while ((unsigned int)c < (unsigned int)d) {
|
||||
if (nxtchar >= MAXLIN)
|
||||
overflo();
|
||||
chars[nxtchar++] = ++c;
|
||||
cclcnt++;
|
||||
}
|
||||
continue;
|
||||
} /* if() */
|
||||
} /* if() */
|
||||
if (nxtchar >= MAXLIN)
|
||||
overflo();
|
||||
chars[nxtchar++] = c;
|
||||
cclcnt++;
|
||||
} while ((c = nextch()) != ']');
|
||||
chars[count] = cclcnt;
|
||||
return (x);
|
||||
x = CCL;
|
||||
cclcnt = 0;
|
||||
count = nxtchar++;
|
||||
if ((c = nextch()) == '^') {
|
||||
x = NCCL;
|
||||
c = nextch();
|
||||
}
|
||||
do {
|
||||
if (c == '\0')
|
||||
synerror();
|
||||
if ( (c == '-')
|
||||
&& (cclcnt > 0)
|
||||
&& (chars[nxtchar-1] != 0)
|
||||
) {
|
||||
if ((d = nextch()) != 0) {
|
||||
c = chars[nxtchar-1];
|
||||
while ((unsigned int)c < (unsigned int)d) {
|
||||
if (nxtchar >= MAXLIN)
|
||||
overflo();
|
||||
chars[nxtchar++] = ++c;
|
||||
cclcnt++;
|
||||
}
|
||||
continue;
|
||||
} /* if() */
|
||||
} /* if() */
|
||||
if (nxtchar >= MAXLIN)
|
||||
overflo();
|
||||
chars[nxtchar++] = c;
|
||||
cclcnt++;
|
||||
} while ((c = nextch()) != ']');
|
||||
chars[count] = cclcnt;
|
||||
return (x);
|
||||
case '\\':
|
||||
if ((c = nextch()) == '\0')
|
||||
synerror();
|
||||
yylval = c;
|
||||
return (CHAR);
|
||||
if ((c = nextch()) == '\0')
|
||||
synerror();
|
||||
yylval = c;
|
||||
return (CHAR);
|
||||
case '$':
|
||||
case '^':
|
||||
c = '\n';
|
||||
yylval = c;
|
||||
return (CHAR);
|
||||
c = '\n';
|
||||
yylval = c;
|
||||
return (CHAR);
|
||||
default:
|
||||
yylval = c;
|
||||
return (CHAR);
|
||||
yylval = c;
|
||||
return (CHAR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1624,7 +1624,7 @@ static unsigned int
|
||||
enter(int x)
|
||||
{
|
||||
if(line >= MAXLIN)
|
||||
overflo();
|
||||
overflo();
|
||||
name[line] = x;
|
||||
left[line] = 0;
|
||||
right[line] = 0;
|
||||
@ -1645,7 +1645,7 @@ static int
|
||||
node(int x, int l, int r)
|
||||
{
|
||||
if(line >= MAXLIN)
|
||||
overflo();
|
||||
overflo();
|
||||
name[line] = x;
|
||||
left[line] = l;
|
||||
right[line] = r;
|
||||
@ -1658,7 +1658,7 @@ static int
|
||||
unary(int x, int d)
|
||||
{
|
||||
if(line >= MAXLIN)
|
||||
overflo();
|
||||
overflo();
|
||||
name[line] = x;
|
||||
left[line] = d;
|
||||
right[line] = 0;
|
||||
@ -1678,16 +1678,16 @@ cfoll(int v)
|
||||
unsigned int i;
|
||||
|
||||
if (left[v] == 0) {
|
||||
count = 0;
|
||||
for (i = 1; i <= line; i++)
|
||||
tmpstat[i] = 0;
|
||||
follow(v);
|
||||
add(foll, v);
|
||||
count = 0;
|
||||
for (i = 1; i <= line; i++)
|
||||
tmpstat[i] = 0;
|
||||
follow(v);
|
||||
add(foll, v);
|
||||
} else if (right[v] == 0)
|
||||
cfoll(left[v]);
|
||||
cfoll(left[v]);
|
||||
else {
|
||||
cfoll(left[v]);
|
||||
cfoll(right[v]);
|
||||
cfoll(left[v]);
|
||||
cfoll(right[v]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1704,126 +1704,126 @@ cgotofn(void)
|
||||
|
||||
count = 0;
|
||||
for (n=3; n<=line; n++)
|
||||
tmpstat[n] = 0;
|
||||
tmpstat[n] = 0;
|
||||
if (cstate(line-1)==0) {
|
||||
tmpstat[line] = 1;
|
||||
count++;
|
||||
out[0] = 1;
|
||||
tmpstat[line] = 1;
|
||||
count++;
|
||||
out[0] = 1;
|
||||
}
|
||||
for (n=3; n<=line; n++)
|
||||
initstat[n] = tmpstat[n];
|
||||
count--; /*leave out position 1 */
|
||||
initstat[n] = tmpstat[n];
|
||||
count--; /*leave out position 1 */
|
||||
icount = count;
|
||||
tmpstat[1] = 0;
|
||||
add(state, 0);
|
||||
n = 0;
|
||||
for (s = 0; s <= n; s++) {
|
||||
if (out[s] == 1)
|
||||
continue;
|
||||
for (i = 0; i < NCHARS; i++)
|
||||
symbol[i] = 0;
|
||||
num = positions[state[s]];
|
||||
count = icount;
|
||||
for (i = 3; i <= line; i++)
|
||||
tmpstat[i] = initstat[i];
|
||||
pos = state[s] + 1;
|
||||
for (i = 0; i < num; i++) {
|
||||
curpos = positions[pos];
|
||||
if ((c = name[curpos]) >= 0) {
|
||||
if (c < NCHARS) {
|
||||
symbol[c] = 1;
|
||||
} else if (c == DOT) {
|
||||
for (k = 0; k < NCHARS; k++)
|
||||
if (k != '\n')
|
||||
symbol[k] = 1;
|
||||
} else if (c == CCL) {
|
||||
nc = chars[right[curpos]];
|
||||
pc = right[curpos] + 1;
|
||||
for (j = 0; j < nc; j++)
|
||||
symbol[(unsigned char)chars[pc++]] = 1;
|
||||
} else if (c == NCCL) {
|
||||
nc = chars[right[curpos]];
|
||||
for (j = 0; j < NCHARS; j++) {
|
||||
pc = right[curpos] + 1;
|
||||
for (l = 0; l < nc; l++)
|
||||
if (j==(unsigned char)chars[pc++])
|
||||
goto cont;
|
||||
if (j != '\n')
|
||||
symbol[j] = 1;
|
||||
cont:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
} /* for (i) */
|
||||
for (c=0; c<NCHARS; c++) {
|
||||
if (symbol[c] == 1) {
|
||||
/* nextstate(s,c) */
|
||||
count = icount;
|
||||
for (i=3; i <= line; i++)
|
||||
tmpstat[i] = initstat[i];
|
||||
pos = state[s] + 1;
|
||||
for (i=0; i<num; i++) {
|
||||
curpos = positions[pos];
|
||||
if ((k = name[curpos]) >= 0)
|
||||
if ((k == c)
|
||||
|| (k == DOT)
|
||||
|| (k == CCL && member(c, right[curpos], 1))
|
||||
|| (k == NCCL && member(c, right[curpos], 0))
|
||||
) {
|
||||
number = positions[foll[curpos]];
|
||||
newpos = foll[curpos] + 1;
|
||||
for (j = 0; j < number; j++) {
|
||||
if (tmpstat[positions[newpos]] != 1) {
|
||||
tmpstat[positions[newpos]] = 1;
|
||||
count++;
|
||||
}
|
||||
newpos++;
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
} /* end nextstate */
|
||||
if (notin(n)) {
|
||||
if (n >= NSTATES)
|
||||
overflo();
|
||||
add(state, ++n);
|
||||
if (tmpstat[line] == 1)
|
||||
out[n] = 1;
|
||||
gotofn[s][c] = n;
|
||||
} else {
|
||||
gotofn[s][c] = xstate;
|
||||
}
|
||||
} /* if (symbol) */
|
||||
} /* for(c) */
|
||||
if (out[s] == 1)
|
||||
continue;
|
||||
for (i = 0; i < NCHARS; i++)
|
||||
symbol[i] = 0;
|
||||
num = positions[state[s]];
|
||||
count = icount;
|
||||
for (i = 3; i <= line; i++)
|
||||
tmpstat[i] = initstat[i];
|
||||
pos = state[s] + 1;
|
||||
for (i = 0; i < num; i++) {
|
||||
curpos = positions[pos];
|
||||
if ((c = name[curpos]) >= 0) {
|
||||
if (c < NCHARS) {
|
||||
symbol[c] = 1;
|
||||
} else if (c == DOT) {
|
||||
for (k = 0; k < NCHARS; k++)
|
||||
if (k != '\n')
|
||||
symbol[k] = 1;
|
||||
} else if (c == CCL) {
|
||||
nc = chars[right[curpos]];
|
||||
pc = right[curpos] + 1;
|
||||
for (j = 0; j < nc; j++)
|
||||
symbol[(unsigned char)chars[pc++]] = 1;
|
||||
} else if (c == NCCL) {
|
||||
nc = chars[right[curpos]];
|
||||
for (j = 0; j < NCHARS; j++) {
|
||||
pc = right[curpos] + 1;
|
||||
for (l = 0; l < nc; l++)
|
||||
if (j==(unsigned char)chars[pc++])
|
||||
goto cont;
|
||||
if (j != '\n')
|
||||
symbol[j] = 1;
|
||||
cont:
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
} /* for (i) */
|
||||
for (c=0; c<NCHARS; c++) {
|
||||
if (symbol[c] == 1) {
|
||||
/* nextstate(s,c) */
|
||||
count = icount;
|
||||
for (i=3; i <= line; i++)
|
||||
tmpstat[i] = initstat[i];
|
||||
pos = state[s] + 1;
|
||||
for (i=0; i<num; i++) {
|
||||
curpos = positions[pos];
|
||||
if ((k = name[curpos]) >= 0)
|
||||
if ((k == c)
|
||||
|| (k == DOT)
|
||||
|| (k == CCL && member(c, right[curpos], 1))
|
||||
|| (k == NCCL && member(c, right[curpos], 0))
|
||||
) {
|
||||
number = positions[foll[curpos]];
|
||||
newpos = foll[curpos] + 1;
|
||||
for (j = 0; j < number; j++) {
|
||||
if (tmpstat[positions[newpos]] != 1) {
|
||||
tmpstat[positions[newpos]] = 1;
|
||||
count++;
|
||||
}
|
||||
newpos++;
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
} /* end nextstate */
|
||||
if (notin(n)) {
|
||||
if (n >= NSTATES)
|
||||
overflo();
|
||||
add(state, ++n);
|
||||
if (tmpstat[line] == 1)
|
||||
out[n] = 1;
|
||||
gotofn[s][c] = n;
|
||||
} else {
|
||||
gotofn[s][c] = xstate;
|
||||
}
|
||||
} /* if (symbol) */
|
||||
} /* for(c) */
|
||||
} /* for(s) */
|
||||
}
|
||||
|
||||
static int
|
||||
cstate(int v)
|
||||
{
|
||||
int b;
|
||||
if (left[v] == 0) {
|
||||
if (tmpstat[v] != 1) {
|
||||
tmpstat[v] = 1;
|
||||
count++;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
else if (right[v] == 0) {
|
||||
if (cstate(left[v]) == 0) return (0);
|
||||
else if (name[v] == PLUS) return (1);
|
||||
else return (0);
|
||||
}
|
||||
else if (name[v] == CAT) {
|
||||
if (cstate(left[v]) == 0 && cstate(right[v]) == 0) return (0);
|
||||
else return (1);
|
||||
}
|
||||
else { /* name[v] == OR */
|
||||
b = cstate(right[v]);
|
||||
if (cstate(left[v]) == 0 || b == 0) return (0);
|
||||
else return (1);
|
||||
}
|
||||
int b;
|
||||
if (left[v] == 0) {
|
||||
if (tmpstat[v] != 1) {
|
||||
tmpstat[v] = 1;
|
||||
count++;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
else if (right[v] == 0) {
|
||||
if (cstate(left[v]) == 0) return (0);
|
||||
else if (name[v] == PLUS) return (1);
|
||||
else return (0);
|
||||
}
|
||||
else if (name[v] == CAT) {
|
||||
if (cstate(left[v]) == 0 && cstate(right[v]) == 0) return (0);
|
||||
else return (1);
|
||||
}
|
||||
else { /* name[v] == OR */
|
||||
b = cstate(right[v]);
|
||||
if (cstate(left[v]) == 0 || b == 0) return (0);
|
||||
else return (1);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1834,26 +1834,26 @@ member(int symb, int set, int torf)
|
||||
num = chars[set];
|
||||
pos = set + 1;
|
||||
for (i = 0; i < num; i++)
|
||||
if (symb == (unsigned char)(chars[pos++]))
|
||||
return (torf);
|
||||
if (symb == (unsigned char)(chars[pos++]))
|
||||
return (torf);
|
||||
return (!torf);
|
||||
}
|
||||
|
||||
static int
|
||||
notin(int n)
|
||||
{
|
||||
int i, j, pos;
|
||||
for (i=0; i<=n; i++) {
|
||||
if (positions[state[i]] == count) {
|
||||
pos = state[i] + 1;
|
||||
for (j=0; j < count; j++)
|
||||
if (tmpstat[positions[pos++]] != 1) goto nxt;
|
||||
xstate = i;
|
||||
return (0);
|
||||
}
|
||||
nxt: ;
|
||||
}
|
||||
return (1);
|
||||
int i, j, pos;
|
||||
for (i=0; i<=n; i++) {
|
||||
if (positions[state[i]] == count) {
|
||||
pos = state[i] + 1;
|
||||
for (j=0; j < count; j++)
|
||||
if (tmpstat[positions[pos++]] != 1) goto nxt;
|
||||
xstate = i;
|
||||
return (0);
|
||||
}
|
||||
nxt: ;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1862,13 +1862,13 @@ add(int *array, int n)
|
||||
unsigned int i;
|
||||
|
||||
if (nxtpos + count > MAXPOS)
|
||||
overflo();
|
||||
overflo();
|
||||
array[n] = nxtpos;
|
||||
positions[nxtpos++] = count;
|
||||
for (i=3; i <= line; i++) {
|
||||
if (tmpstat[i] == 1) {
|
||||
positions[nxtpos++] = i;
|
||||
}
|
||||
if (tmpstat[i] == 1) {
|
||||
positions[nxtpos++] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1878,33 +1878,33 @@ follow(unsigned int v)
|
||||
unsigned int p;
|
||||
|
||||
if (v == line)
|
||||
return;
|
||||
return;
|
||||
p = parent[v];
|
||||
switch(name[p]) {
|
||||
case STAR:
|
||||
case PLUS: cstate(v);
|
||||
follow(p);
|
||||
return;
|
||||
case PLUS: cstate(v);
|
||||
follow(p);
|
||||
return;
|
||||
|
||||
case OR:
|
||||
case QUEST: follow(p);
|
||||
return;
|
||||
case QUEST: follow(p);
|
||||
return;
|
||||
|
||||
case CAT:
|
||||
if (v == left[p]) {
|
||||
if (cstate(right[p]) == 0) {
|
||||
follow(p);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
follow(p);
|
||||
return;
|
||||
if (v == left[p]) {
|
||||
if (cstate(right[p]) == 0) {
|
||||
follow(p);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
follow(p);
|
||||
return;
|
||||
case FINAL:
|
||||
if (tmpstat[line] != 1) {
|
||||
tmpstat[line] = 1;
|
||||
count++;
|
||||
}
|
||||
return;
|
||||
if (tmpstat[line] != 1) {
|
||||
tmpstat[line] = 1;
|
||||
count++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1933,9 +1933,9 @@ egrepinit(char *egreppat)
|
||||
input = egreppat;
|
||||
message = NULL;
|
||||
if (setjmp(env) == 0) {
|
||||
yyparse();
|
||||
cfoll(line-1);
|
||||
cgotofn();
|
||||
yyparse();
|
||||
cfoll(line-1);
|
||||
cgotofn();
|
||||
}
|
||||
return(message);
|
||||
}
|
||||
@ -1947,11 +1947,11 @@ static size_t read_next_chunk(char **p, FILE *fptr)
|
||||
{
|
||||
if (*p <= (buf + BUFSIZ)) {
|
||||
/* bwlow the middle, so enough space left for one entire BUFSIZ */
|
||||
return fread(*p, sizeof(**p), BUFSIZ, fptr);
|
||||
return fread(*p, sizeof(**p), BUFSIZ, fptr);
|
||||
} else if (*p == buf_end) {
|
||||
/* exactly at end ... wrap around and use lower half */
|
||||
*p = buf;
|
||||
return fread(*p, sizeof(**p), BUFSIZ, fptr);
|
||||
*p = buf;
|
||||
return fread(*p, sizeof(**p), BUFSIZ, fptr);
|
||||
}
|
||||
/* somewhere in second half, so do a limited read */
|
||||
return fread(*p, sizeof(**p), buf_end - *p, fptr);
|
||||
@ -1969,7 +1969,7 @@ egrep(char *file, FILE *output, char *format)
|
||||
FILE *fptr;
|
||||
|
||||
if ((fptr = myfopen(file, "r")) == NULL)
|
||||
return(-1);
|
||||
return(-1);
|
||||
|
||||
lnum = 1;
|
||||
p = buf;
|
||||
@ -1977,70 +1977,70 @@ egrep(char *file, FILE *output, char *format)
|
||||
ccount = read_next_chunk(&p, fptr);
|
||||
|
||||
if (ccount <= 0) {
|
||||
fclose(fptr);
|
||||
return(0);
|
||||
fclose(fptr);
|
||||
return(0);
|
||||
}
|
||||
in_line = 1;
|
||||
istat = cstat = (unsigned int) gotofn[0]['\n'];
|
||||
if (out[cstat])
|
||||
goto found;
|
||||
goto found;
|
||||
for (;;) {
|
||||
if (!iflag) {
|
||||
/* all input chars made positive */
|
||||
cstat = (unsigned int) gotofn[cstat][(unsigned char)*p];
|
||||
} else {
|
||||
/* for -i option*/
|
||||
cstat = (unsigned int) gotofn[cstat][tolower((unsigned char)*p)];
|
||||
if (!iflag) {
|
||||
/* all input chars made positive */
|
||||
cstat = (unsigned int) gotofn[cstat][(unsigned char)*p];
|
||||
} else {
|
||||
/* for -i option*/
|
||||
cstat = (unsigned int) gotofn[cstat][tolower((unsigned char)*p)];
|
||||
}
|
||||
if (out[cstat]) {
|
||||
found:
|
||||
for(;;) {
|
||||
if (*p++ == '\n') {
|
||||
in_line = 0;
|
||||
succeed:
|
||||
fprintf(output, format, file, lnum);
|
||||
if (p <= nlp) {
|
||||
while (nlp < buf_end)
|
||||
putc(*nlp++, output);
|
||||
nlp = buf;
|
||||
}
|
||||
while (nlp < p)
|
||||
putc(*nlp++, output);
|
||||
lnum++;
|
||||
nlp = p;
|
||||
if (out[cstat = istat] == 0)
|
||||
goto brk2;
|
||||
} /* if (p++ == \n) */
|
||||
cfound:
|
||||
if (--ccount <= 0) {
|
||||
ccount = read_next_chunk(&p, fptr);
|
||||
if (ccount <= 0) {
|
||||
if (in_line) {
|
||||
in_line = 0;
|
||||
goto succeed;
|
||||
}
|
||||
if (out[cstat]) {
|
||||
found:
|
||||
for(;;) {
|
||||
if (*p++ == '\n') {
|
||||
in_line = 0;
|
||||
succeed:
|
||||
fprintf(output, format, file, lnum);
|
||||
if (p <= nlp) {
|
||||
while (nlp < buf_end)
|
||||
putc(*nlp++, output);
|
||||
nlp = buf;
|
||||
}
|
||||
while (nlp < p)
|
||||
putc(*nlp++, output);
|
||||
lnum++;
|
||||
nlp = p;
|
||||
if (out[cstat = istat] == 0)
|
||||
goto brk2;
|
||||
} /* if (p++ == \n) */
|
||||
cfound:
|
||||
if (--ccount <= 0) {
|
||||
ccount = read_next_chunk(&p, fptr);
|
||||
if (ccount <= 0) {
|
||||
if (in_line) {
|
||||
in_line = 0;
|
||||
goto succeed;
|
||||
}
|
||||
fclose(fptr);
|
||||
return(0);
|
||||
}
|
||||
} /* if(ccount <= 0) */
|
||||
in_line = 1;
|
||||
} /* for(ever) */
|
||||
} /* if(out[cstat]) */
|
||||
}
|
||||
} /* if(ccount <= 0) */
|
||||
in_line = 1;
|
||||
} /* for(ever) */
|
||||
} /* if(out[cstat]) */
|
||||
|
||||
if (*p++ == '\n') {
|
||||
in_line = 0;
|
||||
lnum++;
|
||||
nlp = p;
|
||||
if (out[(cstat=istat)])
|
||||
goto cfound;
|
||||
}
|
||||
if (*p++ == '\n') {
|
||||
in_line = 0;
|
||||
lnum++;
|
||||
nlp = p;
|
||||
if (out[(cstat=istat)])
|
||||
goto cfound;
|
||||
}
|
||||
brk2:
|
||||
if (--ccount <= 0) {
|
||||
ccount = read_next_chunk(&p, fptr);
|
||||
if (ccount <= 0)
|
||||
break;
|
||||
}
|
||||
in_line = 1;
|
||||
if (--ccount <= 0) {
|
||||
ccount = read_next_chunk(&p, fptr);
|
||||
if (ccount <= 0)
|
||||
break;
|
||||
}
|
||||
in_line = 1;
|
||||
}
|
||||
fclose(fptr);
|
||||
return(0);
|
||||
@ -2049,5 +2049,5 @@ egrep(char *file, FILE *output, char *format)
|
||||
void
|
||||
egrepcaseless(int i)
|
||||
{
|
||||
iflag = i; /* simulate "egrep -i" */
|
||||
iflag = i; /* simulate "egrep -i" */
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||
/* DO falseT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
|
||||
especially those whose name start with YY_ or yy_. They are
|
||||
private implementation details that can be changed or removed. */
|
||||
|
||||
|
@ -18,11 +18,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -125,7 +125,7 @@ myexecvp(char *a, char **args)
|
||||
perror(msg); /* display the reason */
|
||||
askforreturn(); /* wait until the user sees the message */
|
||||
myexit(1); /* exit the child */
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
166
src/find.c
166
src/find.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -68,17 +68,17 @@ static long lastfcnoffset; /* last function name offset */
|
||||
static POSTING *postingp; /* retrieved posting set pointer */
|
||||
static long postingsfound; /* retrieved number of postings */
|
||||
static regex_t regexp; /* regular expression */
|
||||
static BOOL isregexp_valid = NO; /* regular expression status */
|
||||
static bool isregexp_valid = false; /* regular expression status */
|
||||
|
||||
static BOOL match(void);
|
||||
static BOOL matchrest(void);
|
||||
static bool match(void);
|
||||
static bool matchrest(void);
|
||||
static POSTING *getposting(void);
|
||||
static char *lcasify(char *s);
|
||||
static void findcalledbysub(char *file, BOOL macro);
|
||||
static void findcalledbysub(char *file, bool macro);
|
||||
static void findterm(char *pattern);
|
||||
static void putline(FILE *output);
|
||||
static char *find_symbol_or_assignment(char *pattern, BOOL assign_flag);
|
||||
static BOOL check_for_assignment(void);
|
||||
static char *find_symbol_or_assignment(char *pattern, bool assign_flag);
|
||||
static bool check_for_assignment(void);
|
||||
static void putpostingref(POSTING *p, char *pat);
|
||||
static void putref(int seemore, char *file, char *func);
|
||||
static void putsource(int seemore, FILE *output);
|
||||
@ -88,19 +88,19 @@ static void putsource(int seemore, FILE *output);
|
||||
char *
|
||||
findsymbol(char *pattern)
|
||||
{
|
||||
return find_symbol_or_assignment(pattern, NO);
|
||||
return find_symbol_or_assignment(pattern, false);
|
||||
}
|
||||
|
||||
/* find the symbol in the cross-reference, and look for assignments */
|
||||
char *
|
||||
findassign(char *pattern)
|
||||
{
|
||||
return find_symbol_or_assignment(pattern, YES);
|
||||
return find_symbol_or_assignment(pattern, true);
|
||||
}
|
||||
|
||||
/* Test reference whether it's an assignment to the symbol found at
|
||||
* (global variable) 'blockp' */
|
||||
static BOOL
|
||||
static bool
|
||||
check_for_assignment(void)
|
||||
{
|
||||
/* Do the extra work here to determine if this is an
|
||||
@ -115,18 +115,18 @@ check_for_assignment(void)
|
||||
/* get the next block when we reach the end of
|
||||
* the current block */
|
||||
if (NULL == (asgn_char = read_block()))
|
||||
return NO;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/* check for digraph starting with = */
|
||||
if ((asgn_char[0] & 0x80) && (dichar1[(asgn_char[0] & 0177)/8] == '=')) {
|
||||
return YES;
|
||||
return true;
|
||||
}
|
||||
/* check for plain '=', not '==' */
|
||||
if ((asgn_char[0] == '=') &&
|
||||
(((asgn_char[1] != '=') && !(asgn_char[1] & 0x80)) ||
|
||||
((asgn_char[1] & 0x80) && (dichar1[(asgn_char[1]& 0177)/8] != '=')))) {
|
||||
return YES;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* check for operator assignments: +=, ... ^= ? */
|
||||
@ -142,7 +142,7 @@ check_for_assignment(void)
|
||||
&& ((asgn_char[1] == '=') || ((asgn_char[1] & 0x80) && (dichar1[(asgn_char[1] &0177)/8] == '=')))
|
||||
|
||||
) {
|
||||
return YES;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* check for two-letter operator assignments: <<= or >>= ? */
|
||||
@ -152,14 +152,14 @@ check_for_assignment(void)
|
||||
&& (asgn_char[1] == asgn_char[0])
|
||||
&& ((asgn_char[2] == '=') || ((asgn_char[2] & 0x80) && (dichar1[(asgn_char[2] & 0177)/8] == '=')))
|
||||
)
|
||||
return YES;
|
||||
return NO;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* The actual routine that does the work for findsymbol() and
|
||||
* findassign() */
|
||||
static char *
|
||||
find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
find_symbol_or_assignment(char *pattern, bool assign_flag)
|
||||
{
|
||||
char file[PATHLEN + 1]; /* source file name */
|
||||
char function[PATLEN + 1]; /* function name */
|
||||
@ -169,9 +169,9 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
char *s;
|
||||
size_t s_len = 0;
|
||||
char firstchar; /* first character of a potential symbol */
|
||||
BOOL fcndef = NO;
|
||||
bool fcndef = false;
|
||||
|
||||
if ((invertedindex == YES) && (assign_flag == NO)) {
|
||||
if ((invertedindex == true) && (assign_flag == false)) {
|
||||
long lastline = 0;
|
||||
POSTING *p;
|
||||
|
||||
@ -233,7 +233,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
goto notmatched; /* don't match name */
|
||||
|
||||
case FCNDEF: /* function name */
|
||||
fcndef = YES;
|
||||
fcndef = true;
|
||||
s = function;
|
||||
s_len = sizeof(function);
|
||||
break;
|
||||
@ -264,8 +264,8 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
fetch_string_from_dbase(s, s_len);
|
||||
|
||||
/* see if this is a regular expression pattern */
|
||||
if (isregexp_valid == YES) {
|
||||
if (caseless == YES) {
|
||||
if (isregexp_valid == true) {
|
||||
if (caseless == true) {
|
||||
s = lcasify(s);
|
||||
}
|
||||
if (*s != '\0' && regexec (®exp, s, (size_t)0, NULL, 0) == 0) {
|
||||
@ -279,7 +279,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
goto notmatched;
|
||||
}
|
||||
/* if this is a regular expression pattern */
|
||||
if (isregexp_valid == YES) {
|
||||
if (isregexp_valid == true) {
|
||||
|
||||
/* if this is a symbol */
|
||||
|
||||
@ -300,7 +300,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
if (isalpha((unsigned char)firstchar) || firstchar == '_') {
|
||||
blockp = cp;
|
||||
fetch_string_from_dbase(symbol, sizeof(symbol));
|
||||
if (caseless == YES) {
|
||||
if (caseless == true) {
|
||||
s = lcasify(symbol); /* point to lower case version */
|
||||
}
|
||||
else {
|
||||
@ -325,7 +325,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
/* if the assignment flag is set then
|
||||
* we are looking for assignments and
|
||||
* some extra filtering is needed */
|
||||
if(assign_flag == YES
|
||||
if(assign_flag == true
|
||||
&& ! check_for_assignment())
|
||||
goto notmatched;
|
||||
|
||||
@ -334,8 +334,8 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
if (strcmp(macro, global) && s != macro) {
|
||||
putref(0, file, macro);
|
||||
}
|
||||
else if (fcndef == YES || s != function) {
|
||||
fcndef = NO;
|
||||
else if (fcndef == true || s != function) {
|
||||
fcndef = false;
|
||||
putref(0, file, function);
|
||||
}
|
||||
else {
|
||||
@ -346,7 +346,7 @@ find_symbol_or_assignment(char *pattern, BOOL assign_flag)
|
||||
if (blockp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
fcndef = NO;
|
||||
fcndef = false;
|
||||
cp = blockp;
|
||||
}
|
||||
}
|
||||
@ -361,7 +361,7 @@ finddef(char *pattern)
|
||||
{
|
||||
char file[PATHLEN + 1]; /* source file name */
|
||||
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
POSTING *p;
|
||||
|
||||
findterm(pattern);
|
||||
@ -469,7 +469,7 @@ findcalling(char *pattern)
|
||||
char *tmpblockp;
|
||||
int morefuns, i;
|
||||
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
POSTING *p;
|
||||
|
||||
findterm(pattern);
|
||||
@ -607,7 +607,7 @@ findfile(char *dummy)
|
||||
for (i = 0; i < nsrcfiles; ++i) {
|
||||
char *s;
|
||||
|
||||
if (caseless == YES) {
|
||||
if (caseless == true) {
|
||||
s = lcasify(srcfiles[i]);
|
||||
} else {
|
||||
s = srcfiles[i];
|
||||
@ -628,7 +628,7 @@ findinclude(char *pattern)
|
||||
{
|
||||
char file[PATHLEN + 1]; /* source file name */
|
||||
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
POSTING *p;
|
||||
|
||||
findterm(pattern);
|
||||
@ -673,16 +673,16 @@ FINDINIT
|
||||
findinit(char *pattern)
|
||||
{
|
||||
char buf[PATLEN + 3];
|
||||
BOOL isregexp = NO;
|
||||
bool isregexp = false;
|
||||
int i;
|
||||
char *s;
|
||||
unsigned char c; /* HBB 20010427: changed uint to uchar */
|
||||
|
||||
/* HBB: be nice: free regexp before allocating a new one */
|
||||
if(isregexp_valid == YES)
|
||||
if(isregexp_valid == true)
|
||||
regfree(®exp);
|
||||
|
||||
isregexp_valid = NO;
|
||||
isregexp_valid = false;
|
||||
|
||||
/* remove trailing white space */
|
||||
for (s = pattern + strlen(pattern) - 1;
|
||||
@ -694,7 +694,7 @@ findinit(char *pattern)
|
||||
/* HBB 20020620: new: make sure pattern is lowercased. Curses
|
||||
* mode gets this right all on its own, but at least -L mode
|
||||
* doesn't */
|
||||
if (caseless == YES) {
|
||||
if (caseless == true) {
|
||||
pattern = lcasify(pattern);
|
||||
}
|
||||
|
||||
@ -703,35 +703,35 @@ findinit(char *pattern)
|
||||
if (regcomp (®exp, pattern, REG_EXTENDED | REG_NOSUB) != 0) {
|
||||
return(REGCMPERROR);
|
||||
} else {
|
||||
isregexp_valid = YES;
|
||||
isregexp_valid = true;
|
||||
}
|
||||
return(NOERROR);
|
||||
return(falseERROR);
|
||||
}
|
||||
/* see if the pattern is a regular expression */
|
||||
if (strpbrk(pattern, "^.[{*+$|(") != NULL) {
|
||||
isregexp = YES;
|
||||
isregexp = true;
|
||||
} else {
|
||||
/* check for a valid C symbol */
|
||||
s = pattern;
|
||||
if (!isalpha((unsigned char)*s) && *s != '_') {
|
||||
return(NOTSYMBOL);
|
||||
return(falseTSYMBOL);
|
||||
}
|
||||
while (*++s != '\0') {
|
||||
if (!isalnum((unsigned char)*s) && *s != '_') {
|
||||
return(NOTSYMBOL);
|
||||
return(falseTSYMBOL);
|
||||
}
|
||||
}
|
||||
/* look for use of the -T option (truncate symbol to 8
|
||||
characters) on a database not built with -T */
|
||||
if (trun_syms == YES && isuptodate == YES &&
|
||||
dbtruncated == NO && s - pattern >= 8) {
|
||||
if (trun_syms == true && isuptodate == true &&
|
||||
dbtruncated == false && s - pattern >= 8) {
|
||||
(void) strcpy(pattern + 8, ".*");
|
||||
isregexp = YES;
|
||||
isregexp = true;
|
||||
}
|
||||
}
|
||||
/* if this is a regular expression or letter case is to be ignored */
|
||||
/* or there is an inverted index */
|
||||
if (isregexp == YES || caseless == YES || invertedindex == YES) {
|
||||
if (isregexp == true || caseless == true || invertedindex == true) {
|
||||
|
||||
/* remove a leading ^ */
|
||||
s = pattern;
|
||||
@ -748,7 +748,7 @@ findinit(char *pattern)
|
||||
s[i] = '\0';
|
||||
}
|
||||
/* if requested, try to truncate a C symbol pattern */
|
||||
if (trun_syms == YES && strpbrk(s, "[{*+") == NULL) {
|
||||
if (trun_syms == true && strpbrk(s, "[{*+") == NULL) {
|
||||
s[8] = '\0';
|
||||
}
|
||||
/* must be an exact match */
|
||||
@ -760,12 +760,12 @@ findinit(char *pattern)
|
||||
}
|
||||
else
|
||||
{
|
||||
isregexp_valid = YES;
|
||||
isregexp_valid = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* if requested, truncate a C symbol pattern */
|
||||
if (trun_syms == YES && field <= CALLING) {
|
||||
if (trun_syms == true && field <= CALLING) {
|
||||
pattern[8] = '\0';
|
||||
}
|
||||
/* compress the string pattern for matching */
|
||||
@ -779,7 +779,7 @@ findinit(char *pattern)
|
||||
}
|
||||
*s = '\0';
|
||||
}
|
||||
return(NOERROR);
|
||||
return(falseERROR);
|
||||
}
|
||||
|
||||
void
|
||||
@ -790,31 +790,31 @@ findcleanup(void)
|
||||
|
||||
/* match the pattern to the string */
|
||||
|
||||
static BOOL
|
||||
static bool
|
||||
match(void)
|
||||
{
|
||||
char string[PATLEN + 1];
|
||||
|
||||
/* see if this is a regular expression pattern */
|
||||
if (isregexp_valid == YES) {
|
||||
if (isregexp_valid == true) {
|
||||
fetch_string_from_dbase(string, sizeof(string));
|
||||
if (*string == '\0') {
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
if (caseless == YES) {
|
||||
return (regexec (®exp, lcasify(string), (size_t)0, NULL, 0) ? NO : YES);
|
||||
if (caseless == true) {
|
||||
return (regexec (®exp, lcasify(string), (size_t)0, NULL, 0) ? false : true);
|
||||
}
|
||||
else {
|
||||
return (regexec (®exp, string, (size_t)0, NULL, 0) ? NO : YES);
|
||||
return (regexec (®exp, string, (size_t)0, NULL, 0) ? false : true);
|
||||
}
|
||||
}
|
||||
/* it is a string pattern */
|
||||
return((BOOL) (*blockp == cpattern[0] && matchrest()));
|
||||
return((bool) (*blockp == cpattern[0] && matchrest()));
|
||||
}
|
||||
|
||||
/* match the rest of the pattern to the name */
|
||||
|
||||
static BOOL
|
||||
static bool
|
||||
matchrest(void)
|
||||
{
|
||||
int i = 1;
|
||||
@ -828,9 +828,9 @@ matchrest(void)
|
||||
} while (*(blockp + 1) == '\0' && read_block() != NULL);
|
||||
|
||||
if (*blockp == '\n' && cpattern[i] == '\0') {
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
|
||||
/* put the reference into the file */
|
||||
@ -857,7 +857,7 @@ putsource(int seemore, FILE *output)
|
||||
{
|
||||
char *tmpblockp;
|
||||
char *cp, nextc = '\0';
|
||||
BOOL Change = NO, retreat = NO;
|
||||
bool Change = false, retreat = false;
|
||||
|
||||
if (fileversion <= 5) {
|
||||
(void) scanpast(' ');
|
||||
@ -870,7 +870,7 @@ putsource(int seemore, FILE *output)
|
||||
while (*cp != '\n' || nextc != '\n') {
|
||||
nextc = *cp;
|
||||
if (--cp < block) {
|
||||
retreat = YES;
|
||||
retreat = true;
|
||||
/* read the previous block */
|
||||
(void) dbseek((blocknumber - 1) * BUFSIZ);
|
||||
cp = block + (BUFSIZ - 1);
|
||||
@ -880,19 +880,19 @@ putsource(int seemore, FILE *output)
|
||||
if (*blockp != '\n' || getrefchar() != '\n' ||
|
||||
(!isdigit(getrefchar()) && fileversion >= 12)) {
|
||||
postfatal("Internal error: cannot get source line from database");
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* until a double newline is found */
|
||||
do {
|
||||
/* skip a symbol type */
|
||||
if (*blockp == '\t') {
|
||||
/* if retreat == YES, that means tmpblockp and blockp
|
||||
/* if retreat == true, that means tmpblockp and blockp
|
||||
* point to different blocks. Offset comparison should
|
||||
* NOT be performed until they point to the same block.
|
||||
* falseT be performed until they point to the same block.
|
||||
*/
|
||||
if (seemore && Change == NO && retreat == NO &&
|
||||
if (seemore && Change == false && retreat == false &&
|
||||
blockp > tmpblockp) {
|
||||
Change = YES;
|
||||
Change = true;
|
||||
cp = blockp;
|
||||
}
|
||||
skiprefchar();
|
||||
@ -900,10 +900,10 @@ putsource(int seemore, FILE *output)
|
||||
}
|
||||
/* output a piece of the source line */
|
||||
putline(output);
|
||||
if (retreat == YES) retreat = NO;
|
||||
if (retreat == true) retreat = false;
|
||||
} while (blockp != NULL && getrefchar() != '\n');
|
||||
(void) putc('\n', output);
|
||||
if (Change == YES) blockp = cp;
|
||||
if (Change == true) blockp = cp;
|
||||
}
|
||||
|
||||
/* put the rest of the cross-reference line into the file */
|
||||
@ -1038,16 +1038,16 @@ lcasify(char *s)
|
||||
/* HBB 2000/05/05: for consitency of calling interface between the
|
||||
* different 'find...()' functions, this now returns a char pointer,
|
||||
* too. Implemented as a pointer to static storage containing 'y' or
|
||||
* 'n', for the boolean result values YES and NO */
|
||||
* 'n', for the boolean result values true and false */
|
||||
|
||||
char *
|
||||
findcalledby(char *pattern)
|
||||
{
|
||||
char file[PATHLEN + 1]; /* source file name */
|
||||
static char found_caller = 'n'; /* seen calling function? */
|
||||
BOOL macro = NO;
|
||||
bool macro = false;
|
||||
|
||||
if (invertedindex == YES) {
|
||||
if (invertedindex == true) {
|
||||
POSTING *p;
|
||||
|
||||
findterm(pattern);
|
||||
@ -1081,7 +1081,7 @@ findcalledby(char *pattern)
|
||||
if (fileversion < 10) {
|
||||
break;
|
||||
}
|
||||
macro = YES;
|
||||
macro = true;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case FCNDEF:
|
||||
@ -1117,7 +1117,7 @@ findterm(char *pattern)
|
||||
*s = '\0';
|
||||
}
|
||||
/* if letter case is to be ignored */
|
||||
if (caseless == YES) {
|
||||
if (caseless == true) {
|
||||
|
||||
/* convert the prefix to upper case because it is lexically
|
||||
less than lower case */
|
||||
@ -1129,7 +1129,7 @@ findterm(char *pattern)
|
||||
}
|
||||
/* find the term lexically >= the prefix */
|
||||
(void) invfind(&invcontrol, prefix);
|
||||
if (caseless == YES) { /* restore lower case */
|
||||
if (caseless == true) { /* restore lower case */
|
||||
(void) strcpy(prefix, lcasify(prefix));
|
||||
}
|
||||
/* a null prefix matches the null term in the inverted index,
|
||||
@ -1141,14 +1141,14 @@ findterm(char *pattern)
|
||||
do {
|
||||
(void) invterm(&invcontrol, term); /* get the term */
|
||||
s = term;
|
||||
if (caseless == YES) {
|
||||
if (caseless == true) {
|
||||
s = lcasify(s); /* make it lower case */
|
||||
}
|
||||
/* if it matches */
|
||||
if (regexec (®exp, s, (size_t)0, NULL, 0) == 0) {
|
||||
|
||||
/* add its postings to the set */
|
||||
if ((postingp = boolfile(&invcontrol, &npostings, BOOL_OR)) == NULL) {
|
||||
if ((postingp = boolfile(&invcontrol, &npostings, bool_OR)) == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1157,7 +1157,7 @@ findterm(char *pattern)
|
||||
|
||||
/* if ignoring letter case and the term is out of the
|
||||
range of possible matches */
|
||||
if (caseless == YES) {
|
||||
if (caseless == true) {
|
||||
if (strncmp(term, prefix, len) > 0) {
|
||||
break; /* stop searching */
|
||||
}
|
||||
@ -1250,7 +1250,7 @@ dbseek(long offset)
|
||||
}
|
||||
|
||||
static void
|
||||
findcalledbysub(char *file, BOOL macro)
|
||||
findcalledbysub(char *file, bool macro)
|
||||
{
|
||||
/* find the next function call or the end of this function */
|
||||
while (scanpast('\t') != NULL) {
|
||||
@ -1280,8 +1280,8 @@ findcalledbysub(char *file, BOOL macro)
|
||||
|
||||
case DEFINEEND: /* #define end */
|
||||
|
||||
if (invertedindex == NO) {
|
||||
if (macro == YES) {
|
||||
if (invertedindex == false) {
|
||||
if (macro == true) {
|
||||
return;
|
||||
}
|
||||
break; /* inside a function */
|
||||
@ -1290,7 +1290,7 @@ findcalledbysub(char *file, BOOL macro)
|
||||
|
||||
case FCNDEF: /* function end (pre 9.5) */
|
||||
|
||||
if (invertedindex == NO) break;
|
||||
if (invertedindex == false) break;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case FCNEND: /* function end */
|
||||
|
314
src/fscanner.l
314
src/fscanner.l
@ -18,11 +18,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -50,7 +50,7 @@
|
||||
#endif
|
||||
|
||||
#define IFLEVELINC 5 /* #if nesting level size increment */
|
||||
#define YY_NO_TOP_STATE 1
|
||||
#define YY_false_TOP_STATE 1
|
||||
|
||||
int first; /* buffer index for first char of symbol */
|
||||
int last; /* buffer index for last char of symbol */
|
||||
@ -63,32 +63,32 @@ int myylineno = 1;
|
||||
size_t my_yyleng = 0;
|
||||
char *my_yytext = NULL;
|
||||
|
||||
static BOOL arraydimension; /* inside array dimension declaration */
|
||||
static BOOL bplisting; /* breakpoint listing */
|
||||
static bool arraydimension; /* inside array dimension declaration */
|
||||
static bool bplisting; /* breakpoint listing */
|
||||
static int braces; /* unmatched left brace count */
|
||||
static BOOL classdef; /* c++ class definition */
|
||||
static BOOL elseelif; /* #else or #elif found */
|
||||
static BOOL esudef; /* enum/struct/union global definition */
|
||||
static BOOL external; /* external definition */
|
||||
static bool classdef; /* c++ class definition */
|
||||
static bool elseelif; /* #else or #elif found */
|
||||
static bool esudef; /* enum/struct/union global definition */
|
||||
static bool external; /* external definition */
|
||||
static int externalbraces; /* external definition outer brace count */
|
||||
static BOOL fcndef; /* function definition */
|
||||
static BOOL global; /* file global scope (outside functions) */
|
||||
static bool fcndef; /* function definition */
|
||||
static bool global; /* file global scope (outside functions) */
|
||||
static size_t iflevel; /* #if nesting level */
|
||||
static BOOL initializer; /* data initializer */
|
||||
static bool initializer; /* data initializer */
|
||||
static int initializerbraces; /* data initializer outer brace count */
|
||||
static BOOL lex; /* lex file */
|
||||
static bool lex; /* lex file */
|
||||
static size_t miflevel = IFLEVELINC; /* maximum #if nesting level */
|
||||
static int *maxifbraces; /* maximum brace count within #if */
|
||||
static int *preifbraces; /* brace count before #if */
|
||||
static int parens; /* unmatched left parenthesis count */
|
||||
static BOOL ppdefine; /* preprocessor define statement */
|
||||
static BOOL pseudoelif; /* pseudo-#elif */
|
||||
static BOOL oldtype; /* next identifier is an old type */
|
||||
static BOOL rules; /* lex/yacc rules */
|
||||
static BOOL sdl; /* sdl file */
|
||||
static BOOL structfield; /* structure field declaration */
|
||||
static bool ppdefine; /* preprocessor define statement */
|
||||
static bool pseudoelif; /* pseudo-#elif */
|
||||
static bool oldtype; /* next identifier is an old type */
|
||||
static bool rules; /* lex/yacc rules */
|
||||
static bool sdl; /* sdl file */
|
||||
static bool structfield; /* structure field declaration */
|
||||
static int tagdef; /* class/enum/struct/union tag definition */
|
||||
static BOOL template; /* function template */
|
||||
static bool template; /* function template */
|
||||
static int templateparens; /* function template outer parentheses count */
|
||||
static int typedefbraces = -1; /* initial typedef brace count */
|
||||
static int token; /* token found */
|
||||
@ -117,20 +117,20 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
%%
|
||||
|
||||
%\{ { /* lex/yacc C declarations/definitions */
|
||||
global = YES;
|
||||
global = true;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
%\} {
|
||||
global = NO;
|
||||
global = false;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
^%% { /* lex/yacc rules delimiter */
|
||||
braces = 0;
|
||||
if (rules == NO) {
|
||||
if (rules == false) {
|
||||
/* this %% starts the section containing the rules */
|
||||
rules = YES;
|
||||
rules = true;
|
||||
|
||||
/* Copy yytext to private buffer, to be able to add further
|
||||
* content following it: */
|
||||
@ -139,7 +139,7 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
/* simulate a yylex() or yyparse() definition */
|
||||
(void) strcat(my_yytext, " /* ");
|
||||
first = strlen(my_yytext);
|
||||
if (lex == YES) {
|
||||
if (lex == true) {
|
||||
(void) strcat(my_yytext, "yylex");
|
||||
} else {
|
||||
/* yacc: yyparse implicitly calls yylex */
|
||||
@ -156,25 +156,25 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
return(FCNDEF);
|
||||
} else {
|
||||
/* were in the rules section, now comes the closing one */
|
||||
rules = NO;
|
||||
global = YES;
|
||||
rules = false;
|
||||
global = true;
|
||||
last = first;
|
||||
my_yymore();
|
||||
return(FCNEND);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
<SDL>STATE[ \t]+({identifier}|\*) { /* sdl state, treat as function def */
|
||||
braces = 1;
|
||||
fcndef = YES;
|
||||
fcndef = true;
|
||||
token = FCNDEF;
|
||||
goto findident;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<SDL>ENDSTATE[ \t] { /* end of an sdl state, treat as end of a function */
|
||||
goto endstate;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
\{ { /* count unmatched left braces for fcn def detection */
|
||||
@ -184,7 +184,7 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
can be found */
|
||||
if (tagdef) {
|
||||
if (braces == 1) {
|
||||
esudef = YES;
|
||||
esudef = true;
|
||||
}
|
||||
token = tagdef;
|
||||
tagdef = '\0';
|
||||
@ -193,15 +193,15 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
return(token);
|
||||
}
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
\#{ws}* { /* start a preprocessor line */
|
||||
if (rules == NO) /* don't consider CPP for lex/yacc rules */
|
||||
if (rules == false) /* don't consider CPP for lex/yacc rules */
|
||||
BEGIN(IN_PREPROC);
|
||||
yyleng = 1; /* get rid of the blanks, if any */
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_PREPROC>endif([^a-zA-Z0-9_$\n].*)? { /* #endif */
|
||||
/* delay treatment of #endif depending on whether an
|
||||
@ -210,7 +210,7 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
* after the #endif */
|
||||
BEGIN(WAS_ENDIF);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<WAS_ENDIF>\n{wsnl}*#{ws}*if(ndef|def)?{ws}+ {
|
||||
/* attempt to correct erroneous brace count caused by:
|
||||
@ -223,16 +223,16 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
* #endif
|
||||
*/
|
||||
/* the current #if must not have an #else or #elif */
|
||||
if (elseelif == YES) {
|
||||
if (elseelif == true) {
|
||||
goto endif;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
pseudoelif = YES;
|
||||
pseudoelif = true;
|
||||
BEGIN(INITIAL);
|
||||
yyless(1); /* rescan all but the line ending */
|
||||
yy_set_bol(1);
|
||||
goto eol;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<WAS_ENDIF>\n{wsnl}* { /* an #endif with no #if right after it */
|
||||
endif:
|
||||
@ -246,17 +246,17 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
yyless(1);
|
||||
yy_set_bol(1);
|
||||
goto eol;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
<IN_PREPROC>ifndef{ws}+ |
|
||||
<IN_PREPROC>ifdef{ws}+ |
|
||||
<IN_PREPROC>if{ws}+ { /* #if directive */
|
||||
elseelif = NO;
|
||||
if (pseudoelif == YES) {
|
||||
pseudoelif = NO;
|
||||
elseelif = false;
|
||||
if (pseudoelif == true) {
|
||||
pseudoelif = false;
|
||||
goto elif;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* make sure there is room for the current brace count */
|
||||
if (iflevel == miflevel) {
|
||||
@ -269,10 +269,10 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
maxifbraces[iflevel++] = 0;
|
||||
BEGIN(INITIAL);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_PREPROC>else({ws}.*)? { /* #else --- eat up whole line */
|
||||
elseelif = YES;
|
||||
elseelif = true;
|
||||
if (iflevel > 0) {
|
||||
|
||||
/* save the maximum brace count for this #if */
|
||||
@ -284,10 +284,10 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
}
|
||||
BEGIN(INITIAL);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_PREPROC>elif{ws}+ { /* #elif */
|
||||
/* elseelif = YES; --- HBB I doubt this is correct */
|
||||
/* elseelif = true; --- HBB I doubt this is correct */
|
||||
elif:
|
||||
if (iflevel > 0) {
|
||||
|
||||
@ -300,7 +300,7 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
}
|
||||
BEGIN(INITIAL);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
<IN_PREPROC>include{ws}*\"[^"\n]+\" |
|
||||
@ -317,47 +317,47 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
my_yytext[my_yyleng-1] = remember;
|
||||
first = s - my_yytext;
|
||||
last = my_yyleng - 1;
|
||||
if (compress == YES) {
|
||||
if (compress == true) {
|
||||
my_yytext[0] = '\2'; /* compress the keyword */
|
||||
}
|
||||
BEGIN(INITIAL);
|
||||
return(INCLUDE);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
\} {
|
||||
/* could be the last enum member initializer */
|
||||
if (braces == initializerbraces) {
|
||||
initializerbraces = -1;
|
||||
initializer = NO;
|
||||
initializer = false;
|
||||
}
|
||||
if (--braces <= 0) {
|
||||
endstate:
|
||||
braces = 0;
|
||||
classdef = NO;
|
||||
classdef = false;
|
||||
}
|
||||
if (braces == 0 || (braces == 1 && classdef == YES)) {
|
||||
if (braces == 0 || (braces == 1 && classdef == true)) {
|
||||
|
||||
/* if the end of an enum/struct/union definition */
|
||||
if (esudef == YES) {
|
||||
esudef = NO;
|
||||
if (esudef == true) {
|
||||
esudef = false;
|
||||
}
|
||||
/* if the end of the function */
|
||||
else if (fcndef == YES) {
|
||||
fcndef = NO;
|
||||
else if (fcndef == true) {
|
||||
fcndef = false;
|
||||
last = first;
|
||||
my_yymore();
|
||||
return(FCNEND);
|
||||
}
|
||||
}
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
\( { /* count unmatched left parentheses for function templates */
|
||||
++parens;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\) {
|
||||
if (--parens <= 0) {
|
||||
@ -366,42 +366,42 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
/* if the end of a function template */
|
||||
if (parens == templateparens) {
|
||||
templateparens = -1;
|
||||
template = NO;
|
||||
template = false;
|
||||
}
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
= { /* if a global definition initializer */
|
||||
if (!my_yytext)
|
||||
return(LEXERR);
|
||||
if (global == YES && ppdefine == NO && my_yytext[0] != '#') {
|
||||
if (global == true && ppdefine == false && my_yytext[0] != '#') {
|
||||
initializerbraces = braces;
|
||||
initializer = YES;
|
||||
initializer = true;
|
||||
}
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
: { /* a if global structure field */
|
||||
if (!my_yytext)
|
||||
return(LEXERR);
|
||||
if (global == YES && ppdefine == NO && my_yytext[0] != '#') {
|
||||
structfield = YES;
|
||||
if (global == true && ppdefine == false && my_yytext[0] != '#') {
|
||||
structfield = true;
|
||||
}
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\, {
|
||||
if (braces == initializerbraces) {
|
||||
initializerbraces = -1;
|
||||
initializer = NO;
|
||||
initializer = false;
|
||||
}
|
||||
structfield = NO;
|
||||
structfield = false;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
; { /* if the enum/struct/union was not a definition */
|
||||
if (braces == 0) {
|
||||
esudef = NO;
|
||||
esudef = false;
|
||||
}
|
||||
/* if the end of a typedef */
|
||||
if (braces == typedefbraces) {
|
||||
@ -410,24 +410,24 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
/* if the end of a external definition */
|
||||
if (braces == externalbraces) {
|
||||
externalbraces = -1;
|
||||
external = NO;
|
||||
external = false;
|
||||
}
|
||||
structfield = NO;
|
||||
initializer = NO;
|
||||
structfield = false;
|
||||
initializer = false;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_PREPROC>define{ws}+{identifier} {
|
||||
|
||||
/* preprocessor macro or constant definition */
|
||||
ppdefine = YES;
|
||||
ppdefine = true;
|
||||
token = DEFINE;
|
||||
if (compress == YES) {
|
||||
if (compress == true) {
|
||||
my_yytext[0] = '\1'; /* compress the keyword */
|
||||
}
|
||||
findident:
|
||||
/* search backwards through yytext[] to find the identifier */
|
||||
/* NOTE: this had better be left to flex, by use of
|
||||
/* falseTE: this had better be left to flex, by use of
|
||||
* yet another starting condition */
|
||||
my_yymore();
|
||||
first = my_yyleng - 1;
|
||||
@ -438,28 +438,28 @@ wsnl [ \t\r\v\f\n]|{comment}
|
||||
last = my_yyleng;
|
||||
BEGIN(INITIAL);
|
||||
goto definition;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_PREPROC>\n { /* unknown preprocessor line */
|
||||
BEGIN(INITIAL);
|
||||
++myylineno;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_PREPROC>. |
|
||||
<IN_PREPROC>{identifier} { /* unknown preprocessor line */
|
||||
BEGIN(INITIAL);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{ { /* class definition */
|
||||
classdef = YES;
|
||||
classdef = true;
|
||||
tagdef = 'c';
|
||||
yyless(5); /* eat up 'class', and re-scan */
|
||||
yy_set_bol(0);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
("enum"|"struct"|"union") {
|
||||
@ -477,7 +477,7 @@ class{wsnl}+{identifier}({wsnl}|{identifier}|[():])*\{ { /* class definition */
|
||||
tagdef = my_yytext[ident_start];
|
||||
BEGIN(INITIAL);
|
||||
if (braces == 0) {
|
||||
esudef = YES;
|
||||
esudef = true;
|
||||
}
|
||||
last = first;
|
||||
yyless(0); /* re-scan all this as normal text */
|
||||
@ -501,7 +501,7 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
BEGIN(WAS_IDENTIFIER);
|
||||
ident_start = first;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
<WAS_IDENTIFIER>{
|
||||
@ -517,41 +517,41 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
* reason for the parsing bug concerning function pointer usage,
|
||||
* I suspect. --- I think my new special-case rule for 'if'
|
||||
* could be helpful in removing that limitation */
|
||||
if ((braces == 0 && ppdefine == NO && my_yytext[0] != '#' && rules == NO) ||
|
||||
(braces == 1 && classdef == YES)) {
|
||||
fcndef = YES;
|
||||
if ((braces == 0 && ppdefine == false && my_yytext[0] != '#' && rules == false) ||
|
||||
(braces == 1 && classdef == true)) {
|
||||
fcndef = true;
|
||||
token = FCNDEF;
|
||||
goto fcn;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
goto fcncal;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
{ws}*\(([*&[\]=,.]|{identifier}|{number}|{wsnl})* { /* function call */
|
||||
fcncal: if (fcndef == YES || ppdefine == YES || rules == YES) {
|
||||
fcncal: if (fcndef == true || ppdefine == true || rules == true) {
|
||||
token = FCNCALL;
|
||||
goto fcn;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
if (template == NO) {
|
||||
if (template == false) {
|
||||
templateparens = parens;
|
||||
template = YES;
|
||||
template = true;
|
||||
}
|
||||
goto ident;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
("*"|{wsnl})+{identifier} { /* typedef name or modifier use */
|
||||
goto ident;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
.|\n { /* general identifer usage */
|
||||
char *s;
|
||||
|
||||
if (global == YES && ppdefine == NO && my_yytext[0] != '#' &&
|
||||
external == NO && initializer == NO &&
|
||||
arraydimension == NO && structfield == NO &&
|
||||
template == NO && fcndef == NO) {
|
||||
if (esudef == YES) {
|
||||
if (global == true && ppdefine == false && my_yytext[0] != '#' &&
|
||||
external == false && initializer == false &&
|
||||
arraydimension == false && structfield == false &&
|
||||
template == false && fcndef == false) {
|
||||
if (esudef == true) {
|
||||
/* if enum/struct/union */
|
||||
token = MEMBERDEF;
|
||||
} else {
|
||||
@ -607,7 +607,7 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
/* if the start of a typedef */
|
||||
if (s == typedeftext) {
|
||||
typedefbraces = braces;
|
||||
oldtype = YES;
|
||||
oldtype = true;
|
||||
}
|
||||
/* if an enum/struct/union */
|
||||
/* (needed for "typedef struct tag name;" so
|
||||
@ -617,16 +617,16 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
} else if (s == externtext) {
|
||||
/* if an external definition */
|
||||
externalbraces = braces;
|
||||
external = YES;
|
||||
} else if (templateparens == parens && template == YES) {
|
||||
external = true;
|
||||
} else if (templateparens == parens && template == true) {
|
||||
/* keyword doesn't start a function
|
||||
* template */
|
||||
templateparens = -1;
|
||||
template = NO;
|
||||
template = false;
|
||||
} else {
|
||||
/* identifier after typedef was a
|
||||
* keyword */
|
||||
oldtype = NO;
|
||||
oldtype = false;
|
||||
}
|
||||
} else {
|
||||
/* not a keyword --> found an identifier */
|
||||
@ -638,42 +638,42 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
token = tagdef;
|
||||
tagdef = '\0';
|
||||
if (braces == 0) {
|
||||
esudef = YES;
|
||||
esudef = true;
|
||||
}
|
||||
} else if (braces == typedefbraces && oldtype == NO &&
|
||||
arraydimension == NO) {
|
||||
} else if (braces == typedefbraces && oldtype == false &&
|
||||
arraydimension == false) {
|
||||
/* if a typedef name */
|
||||
token = TYPEDEF;
|
||||
} else {
|
||||
oldtype = NO;
|
||||
oldtype = false;
|
||||
}
|
||||
/* my_yymore(); */
|
||||
return(token);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\[ { /* array dimension (don't worry or about subscripts) */
|
||||
arraydimension = YES;
|
||||
arraydimension = true;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\] {
|
||||
arraydimension = NO;
|
||||
arraydimension = false;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\\\n { /* preprocessor statement is continued on next line */
|
||||
/* save the '\\' to the output file, but not the '\n': */
|
||||
yyleng = 1;
|
||||
my_yymore();
|
||||
goto eol;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\n { /* end of the line */
|
||||
if (ppdefine == YES) { /* end of a #define */
|
||||
ppdefine = NO;
|
||||
if (ppdefine == true) { /* end of a #define */
|
||||
ppdefine = false;
|
||||
yyless(yyleng - 1);
|
||||
last = first;
|
||||
my_yymore();
|
||||
@ -681,7 +681,7 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
}
|
||||
/* skip the first 8 columns of a breakpoint listing line */
|
||||
/* and skip the file path in the page header */
|
||||
if (bplisting == YES) {
|
||||
if (bplisting == true) {
|
||||
int c, i;
|
||||
|
||||
/* FIXME HBB 20001007: should call input() instead */
|
||||
@ -722,41 +722,41 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
}
|
||||
|
||||
\' { /* character constant */
|
||||
if (sdl == NO)
|
||||
if (sdl == false)
|
||||
BEGIN(IN_SQUOTE);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_SQUOTE>\' {
|
||||
BEGIN(INITIAL);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\" { /* string constant */
|
||||
BEGIN(IN_DQUOTE);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_DQUOTE>\" {
|
||||
BEGIN(INITIAL);
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
<IN_DQUOTE,IN_SQUOTE>{
|
||||
\n { /* syntax error: unexpected EOL */
|
||||
BEGIN(INITIAL);
|
||||
goto eol;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\\. |
|
||||
. {
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
\\\n { /* line continuation inside a string! */
|
||||
myylineno++;
|
||||
goto more;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
|
||||
@ -782,12 +782,12 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
"*"+[^*/\n]* ; /* do nothing */
|
||||
[^*\n]*\n |
|
||||
"*"+[^*/\n]*\n {
|
||||
if (ppdefine == NO) {
|
||||
if (ppdefine == false) {
|
||||
goto eol;
|
||||
} else {
|
||||
++myylineno;
|
||||
}
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
"*"+"/" {
|
||||
/* replace the comment by a single blank */
|
||||
@ -799,7 +799,7 @@ if{wsnl}*\( { /* ignore 'if' */
|
||||
"//".*\n? {
|
||||
/* C++-style one-line comment */
|
||||
goto eol;
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
{number} | /* number */
|
||||
@ -825,29 +825,29 @@ initscanner(char *srcfile)
|
||||
last = 0; /* buffer index for last char of symbol */
|
||||
lineno = 1; /* symbol line number */
|
||||
myylineno = 1; /* input line number */
|
||||
arraydimension = NO; /* inside array dimension declaration */
|
||||
bplisting = NO; /* breakpoint listing */
|
||||
arraydimension = false; /* inside array dimension declaration */
|
||||
bplisting = false; /* breakpoint listing */
|
||||
braces = 0; /* unmatched left brace count */
|
||||
classdef = NO; /* c++ class definition */
|
||||
elseelif = NO; /* #else or #elif found */
|
||||
esudef = NO; /* enum/struct/union global definition */
|
||||
external = NO; /* external definition */
|
||||
classdef = false; /* c++ class definition */
|
||||
elseelif = false; /* #else or #elif found */
|
||||
esudef = false; /* enum/struct/union global definition */
|
||||
external = false; /* external definition */
|
||||
externalbraces = -1; /* external definition outer brace count */
|
||||
fcndef = NO; /* function definition */
|
||||
global = YES; /* file global scope (outside functions) */
|
||||
fcndef = false; /* function definition */
|
||||
global = true; /* file global scope (outside functions) */
|
||||
iflevel = 0; /* #if nesting level */
|
||||
initializer = NO; /* data initializer */
|
||||
initializer = false; /* data initializer */
|
||||
initializerbraces = -1; /* data initializer outer brace count */
|
||||
lex = NO; /* lex file */
|
||||
lex = false; /* lex file */
|
||||
parens = 0; /* unmatched left parenthesis count */
|
||||
ppdefine = NO; /* preprocessor define statement */
|
||||
pseudoelif = NO; /* pseudo-#elif */
|
||||
oldtype = NO; /* next identifier is an old type */
|
||||
rules = NO; /* lex/yacc rules */
|
||||
sdl = NO; /* sdl file */
|
||||
structfield = NO; /* structure field declaration */
|
||||
ppdefine = false; /* preprocessor define statement */
|
||||
pseudoelif = false; /* pseudo-#elif */
|
||||
oldtype = false; /* next identifier is an old type */
|
||||
rules = false; /* lex/yacc rules */
|
||||
sdl = false; /* sdl file */
|
||||
structfield = false; /* structure field declaration */
|
||||
tagdef = '\0'; /* class/enum/struct/union tag definition */
|
||||
template = NO; /* function template */
|
||||
template = false; /* function template */
|
||||
templateparens = -1; /* function template outer parentheses count */
|
||||
typedefbraces = -1; /* initial typedef braces count */
|
||||
ident_start = 0; /* start of previously found identifier */
|
||||
@ -863,24 +863,24 @@ initscanner(char *srcfile)
|
||||
switch (*++s) { /* this switch saves time on C files */
|
||||
case 'b':
|
||||
if (strcmp(s, "bp") == 0) { /* breakpoint listing */
|
||||
bplisting = YES;
|
||||
bplisting = true;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
if (strcmp(s, "l") == 0) { /* lex */
|
||||
lex = YES;
|
||||
global = NO;
|
||||
lex = true;
|
||||
global = false;
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (strcmp(s, "sd") == 0) { /* sdl */
|
||||
sdl = YES;
|
||||
sdl = true;
|
||||
BEGIN(SDL);
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
if (strcmp(s, "y") == 0) { /* yacc */
|
||||
global = NO;
|
||||
global = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
76
src/global.h
76
src/global.h
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -58,14 +58,11 @@ typedef void (*sighandler_t)(int);
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
typedef enum { /* boolean data type */
|
||||
NO,
|
||||
YES
|
||||
} BOOL;
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum { /* findinit return code */
|
||||
NOERROR,
|
||||
NOTSYMBOL,
|
||||
falseERROR,
|
||||
falseTSYMBOL,
|
||||
REGCMPERROR
|
||||
} FINDINIT;
|
||||
|
||||
@ -85,20 +82,17 @@ struct cmd { /* command history struct */
|
||||
};
|
||||
|
||||
enum {
|
||||
CH_NONE = 0x0000,
|
||||
CH_falseNE = 0x0000,
|
||||
CH_RESULT = 0x0001 << 0,
|
||||
CH_INPUT = 0x0001 << 1,
|
||||
CH_MODE = 0x0001 << 2,
|
||||
CH_ALL = CH_RESULT | CH_INPUT | CH_MODE
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifndef DFLT_INCDIR
|
||||
# define DFLT_INCDIR "/usr/include"
|
||||
#endif
|
||||
|
||||
|
||||
/* digraph data for text compression */
|
||||
extern char dichar1[]; /* 16 most frequent first chars */
|
||||
extern char dichar2[]; /* 8 most frequent second chars
|
||||
@ -118,46 +112,46 @@ extern char dicode2[]; /* digraph second character code */
|
||||
/* main.c global data */
|
||||
extern char *editor, *home, *shell, *lineflag; /* environment variables */
|
||||
extern char *home; /* Home directory */
|
||||
extern BOOL lineflagafterfile;
|
||||
extern bool lineflagafterfile;
|
||||
extern char *argv0; /* command name */
|
||||
extern BOOL compress; /* compress the characters in the crossref */
|
||||
extern BOOL dbtruncated; /* database symbols truncated to 8 chars */
|
||||
extern bool compress; /* compress the characters in the crossref */
|
||||
extern bool dbtruncated; /* database symbols truncated to 8 chars */
|
||||
extern int dispcomponents; /* file path components to display */
|
||||
#if CCS
|
||||
extern BOOL displayversion; /* display the C Compilation System version */
|
||||
extern bool displayversion; /* display the C Compilation System version */
|
||||
#endif
|
||||
extern BOOL editallprompt; /* prompt between editing files */
|
||||
extern bool editallprompt; /* prompt between editing files */
|
||||
extern unsigned int fileargc; /* file argument count */
|
||||
extern char **fileargv; /* file argument values */
|
||||
extern int fileversion; /* cross-reference file version */
|
||||
extern BOOL incurses; /* in curses */
|
||||
extern BOOL invertedindex; /* the database has an inverted index */
|
||||
extern BOOL isuptodate; /* consider the crossref up-to-date */
|
||||
extern BOOL kernelmode; /* don't use DFLT_INCDIR - bad for kernels */
|
||||
extern BOOL linemode; /* use line oriented user interface */
|
||||
extern BOOL verbosemode; /* print extra information on line mode */
|
||||
extern BOOL recurse_dir; /* recurse dirs when searching for src files */
|
||||
extern bool incurses; /* in curses */
|
||||
extern bool invertedindex; /* the database has an inverted index */
|
||||
extern bool isuptodate; /* consider the crossref up-to-date */
|
||||
extern bool kernelmode; /* don't use DFLT_INCDIR - bad for kernels */
|
||||
extern bool linemode; /* use line oriented user interface */
|
||||
extern bool verbosemode; /* print extra information on line mode */
|
||||
extern bool recurse_dir; /* recurse dirs when searching for src files */
|
||||
extern char *namefile; /* file of file names */
|
||||
extern BOOL ogs; /* display OGS book and subsystem names */
|
||||
extern bool ogs; /* display OGS book and subsystem names */
|
||||
extern char *prependpath; /* prepend path to file names */
|
||||
extern FILE *refsfound; /* references found file */
|
||||
extern char temp1[]; /* temporary file name */
|
||||
extern char temp2[]; /* temporary file name */
|
||||
extern long totalterms; /* total inverted index terms */
|
||||
extern BOOL trun_syms; /* truncate symbols to 8 characters */
|
||||
extern bool trun_syms; /* truncate symbols to 8 characters */
|
||||
extern char tempstring[TEMPSTRING_LEN + 1]; /* global dummy string buffer */
|
||||
extern char *tmpdir; /* temporary directory */
|
||||
|
||||
/* command.c global data */
|
||||
extern BOOL caseless; /* ignore letter case when searching */
|
||||
extern BOOL *change; /* change this line */
|
||||
extern BOOL changing; /* changing text */
|
||||
extern bool caseless; /* ignore letter case when searching */
|
||||
extern bool *change; /* change this line */
|
||||
extern bool changing; /* changing text */
|
||||
extern unsigned int curdispline;
|
||||
extern char newpat[]; /* new pattern */
|
||||
|
||||
/* crossref.c global data */
|
||||
extern long dboffset; /* new database offset */
|
||||
extern BOOL errorsfound; /* prompt before clearing error messages */
|
||||
extern bool errorsfound; /* prompt before clearing error messages */
|
||||
extern long lineoffset; /* source line database offset */
|
||||
extern long npostings; /* number of postings */
|
||||
extern unsigned long symbols; /* number of symbols */
|
||||
@ -206,7 +200,7 @@ extern struct keystruct {
|
||||
} keyword[];
|
||||
|
||||
/* mouse.c global data */
|
||||
extern BOOL mouse; /* mouse interface */
|
||||
extern bool mouse; /* mouse interface */
|
||||
|
||||
/* readline.c global data */
|
||||
extern char* rl_line_buffer;
|
||||
@ -214,7 +208,7 @@ extern char input_line[PATLEN + 1];
|
||||
extern int rl_point;
|
||||
|
||||
#if UNIXPC
|
||||
extern BOOL unixpcmouse; /* UNIX PC mouse interface */
|
||||
extern bool unixpcmouse; /* UNIX PC mouse interface */
|
||||
#endif
|
||||
|
||||
/* cscope functions called from more than one function or between files */
|
||||
@ -240,12 +234,12 @@ char ** parse_options(int *argc, char **argv);
|
||||
void error_usage(void);
|
||||
void longusage(void);
|
||||
void usage(void);
|
||||
extern BOOL remove_symfile_onexit;
|
||||
extern BOOL onesearch; /* one search only in line mode */
|
||||
extern bool remove_symfile_onexit;
|
||||
extern bool onesearch; /* one search only in line mode */
|
||||
extern char *reflines; /* symbol reference lines file */
|
||||
void verswp_field(void);
|
||||
void horswp_field(void);
|
||||
BOOL interpret(int c); // XXX: probably rename
|
||||
bool interpret(int c); // XXX: probably rename
|
||||
int handle_input(const char c);
|
||||
|
||||
void rlinit(void);
|
||||
@ -301,10 +295,10 @@ void myungetch(int c);
|
||||
void warning(char *text);
|
||||
void writestring(char *s);
|
||||
|
||||
BOOL infilelist(char *file);
|
||||
BOOL readrefs(char *filename);
|
||||
BOOL search(void);
|
||||
BOOL writerefsfound(void);
|
||||
bool infilelist(char *file);
|
||||
bool readrefs(char *filename);
|
||||
bool search(void);
|
||||
bool writerefsfound(void);
|
||||
|
||||
FINDINIT findinit(char *pattern);
|
||||
MOUSE *getmouseaction(char leading_char);
|
||||
@ -313,7 +307,7 @@ struct cmd *prevcmd(void);
|
||||
struct cmd *nextcmd(void);
|
||||
|
||||
int egrep(char *file, FILE *output, char *format);
|
||||
int mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless);
|
||||
int mygetline(char p[], char s[], unsigned size, int firstchar, bool iscaseless);
|
||||
int mygetch(void);
|
||||
int hash(char *ss);
|
||||
int execute(char *a, ...);
|
||||
|
10
src/help.c
10
src/help.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -55,7 +55,7 @@ help(void)
|
||||
int ln;
|
||||
|
||||
tp = text;
|
||||
if (changing == NO) {
|
||||
if (changing == false) {
|
||||
if (mouse) {
|
||||
*tp++ = "Point with the mouse and click button 1 to move to the desired input field,\n";
|
||||
*tp++ = "type the pattern to search for, and then press the RETURN key. For the first 4\n";
|
||||
@ -91,7 +91,7 @@ help(void)
|
||||
*tp++ = "^B\t\tRecall previous input field and search pattern.\n";
|
||||
*tp++ = "^F\t\tRecall next input field and search pattern.\n";
|
||||
if(caseless)
|
||||
*tp++ = "^C\t\tToggle ignore/use letter case when searching (IGNORE).\n";
|
||||
*tp++ = "^C\t\tToggle ignore/use letter case when searching (IGfalseRE).\n";
|
||||
else
|
||||
*tp++ = "^C\t\tToggle ignore/use letter case when searching (USE).\n";
|
||||
*tp++ = "^R\t\tRebuild the cross-reference.\n";
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
18
src/input.c
18
src/input.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -104,7 +104,7 @@ mygetch(void)
|
||||
|
||||
/* get a line from the terminal in non-canonical mode */
|
||||
int
|
||||
mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless)
|
||||
mygetline(char p[], char s[], unsigned size, int firstchar, bool iscaseless)
|
||||
{
|
||||
int c;
|
||||
unsigned int i = 0, j;
|
||||
@ -126,7 +126,7 @@ mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless)
|
||||
i += strlen(p);
|
||||
/* if a character already has been typed */
|
||||
if (firstchar != '\0') {
|
||||
if(iscaseless == YES) {
|
||||
if(iscaseless == true) {
|
||||
firstchar = tolower(firstchar);
|
||||
}
|
||||
addch(firstchar); /* display it */
|
||||
@ -193,7 +193,7 @@ mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless)
|
||||
i = 0;
|
||||
} else if (isprint(c) || c == '\t') {
|
||||
/* printable */
|
||||
if(iscaseless == YES) {
|
||||
if(iscaseless == true) {
|
||||
c = tolower(c);
|
||||
}
|
||||
/* if it will fit on the line */
|
||||
@ -207,10 +207,10 @@ mygetline(char p[], char s[], unsigned size, int firstchar, BOOL iscaseless)
|
||||
}
|
||||
}
|
||||
#if UNIXPC
|
||||
} else if (unixpcmouse == YES && c == ESC) { /* mouse */
|
||||
} else if (unixpcmouse == true && c == ESC) { /* mouse */
|
||||
getmouseaction(ESC); /* ignore it */
|
||||
#endif
|
||||
} else if (mouse == YES && c == ctrl('X')) {
|
||||
} else if (mouse == true && c == ctrl('X')) {
|
||||
getmouseaction(ctrl('X')); /* ignore it */
|
||||
} else if (c == EOF) { /* end-of-file */
|
||||
break;
|
||||
@ -251,7 +251,7 @@ askforreturn(void)
|
||||
fprintf(stderr, "Press the RETURN key to continue: ");
|
||||
getchar();
|
||||
/* HBB 20060419: message probably messed up the screen --- redraw */
|
||||
if (incurses == YES) {
|
||||
if (incurses == true) {
|
||||
redrawwin(curscr);
|
||||
}
|
||||
}
|
||||
|
28
src/invlib.c
28
src/invlib.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -940,8 +940,8 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
ptr2 = ((unsigned long *) ptr) + (entryptr->size + (sizeof(long) - 1)) / sizeof(long);
|
||||
*num = entryptr->post;
|
||||
switch (boolarg) {
|
||||
case BOOL_OR:
|
||||
case NOT:
|
||||
case bool_OR:
|
||||
case falseT:
|
||||
if (*num == 0) {
|
||||
*num = numitems;
|
||||
return(item);
|
||||
@ -951,14 +951,14 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
u = 0;
|
||||
switch (boolarg) {
|
||||
case AND:
|
||||
case NOT:
|
||||
case falseT:
|
||||
newsetp = item;
|
||||
break;
|
||||
|
||||
case BOOL_OR:
|
||||
case bool_OR:
|
||||
u = enditem - item;
|
||||
/* FALLTHROUGH */
|
||||
case REVERSENOT:
|
||||
case REVERSEfalseT:
|
||||
u += *num;
|
||||
if (item == item2) {
|
||||
if (u > setsize1) {
|
||||
@ -996,7 +996,7 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
fread(&posting, sizeof(posting), 1, file);
|
||||
newsetc = 0;
|
||||
switch (boolarg) {
|
||||
case BOOL_OR:
|
||||
case bool_OR:
|
||||
/* while something in both sets */
|
||||
set1p = item;
|
||||
newsetp = newitem;
|
||||
@ -1041,7 +1041,7 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
}
|
||||
}
|
||||
item = newitem;
|
||||
break; /* end of BOOL_OR */
|
||||
break; /* end of bool_OR */
|
||||
#if 0
|
||||
case AND:
|
||||
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
|
||||
@ -1071,7 +1071,7 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
}
|
||||
break; /* end of AND */
|
||||
|
||||
case NOT:
|
||||
case falseT:
|
||||
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
|
||||
if (set1p->lineoffset < posting.lineoffset) {
|
||||
*newsetp++ = *set1p++;
|
||||
@ -1102,9 +1102,9 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
while (set1c++ < numitems) {
|
||||
*newsetp++ = *set1p++;
|
||||
}
|
||||
break; /* end of NOT */
|
||||
break; /* end of falseT */
|
||||
|
||||
case REVERSENOT: /* core NOT incoming set */
|
||||
case REVERSEfalseT: /* core falseT incoming set */
|
||||
for (set1c = 0, set2c = 0; set1c < numitems && set2c < *num; ) {
|
||||
if (set1p->lineoffset < posting.lineoffset) {
|
||||
set1p++;
|
||||
@ -1137,7 +1137,7 @@ boolfile(INVCONTROL *invcntl, long *num, int boolarg)
|
||||
fread(&posting, (int) sizeof(posting), 1, file);
|
||||
}
|
||||
item = newitem;
|
||||
break; /* end of REVERSENOT */
|
||||
break; /* end of REVERSEfalseT */
|
||||
#endif
|
||||
}
|
||||
numitems = newsetc;
|
||||
|
12
src/invlib.h
12
src/invlib.h
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -57,10 +57,10 @@
|
||||
#define INVALONE 2
|
||||
|
||||
/* boolean set operations */
|
||||
#define BOOL_OR 3
|
||||
#define bool_OR 3
|
||||
#define AND 4
|
||||
#define NOT 5
|
||||
#define REVERSENOT 6
|
||||
#define falseT 5
|
||||
#define REVERSEfalseT 6
|
||||
|
||||
/* note that the entire first block is for parameters */
|
||||
typedef struct {
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -126,7 +126,7 @@ lookup(char *ident)
|
||||
/* look up the identifier in the keyword table */
|
||||
for (p = hashtab[hash(ident) % HASHMOD]; p != NULL; p = p->next) {
|
||||
if (strequal(ident, p->text)) {
|
||||
if (compress == YES && (c = p - keyword) < ' ') {
|
||||
if (compress == true && (c = p - keyword) < ' ') {
|
||||
ident[0] = c; /* compress the keyword */
|
||||
}
|
||||
return(p->text);
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
122
src/main.c
122
src/main.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -67,34 +67,34 @@ char dicode2[256]; /* digraph second character code */
|
||||
|
||||
char *editor, *shell, *lineflag; /* environment variables */
|
||||
char *home; /* Home directory */
|
||||
BOOL lineflagafterfile;
|
||||
bool lineflagafterfile;
|
||||
char *argv0; /* command name */
|
||||
BOOL compress = YES; /* compress the characters in the crossref */
|
||||
BOOL dbtruncated; /* database symbols are truncated to 8 chars */
|
||||
bool compress = true; /* compress the characters in the crossref */
|
||||
bool dbtruncated; /* database symbols are truncated to 8 chars */
|
||||
int dispcomponents = 1; /* file path components to display */
|
||||
#if CCS
|
||||
BOOL displayversion; /* display the C Compilation System version */
|
||||
bool displayversion; /* display the C Compilation System version */
|
||||
#endif
|
||||
BOOL editallprompt = YES; /* prompt between editing files */
|
||||
bool editallprompt = true; /* prompt between editing files */
|
||||
unsigned int fileargc; /* file argument count */
|
||||
char **fileargv; /* file argument values */
|
||||
int fileversion; /* cross-reference file version */
|
||||
BOOL incurses = NO; /* in curses */
|
||||
BOOL invertedindex; /* the database has an inverted index */
|
||||
BOOL isuptodate; /* consider the crossref up-to-date */
|
||||
BOOL kernelmode; /* don't use DFLT_INCDIR - bad for kernels */
|
||||
BOOL linemode = NO; /* use line oriented user interface */
|
||||
BOOL verbosemode = NO; /* print extra information on line mode */
|
||||
BOOL recurse_dir = NO; /* recurse dirs when searching for src files */
|
||||
bool incurses = false; /* in curses */
|
||||
bool invertedindex; /* the database has an inverted index */
|
||||
bool isuptodate; /* consider the crossref up-to-date */
|
||||
bool kernelmode; /* don't use DFLT_INCDIR - bad for kernels */
|
||||
bool linemode = false; /* use line oriented user interface */
|
||||
bool verbosemode = false; /* print extra information on line mode */
|
||||
bool recurse_dir = false; /* recurse dirs when searching for src files */
|
||||
char *namefile; /* file of file names */
|
||||
BOOL ogs = NO; /* display OGS book and subsystem names */
|
||||
bool ogs = false; /* display OGS book and subsystem names */
|
||||
char *prependpath; /* prepend path to file names */
|
||||
FILE *refsfound; /* references found file */
|
||||
char temp1[PATHLEN + 1]; /* temporary file name */
|
||||
char temp2[PATHLEN + 1]; /* temporary file name */
|
||||
char tempdirpv[PATHLEN + 1]; /* private temp directory */
|
||||
long totalterms; /* total inverted index terms */
|
||||
BOOL trun_syms; /* truncate symbols to 8 characters */
|
||||
bool trun_syms; /* truncate symbols to 8 characters */
|
||||
char tempstring[TEMPSTRING_LEN + 1]; /* use this as a buffer, instead of 'yytext',
|
||||
* which had better be left alone */
|
||||
char *tmpdir; /* temporary directory */
|
||||
@ -112,7 +112,7 @@ static inline void screenmode_event_loop(void);
|
||||
void
|
||||
sigwinch_handler(int sig, siginfo_t *info, void *unused)
|
||||
{
|
||||
if(incurses == YES){
|
||||
if(incurses == true){
|
||||
ungetch(KEY_RESIZE);
|
||||
}
|
||||
}
|
||||
@ -140,7 +140,7 @@ siginit(void){
|
||||
*/
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
if (linemode == NO) {
|
||||
if (linemode == false) {
|
||||
signal(SIGINT, SIG_IGN); /* ignore interrupts */
|
||||
#if defined(KEY_RESIZE) && !defined(__DJGPP__)
|
||||
struct sigaction winch_action;
|
||||
@ -180,7 +180,7 @@ initcompress(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (compress == YES) {
|
||||
if (compress == true) {
|
||||
for (i = 0; i < 16; ++i) {
|
||||
dicode1[(unsigned char) (dichar1[i])] = i * 8 + 1;
|
||||
}
|
||||
@ -199,12 +199,12 @@ skiplist(FILE *oldrefs)
|
||||
|
||||
if (fscanf(oldrefs, "%d", &i) != 1) {
|
||||
postfatal("cscope: cannot read list size from file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
while (--i >= 0) {
|
||||
if (fscanf(oldrefs, "%*s") != 0) {
|
||||
postfatal("cscope: cannot read list name from file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ skiplist(FILE *oldrefs)
|
||||
void
|
||||
entercurses(void)
|
||||
{
|
||||
incurses = YES;
|
||||
incurses = true;
|
||||
#ifndef __MSDOS__ /* HBB 20010313 */
|
||||
nonl(); /* don't translate an output \n to \n\r */
|
||||
#endif
|
||||
@ -237,7 +237,7 @@ exitcurses(void)
|
||||
|
||||
/* exit curses and restore the terminal modes */
|
||||
endwin();
|
||||
incurses = NO;
|
||||
incurses = false;
|
||||
|
||||
/* restore the mouse */
|
||||
mousecleanup();
|
||||
@ -260,7 +260,7 @@ myexit(int sig)
|
||||
rmdir(tempdirpv);
|
||||
}
|
||||
/* restore the terminal to its original mode */
|
||||
if (incurses == YES) {
|
||||
if (incurses == true) {
|
||||
exitcurses();
|
||||
}
|
||||
/* dump core for debugging on the quit signal */
|
||||
@ -274,7 +274,7 @@ myexit(int sig)
|
||||
freecrossref();
|
||||
free_newbuildfiles();
|
||||
|
||||
if( remove_symfile_onexit == YES ) {
|
||||
if( remove_symfile_onexit == true ) {
|
||||
unlink( reffile );
|
||||
unlink( invname );
|
||||
unlink( invpost );
|
||||
@ -298,10 +298,10 @@ static inline void linemode_event_loop(void){
|
||||
int c;
|
||||
|
||||
if (*input_line != '\0') { /* do any optional search */
|
||||
if (search() == YES) {
|
||||
if (search() == true) {
|
||||
/* print the total number of lines in
|
||||
* verbose mode */
|
||||
if (verbosemode == YES)
|
||||
if (verbosemode == true)
|
||||
printf("cscope: %d lines\n",
|
||||
totallines);
|
||||
|
||||
@ -309,9 +309,9 @@ static inline void linemode_event_loop(void){
|
||||
putchar(c);
|
||||
}
|
||||
}
|
||||
if (onesearch == YES) {
|
||||
if (onesearch == true) {
|
||||
myexit(0);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
for (char *s;;) {
|
||||
@ -339,7 +339,7 @@ static inline void linemode_event_loop(void){
|
||||
case '9': /* samuel only */
|
||||
field = *buf - '0';
|
||||
strcpy(input_line, buf + 1);
|
||||
if (search() == NO) {
|
||||
if (search() == false) {
|
||||
printf("Unable to search database\n");
|
||||
} else {
|
||||
printf("cscope: %d lines\n", totallines);
|
||||
@ -351,10 +351,10 @@ static inline void linemode_event_loop(void){
|
||||
|
||||
case 'c': /* toggle caseless mode */
|
||||
case ctrl('C'):
|
||||
if (caseless == NO) {
|
||||
caseless = YES;
|
||||
if (caseless == false) {
|
||||
caseless = true;
|
||||
} else {
|
||||
caseless = NO;
|
||||
caseless = false;
|
||||
}
|
||||
egrepcaseless(caseless);
|
||||
break;
|
||||
@ -377,7 +377,7 @@ static inline void linemode_event_loop(void){
|
||||
|
||||
case 'F': /* add a file name */
|
||||
strcpy(path, buf + 1);
|
||||
if (infilelist(path) == NO &&
|
||||
if (infilelist(path) == false &&
|
||||
(s = inviewpath(path)) != NULL) {
|
||||
addsrcfile(s);
|
||||
}
|
||||
@ -429,7 +429,7 @@ main(int argc, char **argv)
|
||||
/* XXX remove if/when clearerr() in dir.c does the right thing. */
|
||||
if (namefile && strcmp(namefile, "-") == 0 && !buildonly) {
|
||||
postfatal("cscope: Must use -b if file list comes from stdin\n");
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
|
||||
/* make sure that tmpdir exists */
|
||||
@ -468,7 +468,7 @@ main(int argc, char **argv)
|
||||
* the home directory
|
||||
*/
|
||||
snprintf(path, sizeof(path), "%s/%s", home, reffile);
|
||||
if (isuptodate == NO || access(path, READ) == 0) {
|
||||
if (isuptodate == false || access(path, READ) == 0) {
|
||||
reffile = strdup(path);
|
||||
snprintf(path, sizeof(path), "%s/%s", home, invname);
|
||||
invname = strdup(path);
|
||||
@ -479,7 +479,7 @@ main(int argc, char **argv)
|
||||
|
||||
siginit();
|
||||
|
||||
if (linemode == NO) {
|
||||
if (linemode == false) {
|
||||
dispinit(); /* initialize display parameters */
|
||||
clearmsg(); /* clear any build progress message */
|
||||
display(); /* display the version number and input fields */
|
||||
@ -487,22 +487,22 @@ main(int argc, char **argv)
|
||||
|
||||
|
||||
/* if the cross-reference is to be considered up-to-date */
|
||||
if (isuptodate == YES) {
|
||||
if (isuptodate == true) {
|
||||
if ((oldrefs = vpfopen(reffile, "rb")) == NULL) {
|
||||
postfatal("cscope: cannot open file %s\n", reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* get the crossref file version but skip the current directory */
|
||||
if (fscanf(oldrefs, "cscope %d %*s", &fileversion) != 1) {
|
||||
postfatal("cscope: cannot read file version from file %s\n",
|
||||
reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
if (fileversion >= 8) {
|
||||
|
||||
/* override these command line options */
|
||||
compress = YES;
|
||||
invertedindex = NO;
|
||||
compress = true;
|
||||
invertedindex = false;
|
||||
|
||||
/* see if there are options in the database */
|
||||
for (int c;;) {
|
||||
@ -513,15 +513,15 @@ main(int argc, char **argv)
|
||||
}
|
||||
switch (getc(oldrefs)) {
|
||||
case 'c': /* ASCII characters only */
|
||||
compress = NO;
|
||||
compress = false;
|
||||
break;
|
||||
case 'q': /* quick search */
|
||||
invertedindex = YES;
|
||||
invertedindex = true;
|
||||
fscanf(oldrefs, "%ld", &totalterms);
|
||||
break;
|
||||
case 'T': /* truncate symbols to 8 characters */
|
||||
dbtruncated = YES;
|
||||
trun_syms = YES;
|
||||
dbtruncated = true;
|
||||
trun_syms = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -537,7 +537,7 @@ main(int argc, char **argv)
|
||||
postfatal(
|
||||
"cscope: cannot read source file size from file %s\n",
|
||||
reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* get the source file list */
|
||||
srcfiles = malloc(nsrcfiles * sizeof(*srcfiles));
|
||||
@ -548,7 +548,7 @@ main(int argc, char **argv)
|
||||
postfatal(
|
||||
"cscope: cannot read string space size from file %s\n",
|
||||
reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
s = malloc(oldnum);
|
||||
getc(oldrefs); /* skip the newline */
|
||||
@ -558,7 +558,7 @@ main(int argc, char **argv)
|
||||
postfatal(
|
||||
"cscope: cannot read source file names from file %s\n",
|
||||
reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* change newlines to nulls */
|
||||
for (i = 0; i < nsrcfiles; ++i) {
|
||||
@ -598,7 +598,7 @@ main(int argc, char **argv)
|
||||
postfatal(
|
||||
"cscope: cannot read source file name from file %s\n",
|
||||
reffile);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
srcfiles[i] = strdup(path);
|
||||
}
|
||||
@ -618,7 +618,7 @@ main(int argc, char **argv)
|
||||
makefilelist();
|
||||
if (nsrcfiles == 0) {
|
||||
postfatal("cscope: no source files found\n");
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
/* get include directories from the environment */
|
||||
if ((s = getenv("INCLUDEDIRS")) != NULL) {
|
||||
@ -626,7 +626,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
/* add /usr/include to the #include directory list,
|
||||
but not in kernelmode... kernels tend not to use it. */
|
||||
if (kernelmode == NO) {
|
||||
if (kernelmode == false) {
|
||||
if (NULL != (s = getenv("INCDIR"))) {
|
||||
includedir(s);
|
||||
} else {
|
||||
@ -642,28 +642,28 @@ main(int argc, char **argv)
|
||||
|
||||
/* build the cross-reference */
|
||||
initcompress();
|
||||
if (linemode == NO || verbosemode == YES) { /* display if verbose as well */
|
||||
if (linemode == false || verbosemode == true) { /* display if verbose as well */
|
||||
postmsg("Building cross-reference...");
|
||||
}
|
||||
build();
|
||||
if (linemode == NO ) {
|
||||
if (linemode == false ) {
|
||||
clearmsg(); /* clear any build progress message */
|
||||
}
|
||||
if (buildonly == YES) {
|
||||
if (buildonly == true) {
|
||||
myexit(0);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
}
|
||||
opendatabase();
|
||||
|
||||
/* if using the line oriented user interface so cscope can be a
|
||||
subprocess to emacs or samuel */
|
||||
if (linemode == YES) {
|
||||
if (linemode == true) {
|
||||
linemode_event_loop();
|
||||
}
|
||||
/* pause before clearing the screen if there have been error messages */
|
||||
if (errorsfound == YES) {
|
||||
errorsfound = NO;
|
||||
if (errorsfound == true) {
|
||||
errorsfound = false;
|
||||
askforreturn();
|
||||
}
|
||||
/* do any optional search */
|
||||
@ -677,6 +677,6 @@ main(int argc, char **argv)
|
||||
screenmode_event_loop();
|
||||
/* cleanup and exit */
|
||||
myexit(0);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
return 0; /* avoid warning... */
|
||||
}
|
||||
|
38
src/mouse.c
38
src/mouse.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -37,11 +37,11 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
BOOL mouse = NO; /* mouse interface */
|
||||
bool mouse = false; /* mouse interface */
|
||||
|
||||
#ifdef UNIXPC /* build command requires #ifdef instead of #if */
|
||||
#include <sys/window.h>
|
||||
BOOL unixpcmouse = NO; /* running with a mouse on the Unix PC? */
|
||||
bool unixpcmouse = false; /* running with a mouse on the Unix PC? */
|
||||
static int uw_hs, uw_vs; /* character height and width */
|
||||
#endif
|
||||
|
||||
@ -74,7 +74,7 @@ static MENU changemenu[] = { /* change mode menu */
|
||||
};
|
||||
|
||||
static MENU *loaded; /* menu loaded */
|
||||
static BOOL emacsviterm = NO; /* terminal type */
|
||||
static bool emacsviterm = false; /* terminal type */
|
||||
|
||||
static void loadmenu(MENU *menu);
|
||||
static int getcoordinate(void);
|
||||
@ -91,14 +91,14 @@ mouseinit(void)
|
||||
term = mygetenv("TERM", "");
|
||||
if (strcmp(term, "emacsterm") == 0 ||
|
||||
strcmp(term, "viterm") == 0) {
|
||||
emacsviterm = YES;
|
||||
mouse = YES;
|
||||
emacsviterm = true;
|
||||
mouse = true;
|
||||
}
|
||||
/* the MOUSE enviroment variable is for 5620 terminal programs that have
|
||||
mouse support but the TERM environment variable is the same as a
|
||||
terminal without a mouse, such as myx */
|
||||
else if (strcmp(mygetenv("MOUSE", ""), "myx") == 0) {
|
||||
mouse = YES;
|
||||
mouse = true;
|
||||
}
|
||||
#if UNIXPC
|
||||
else if (strcmp(term,"s4") == 0 ||
|
||||
@ -138,10 +138,10 @@ mouseinit(void)
|
||||
umd.um_flags= MSDOWN+MSUP;
|
||||
ioctl(1,WIOCSETMOUSE,&umd);
|
||||
}
|
||||
unixpcmouse = YES;
|
||||
unixpcmouse = true;
|
||||
}
|
||||
#endif
|
||||
if (mouse == YES) {
|
||||
if (mouse == true) {
|
||||
loadmenu(mainmenu);
|
||||
}
|
||||
}
|
||||
@ -151,8 +151,8 @@ mouseinit(void)
|
||||
void
|
||||
mousemenu(void)
|
||||
{
|
||||
if (mouse == YES) {
|
||||
if (changing == YES) {
|
||||
if (mouse == true) {
|
||||
if (changing == true) {
|
||||
loadmenu(changemenu);
|
||||
}
|
||||
else {
|
||||
@ -168,7 +168,7 @@ loadmenu(MENU *menu)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (emacsviterm == YES) {
|
||||
if (emacsviterm == true) {
|
||||
mousereinit();
|
||||
(void) printf("\033V1"); /* display the scrollbar */
|
||||
(void) printf("\033M0@%s@%s@", menu[0].text, menu[0].value);
|
||||
@ -197,7 +197,7 @@ loadmenu(MENU *menu)
|
||||
void
|
||||
mousereinit(void)
|
||||
{
|
||||
if (emacsviterm == YES) {
|
||||
if (emacsviterm == true) {
|
||||
|
||||
/* enable the mouse click and sweep coordinate control sequence */
|
||||
/* and switch to menu 2 */
|
||||
@ -231,7 +231,7 @@ drawscrollbar(int top, int bot)
|
||||
{
|
||||
int p1, p2;
|
||||
|
||||
if (emacsviterm == YES) {
|
||||
if (emacsviterm == true) {
|
||||
if (bot > top) {
|
||||
p1 = 16 + (top - 1) * 100 / totallines;
|
||||
p2 = 16 + (bot - 1) * 100 / totallines;
|
||||
@ -265,7 +265,7 @@ getmouseaction(char leading_char)
|
||||
|
||||
#if UNIXPC
|
||||
|
||||
if(unixpcmouse == YES && leading_char == ESC) {
|
||||
if(unixpcmouse == true && leading_char == ESC) {
|
||||
|
||||
/* Called if cscope received an ESC character. See if it is
|
||||
* a mouse report and if so, decipher it. A mouse report
|
||||
@ -282,7 +282,7 @@ getmouseaction(char leading_char)
|
||||
*
|
||||
* In general, the input is read until the mouse report has
|
||||
* been completely read in or we have discovered that this
|
||||
* escape sequence is NOT a mouse report. In the latter case
|
||||
* escape sequence is falseT a mouse report. In the latter case
|
||||
* return the last character read to the input stream with
|
||||
* myungetch().
|
||||
*/
|
||||
@ -364,7 +364,7 @@ getmouseaction(char leading_char)
|
||||
else
|
||||
#endif /* not UNIXPC */
|
||||
|
||||
if (mouse == YES && leading_char == ctrl('X')) {
|
||||
if (mouse == true && leading_char == ctrl('X')) {
|
||||
|
||||
switch (mygetch()) {
|
||||
case ctrl('_'): /* click */
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
38
src/opt.c
38
src/opt.c
@ -8,8 +8,8 @@
|
||||
#include <stdlib.h> /* atoi */
|
||||
#include <getopt.h>
|
||||
|
||||
BOOL remove_symfile_onexit = NO;
|
||||
BOOL onesearch; /* one search only in line mode */
|
||||
bool remove_symfile_onexit = false;
|
||||
bool onesearch; /* one search only in line mode */
|
||||
char *reflines; /* symbol reference lines file */
|
||||
|
||||
char ** parse_options(int *argc, char **argv)
|
||||
@ -36,7 +36,7 @@ char ** parse_options(int *argc, char **argv)
|
||||
myexit(1);
|
||||
break;
|
||||
case 'X':
|
||||
remove_symfile_onexit = YES;
|
||||
remove_symfile_onexit = true;
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
@ -58,37 +58,37 @@ char ** parse_options(int *argc, char **argv)
|
||||
strcpy(input_line, optarg);
|
||||
break;
|
||||
case 'b': /* only build the cross-reference */
|
||||
buildonly = YES;
|
||||
linemode = YES;
|
||||
buildonly = true;
|
||||
linemode = true;
|
||||
break;
|
||||
case 'c': /* ASCII characters only in crossref */
|
||||
compress = NO;
|
||||
compress = false;
|
||||
break;
|
||||
case 'C': /* turn on caseless mode for symbol searches */
|
||||
caseless = YES;
|
||||
caseless = true;
|
||||
egrepcaseless(caseless); /* simulate egrep -i flag */
|
||||
break;
|
||||
case 'd': /* consider crossref up-to-date */
|
||||
isuptodate = YES;
|
||||
isuptodate = true;
|
||||
break;
|
||||
case 'e': /* suppress ^E prompt between files */
|
||||
editallprompt = NO;
|
||||
editallprompt = false;
|
||||
break;
|
||||
case 'h':
|
||||
longusage();
|
||||
myexit(1);
|
||||
break;
|
||||
case 'k': /* ignore DFLT_INCDIR */
|
||||
kernelmode = YES;
|
||||
kernelmode = true;
|
||||
break;
|
||||
case 'L':
|
||||
onesearch = YES;
|
||||
onesearch = true;
|
||||
/* FALLTHROUGH */
|
||||
case 'l':
|
||||
linemode = YES;
|
||||
linemode = true;
|
||||
break;
|
||||
case 'v':
|
||||
verbosemode = YES;
|
||||
verbosemode = true;
|
||||
break;
|
||||
case 'V':
|
||||
fprintf(stderr, "%s: version %d%s\n", argv0,
|
||||
@ -96,19 +96,19 @@ char ** parse_options(int *argc, char **argv)
|
||||
myexit(0);
|
||||
break;
|
||||
case 'q': /* quick search */
|
||||
invertedindex = YES;
|
||||
invertedindex = true;
|
||||
break;
|
||||
case 'T': /* truncate symbols to 8 characters */
|
||||
trun_syms = YES;
|
||||
trun_syms = true;
|
||||
break;
|
||||
case 'u': /* unconditionally build the cross-reference */
|
||||
unconditional = YES;
|
||||
unconditional = true;
|
||||
break;
|
||||
case 'U': /* assume some files have changed */
|
||||
fileschanged = YES;
|
||||
fileschanged = true;
|
||||
break;
|
||||
case 'R':
|
||||
recurse_dir = YES;
|
||||
recurse_dir = true;
|
||||
break;
|
||||
case 'f': /* alternate cross-reference file */
|
||||
reffile = optarg;
|
||||
@ -116,7 +116,7 @@ char ** parse_options(int *argc, char **argv)
|
||||
postfatal("\
|
||||
cscope: reffile too long, cannot \
|
||||
be > %d characters\n", sizeof(path) - 3);
|
||||
/* NOTREACHED */
|
||||
/* falseTREACHED */
|
||||
}
|
||||
strcpy(path, reffile);
|
||||
|
||||
|
@ -9,9 +9,9 @@ static int input_available = 0;
|
||||
static char input_char;
|
||||
char input_line[PATLEN + 1];
|
||||
|
||||
BOOL do_terminate = NO;
|
||||
bool do_terminate = false;
|
||||
|
||||
BOOL interpret(int c){
|
||||
bool interpret(int c){
|
||||
input_char = c;
|
||||
input_available = 1;
|
||||
rl_callback_read_char();
|
||||
@ -38,7 +38,7 @@ static void callback_handler(char* line){
|
||||
}
|
||||
|
||||
static int interpret_break(){
|
||||
do_terminate = YES;
|
||||
do_terminate = true;
|
||||
}
|
||||
|
||||
static int ctrl_z(){
|
||||
@ -46,27 +46,27 @@ static int ctrl_z(){
|
||||
}
|
||||
|
||||
static int toggle_caseless(){
|
||||
if (caseless == NO) {
|
||||
caseless = YES;
|
||||
if (caseless == false) {
|
||||
caseless = true;
|
||||
postmsg2("Caseless mode is now ON");
|
||||
} else {
|
||||
caseless = NO;
|
||||
caseless = false;
|
||||
postmsg2("Caseless mode is now OFF");
|
||||
}
|
||||
egrepcaseless(caseless); /* turn on/off -i flag */
|
||||
}
|
||||
|
||||
static int rebuild_reference(){
|
||||
if (isuptodate == YES) {
|
||||
if (isuptodate == true) {
|
||||
postmsg("The -d option prevents rebuilding the symbol database");
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
exitcurses();
|
||||
freefilelist(); /* remake the source file list */
|
||||
makefilelist();
|
||||
rebuild();
|
||||
if (errorsfound == YES) {
|
||||
errorsfound = NO;
|
||||
if (errorsfound == true) {
|
||||
errorsfound = false;
|
||||
askforreturn();
|
||||
}
|
||||
entercurses();
|
||||
@ -74,23 +74,23 @@ static int rebuild_reference(){
|
||||
totallines = 0;
|
||||
disprefs = 0;
|
||||
topline = nextline = 1;
|
||||
return(YES);
|
||||
return(true);
|
||||
}
|
||||
|
||||
static int process_mouse(){
|
||||
int i;
|
||||
MOUSE* p;
|
||||
if ((p = getmouseaction(DUMMYCHAR)) == NULL) {
|
||||
return(NO); /* unknown control sequence */
|
||||
return(false); /* unknown control sequence */
|
||||
}
|
||||
/* if the button number is a scrollbar tag */
|
||||
if (p->button == '0') {
|
||||
//scrollbar(p); // XXX
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
/* ignore a sweep */
|
||||
if (p->x2 >= 0) {
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
/* if this is a line selection */
|
||||
if (p->y1 > FLDLINE) {
|
||||
@ -99,7 +99,7 @@ static int process_mouse(){
|
||||
/* note: the selection is forced into range */
|
||||
for (i = disprefs - 1; i > 0; --i) {
|
||||
if (p->y1 >= displine[i]) {
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
/* display it in the file with the editor */
|
||||
@ -111,7 +111,7 @@ static int process_mouse(){
|
||||
field = FIELDS - 1;
|
||||
}
|
||||
resetcmd();
|
||||
return(NO);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
8
src/vp.h
8
src/vp.h
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -54,7 +54,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if !NOMALLOC
|
||||
#if !falseMALLOC
|
||||
extern char **vpdirs; /* directories (including current) in view path */
|
||||
#else
|
||||
#define MAXDIR 25 /* same as libVP */
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
14
src/vpinit.c
14
src/vpinit.c
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
@ -42,7 +42,7 @@
|
||||
#include "global.h"
|
||||
#include "constants.h"
|
||||
|
||||
#if !NOMALLOC
|
||||
#if !falseMALLOC
|
||||
char **vpdirs; /* directories (including current) in view path */
|
||||
#else
|
||||
char vpdirs[MAXDIR][DIRLEN + 1];
|
||||
@ -58,14 +58,14 @@ vpinit(char *current_dir)
|
||||
char buf[MAXPATH + 1];
|
||||
int i;
|
||||
char *s;
|
||||
#if NOMALLOC
|
||||
#if falseMALLOC
|
||||
char *node; /* view path node */
|
||||
char vpathbuf[MAXVPATH + 1];
|
||||
#endif
|
||||
|
||||
/* if an existing directory list is to be updated, free it */
|
||||
if (current_dir != NULL && vpndirs > 0) {
|
||||
#if !NOMALLOC
|
||||
#if !falseMALLOC
|
||||
for (i = 0; i < vpndirs; ++i) {
|
||||
free(vpdirs[i]);
|
||||
}
|
||||
@ -93,7 +93,7 @@ vpinit(char *current_dir)
|
||||
return;
|
||||
}
|
||||
suffix = ¤t_dir[i];
|
||||
#if !NOMALLOC
|
||||
#if !falseMALLOC
|
||||
|
||||
/* count the nodes in the view path */
|
||||
vpndirs = 1;
|
||||
|
@ -17,11 +17,11 @@
|
||||
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,
|
||||
IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT falseT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
|
||||
PURPOSE ARE DISCLAIMED. IN false 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
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT falseT 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
|
||||
|
Loading…
Reference in New Issue
Block a user