summaryrefslogtreecommitdiff
path: root/xsd/xsd/cxx/parser/generator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'xsd/xsd/cxx/parser/generator.cxx')
-rw-r--r--xsd/xsd/cxx/parser/generator.cxx200
1 files changed, 117 insertions, 83 deletions
diff --git a/xsd/xsd/cxx/parser/generator.cxx b/xsd/xsd/cxx/parser/generator.cxx
index 91af898..b1acdbb 100644
--- a/xsd/xsd/cxx/parser/generator.cxx
+++ b/xsd/xsd/cxx/parser/generator.cxx
@@ -77,19 +77,19 @@ namespace CXX
"// along with this program; if not, write to the Free Software\n"
"// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n"
"//\n"
- "// In addition, as a special exception, Code Synthesis Tools CC gives\n"
- "// permission to link this program with the Xerces-C++ library (or with\n"
- "// modified versions of Xerces-C++ that use the same license as Xerces-C++),\n"
- "// and distribute linked combinations including the two. You must obey\n"
- "// the GNU General Public License version 2 in all respects for all of\n"
- "// the code used other than Xerces-C++. If you modify this copy of the\n"
- "// program, you may extend this exception to your version of the program,\n"
- "// but you are not obligated to do so. If you do not wish to do so, delete\n"
- "// this exception statement from your version.\n"
+ "// In addition, as a special exception, Code Synthesis gives permission\n"
+ "// to link this program with the Xerces-C++ library (or with modified\n"
+ "// versions of Xerces-C++ that use the same license as Xerces-C++), and\n"
+ "// distribute linked combinations including the two. You must obey the GNU\n"
+ "// General Public License version 2 in all respects for all of the code\n"
+ "// used other than Xerces-C++. If you modify this copy of the program, you\n"
+ "// may extend this exception to your version of the program, but you are\n"
+ "// not obligated to do so. If you do not wish to do so, delete this\n"
+ "// exception statement from your version.\n"
"//\n"
- "// Furthermore, Code Synthesis Tools CC makes a special exception for\n"
- "// the Free/Libre and Open Source Software (FLOSS) which is described\n"
- "// in the accompanying FLOSSE file.\n"
+ "// Furthermore, Code Synthesis makes a special exception for the Free/Libre\n"
+ "// and Open Source Software (FLOSS) which is described in the accompanying\n"
+ "// FLOSSE file.\n"
"//\n\n";
char const copyright_proprietary[] =
@@ -98,8 +98,7 @@ namespace CXX
"// This program was generated by CodeSynthesis XSD, an XML Schema\n"
"// to C++ data binding compiler, in the Proprietary License mode.\n"
"// You should have received a proprietary license from Code Synthesis\n"
- "// Tools CC prior to generating this code. See the license text for\n"
- "// conditions.\n"
+ "// prior to generating this code. See the license text for conditions.\n"
"//\n\n";
char const copyright_impl[] =
@@ -232,8 +231,11 @@ namespace CXX
throw Failed ();
}
+ bool gen_cxx (!ops.file_list_only ());
+
// Process names.
//
+ if (gen_cxx)
{
NameProcessor proc;
proc.process (ops, schema, file_path, string_literal_map);
@@ -245,7 +247,7 @@ namespace CXX
// Compute state machine info.
//
- if (validation)
+ if (gen_cxx && validation)
{
StateProcessor proc;
proc.process (schema, file_path);
@@ -254,6 +256,7 @@ namespace CXX
// Read-in type maps.
//
TypeMap::Namespaces type_map;
+ if (gen_cxx)
{
using namespace TypeMap;
@@ -376,6 +379,7 @@ namespace CXX
// Process types.
//
+ if (gen_cxx)
{
TypeProcessor proc;
proc.process (ops, schema, gen_driver, type_map);
@@ -559,135 +563,165 @@ namespace CXX
if (impl)
{
- if (!ops.force_overwrite ())
+ if (gen_cxx)
{
- WideInputFileStream tmp (
- hxx_impl_path.string ().c_str (), ios_base::in);
+ if (!ops.force_overwrite ())
+ {
+ WideInputFileStream tmp (
+ hxx_impl_path.string ().c_str (), ios_base::in);
- if (tmp.is_open ())
+ if (tmp.is_open ())
+ {
+ wcerr << hxx_impl_path << ": error: cowardly refusing to " <<
+ "overwrite an existing file" << endl;
+ throw Failed ();
+ }
+
+ tmp.close ();
+ }
+
+ hxx_impl.open (hxx_impl_path.string ().c_str (), ios_base::out);
+
+ if (!hxx_impl.is_open ())
{
- wcerr << hxx_impl_path << ": error: cowardly refusing to " <<
- "overwrite an existing file" << endl;
+ wcerr << hxx_impl_path << ": error: unable to open in write mode"
+ << endl;
throw Failed ();
}
- tmp.close ();
+ unlinks.add (hxx_impl_path);
}
- hxx_impl.open (hxx_impl_path.string ().c_str (), ios_base::out);
+ file_list.push_back (hxx_impl_path.string ());
- if (!hxx_impl.is_open ())
+ if (gen_cxx)
{
- wcerr << hxx_impl_path << ": error: unable to open in write mode"
- << endl;
- throw Failed ();
- }
+ if (!ops.force_overwrite ())
+ {
+ WideInputFileStream tmp (
+ cxx_impl_path.string ().c_str (), ios_base::in);
- unlinks.add (hxx_impl_path);
- file_list.push_back (hxx_impl_path.string ());
+ if (tmp.is_open ())
+ {
+ wcerr << cxx_impl_path << ": error: cowardly refusing to " <<
+ "overwrite an existing file" << endl;
+ throw Failed ();
+ }
- if (!ops.force_overwrite ())
- {
- WideInputFileStream tmp (
- cxx_impl_path.string ().c_str (), ios_base::in);
+ tmp.close ();
+ }
- if (tmp.is_open ())
+ cxx_impl.open (cxx_impl_path.string ().c_str (), ios_base::out);
+
+ if (!cxx_impl.is_open ())
{
- wcerr << cxx_impl_path << ": error: cowardly refusing to " <<
- "overwrite an existing file" << endl;
+ wcerr << cxx_impl_path << ": error: unable to open in write mode"
+ << endl;
throw Failed ();
}
- tmp.close ();
- }
-
- cxx_impl.open (cxx_impl_path.string ().c_str (), ios_base::out);
-
- if (!cxx_impl.is_open ())
- {
- wcerr << cxx_impl_path << ": error: unable to open in write mode"
- << endl;
- throw Failed ();
+ unlinks.add (cxx_impl_path);
}
- unlinks.add (cxx_impl_path);
file_list.push_back (cxx_impl_path.string ());
}
if (driver)
{
- if (!ops.force_overwrite ())
+ if (gen_cxx)
{
- WideInputFileStream tmp (
- cxx_driver_path.string ().c_str (), ios_base::in);
-
- if (tmp.is_open ())
+ if (!ops.force_overwrite ())
{
- wcerr << cxx_driver_path << ": error: cowardly refusing to " <<
- "overwrite an existing file" << endl;
- throw Failed ();
+ WideInputFileStream tmp (
+ cxx_driver_path.string ().c_str (), ios_base::in);
+
+ if (tmp.is_open ())
+ {
+ wcerr << cxx_driver_path << ": error: cowardly refusing to " <<
+ "overwrite an existing file" << endl;
+ throw Failed ();
+ }
+
+ tmp.close ();
}
- tmp.close ();
- }
+ cxx_driver.open (cxx_driver_path.string ().c_str (), ios_base::out);
- cxx_driver.open (cxx_driver_path.string ().c_str (), ios_base::out);
+ if (!cxx_driver.is_open ())
+ {
+ wcerr << cxx_driver_path << ": error: unable to open in write " <<
+ "mode" << endl;
+ throw Failed ();
+ }
- if (!cxx_driver.is_open ())
- {
- wcerr << cxx_driver_path << ": error: unable to open in write " <<
- "mode" << endl;
- throw Failed ();
+ unlinks.add (cxx_driver_path);
}
- unlinks.add (cxx_driver_path);
file_list.push_back (cxx_driver_path.string ());
}
// Open the skel files.
//
- WideOutputFileStream hxx (hxx_path.string ().c_str (), ios_base::out);
+ WideOutputFileStream hxx;
WideOutputFileStream ixx;
WideOutputFileStream cxx;
- if (!hxx.is_open ())
+ if (gen_cxx)
{
- wcerr << hxx_path << ": error: unable to open in write mode" << endl;
- throw Failed ();
+ hxx.open (hxx_path.string ().c_str (), ios_base::out);
+
+ if (!hxx.is_open ())
+ {
+ wcerr << hxx_path << ": error: unable to open in write mode" << endl;
+ throw Failed ();
+ }
+
+ unlinks.add (hxx_path);
}
- unlinks.add (hxx_path);
file_list.push_back (hxx_path.string ());
if (inline_)
{
- ixx.open (ixx_path.string ().c_str (), ios_base::out);
-
- if (!ixx.is_open ())
+ if (gen_cxx)
{
- wcerr << ixx_path << ": error: unable to open in write mode" << endl;
- throw Failed ();
+ ixx.open (ixx_path.string ().c_str (), ios_base::out);
+
+ if (!ixx.is_open ())
+ {
+ wcerr << ixx_path << ": error: unable to open in write mode"
+ << endl;
+ throw Failed ();
+ }
+
+ unlinks.add (ixx_path);
}
- unlinks.add (ixx_path);
file_list.push_back (ixx_path.string ());
}
-
if (source)
{
- cxx.open (cxx_path.string ().c_str (), ios_base::out);
-
- if (!cxx.is_open ())
+ if (gen_cxx)
{
- wcerr << cxx_path << ": error: unable to open in write mode" << endl;
- throw Failed ();
+ cxx.open (cxx_path.string ().c_str (), ios_base::out);
+
+ if (!cxx.is_open ())
+ {
+ wcerr << cxx_path << ": error: unable to open in write mode"
+ << endl;
+ throw Failed ();
+ }
+
+ unlinks.add (cxx_path);
}
- unlinks.add (cxx_path);
file_list.push_back (cxx_path.string ());
}
+ if (!gen_cxx)
+ return 0;
+
// Print copyright and license.
//
char const* copyright (