From b5777a3a3919ee935dc6b78bf541399b30ddc2d3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 29 Apr 2014 15:51:49 +0000 Subject: new simpletypes.h to break types.h<->str-llist.h loop git-svn-id: svn://tug.org/texlive/trunk@33750 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/kpathsea/ChangeLog | 15 +++++-- Build/source/texk/kpathsea/pathsearch.h | 7 +--- Build/source/texk/kpathsea/simpletypes.h | 70 ++++++++++++++++++++++++++++++++ Build/source/texk/kpathsea/str-llist.h | 5 +-- Build/source/texk/kpathsea/types.h | 36 ++-------------- 5 files changed, 89 insertions(+), 44 deletions(-) create mode 100644 Build/source/texk/kpathsea/simpletypes.h (limited to 'Build/source/texk/kpathsea') diff --git a/Build/source/texk/kpathsea/ChangeLog b/Build/source/texk/kpathsea/ChangeLog index 8a05990cad9..cfd8f87f2bf 100644 --- a/Build/source/texk/kpathsea/ChangeLog +++ b/Build/source/texk/kpathsea/ChangeLog @@ -1,3 +1,11 @@ +2014-04-29 Karl Berry + + * simpletypes.h: new file, defining just boolean, string, address, etc. + * pathsearch.h: restore #include of str-llist.h before types.h, + as it should be. + * str-llist.h: #include simpletypes.h instead of types.h. + * types.h: #include simpletypes.h. + 2014-04-22 Karl Berry * texmf.cnf (guess_input_kanji_encoding): set to 1, @@ -18,9 +26,10 @@ * pathsearch.h: with deep regret, #include types.h before str-llist.h, since otherwise str_llist_type is not defined - in its use within types.h. Reported by Norman Gray, tex-k - 14 Apr 2013 12:23:50, - http://tug.org/pipermail/tex-k/2013-April/002496.html. + in its use within types.h and a simple #include + fails. Reported by Norman Gray, + tex-k 14 Apr 2013 12:23:50, + http://tug.org/pipermail/tex-k/2013-April/002496.html 2014-04-09 Luigi Scarso diff --git a/Build/source/texk/kpathsea/pathsearch.h b/Build/source/texk/kpathsea/pathsearch.h index 2a87df7ee94..7b4d5a7920e 100644 --- a/Build/source/texk/kpathsea/pathsearch.h +++ b/Build/source/texk/kpathsea/pathsearch.h @@ -22,13 +22,8 @@ #include -/* Very sadly, types.h must be included before str-llist.h, because - types.h itself also includes str-llist.h, and its following use of - str_llist_type would not be defined if we have str-llist.h first - here. All follows from types.h including nearly everything so that - MetaPost can be a threaded library. */ -#include #include +#include #ifdef __cplusplus extern "C" { diff --git a/Build/source/texk/kpathsea/simpletypes.h b/Build/source/texk/kpathsea/simpletypes.h new file mode 100644 index 00000000000..8403f55ab55 --- /dev/null +++ b/Build/source/texk/kpathsea/simpletypes.h @@ -0,0 +1,70 @@ +/* simpletypes.h: basic string, boolean, etc., that we use in kpathsea. + + This is needed to avoid a loop between types.h and str-llist.h. + Otherwise, types.h would have to be included before str-llist.h, + because types.h itself also includes str-llist.h, and its following + use of str_llist_type would not be defined. So instead we have + str-llist.h #include this, instead of the full types.h. All follows + from types.h including nearly everything, so that MetaPost can be a + threaded library. + + Copyright 1993, 1994, 2008, 2010, 2014 Karl Berry. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, see . */ + +#ifndef KPATHSEA_SIMPLETYPES_H +#define KPATHSEA_SIMPLETYPES_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Booleans. */ +/* NeXT wants to define their own boolean type. */ +#ifndef HAVE_BOOLEAN +#define HAVE_BOOLEAN +typedef int boolean; +/* `true' and `false' are reserved words in C++. */ +#ifndef __cplusplus +#ifndef true +#define true 1 +#define false 0 +#endif /* not true */ +#endif /* not __cplusplus */ +#endif /* not HAVE_BOOLEAN */ + +/* The X library (among other things) defines `FALSE' and `TRUE', and so + we only want to define them if necessary, for use by application code. */ +#ifndef FALSE +#define FALSE false +#define TRUE true +#endif /* FALSE */ + +/* The usual null-terminated string. */ +typedef char *string; + +/* A pointer to constant data. (ANSI says `const string' is + `char * const', which is a constant pointer to non-constant data.) */ +typedef const char *const_string; + +/* A generic pointer. */ +typedef void *address; + +#ifdef __cplusplus +} +#endif + +#endif /* not KPATHSEA_TYPES_H */ diff --git a/Build/source/texk/kpathsea/str-llist.h b/Build/source/texk/kpathsea/str-llist.h index bcc9b6dffaa..2d1468c4ace 100644 --- a/Build/source/texk/kpathsea/str-llist.h +++ b/Build/source/texk/kpathsea/str-llist.h @@ -4,7 +4,7 @@ that C cannot express iterators very well, and I don't want to change all the for loops. - Copyright 1993, 1994, 2008, 2010 Karl Berry. + Copyright 1993, 1994, 2008, 2010, 2014 Karl Berry. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -23,8 +23,7 @@ #define STR_LLIST_H #include -#include - +#include #ifdef __cplusplus extern "C" { diff --git a/Build/source/texk/kpathsea/types.h b/Build/source/texk/kpathsea/types.h index a2b0a00ba44..54fd59c604e 100644 --- a/Build/source/texk/kpathsea/types.h +++ b/Build/source/texk/kpathsea/types.h @@ -1,6 +1,6 @@ /* types.h: general types for kpathsea. - Copyright 1993, 1995, 1996, 2005, 2008-2013 Karl Berry. + Copyright 1993, 1995, 1996, 2005, 2008-2014 Karl Berry. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,30 +18,12 @@ #ifndef KPATHSEA_TYPES_H #define KPATHSEA_TYPES_H +/* Our string, boolean, etc. */ +#include + /* Required until all programs use the new API, if ever. */ #define KPSE_COMPAT_API 1 -/* Booleans. */ -/* NeXT wants to define their own boolean type. */ -#ifndef HAVE_BOOLEAN -#define HAVE_BOOLEAN -typedef int boolean; -/* `true' and `false' are reserved words in C++. */ -#ifndef __cplusplus -#ifndef true -#define true 1 -#define false 0 -#endif /* not true */ -#endif /* not __cplusplus */ -#endif /* not HAVE_BOOLEAN */ - -/* The X library (among other things) defines `FALSE' and `TRUE', and so - we only want to define them if necessary, for use by application code. */ -#ifndef FALSE -#define FALSE false -#define TRUE true -#endif /* FALSE */ - #include /* for FILE* */ /* Declare int64_t and uint64_t, and define PRId64 etc. */ @@ -69,16 +51,6 @@ typedef int boolean; extern "C" { #endif -/* The usual null-terminated string. */ -typedef char *string; - -/* A pointer to constant data. (ANSI says `const string' is - `char * const', which is a constant pointer to non-constant data.) */ -typedef const char *const_string; - -/* A generic pointer. */ -typedef void *address; - /* function pointer prototype definitions for recorder */ typedef void (*p_record_input) (const_string); typedef void (*p_record_output) (const_string); -- cgit v1.2.3