You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by David Ezell <Da...@Verifone.Com> on 2000/07/29 22:22:44 UTC

help with porting Xerces-c 1.2.0a to LynxOS 3.1.0

Hello everyone.  I hope this forum is the right place to post questions on
porting.  If it's not, please steer me.  I'm listing the issues I've encountered
in order to help anybody else who might come stumbling this way.

I'm attempting to port Xerces-C (1.2.0a) over to LynxOS v3.1.0.  Lynx is an
"embedded/realtime" Unix, and should have interoperability with Linux binaries
sometime soon (Bluecat).  Given that, I've chosen to use the Linux code as the
target for my hacking, and all the notes below refer to that model.
Specifically, I created my build environment using runConfigure...

	./runConfigure -p linux -c gcc -x g++ -m inmem -n fileonly -t native

My current situation:  I can compile and link the SAXCount example and the
DOMCount example.  The SAXCount example appears to work.  The DOMCount example
always returns 0 elements.  Given the nature of the hacks I've made (please see
below) I think I need a little guidance from the experts...

1) Lynx doesn't have definitions for wint_t or wctype_t, iswspace(), towupper()

	based on examples I could find, I added the following to a wchar.h
(which I also had to create).

	typedef wchar_t wint_t;
	typedef wchar_t wctype_t;

	Under Lynx, wchar_t is defined in stddef.h, along with some companion
wchar_t functions.  I had to add iswspace() and towupper().  These latter I
think will work ok.  I'm mainly concerned about the adequacy of the typedefs,
though they seem to work.

2) Lynx doesn't have definitions for stricmp(), strnicmp,strcasecmp()

	I created these, and they seem fine.

3) The implementation of wcstombs() and mbstowcs() doesn't appear to be
equivalent to what the Xerces code expects.

	Here's an example from util/Transcoders/Iconv/IconvTransService.cpp, 

	unsigned int IconvLCPTranscoder::calcRequiredSize(const char* const
srcText)
	{
	...
	        /* David Ezell hack */
	   // const unsigned int retVal = ::mbstowcs(NULL, srcText, 0);
	    const unsigned int retVal = (strlen(srcText)*2)+1;
	        /* end hack */
	...
	}

	The problem is that the Lynx version of mbstowcs() will never return
anything other than 0, causing the programs to fail.  My hack is to estimate a
buffer about twice the size of the single wide character rendition.  Is this
hack adequate (for now)?

4) Lynx doesn't have an implementation of realpath()

	The code for my "fix" (in util/Platforms/Linux/LinuxPlatformUtils.cpp)
affects XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath).
Essentially, it returns whatever is in srcPath.  This appears to work (I'm only
using local files). Does anyone know of a work around for systems which don't
have realpath() to implement getFullPath()?  I checked out Win32 but they just
make a call to the Win32 API.  I'm worried that
	it seems to work in my examples but may give trouble later.

5) Lynx doens't have an implementation of pthread_mutexattr_settype() or a
define for PTHREAD_MUTEX_RECURSIVE_NP

	Lynx *does* have pthread_mutexattr_init() and it also has a
PTHREAD_MUTEX_RECURSIVE.  After several threading failures, I've disabled
multi-threading.  Any idea how I can restore this functionality?

6) Lynx doesn't support dynamic link libraries

	I'm using regular old fatlinking.  I'll try static linking once things
are working better.

If anyone has any suggestions for how I might improve things, I'd very much
appreciate it.

Thanks,
David Ezell

VeriFone, a division of Hewlett-Packard
Ph:  727/953-4080
Fx: 727/953-4001


Re: help with porting Xerces-c 1.2.0a to LynxOS 3.1.0

Posted by Arundhati Bhowmick <ar...@hyperreal.org>.
I'd suggest you create a separate compiler option for lynx and
1. use the build switches that are appropriate for lynx
2. create its own lynxPlatformUtils file
3. Do not change generic files with platform specific changes
4. Check if bool is already defined for your system
5. If pthread_mutexattr_settype is not there then you might have to look at Solaris
support for faking this functionality
6. Both multi-thread and single thread support must be provided.

