Fix compilation of WinCE. Change the fixed UNICODE define of WinCE to FPC_OS_UNICODE, so that it won't be undefined when changing the mode/string type and that the usage of a UNICODE API is independant of the mode.

Also adjusted all Windows (Win32/64/CE) units to define a "UNICODE" if "FPC_OS_UNICODE" is defined (except the Jedi units).
Also the common RTL units that checked for UNICODE now check for FPC_OS_UNICODE.

git-svn-id: trunk@24420 -
This commit is contained in:
svenbarth 2013-05-04 11:06:32 +00:00
parent 1de40c8de7
commit 930b76e8fb
28 changed files with 95 additions and 19 deletions

View File

@ -42,7 +42,7 @@ unit i_nativent;
tf_dwarf_only_local_labels];
cpu : cpu_i386;
unit_env : 'NTUNITS';
extradefines : 'NATIVENT,UNICODE';
extradefines : 'NATIVENT,FPC_OS_UNICODE';
exeext : '.exe';
defext : '.def';
scriptext : '.bat';

View File

@ -174,7 +174,7 @@ unit i_win;
tf_safecall_exceptions,tf_no_backquote_support];
cpu : cpu_arm;
unit_env : '';
extradefines : 'UNDER_CE;WINDOWS;UNICODE';
extradefines : 'UNDER_CE;WINDOWS;FPC_OS_UNICODE';
exeext : '.exe';
defext : '.def';
scriptext : '.bat';
@ -239,7 +239,7 @@ unit i_win;
tf_safecall_exceptions,tf_no_backquote_support];
cpu : cpu_i386;
unit_env : '';
extradefines : 'UNDER_CE;WINDOWS;UNICODE';
extradefines : 'UNDER_CE;WINDOWS;FPC_OS_UNICODE';
exeext : '.exe';
defext : '.def';
scriptext : '.bat';

View File

@ -202,7 +202,7 @@ var
Stream: TResourceStream;
begin
FreeResources;
Stream := TResourceStream.CreateFromID(Instance, 1, {$ifdef UNICODE}PWideChar{$else}PChar{$endif}(RT_VERSION));
Stream := TResourceStream.CreateFromID(Instance, 1, {$ifdef FPC_OS_UNICODE}PWideChar{$else}PChar{$endif}(RT_VERSION));
try
FVersionInfo:=TVersionResource.Create;
FVersionInfo.SetCustomRawDataStream(Stream);

View File

@ -83,6 +83,9 @@ interface
// ======== Define options for TRegExpr engine
{.$DEFINE UniCode} // Unicode support
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
{$DEFINE RegExpPCodeDump} // p-code dumping (see Dump method)
{$IFNDEF FPC} // the option is not supported in FreePascal
{$DEFINE reRealExceptionAddr} // exceptions will point to appropriate source line, not to Error procedure

View File

@ -52,6 +52,10 @@
unit cpl;
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses Windows;
@ -244,4 +248,4 @@ const
implementation
end.
end.

View File

@ -25,6 +25,10 @@ unit imm;
{$CALLING cdecl}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses Windows;
@ -1381,4 +1385,4 @@ function ImmGetKeyboardLayout(dwThreadId:DWORD):HKL; external ImmDLL name 'ImmGe
implementation
end.
end.

View File

@ -32,6 +32,10 @@ unit mmsystem;
{$CALLING cdecl}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses Windows, mmreg;

View File

@ -34,6 +34,10 @@ unit wininet;
{$CALLING cdecl}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses Windows;

View File

@ -43,6 +43,10 @@ Unit CommCtrl;
Interface
{$Mode ObjFPC}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
Uses Windows,CTypes,ActiveX;
// --------------------

View File

@ -20,6 +20,10 @@ interface
{$ifndef Win64}
{$packrecords 1}
{$endif}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
uses windows;
Type

View File

@ -29,6 +29,10 @@ Uses Windows;
{$define imagehlp64}
{$endif}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
Const
IMAGE_SEPARATION = 64*1024;
DBHHEADER_DEBUGDIRS = $1;
@ -1599,4 +1603,4 @@ begin
p64^.SystemRangeStart := p32^.SystemRangeStart;
end;
end.
end.

View File

@ -19,6 +19,10 @@ uses
{$PACKRECORDS C}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
// IME_Codes
// bit field for conversion mode
const

View File

@ -11,6 +11,10 @@ Unit mmsystem;
{$smartlink on}
{$endif}
{$MODE DELPHI}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses
windows;

View File

@ -30,6 +30,10 @@ unit MultiMon;
{$mode objfpc}{$H+}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses

