[xsd-users] Program Crash with message : basic_string::_S_construct null not valid

Vishwanath Kale vishkale at gmail.com
Wed Dec 7 16:17:37 EST 2011


Boris, Thank you for your Response.

Yes, I agree XSD version is very old. I would like to keep it that way,
till the time i get the open source (SRC SRGS code) program up and running.

I am attaching the full src code with main.cpp.

1. srgs_parser - main.cpp
2. libsrgs\srgs - sub_main.cpp sub_main entry point.
3. libsrgs\srgs - grammar.cxx function: make_grammar <-- Issue is in this
function

I have located a line which is causing the  basic_string::_S_construct null
not valid.

When the function below is called

grammar_p.parsers(rule_p,
                          lexicon_p,
                          meta_p,
                          string_p,
                          tag_p,
                          Tag_format_datatype_p,
                          Version_datatype_p,
                          lang_p,
                          string_p,        // base
                          Root_datatype_p,
                          Mode_datatype_p);

Which is implemented in srgs-parser-templates.ixx

        template < typename _xsd_rule_, typename _xsd_lexicon_, typename
_xsd_meta_, typename _xsd_metadata_, typename _xsd_tag_, typename
_xsd_tag_format_, typename _xsd_version_, typename _xsd_lang_, typename
_xsd_base_, typename _xsd_root_, typename _xsd_mode_ >
        inline
        void grammar< _xsd_rule_, _xsd_lexicon_, _xsd_meta_,
_xsd_metadata_, _xsd_tag_, _xsd_tag_format_, _xsd_version_, _xsd_lang_,
_xsd_base_, _xsd_root_, _xsd_mode_ >::
        parsers (::xsd::cxx::parser::parser< _xsd_rule_, char >& rule,
                 ::xsd::cxx::parser::parser< _xsd_lexicon_, char >& lexicon,
                 ::xsd::cxx::parser::parser< _xsd_meta_, char >& meta,
                 ::xsd::cxx::parser::parser< _xsd_metadata_, char >&
metadata,
                 ::xsd::cxx::parser::parser< _xsd_tag_, char >& tag,
                 ::xsd::cxx::parser::parser< _xsd_tag_format_, char >&
tag_format,
                 ::xsd::cxx::parser::parser< _xsd_version_, char >& version,
                 ::xsd::cxx::parser::parser< _xsd_lang_, char >& lang,
                 ::xsd::cxx::parser::parser< _xsd_base_, char >& base,
                 ::xsd::cxx::parser::parser< _xsd_root_, char >& root,
                 ::xsd::cxx::parser::parser< _xsd_mode_, char >& mode)
        {
          // this->_xsd_rule__ = &rule;
          this->_xsd_lexicon__ = &lexicon;
          this->_xsd_meta__ = &meta;
          this->_xsd_metadata__ = &metadata;
          this->_xsd_tag__ = &tag;
          this->_xsd_tag_format__ = &tag_format;
          this->_xsd_version__ = &version;
          this->_xsd_lang__ = &lang;
          this->_xsd_base__ = &base;
          this->_xsd_root__ = &root;
          this->_xsd_mode__ = &mode;
        }

If i comment out  this line this->_xsd_rule__ = &rule; and keep rest as is.
basic_string::_S_construct null not valid error is not thrown. The
exception goes away though by commenting this line the the SRGS parsing is
not complete, as i don't have srgs rule element parsed.

Any idea? Is it something to do with rule tag in srgs.xsd? The rule tage
element NULL etc?

Thank you for all your help

*
*
*On Tue, Dec 6, 2011 at 5:13 PM, Vishwanath Kale <vishkale at gmail.com> wrote:
*

