Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /****************************************************************************
  2. *
  3. *                            Open Watcom Project
  4. *
  5. *    Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
  6. *
  7. *  ========================================================================
  8. *
  9. *    This file contains Original Code and/or Modifications of Original
  10. *    Code as defined in and that are subject to the Sybase Open Watcom
  11. *    Public License version 1.0 (the 'License'). You may not use this file
  12. *    except in compliance with the License. BY USING THIS FILE YOU AGREE TO
  13. *    ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
  14. *    provided with the Original Code and Modifications, and is also
  15. *    available at www.sybase.com/developer/opensource.
  16. *
  17. *    The Original Code and all software distributed under the License are
  18. *    distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  19. *    EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
  20. *    ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
  21. *    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
  22. *    NON-INFRINGEMENT. Please see the License for the specific language
  23. *    governing rights and limitations under the License.
  24. *
  25. *  ========================================================================
  26. *
  27. * Description:  Macros for single source wide/narrow character code.
  28. *
  29. ****************************************************************************/
  30.  
  31.  
  32. #ifndef _WIDECHAR_H_INCLUDED
  33. #define _WIDECHAR_H_INCLUDED
  34.  
  35. #include "variety.h"
  36. #include <stdlib.h>             /* for wchar_t and _atouni */
  37.  
  38. /*** Define some handy macros ***/
  39. #ifdef __WIDECHAR__
  40.     #define DIR_TYPE            struct _wdirent
  41.     #define CHAR_TYPE           wchar_t
  42.     #define UCHAR_TYPE          wchar_t
  43.     #define INTCHAR_TYPE        wint_t
  44.     #define INT_WC_TYPE         wchar_t
  45.     #define VOID_WC_TYPE        wchar_t
  46.     #define NULLCHAR            0
  47.     #define STRING(a)           L##a
  48.     #define _AToUni(p1,p2)      _atouni(p1,p2)
  49.     #define IS_ASCII(c)         ( (c & 0xff00) == 0 )
  50.     #define TO_ASCII(c)         ( c )
  51.     #define __F_NAME(n1,n2)     n2
  52.     #define UNICODE
  53.     #define _UNICODE
  54.     #define __UNICODE__
  55. #else
  56.     #define DIR_TYPE            struct dirent
  57.     #define CHAR_TYPE           char
  58.     #define UCHAR_TYPE          unsigned char
  59.     #define INTCHAR_TYPE        int
  60.     #define INT_WC_TYPE         int
  61.     #define VOID_WC_TYPE        void
  62.     #define NULLCHAR            '\0'
  63.     #define STRING(a)           a
  64.     #define _AToUni(p1,p2)      (p2)
  65.     #define IS_ASCII(c)         ( 1 )
  66.     #define TO_ASCII(c)         ( (unsigned char)c )
  67.     #define __F_NAME(n1,n2)     n1
  68. #endif
  69. #define CHARSIZE                (sizeof( CHAR_TYPE ))
  70.  
  71. /* must be the larger of char and wchar_t */
  72. #define MAX_CHAR_TYPE           wchar_t
  73.  
  74. #endif
  75.