[xsde-users] Re: Type Maps & generated code results

Eric Broadbent eric.broadbent at csr.com
Mon Dec 5 12:09:53 EST 2011


I decided to try making a change to the library.map in the examples, and regenerate the skeleton and implementation code to see whether and how it reflects the new mapping.

The file library.map was changed to look like this:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace http://www.codesynthesis.com/library library
{
  include "library.hxx";

  isbn    isbn_C_struct* isbn_C_struct;
}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This allows for a simple search on "C_struct" to tell where the mapping is activated.
Accordingly, I changed the operative part of the library.hxx file to look like this:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace library
{
  //
  //
  typedef unsigned int isbn_C_struct;

}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I removed all the other .cxx and .hxx files - made some makefile changes (to get the driver to be rebuilt), and regenerated all the code.
I don't find any instances of "isbn_C_struct" in the generated code - which otherwise is compiled/linked/run fine and operates normally - but it doesn't allow the access to parsed schema elements that --type-map is supposed to support.

I'm at a loss to know what to do to get the --type-map option to work.
Any help is greatly appreciated.  I can send the three files I changed if that helps:
	library.map
	library.hxx
	makefile

Thanks.
-Eric B.

On Dec 5, 2011, at 12:14 AM, Eric Broadbent wrote:

> I have two different sets of code generated with the same schemas and same basic commands, but one uses a type map file along with the --type-map command, and the other doesn't.  When I compare the generated code, there are no diffs, and the return type from the "post_<type>()" method is still void.
> 
> I know that XSDe is at least scanning my type map file because I first had normal C-style comments in there and I got error messages.
> 
> I am also using the "--namespace-map" option, and am supplying the same namespace mapping in the map file.
> For example, this is in library.map in the .../examples/cxx/parser/library/library.map
> 
>  namespace http://www.codesynthesis.com/library library
> 
> so as far as I can tell the command line used to generate the parser-code should have also included "--namespace-map http://www.codesynthesis.com/library=library"
> This is the convention that I'm using in my map file.
> 
> I see that in the examples (library.map and library-pimpl.cxx), the generated code has lines comments indicating where one needs to fill in code to build the object to return in the post_<type>() method:
> 
>    // TODO
>    //
>    // return ... ;
> 
> However I don't see any lines like this in the code I'm generating, so I must be doing something wrong.
> 
> Given a correct command invocation and a properly formed type map, is there anything else besides the "--type-map" option that we need to do to get the parser to generate the code to use our schema-to-C mappings?
> If not, how should I go about debugging this?  I thought that perhaps putting some garbage mappings in the map file would help to illuminate the problem, but they were consumed without any indication of a problem.
> 
> Thanks for any advice,
> 
> -Eric B.
> 
> 
> 
> 
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog
> 
> 
> 
> To report this email as spam click https://www.mailcontrol.com/sr/k3G6A+!G!X3TndxI!oX7Ulvwl1GqFAPrg!Mws13yRuY6A+OyJ60KZ!P9U7BY3q+!TTBbJCW1sDWbYw94u+b0NQ== .




More information about the xsde-users mailing list