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