Completing tchar.h

Francois Gouget fgouget at free.fr
Mon Apr 23 02:31:39 CDT 2001


   I believe that tchar.h, like windows.h, should not be included by any
of Wine's sources: the whole point of tchar.h is to make it possible for
a single source to be compiled wither for SBCS, MBCS or Unicode. This is
not something we want to do in Wine's source.


Changelog:

 * include/tchar.h

   Prevent use by Wine's source
   Added missing 'function' definitions (macros really)


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                  Dieu dit: "M-x Lumière". Et la lumière fut.
-------------- next part --------------
Index: include/tchar.h
===================================================================
RCS file: /home/wine/wine/include/tchar.h,v
retrieving revision 1.14
diff -u -r1.14 tchar.h
--- include/tchar.h	2001/04/10 23:23:31	1.14
+++ include/tchar.h	2001/04/23 02:29:17
@@ -1,6 +1,10 @@
 #ifndef __WINE_TCHAR_H
 #define __WINE_TCHAR_H
 
+#ifdef __WINE__
+#error Wine should not include tchar.h internally
+#endif
+
 #include "windef.h"
 
 #ifdef __cplusplus
@@ -10,10 +14,12 @@
 /*****************************************************************************
  * tchar routines
  */
-#define _strdec(start,current)  (start<current?((char*)current)-1:NULL)
-#define _strinc(current) (((char*)current)+1)
-/* FIXME: _strncnt and strncnt are missing */
-/* FIXME: _strspnp is not implemented */
+#define _strdec(start,current)  ((start)<(current) ? ((char*)current)-1 : NULL)
+#define _strinc(current)        (((char*)current)+1)
+#define _strncnt(str,max)       (strlen(str)>(max) ? (max) : strlen(str))
+#define _strnextc(str)          ((unsigned int)*str)
+#define _strninc(str,n)         (((char*)str)+(n))
+#define _strspnp(s1,s2)         (*((s1)+=strspn(s1,s2)) ? (s1) : NULL)
 
 
 /*****************************************************************************


More information about the wine-patches mailing list