View File

@ -4,6 +4,10 @@ unit richedit;
{$mode objfpc}
{$calling stdcall}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
uses Messages, Windows;

View File

@ -22,6 +22,10 @@
{$calling stdcall}
{$mode objfpc}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
Unit ShellApi;
//+-------------------------------------------------------------------------

View File

@ -16,6 +16,10 @@ unit wininet;
{$smartlink on}
{$endif}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
Uses Windows;
@ -2774,4 +2778,4 @@ implementation
result:=(gtype and GOPHER_TYPE_GOPHER_PLUS)=0;
end;
end.
end.

View File

@ -8,7 +8,7 @@ type
TFPResourceHandle = PtrUInt;
TFPResourceHMODULE = PtrUInt;
TFPResourceHGLOBAL = PtrUInt;
{$ifdef UNICODE}
{$ifdef FPC_OS_UNICODE}
{roozbeh : maybe it shoud be moved after ifndef mswindows,as there is one declared in wince,base.inc}
MAKEINTRESOURCE = pwidechar;
{$else}

View File

@ -998,7 +998,7 @@ type
{ TResourceStream }
{$ifdef UNICODE}
{$ifdef FPC_OS_UNICODE}
TResourceStream = class(TCustomMemoryStream)
private
Res: TFPResourceHandle;
@ -1020,7 +1020,7 @@ type
constructor CreateFromID(Instance: TFPResourceHMODULE; ResID: Integer; ResType: PChar);
destructor Destroy; override;
end;
{$endif UNICODE}
{$endif FPC_OS_UNICODE}
{ TStreamAdapter }

View File

@ -872,7 +872,7 @@ end;
{* TResourceStream *}
{****************************************************************************}
{$ifdef UNICODE}
{$ifdef FPC_OS_UNICODE}
procedure TResourceStream.Initialize(Instance: TFPResourceHMODULE; Name, ResType: PWideChar; NameIsID: Boolean);
begin
Res:=FindResource(Instance, Name, ResType);
@ -900,7 +900,7 @@ constructor TResourceStream.CreateFromID(Instance: TFPResourceHMODULE; ResID: In
inherited create;
Initialize(Instance,PWideChar(ResID),ResType,True);
end;
{$else UNICODE}
{$else FPC_OS_UNICODE}
procedure TResourceStream.Initialize(Instance: TFPResourceHMODULE; Name, ResType: PChar; NameIsID: Boolean);
begin
@ -929,7 +929,7 @@ constructor TResourceStream.CreateFromID(Instance: TFPResourceHMODULE; ResID: In
inherited create;
Initialize(Instance,pchar(PtrInt(ResID)),ResType,True);
end;
{$endif UNICODE}
{$endif FPC_OS_UNICODE}
destructor TResourceStream.Destroy;

View File

@ -120,15 +120,15 @@ type
UINT = cardinal;
BOOL = longbool;
// WCHAR = word;
{$ifdef UNICODE}
{$ifdef FPC_OS_UNICODE}
LPTCH = ^word;
LPTSTR = ^word;
LPCTSTR = ^word;
{$else UNICODE}
{$else FPC_OS_UNICODE}
LPTCH = ^char;
LPTSTR = ^char;
LPCTSTR = ^char;
{$endif UNICODE}
{$endif FPC_OS_UNICODE}
LPWSTR = ^wchar;
PVOID = pointer;
LPVOID = pointer;

View File

@ -14,6 +14,10 @@ unit WinSock2;
{$smartlink on}
{$endif}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
Uses Windows;

View File

@ -25,6 +25,10 @@ unit windows;
{$inline on}
{$calling stdcall}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
{$define read_interface}

View File

@ -25,6 +25,10 @@ unit windows;
{$inline on}
{$calling stdcall}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
{$define read_interface}

View File

@ -13,8 +13,6 @@
**********************************************************************}
{$define UNICODE} //ce is unicode only, needed here for classes.inc
{$mode objfpc}
{ determine the type of the resource/form file }

View File

@ -28,6 +28,10 @@ unit windows;
{ convention is cdecl for WinCE API}
{$calling cdecl}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface

View File

@ -19,6 +19,9 @@ unit winsock;
{ convention is cdecl for WinCE API}
{$calling cdecl}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
{remaining functions exported from ws2.dll and not used yet = to do,

View File

@ -18,6 +18,10 @@ unit WinSock2;
{ convention is cdecl for WinCE API}
{$calling cdecl}
{$ifdef FPC_OS_UNICODE}
{$define UNICODE}
{$endif}
interface
Uses Windows;