You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
3.0 KiB

  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /*
  18. * $Id: Xlat.hpp 470094 2006-11-01 20:41:30Z amassari $
  19. */
  20. // ---------------------------------------------------------------------------
  21. // Some globally used types
  22. // ---------------------------------------------------------------------------
  23. enum MsgTypes
  24. {
  25. MsgType_Warning
  26. , MsgType_Error
  27. , MsgType_FatalError
  28. , MsgTypes_Count
  29. };
  30. // ---------------------------------------------------------------------------
  31. // Includes
  32. // ---------------------------------------------------------------------------
  33. #include <stdio.h>
  34. #include <wchar.h>
  35. #include <stdlib.h>
  36. #include <xercesc/util/XercesDefs.hpp>
  37. #include <xercesc/util/PlatformUtils.hpp>
  38. #include <xercesc/util/TransService.hpp>
  39. #include <xercesc/sax/SAXParseException.hpp>
  40. #include <xercesc/parsers/XercesDOMParser.hpp>
  41. #include <xercesc/dom/DOM.hpp>
  42. #include "Xlat_ErrHandler.hpp"
  43. #include "Xlat_Types.hpp"
  44. #include "Xlat_Formatter.hpp"
  45. #include "Xlat_CppSrc.hpp"
  46. #include "Xlat_Win32RC.hpp"
  47. #include "Xlat_MsgCatalog.hpp"
  48. #include "Xlat_ICUResourceBundle.hpp"
  49. XERCES_CPP_NAMESPACE_USE
  50. // ---------------------------------------------------------------------------
  51. // Some const global data
  52. // ---------------------------------------------------------------------------
  53. extern XMLCh* typePrefixes[MsgTypes_Count];
  54. // this ugly hack is needed because cygwin/linux and Windows (MSVC++)
  55. // have irreconcileable differences about what to do with chars, wchar_t and XMLCh
  56. // in wfprintf. Windows thinks that XMLCh * is fine here whereas
  57. // char * is not; gcc will allow XMLCh to be cast to wchar_t but happily
  58. // prints out gobbledygook in this case; it only seems happy when
  59. // the native transcoder is used to convert the XMLCh to a char *
  60. #if defined(__linux__) || defined(__CYGWIN__)
  61. extern char *fTmpStr;
  62. #define xmlStrToPrintable(xmlStr) \
  63. (fTmpStr = XMLString::transcode(xmlStr))
  64. #define releasePrintableStr \
  65. XMLString::release(&fTmpStr);
  66. #define longChars(str) str
  67. #elif defined(_WIN32) || defined(WIN32) || defined(__WINDOWS__)
  68. extern wchar_t *longChars(const char *str);
  69. #define xmlStrToPrintable(xmlStr) xmlStr
  70. #define releasePrintableStr
  71. #else
  72. #error Code requires port to host OS!
  73. #endif