[opengtl-commits] [396] allow to export to C

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 396
Author:   cyrille
Date:     2008-09-20 00:54:18 +0200 (Sat, 20 Sep 2008)

Log Message:
-----------
allow to export to C

Modified Paths:
--------------
    trunk/OpenGTL/OpenCTL/tools/compiler/CtlC.cpp


Modified: trunk/OpenGTL/OpenCTL/tools/compiler/CtlC.cpp
===================================================================
--- trunk/OpenGTL/OpenCTL/tools/compiler/CtlC.cpp	2008-09-19 22:18:35 UTC (rev 395)
+++ trunk/OpenGTL/OpenCTL/tools/compiler/CtlC.cpp	2008-09-19 22:54:18 UTC (rev 396)
@@ -39,6 +39,7 @@
   std::cout << std::endl;
   std::cout << "Options : " << std::endl;
   std::cout << "  -S --asm-source         print the assembly source code generated" << std::endl;
+  std::cout << "  -C --c-source           print the source code as C" << std::endl;
   std::cout << "  -L --module-dir   add a location where to find modules" << std::endl;
   std::cout << std::endl;
   std::cout << "  -h --help               print this message" << std::endl;
@@ -51,6 +52,7 @@
 {
   GTLCore::String fileName = "";
   bool showAssembly = false;
+  bool showAsC = false;
   for(int ai = 1; ai < argc; ai++)
   {
     if(ARG_IS("-h","--help"))
@@ -63,6 +65,8 @@
       return EXIT_SUCCESS;
     } else if(ARG_IS("-S","--asm-source")) {
       showAssembly = true;
+    } else if(ARG_IS("-C","--c-source")) {
+      showAsC = true;
     } else if(ARG_IS("-L", "--module-dir")) {
       if( ai == argc )
       {
@@ -112,6 +116,10 @@
     {
       std::cout << p.asmSourceCode();
     }
+    if( showAsC )
+    {
+      std::cout << p.cSourceCode();
+    }
   }
   return EXIT_SUCCESS;
 }


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/