|
 |  |  |  | How can I port Xerces to my favourite platform? |  |  |  |  |
| |
All platform dependent code in Xerces has been isolated to
a couple of files, which should ease the porting effort.
Here are the basic steps that should be followed to port
Xerces.
- The directory 'src/util/Platforms' contains the
platform sensitive files while 'src/util/Compilers' contains all
development environment sensitive files. Each
operating system has a file of its own and each
development environment has another one of its own too.
As an example, the Win32 platform as a Win32Defs.hpp file
and the Visual C++ environment has a VCPPDefs.hpp file.
These files set up certain define tokens, typedefs,
constants, etc... that will drive the rest of the code to
do the right thing for that platform and development
environment. AIX/CSet have their own AIXDefs.hpp and
CSetDefs.hpp files, and so on. You should create new
versions of these files for your platform and environment
and follow the comments in them to set up your own.
Probably the comments in the Win32 and Visual C++ will be
the best to follow, since that is where the main
development is done.
- Next, edit the file XML4CDefs.hpp , which is where all
of the fundamental stuff comes into the system. You will
see conditional sections in there where the above
per-platform and per-environment headers are brought in.
Add the new ones for your platform under the appropriate
conditionals.
- Now edit 'AutoSense.hpp'. Here we set canonical Xerces
internal #define tokens which indicate the platform and
compiler. These definitions are based on known platform
and compiler defines.
AutoSense.hpp is included in XML4CDefs.hpp and the
canonical platform and compiler settings thus defined will
make the particular platform and compiler headers to be
the included at compilation.
It might be a little tricky to decipher this file so be
careful. If you are using say another compiler on Win32,
probably it will use similar tokens so that the platform
will get picked up already using what is already there.
- Once this is done, you will then need to implement a
version of the 'platform utilities' for your platform.
Each operating system has a file which implements some
methods of the XMLPlatformUtils class, specific to that
operating system. These are not terribly complex, so it
should not be a lot of work. The Win32 verions is called
Win32PlatformUtils.cpp, the AIX version is
AIXPlatformUtils.cpp and so on. Create one for your
platform, with the correct name, and empty out all of the
implementation so that just the empty shells of the
methods are there (with dummy returns where needed to make
the compiler happy.) Once you've done that, you can start
to get it to build without any real implementation.
- Once you have the system building, then start
implementing your own platform utilties methods. Follow
the comments in the Win32 version as to what they do, the
comments will be improved in subsequent versions, but they
should be fairly obvious now. Once you have these
implementations done, you should be able to start
debugging the system using the demo programs.
That is the work required in a nutshell.
|
|