1 /** @file 2 * @brief Mechanism for accessing a struct of constant information 3 */ 4 // Copyright (C) 2003,2004,2005,2007,2008,2009,2010,2012,2013,2015 Olly Betts 5 // 6 // This program is free software; you can redistribute it and/or modify 7 // it under the terms of the GNU General Public License as published by 8 // the Free Software Foundation; either version 2 of the License, or 9 // (at your option) any later version. 10 // 11 // This program is distributed in the hope that it will be useful, 12 // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 // GNU General Public License for more details. 15 // 16 // You should have received a copy of the GNU General Public License 17 // along with this program; if not, write to the Free Software 18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 20 #ifndef XAPIAN_INCLUDED_XAPIAN_CONSTINFO_H 21 #define XAPIAN_INCLUDED_XAPIAN_CONSTINFO_H 22 23 #include <xapian/attributes.h> 24 #include <xapian/visibility.h> 25 26 namespace Xapian { 27 namespace Internal { 28 29 /** @private @internal */ 30 struct constinfo { 31 unsigned char C_tab[256]; 32 int major, minor, revision; 33 char str[8]; 34 unsigned stemmer_name_len; 35 // FIXME: We don't want to fix the size of this in the API headers. 36 char stemmer_data[256]; 37 }; 38 39 /** @private @internal 40 * 41 * Rather than having a separate function to access each piece of information, 42 * we put it all into a structure and have a single function which returns a 43 * pointer to this (and we mark that function with attribute const, so the 44 * compiler should be able to CSE calls to it. This means that when Xapian is 45 * loaded as a shared library we save N-1 relocations (where N is the 46 * number of pieces of information), which reduces the library load time. 47 */ 48 XAPIAN_VISIBILITY_DEFAULT 49 const struct constinfo * XAPIAN_NOTHROW(get_constinfo_()) XAPIAN_CONST_FUNCTION; 50 51 } 52 } 53 54 #endif /* XAPIAN_INCLUDED_XAPIAN_CONSTINFO_H */ 55