Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2006-10

Patch for fixing CE compilation

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marc Weustink

Hi,
This patch fixes CE compilation.
I would have applied it myself, but I've some questions about the common win dir and the wince implementation in the rtl.

The main fix was changing the definition of TCHAR=Word into a TCHAR=WideChar for UNICODE

This is declared in both wince/wininc/base.inc and win/wininc/base.inc I changed them both, since IMO win32/64 would have the same problem if UNICODE was defined.
At the same time I wondered why there are 2 declarations. Why isn't wince ising the win definition as well ?

Same counts for instance for socket.pp, why are there 2 ?

Further, not related to this fix, but just noticed it, I commented the declatarion of WCHAR in both base.inc.
AFAICS, WCHAR is defined in systemh and IMO there is no reason to define it elsewhere again. I guess more cases are present. Is there a reason for this (other than a leftover form the past) ?

Marc

Reply by email

Oro06
to Marc Weustink
Marc Weustink wrote
Hi,

hi,

Show quoted text 5 lines
This patch fixes CE compilation. I would have applied it myself, but I've some questions about the common win dir and the wince implementation in the rtl.

you can apply it

Show quoted text 20 lines
The main fix was changing the definition of TCHAR=Word into a TCHAR=WideChar for UNICODE This is declared in both wince/wininc/base.inc and win/wininc/base.inc I changed them both, since IMO win32/64 would have the same problem if UNICODE was defined. At the same time I wondered why there are 2 declarations. Why isn't wince ising the win definition as well ? Same counts for instance for socket.pp, why are there 2 ? Further, not related to this fix, but just noticed it, I commented the declatarion of WCHAR in both base.inc. AFAICS, WCHAR is defined in systemh and IMO there is no reason to define it elsewhere again. I guess more cases are present. Is there a reason for this (other than a leftover form the past) ?

from ealry stage of arm/wince port api fork was decided moslty for 2 reasons :
1- not polluting win32 api with too much ifdefs
2- wince sysgen is not the same for wince and win32 (so even for ms it's forked)

now , after one year feedback
the fact is that there not so much differences (few consts and records, calling convention)
so maybe some cleaning could be done in that way
arm/wince compiler is now running very well, i guess a priorised todo for next release could be done :)

Show quoted text 112 lines
Marc ------------------------------------------------------------------------ Index: wince/wininc/base.inc =================================================================== --- wince/wininc/base.inc (revision 5038) +++ wince/wininc/base.inc (working copy) @@ -256,7 +256,7 @@ SIZE_T = Cardinal; //+winnt {$ifdef UNICODE} TBYTE = word; - TCHAR = word; + TCHAR = widechar; BCHAR = word; {$else} TBYTE = byte; @@ -265,7 +265,7 @@ {$endif} UCHAR = byte; //windef - WCHAR = WideChar; //winnt +// WCHAR = WideChar; //winnt UINT = Cardinal; //windef ULONG = Cardinal; //windef Index: wince/sockets.pp =================================================================== --- wince/sockets.pp (revision 5038) +++ wince/sockets.pp (working copy) @@ -284,7 +284,7 @@ Function SocketPair(Domain,SocketType,Protocol:Longint;var Pair:TSockArray):Longint; begin - SocketPair:=fpsocketpair(domain,sockettype,protocol,@pair); + SocketPair:=fpsocketpair(domain,sockettype,protocol,@pair[1]); end; { mimic the linux fpWrite/fpRead calls for the file/text socket wrapper } Index: wince/dos.pp =================================================================== --- wince/dos.pp (revision 5038) +++ wince/dos.pp (working copy) @@ -256,7 +256,7 @@ repeat if fd.dwFileAttributes and dev_attr = dev_attr then begin len:=0; - while fd.cFileName[len] 0 do + while fd.cFileName[len] #0 do Inc(len); len:=(len + 2)*SizeOf(WideChar); GetMem(DriveNames[i], len); Index: wince/sysutils.pp =================================================================== --- wince/sysutils.pp (revision 5038) +++ wince/sysutils.pp (working copy) @@ -290,7 +290,7 @@ WinToDosTime(F.FindData.ftLastWriteTime,F.Time); f.size:=F.FindData.NFileSizeLow; f.attr:=F.FindData.dwFileAttributes; - PWideCharToString(@F.FindData.cFileName, f.Name); + PWideCharToString(@F.FindData.cFileName[0], f.Name); Result:=0; end; @@ -631,7 +631,7 @@ nil, ErrorCode, 0, - @MsgBuffer, { This function allocs the memory } + PWideChar(@MsgBuffer), { This function allocs the memory (in this case you pass a PPwidechar)} 0, nil); while (len > 0) and (MsgBuffer[len - 1] <= #32) do @@ -737,7 +737,7 @@ WinCEMajorVersion:=versionInfo.dwMajorVersion; WinCEMinorVersion:=versionInfo.dwMinorVersion; WinCEBuildNumber:=versionInfo.dwBuildNumber; - i:=WideToAnsiBuf(@versioninfo.szCSDVersion, -1, @WinCECSDVersion[1], SizeOf(WinCECSDVersion) - 1); + i:=WideToAnsiBuf(@versioninfo.szCSDVersion[0], -1, @WinCECSDVersion[1], SizeOf(WinCECSDVersion) - 1); if i 0 then WinCECSDVersion[0]:=chr(i - 1); end; Index: win/wininc/base.inc =================================================================== --- win/wininc/base.inc (revision 5038) +++ win/wininc/base.inc (working copy) @@ -243,7 +243,7 @@ {$ifdef UNICODE} TBYTE = word; - TCHAR = word; + TCHAR = widechar; BCHAR = word; {$else} TBYTE = byte; @@ -252,7 +252,7 @@ {$endif} UCHAR = byte; - WCHAR = WideChar; +// WCHAR = WideChar; UINT = cardinal; ULONG = cardinal; ------------------------------------------------------------------------ _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Marc Weustink
to Oro06
Oro06 wrote 9 lines
Marc Weustink wrote: > Hi, > hi, > This patch fixes CE compilation. > I would have applied it myself, but I've some questions about the common > win dir and the wince implementation in the rtl. > you can apply it

