delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/11/12/15:44:31

From: root AT jacob DOT remcomp DOT fr (root)
Subject: header files (continued)
12 Nov 1996 15:44:31 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <m0vNMST-000ALAC.cygnus.gnu-win32@jacob.remcomp.fr>
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

The policy in the header files concerning UNICODE is that both functions
(the W and A last letters) are defined. Both CreateWindowW and CreateWindowW
are available.

It is not the same for structures though. Consider this structure as is now
defined in the gnu windows headers:
typedef struct tagLOGFONT {
        LONG lfHeight;
        LONG lfWidth;
        LONG lfEscapement;
        LONG lfOrientation;
        LONG lfWeight;
        BYTE lfItalic;
        BYTE lfUnderline;
        BYTE lfStrikeOut;
        BYTE lfCharSet;
        BYTE lfOutPrecision;
        BYTE lfClipPrecision;
        BYTE lfQuality;
        BYTE lfPitchAndFamily;
        TCHAR lfFaceName[LF_FACESIZE];   <<<<<<<<<<<<<<<<<<<<<<<<<<<<
} LOGFONT,*LPLOGFONT;
The TCHAR type is defined as WCHAR if UNICODE is active, or to CHAR if we are
in ascii. This means that if I work in ascii, but want (for whatever reason)
use the wide types, it is impossible. 

The solution to this riddle is simple: we have to define BOTH structures, even 
if the user has NOT defined UNICODE becuase he MAY want to use the wide 
structures too.

Since this would lead to an increased size in the already voluminous headers, 
I propose to split the structures definitions in TWO files: one for the
ASCII structures, and the other for the UNICODE structures when applicable.
If the user wants to use the wide structures when NOT in UNICODE, he just
would include the other file: #include <unicodestructs.h>. In the same vein
if in UNICODE and wants to use the ASCII structure (passing arguments to
16 bit programs, whatever) he would #include <asciistructures.h>.

In any case, according to the UNICODE value, only one set of structures would
be used by default, so 99.99% of you that do not have this kind of weird
problems wouldn't be penalized...


-- 
Jacob Navia	Logiciels/Informatique
41 rue Maurice Ravel			Tel 01 48.23.51.44
93430 Villetaneuse 			Fax 01 48.23.95.39
France
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019