[Proj] New version of PROJ.4 for Windows CE

Mateusz Loskot mateusz at loskot.net
Fri Nov 17 16:42:27 EST 2006


Frank Warmerdam wrote:
> Mateusz Loskot wrote:
>> Hi,
>>
>> After latest comments to my PROJ.4 port for Windows CE platform
>> I cleaned it and here it is in new shape:
>>
>> 1. Changed files:
> ...
>> Here is patch all with changes:
>> http://mateusz.loskot.net/tmp/proj-wince-mloskot-20061116.patch
> 
> Mateusz,
> 
> I would prefer to move #include <errno.h> (or the WCE alternative) into
> projects.h to avoid having to have this issue in so many places. 

Frank,

You're right.
I created proxy-file called errno.h which directly includes my extension
wce_errno.h. So, now, there is no need to use any #ifdef's and the code
is cleaner.

> Likewise the assert.h stuff.

Unfortunately, it's not possible to do it in a clean way.
assert.h is present in Windows CE SDK and it pulls whole Windows API.
Next, Windows API defines symbol called LP which also is used by PROJ.4.
So if WinCE's assert.h is included, names conflict occurs.
That's why I added dummy assert() macro that compiles regardless
_DEBUG/NDEBUG macros definition.

> What does "fprintf(stderr,...)" do on windows CE?  If this compiles but
> does nothing useful, perhaps we could just "#define getenv(x) NULL"
> in projects.h for wince to reduce the number of places we have ifdefs.

fprintf(stderr, ...) compiles for Windows CE, so there is no
need to hack it.
Regarding getenv, on Windows CE, there is no such a term like
environment variable, so there is no API to get/set env variables -
nothing to wrap or port.
For clean workaround, I added dummy version of getenv() called
wceex_getenv() which always returns NULL.
Next, projects.h header maps wceex_getenv() to getenv name.
This way, I've managed to remove all #ifdef's around fprintf/getenv
functions.


Finally, after this cleaning explained above the changeset for
Windows CE port is much smaller than the initial one :-)

Only following files are changed:

src/nad_init.c
src/pj_gridinfo.c
src/pj_gridlist.c
src/pj_open_lib.c
src/projects.h

and here is the patch - also pretty smals:

http://mateusz.loskot.net/tmp/proj-wince-mloskot-20061117.patch

As we've discussed on the IRC, I'll commit the Windows CE port based
on the new and cleaner changeset. Thanks!

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net


More information about the Proj mailing list