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 Bob Vaughn <Bo...@Telestream.net> on 2001/04/03 19:12:48 UTC

Porting Xerces To VxWorks

Since I have got about 5 requests over the last few months for my
experiences porting Xerces to VxWorks, I thought I should post them for all
to use.  Thanks to everyone on the mailing list for helping me get Xerces up
and running.


Here are roughly the steps I used to port the Xerces C++ XML parser to
VxWorks. You have to use Tornado II since Xerces heavily relies on exception
handling. My target processor is the Intel I960 and I'm using the gcc 2.7.2
compiler that came with Tornado. I didn't use any of the makefiles that came
with Xerces.

1) Start with a stable Xerces build. I used one of the 1.3 nightly's and
haven't got around to upgrading to 1.4 yet. Expand the Xerces source code
tree in your local environment where you want to compile it.

2) Modify src/util/AutoSense.hpp with the following lines towards the bottom
of the file:

	#elif defined(VXWORKS)
		#define XML_VXWORKS

3) Modify src/util/Compilers/GCCDefs.hpp so that the toupper() and tolower()
inline functions are NOT included in the build. Wrap them with a #ifndef
VXWORKS. VxWorks has its own upper/lower functions. You also might have to
exclude the function prototypes for stricmp() and/or strnicmp() depending on
what header files came with your version of VxWorks.

4) Modify src/util/Compilers/GCCDefs.cpp so that the strcasecmp() and
strncasecmp() functions are defined. Wrap them with a #ifdef VXWORKS (you
will also need to include <ctype.h> inside that ifdef. I copied the code for
these functions directly from the OS400SetDefs.cpp file. I also had to
exclude the #include for <strings.h> for VXWORKS since there isn't a file of
that name. The other alternative is to create new strings.h and strings.cpp
files with those functions in them.

5) Modify src/util/XercesDefs.hpp to include the following lines towards the
middle of the file:

	#if defined(XML_VXWORKS)
	#include <util/Platforms/VxWorks/VxWorksDefs.hpp>
	#endif

6) Create a directory under src/util/Platforms called VxWorks. Inside that
directory I created 5 new files based on some existing files that were close
to what I needed.

new file			based on
------------------------	--------------------------------------
VxWorksDefs.hpp		src/util/Platforms/OS400/OS400Defs.hpp
VxWorksPlatformUtils.hpp	src/util/Platforms/OS400/OSPlatformUtils.hpp
VxWorksPlatformUtils.cpp	src/util/Platforms/OS400/OSPlatformUtils.cpp
VxWorksTransService.hpp	src/util/Transcoders/Iconv/IconvTransService.hpp
VxWorksTransService.cpp	src/util/Transcoders/Iconv/IconvTransService.cpp

Go through all those new files and change all occurrences of Iconv or OS400
to VxWorks. These files seemed closest to what I needed for VxWorks.  There
is lots of other things to do in these files but basically I just hacked
them up until they compiled. I am only using the Local Code Page transcoders
at this time. The xxxTransService files technically belong over somewhere
under src/util/Transcoders but I wanted to keep all of my new files in one
place so it would be easy to update the Xerces code tree when new builds are
available.

7) Ask a bunch of dumb questions to the Xerces mailing list and read the
FAQs.  These porting instructions are based on those.

8) If you are going to build anything in the samples directory, you might
have to edit it and change "main" to something else. That caused problems in
my build.

9) Now here is the complicated part... what files in what directories are
needed. Since you probably can't use the makefiles that came with Xerces,
here are the files I used:

All .cpp files from src/dom except for CommonParentNode.cpp
All .cpp files from src/framework
All .cpp files from src/internal
All .cpp files from src/parsers
All .cpp files from src/sax
All .cpp files but no .c files from src/util
GCCDefs.cpp from src/util/Compilers
All .cpp files from src/util/MsgLoaders/InMemory
All .cpp files that were created in src/util/Platforms/VxWorks
All .cpp files from src/validators/DTD
Add an empty file called memory.h to src/validators/DTD since string.h is
already included elsewhere and does the same thing in VxWorks land. Having
this empty file to include will make CMStateSet.hpp happy.

Depending on how you use Tornado or some other development environment tool,
you may be able to include all the files into one big "project" -- I didn't
do that though. I shoe-horned the Xerces source code tree into our own
source code tree and just included the appropriate directories and files in
the build. I would post our convoluted makefiles but it would set you back
years. [:>

10) That's about it... The bulk of the work is in customizing
VxWorksPlatformUtils.cpp and VxWorksTransService.cpp. I only did the minimum
amount necessary in those files but will probably have to beef them up and
maybe do some optimization once I really start using this stuff in earnest.

-- Bob Vaughn
Telestream, Inc.
http://www.telestream.net/




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org