15bb6a25fSPoul-Henning Kamp /* internal.h 25bb6a25fSPoul-Henning Kamp 35bb6a25fSPoul-Henning Kamp Internal definitions used by Expat. This is not needed to compile 45bb6a25fSPoul-Henning Kamp client code. 55bb6a25fSPoul-Henning Kamp 6220ed979SColeman Kane The following calling convention macros are defined for frequently 7220ed979SColeman Kane called functions: 85bb6a25fSPoul-Henning Kamp 9220ed979SColeman Kane FASTCALL - Used for those internal functions that have a simple 10220ed979SColeman Kane body and a low number of arguments and local variables. 115bb6a25fSPoul-Henning Kamp 12220ed979SColeman Kane PTRCALL - Used for functions called though function pointers. 13220ed979SColeman Kane 14220ed979SColeman Kane PTRFASTCALL - Like PTRCALL, but for low number of arguments. 15220ed979SColeman Kane 16220ed979SColeman Kane inline - Used for selected internal functions for which inlining 175bb6a25fSPoul-Henning Kamp may improve performance on some platforms. 18220ed979SColeman Kane 19220ed979SColeman Kane Note: Use of these macros is based on judgement, not hard rules, 20220ed979SColeman Kane and therefore subject to change. 21*0a48773fSEric van Gyzen __ __ _ 22*0a48773fSEric van Gyzen ___\ \/ /_ __ __ _| |_ 23*0a48773fSEric van Gyzen / _ \\ /| '_ \ / _` | __| 24*0a48773fSEric van Gyzen | __// \| |_) | (_| | |_ 25*0a48773fSEric van Gyzen \___/_/\_\ .__/ \__,_|\__| 26*0a48773fSEric van Gyzen |_| XML parser 27*0a48773fSEric van Gyzen 28*0a48773fSEric van Gyzen Copyright (c) 1997-2000 Thai Open Source Software Center Ltd 29*0a48773fSEric van Gyzen Copyright (c) 2000-2017 Expat development team 30*0a48773fSEric van Gyzen Licensed under the MIT license: 31*0a48773fSEric van Gyzen 32*0a48773fSEric van Gyzen Permission is hereby granted, free of charge, to any person obtaining 33*0a48773fSEric van Gyzen a copy of this software and associated documentation files (the 34*0a48773fSEric van Gyzen "Software"), to deal in the Software without restriction, including 35*0a48773fSEric van Gyzen without limitation the rights to use, copy, modify, merge, publish, 36*0a48773fSEric van Gyzen distribute, sublicense, and/or sell copies of the Software, and to permit 37*0a48773fSEric van Gyzen persons to whom the Software is furnished to do so, subject to the 38*0a48773fSEric van Gyzen following conditions: 39*0a48773fSEric van Gyzen 40*0a48773fSEric van Gyzen The above copyright notice and this permission notice shall be included 41*0a48773fSEric van Gyzen in all copies or substantial portions of the Software. 42*0a48773fSEric van Gyzen 43*0a48773fSEric van Gyzen THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 44*0a48773fSEric van Gyzen EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 45*0a48773fSEric van Gyzen MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 46*0a48773fSEric van Gyzen NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 47*0a48773fSEric van Gyzen DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 48*0a48773fSEric van Gyzen OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 49*0a48773fSEric van Gyzen USE OR OTHER DEALINGS IN THE SOFTWARE. 505bb6a25fSPoul-Henning Kamp */ 515bb6a25fSPoul-Henning Kamp 52220ed979SColeman Kane #if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) 53220ed979SColeman Kane /* We'll use this version by default only where we know it helps. 54220ed979SColeman Kane 55220ed979SColeman Kane regparm() generates warnings on Solaris boxes. See SF bug #692878. 56220ed979SColeman Kane 57220ed979SColeman Kane Instability reported with egcs on a RedHat Linux 7.3. 58220ed979SColeman Kane Let's comment out: 59220ed979SColeman Kane #define FASTCALL __attribute__((stdcall, regparm(3))) 60220ed979SColeman Kane and let's try this: 615bb6a25fSPoul-Henning Kamp */ 62220ed979SColeman Kane #define FASTCALL __attribute__((regparm(3))) 63220ed979SColeman Kane #define PTRFASTCALL __attribute__((regparm(3))) 645bb6a25fSPoul-Henning Kamp #endif 655bb6a25fSPoul-Henning Kamp 66220ed979SColeman Kane /* Using __fastcall seems to have an unexpected negative effect under 67220ed979SColeman Kane MS VC++, especially for function pointers, so we won't use it for 68220ed979SColeman Kane now on that platform. It may be reconsidered for a future release 69220ed979SColeman Kane if it can be made more effective. 70220ed979SColeman Kane Likely reason: __fastcall on Windows is like stdcall, therefore 71220ed979SColeman Kane the compiler cannot perform stack optimizations for call clusters. 72220ed979SColeman Kane */ 73220ed979SColeman Kane 74220ed979SColeman Kane /* Make sure all of these are defined if they aren't already. */ 75220ed979SColeman Kane 765bb6a25fSPoul-Henning Kamp #ifndef FASTCALL 775bb6a25fSPoul-Henning Kamp #define FASTCALL 785bb6a25fSPoul-Henning Kamp #endif 795bb6a25fSPoul-Henning Kamp 80220ed979SColeman Kane #ifndef PTRCALL 81220ed979SColeman Kane #define PTRCALL 82220ed979SColeman Kane #endif 83220ed979SColeman Kane 84220ed979SColeman Kane #ifndef PTRFASTCALL 85220ed979SColeman Kane #define PTRFASTCALL 86220ed979SColeman Kane #endif 87220ed979SColeman Kane 885bb6a25fSPoul-Henning Kamp #ifndef XML_MIN_SIZE 895bb6a25fSPoul-Henning Kamp #if !defined(__cplusplus) && !defined(inline) 905bb6a25fSPoul-Henning Kamp #ifdef __GNUC__ 915bb6a25fSPoul-Henning Kamp #define inline __inline 925bb6a25fSPoul-Henning Kamp #endif /* __GNUC__ */ 935bb6a25fSPoul-Henning Kamp #endif 945bb6a25fSPoul-Henning Kamp #endif /* XML_MIN_SIZE */ 955bb6a25fSPoul-Henning Kamp 965bb6a25fSPoul-Henning Kamp #ifdef __cplusplus 975bb6a25fSPoul-Henning Kamp #define inline inline 985bb6a25fSPoul-Henning Kamp #else 995bb6a25fSPoul-Henning Kamp #ifndef inline 1005bb6a25fSPoul-Henning Kamp #define inline 1015bb6a25fSPoul-Henning Kamp #endif 1025bb6a25fSPoul-Henning Kamp #endif 103be8aff81SXin LI 104be8aff81SXin LI #ifndef UNUSED_P 105be8aff81SXin LI # ifdef __GNUC__ 106be8aff81SXin LI # define UNUSED_P(p) UNUSED_ ## p __attribute__((__unused__)) 107be8aff81SXin LI # else 108be8aff81SXin LI # define UNUSED_P(p) UNUSED_ ## p 109be8aff81SXin LI # endif 110be8aff81SXin LI #endif 111be8aff81SXin LI 112be8aff81SXin LI 113be8aff81SXin LI #ifdef __cplusplus 114be8aff81SXin LI extern "C" { 115be8aff81SXin LI #endif 116be8aff81SXin LI 117be8aff81SXin LI 118be8aff81SXin LI void 119*0a48773fSEric van Gyzen _INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef); 120be8aff81SXin LI 121be8aff81SXin LI 122be8aff81SXin LI #ifdef __cplusplus 123be8aff81SXin LI } 124be8aff81SXin LI #endif 125