> Boris, Thank you for your Response.
>
> Yes, I agree XSD version is very old. I would like to keep it that way,
> till the time i get the open source (SRC SRGS code) program up and running.
>
> I am attaching the full src code with main.cpp.
>
> 1. srgs_parser - main.cpp
> 2. libsrgs\srgs - sub_main.cpp sub_main entry point.
> 3. libsrgs\srgs - grammar.cxx function: make_grammar <-- Issue is in this
> function
>
> I have located a line which is causing the  basic_string::_S_construct
> null not valid.
>
> When the function below is called
>
> grammar_p.parsers(rule_p,
>                           lexicon_p,
>                           meta_p,
>                           string_p,
>                           tag_p,
>                           Tag_format_datatype_p,
>                           Version_datatype_p,
>                           lang_p,
>                           string_p,        // base
>                           Root_datatype_p,
>                           Mode_datatype_p);
>
> Which is implemented in srgs-parser-templates.ixx
>
>         template < typename _xsd_rule_, typename _xsd_lexicon_, typename
> _xsd_meta_, typename _xsd_metadata_, typename _xsd_tag_, typename
> _xsd_tag_format_, typename _xsd_version_, typename _xsd_lang_, typename
> _xsd_base_, typename _xsd_root_, typename _xsd_mode_ >
>         inline
>         void grammar< _xsd_rule_, _xsd_lexicon_, _xsd_meta_,
> _xsd_metadata_, _xsd_tag_, _xsd_tag_format_, _xsd_version_, _xsd_lang_,
> _xsd_base_, _xsd_root_, _xsd_mode_ >::
>         parsers (::xsd::cxx::parser::parser< _xsd_rule_, char >& rule,
>                  ::xsd::cxx::parser::parser< _xsd_lexicon_, char >&
> lexicon,
>                  ::xsd::cxx::parser::parser< _xsd_meta_, char >& meta,
>                  ::xsd::cxx::parser::parser< _xsd_metadata_, char >&
> metadata,
>                  ::xsd::cxx::parser::parser< _xsd_tag_, char >& tag,
>                  ::xsd::cxx::parser::parser< _xsd_tag_format_, char >&
> tag_format,
>                  ::xsd::cxx::parser::parser< _xsd_version_, char >&
> version,
>                  ::xsd::cxx::parser::parser< _xsd_lang_, char >& lang,
>                  ::xsd::cxx::parser::parser< _xsd_base_, char >& base,
>                  ::xsd::cxx::parser::parser< _xsd_root_, char >& root,
>                  ::xsd::cxx::parser::parser< _xsd_mode_, char >& mode)
>         {
>           // this->_xsd_rule__ = &rule;
>           this->_xsd_lexicon__ = &lexicon;
>           this->_xsd_meta__ = &meta;
>           this->_xsd_metadata__ = &metadata;
>           this->_xsd_tag__ = &tag;
>           this->_xsd_tag_format__ = &tag_format;
>           this->_xsd_version__ = &version;
>           this->_xsd_lang__ = &lang;
>           this->_xsd_base__ = &base;
>           this->_xsd_root__ = &root;
>           this->_xsd_mode__ = &mode;
>         }
>
> If i comment out  this line this->_xsd_rule__ = &rule; and keep rest as
> is. basic_string::_S_construct null not valid error is not thrown. The
> exception goes away though by commenting this line the the SRGS parsing is
> not complete, as i don't have srgs rule element parsed.
>
> Any idea? Is it something to do with rule tag in srgs.xsd? The rule tage
> element NULL etc?
>
> Thank you for all your help
>
>
> On Sun, Dec 4, 2011 at 4:58 AM, Boris Kolpackov <boris at codesynthesis.com>wrote:
>
>> Hi Vishwanath,
>>
>> Vishwanath Kale <vishkale at gmail.com> writes:
>>
>>
>> > xsd : xsd-2.3.0-i686-windows
>>
>> This is a very, very old version of XSD. You may want to consider
>> upgrading, though the C++/Parser mapping in XSD 3-series is quite
>> different compared to XSD 2.3.0. So you may have to make quite a
>> few changes to your code.
>>
>>
>> > The full src file with few other files is attached to email as well.
>>
>> I couldn't try your code sine it doesn't include the test driver (i.e.,
>> the source file with main()). If you want me to investigate this
>> further, then you will need to send me (off list) a complete test.
>>
>> Boris
>>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: srgs_parser-20061217.zip
Type: application/zip
Size: 93057 bytes
Desc: not available
Url : http://codesynthesis.com/pipermail/xsd-users/attachments/20111207/e69401eb/srgs_parser-20061217-0001.zip


More information about the xsd-users mailing list