diff --git a/src/common/folding.cc b/src/common/folding.cc index 24578d82..90bed687 100644 --- a/src/common/folding.cc +++ b/src/common/folding.cc @@ -2,14 +2,13 @@ * Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */ #include "folding.hh" -#include #include "utf8.hh" #include "globalregex.hh" +#include "inc_case_folding.hh" namespace Folding { -#include "inc_case_folding.hh" /// Tests if the given char is one of the Unicode combining marks. Some are /// caught by the diacritics folding table, but they are only handled there diff --git a/src/common/inc_case_folding.hh b/src/common/inc_case_folding.hh index 5a3addec..16a3f217 100644 --- a/src/common/inc_case_folding.hh +++ b/src/common/inc_case_folding.hh @@ -1,8 +1,8 @@ // This file was generated automatically. Do not edit directly. - +#pragma once enum { foldCaseMaxOut = 3 }; -size_t foldCase( wchar in, wchar * out ) +inline size_t foldCase( char32_t in, char32_t * out ) { switch( in ) { @@ -1540,7 +1540,7 @@ size_t foldCase( wchar in, wchar * out ) } } -wchar foldCaseSimple( wchar in ) +char32_t foldCaseSimple( char32_t in ) { switch( in ) { diff --git a/tools/generators/generate.cc b/tools/generators/generate.cc index 6b7df8fa..ee8bcedf 100644 --- a/tools/generators/generate.cc +++ b/tools/generators/generate.cc @@ -164,8 +164,9 @@ int main() fprintf( outf, "// This file was generated automatically. Do not edit directly.\n\n" ); + fprintf( outf, "#pragma once\n\n" ); fprintf( outf, "enum { foldCaseMaxOut = 3 };\n\n" ); - fprintf( outf, "size_t foldCase( wchar in, wchar * out )\n{\n switch( in )\n {\n" ); + fprintf( outf, "inline size_t foldCase( char32_t in, char32_t * out )\n{\n switch( in )\n {\n" ); for ( map< char32_t, u32string >::const_iterator i = foldTable.begin(); i != foldTable.end(); ++i ) { if ( i->second.size() == 1 ) @@ -183,7 +184,7 @@ int main() fprintf( outf, " default: *out = in; return 1;\n" ); fprintf( outf, " }\n}\n\n" ); - fprintf( outf, "wchar foldCaseSimple( wchar in )\n{\n switch( in )\n {\n" ); + fprintf( outf, "char32_t foldCaseSimple( char32_t in )\n{\n switch( in )\n {\n" ); for ( map< char32_t, char32_t >::const_iterator i = simpleFoldTable.begin(); i != simpleFoldTable.end(); ++i ) fprintf( outf, " case 0x%x: return 0x%x;\n", i->first, i->second );