OK, I'll do.

Another question left for the other win devels:

Show quoted text 5 lines
> Further, not related to this fix, but just noticed it, I commented > the declatarion of WCHAR in both base.inc. > AFAICS, WCHAR is defined in systemh and IMO there is no reason to > define it elsewhere again. I guess more cases are present. > Is there a reason for this (other than a leftover form the past) ?

is it OK to remove the extra declarations ?

[snip]

Show quoted text 8 lines
> At the same time I wondered why there are 2 declarations. Why isn't > wince ising the win definition as well ? > Same counts for instance for socket.pp, why are there 2 ? > from ealry stage of arm/wince port api fork was decided moslty for 2 reasons : 1- not polluting win32 api with too much ifdefs

I already thought so. IIRC, at that time there was only win32 (and no win)

Show quoted text 9 lines
2- wince sysgen is not the same for wince and win32 (so even for ms it's forked) now , after one year feedback the fact is that there not so much differences (few consts and records, calling convention) so maybe some cleaning could be done in that way arm/wince compiler is now running very well, i guess a priorised todo for next release could be done :)

OK

Marc

Reply by email

Vincent Snijders
to Marc Weustink
Marc Weustink wrote 13 lines
Oro06 wrote: > Marc Weustink wrote: >> Hi, >> > hi, >> This patch fixes CE compilation. >> I would have applied it myself, but I've some questions about the common >> win dir and the wince implementation in the rtl. >> > you can apply it Done, r5135

Currently fpc 2.1.1 is broken on windows. Maybe it has to do something with this change?

c:/lazarus/source/fpcbuild/2.1/fpcsrc/compiler/ppc386.exe -Ur -Xs -O2 -n
-FuC:/lazarus/source/fpcbuild/2.1/fpcsrc/rtl/units/i386-win32 -FE.
-FUunits/i386-win32 -g -gl -Ur -CX -di386 -dRELEASE buildjwa.pp
jwawintype.pas(164,45) Error: Identifier not found "WCHAR"
jwawintype.pas(164,76) Error: Error in type definition
jwawintype.pas(169,17) Error: Type "WCHAR" is not completely defined
jwawintype.pas(171,16) Error: Type "WCHAR" is not completely defined
jwawintype.pas(173,18) Error: Type "WCHAR" is not completely defined
jwawintype.pas(175,17) Error: Type "WCHAR" is not completely defined
jwawintype.pas(177,18) Error: Type "WCHAR" is not completely defined
jwawintype.pas(734,18) Error: Illegal type conversion: "ShortInt" to "<erroneous type>"
jwawintype.pas(734,26) Error: Illegal expression
jwawintype.pas(1663,1) Fatal: There were 9 errors compiling module, stopping
Fatal: Compilation aborted

Vincent

Reply by email

Peter Vreman
to Vincent Snijders
you wrote 31 lines
Marc Weustink schreef: >Oro06 wrote: >>Marc Weustink wrote: >>>Hi, >>> >>hi, >>>This patch fixes CE compilation. >>>I would have applied it myself, but I've some questions about the common >>>win dir and the wince implementation in the rtl. >>> >>you can apply it >Done, r5135 Currently fpc 2.1.1 is broken on windows. Maybe it has to do something with this change? c:/lazarus/source/fpcbuild/2.1/fpcsrc/compiler/ppc386.exe -Ur -Xs -O2 -n -FuC:/lazarus/source/fpcbuild/2.1/fpcsrc/rtl/units/i386-win32 -FE. -FUunits/i386-win32 -g -gl -Ur -CX -di386 -dRELEASE buildjwa.pp jwawintype.pas(164,45) Error: Identifier not found "WCHAR" jwawintype.pas(164,76) Error: Error in type definition jwawintype.pas(169,17) Error: Type "WCHAR" is not completely defined jwawintype.pas(171,16) Error: Type "WCHAR" is not completely defined jwawintype.pas(173,18) Error: Type "WCHAR" is not completely defined jwawintype.pas(175,17) Error: Type "WCHAR" is not completely defined jwawintype.pas(177,18) Error: Type "WCHAR" is not completely defined jwawintype.pas(734,18) Error: Illegal type conversion: "ShortInt" to "<erroneous type>" jwawintype.pas(734,26) Error: Illegal expression jwawintype.pas(1663,1) Fatal: There were 9 errors compiling module, stopping Fatal: Compilation aborted

Fixed

Peter

Reply by email

Marc Weustink
to Peter Vreman
Peter Vreman wrote 20 lines
At 09:08 1-11-2006, you wrote: > Marc Weustink schreef: >> Oro06 wrote: >>> Marc Weustink wrote: >>>> Hi, >>>> >>> hi, >>>> This patch fixes CE compilation. >>>> I would have applied it myself, but I've some questions about the >>>> common >>>> win dir and the wince implementation in the rtl. >>>> >>> you can apply it >> Done, r5135 > > Currently fpc 2.1.1 is broken on windows. Maybe it has to do something > with this change? > Fixed

:(

thought that I had compiled all.

(maybe add a comment why it is defined twice ?)

Marc

Reply by email