You're too good a hacker but the present kind of changes cannot be incorporated
unless it follows atleast the above guidelines

Arundhati

David Ezell wrote:

> Hello everyone.  I hope this forum is the right place to post questions on
> porting.  If it's not, please steer me.  I'm listing the issues I've encountered
> in order to help anybody else who might come stumbling this way.
>
> I'm attempting to port Xerces-C (1.2.0a) over to LynxOS v3.1.0.  Lynx is an
> "embedded/realtime" Unix, and should have interoperability with Linux binaries
> sometime soon (Bluecat).  Given that, I've chosen to use the Linux code as the
> target for my hacking, and all the notes below refer to that model.
> Specifically, I created my build environment using runConfigure...
>
>         ./runConfigure -p linux -c gcc -x g++ -m inmem -n fileonly -t native
>
> My current situation:  I can compile and link the SAXCount example and the
> DOMCount example.  The SAXCount example appears to work.  The DOMCount example
> always returns 0 elements.  Given the nature of the hacks I've made (please see
> below) I think I need a little guidance from the experts...
>
> 1) Lynx doesn't have definitions for wint_t or wctype_t, iswspace(), towupper()
>
>         based on examples I could find, I added the following to a wchar.h
> (which I also had to create).
>
>         typedef wchar_t wint_t;
>         typedef wchar_t wctype_t;
>
>         Under Lynx, wchar_t is defined in stddef.h, along with some companion
> wchar_t functions.  I had to add iswspace() and towupper().  These latter I
> think will work ok.  I'm mainly concerned about the adequacy of the typedefs,
> though they seem to work.
>
> 2) Lynx doesn't have definitions for stricmp(), strnicmp,strcasecmp()
>
>         I created these, and they seem fine.
>
> 3) The implementation of wcstombs() and mbstowcs() doesn't appear to be
> equivalent to what the Xerces code expects.
>
>         Here's an example from util/Transcoders/Iconv/IconvTransService.cpp,
>
>         unsigned int IconvLCPTranscoder::calcRequiredSize(const char* const
> srcText)
>         {
>         ...
>                 /* David Ezell hack */
>            // const unsigned int retVal = ::mbstowcs(NULL, srcText, 0);
>             const unsigned int retVal = (strlen(srcText)*2)+1;
>                 /* end hack */
>         ...
>         }
>
>         The problem is that the Lynx version of mbstowcs() will never return
> anything other than 0, causing the programs to fail.  My hack is to estimate a
> buffer about twice the size of the single wide character rendition.  Is this
> hack adequate (for now)?
>
> 4) Lynx doesn't have an implementation of realpath()
>
>         The code for my "fix" (in util/Platforms/Linux/LinuxPlatformUtils.cpp)
> affects XMLCh* XMLPlatformUtils::getFullPath(const XMLCh* const srcPath).
> Essentially, it returns whatever is in srcPath.  This appears to work (I'm only
> using local files). Does anyone know of a work around for systems which don't
> have realpath() to implement getFullPath()?  I checked out Win32 but they just
> make a call to the Win32 API.  I'm worried that
>         it seems to work in my examples but may give trouble later.
>
> 5) Lynx doens't have an implementation of pthread_mutexattr_settype() or a
> define for PTHREAD_MUTEX_RECURSIVE_NP
>
>         Lynx *does* have pthread_mutexattr_init() and it also has a
> PTHREAD_MUTEX_RECURSIVE.  After several threading failures, I've disabled
> multi-threading.  Any idea how I can restore this functionality?
>
> 6) Lynx doesn't support dynamic link libraries
>
>         I'm using regular old fatlinking.  I'll try static linking once things
> are working better.
>
> If anyone has any suggestions for how I might improve things, I'd very much
> appreciate it.
>
> Thanks,
> David Ezell
>
> VeriFone, a division of Hewlett-Packard
> Ph:  727/953-4080
> Fx: 727/953-4001
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org

--


Arundhati Bhowmick
IBM -- XML Technology Group (Silicon Valley)