diff options
author | Colin Watson <cjwatson@debian.org> | 2022-01-16 12:54:04 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-01-16 12:54:04 +0000 |
commit | 24b6317bfc3543b93c85130e06bbc4d066910609 (patch) | |
tree | c2161d2ac423f30ec12b6b8ca0660a787cb697f8 /src | |
parent | 59f1bd7e16798d8d99d4d68aa5d591c7380f7b2c (diff) |
Move lexgrog-related bits out of manconfig.h
It's generally cleaner for things like this to be in a dedicated header
file.
* include/manconfig.h.in (struct lexgrog, find_name,
find_name_decompressed): Move to ...
* src/lexgrog.h: ... here (new file). Simplify declarations slightly.
* include/manconfig.h.in (lexgrog filter enum): Move to ...
* src/lexgrog.l: ... here.
* src/Makefile.am (lexgrog_SOURCES, mandb_SOURCES): Add lexgrog.h.
* src/check_mandirs.c, src/lexgrog.l, src/lexgrog_test.c,
src/straycats.c: Include lexgrog.h.
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/check_mandirs.c | 1 | ||||
-rw-r--r-- | src/lexgrog.h | 33 | ||||
-rw-r--r-- | src/lexgrog.l | 12 | ||||
-rw-r--r-- | src/lexgrog_test.c | 1 | ||||
-rw-r--r-- | src/straycats.c | 1 |
6 files changed, 50 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 74d790e5..f61f152a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -96,6 +96,7 @@ lexgrog_SOURCES = \ filenames.h \ globbing.c \ globbing.h \ + lexgrog.h \ lexgrog.l \ lexgrog_test.c \ manconv.c \ @@ -151,6 +152,7 @@ mandb_SOURCES = \ filenames.h \ globbing.c \ globbing.h \ + lexgrog.h \ lexgrog.l \ manconv.c \ manconv.h \ diff --git a/src/check_mandirs.c b/src/check_mandirs.c index 6076f911..a5bb6cd9 100644 --- a/src/check_mandirs.c +++ b/src/check_mandirs.c @@ -70,6 +70,7 @@ #include "descriptions.h" #include "filenames.h" #include "globbing.h" +#include "lexgrog.h" #include "manp.h" #include "ult_src.h" #include "check_mandirs.h" diff --git a/src/lexgrog.h b/src/lexgrog.h new file mode 100644 index 00000000..8ad44ddd --- /dev/null +++ b/src/lexgrog.h @@ -0,0 +1,33 @@ +/* + * lexgrog.h: interface to extracting whatis info + * + * Copyright (C) 1994, 1995 Graeme W. Wilford. (Wilf.) + * Copyright (C) 2001-2022 Colin Watson. + * + * This file is part of man-db. + * + * man-db is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * man-db is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with man-db; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +typedef struct lexgrog { + int type; + char *whatis; + char *filters; +} lexgrog; + +extern int find_name (const char *file, const char *filename, + lexgrog *p_lg, const char *encoding); +extern int find_name_decompressed (struct pipeline *p, const char *filename, + lexgrog *p_lg); diff --git a/src/lexgrog.l b/src/lexgrog.l index 59aec098..0154ef63 100644 --- a/src/lexgrog.l +++ b/src/lexgrog.l @@ -62,11 +62,23 @@ #include "encodings.h" #include "sandbox.h" +#include "lexgrog.h" #include "manconv_client.h" #define YY_READ_BUF_SIZE 1024 #define MAX_NAME 8192 +/* defines the ordered list of filters detected by lexgrog */ +enum { + TBL_FILTER = 0, /* tbl */ + EQN_FILTER, /* eqn */ + PIC_FILTER, /* pic */ + GRAP_FILTER, /* grap */ + REF_FILTER, /* refer */ + VGRIND_FILTER, /* vgrind */ + MAX_FILTERS /* delimiter */ +}; + #define ARRAY_SIZE(array) (sizeof (array) / sizeof ((array)[0])) extern man_sandbox *sandbox; diff --git a/src/lexgrog_test.c b/src/lexgrog_test.c index fec69ec3..9b43c983 100644 --- a/src/lexgrog_test.c +++ b/src/lexgrog_test.c @@ -53,6 +53,7 @@ #include "convert.h" #include "descriptions.h" +#include "lexgrog.h" #include "ult_src.h" int quiet = 1; diff --git a/src/straycats.c b/src/straycats.c index 6ce2042d..2188ea2f 100644 --- a/src/straycats.c +++ b/src/straycats.c @@ -62,6 +62,7 @@ #include "db_storage.h" #include "descriptions.h" +#include "lexgrog.h" #include "manp.h" #include "manconv_client.h" #include "ult_src.h" |