← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/undo-10989 into lp:zorba

 

Chris Hillery has proposed merging lp:~zorba-coders/zorba/undo-10989 into lp:zorba.

Requested reviews:
  Chris Hillery (ceejatec)
  Luis Rodriguez Gonzalez (kuraru)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/undo-10989/+merge/120245
-- 
https://code.launchpad.net/~zorba-coders/zorba/undo-10989/+merge/120245
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'bin/CMakeLists.txt'
--- bin/CMakeLists.txt	2012-08-16 22:16:27 +0000
+++ bin/CMakeLists.txt	2012-08-17 22:04:21 +0000
@@ -59,12 +59,6 @@
 ENDIF(UNIX)
 
 # test the basic features of the command line tool
-ZORBA_ADD_TEST(bin/zorba_f1 zorbacmd blub.xq)
-ZORBA_SET_TEST_PROPERTY(bin/zorba_f1 PASS_REGULAR_EXPRESSION ".*file {blub.xq} not found or not readable.*")
-
-ZORBA_ADD_TEST(bin/zorba_f2 zorbacmd "${CMAKE_CURRENT_SOURCE_DIR}/test/option.xq" --option "{http://www.zorba-xquery.com}option=value";)
-ZORBA_SET_TEST_PROPERTY(bin/zorba_f2 PASS_REGULAR_EXPRESSION "value")
-
 ZORBA_ADD_TEST(bin/zorba1 zorbacmd --omit-xml-declaration -q "1+1")
 ZORBA_SET_TEST_PROPERTY(bin/zorba1 PASS_REGULAR_EXPRESSION "2")
 

=== modified file 'bin/zorbacmdproperties.cpp'
--- bin/zorbacmdproperties.cpp	2012-08-16 22:16:27 +0000
+++ bin/zorbacmdproperties.cpp	2012-08-17 22:04:21 +0000
@@ -23,19 +23,11 @@
 
 std::string ZorbaCMDProperties::check_args () {
 
-  if(qBeforeF()){
-     return "Extra arguments found on command line. Possible reason: misplaced -f option (try '-f -q filename' instead of '-q -f filename'). Use -h for help.";
-  }
-
-  if(unknownOption()){
-    return "Extra arguments found on command line. Use -h for help.";
-  }
-
   if(queriesOrFilesBegin() == queriesOrFilesEnd()) {
     return "No queries submitted \nUsage: zorba -q '1 + 1' execute an inline query \n zorba -f -q file.xq execute a query from a file \n Use -h for help.";
   }
 
-  /*if (getPositionalArgs ().size () != 0) {
+  if (getPositionalArgs ().size () != 0) {
     QueriesOrFiles_t::const_iterator lIter;
     for (lIter = queriesOrFilesBegin(); lIter != queriesOrFilesEnd();
          ++lIter)
@@ -45,7 +37,7 @@
     }
     
     return "Extra arguments found on command line. Use -h for help.";
-  }*/
+  }
 
   if ( theBoundarySpace.size() != 0 )
   {

=== modified file 'bin/zorbacmdproperties_base.h'
--- bin/zorbacmdproperties_base.h	2012-08-16 22:16:27 +0000
+++ bin/zorbacmdproperties_base.h	2012-08-17 22:04:21 +0000
@@ -87,10 +87,6 @@
   bool theSerializePlan;
   bool theSavePlan;
   bool theLoadPlan;
-  /* added for backwards compatibility with -f -q <file> */
-  bool theFparm;
-  bool theQBeforeF;
-  bool theUnknownOption;
 
   void initialize () 
   {
@@ -103,8 +99,7 @@
     theByteOrderMark = false;
     theOmitXmlDeclaration = false;
     theMultiple = 1;
-    /* theAsFiles = false; */
-    theAsFiles = true;
+    theAsFiles = false;
     theOptimizationLevel = "O1";
     theLibModule = false;
     theParseOnly = false;
@@ -119,9 +114,6 @@
     theSerializePlan = false;
     theSavePlan = false;
     theLoadPlan = false;
-    theFparm = false;
-    theQBeforeF = false;
-    theUnknownOption = false;
   }
 
 public:
@@ -166,8 +158,6 @@
   const bool& serializePlan () const { return theSerializePlan; }
   const bool& loadPlan () const { return theLoadPlan; }
   const bool& savePlan () const { return theSavePlan; }
-  const bool& qBeforeF () const { return theQBeforeF; }
-  const bool& unknownOption() const { return theUnknownOption; }
 
   std::string load_argv (int argc, const char **argv) 
   {
@@ -278,12 +268,6 @@
       else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-q", 2) == 0) 
       {
         int d = 2;
-        if(theFparm == false)
-          theAsFiles = false;
-        if(!strncmp(*(argv+1), "-f", 2)){
-          theQBeforeF = true; // is it "-q -f <filename>" perhaps?
-          break;           // stop functionality here
-        }
         if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
         if (*argv == NULL)
         {
@@ -293,7 +277,6 @@
       }
       else if (strcmp (*argv, "--as-files") == 0 || strncmp (*argv, "-f", 2) == 0) 
       {
-        theFparm = true;
         theAsFiles = true;
       }
       else if (strcmp (*argv, "--external-variable") == 0 || strncmp (*argv, "-e", 2) == 0) 
@@ -450,14 +433,12 @@
       }
       else if ((*argv) [0] == '-')
       {
-        result = "unknown command line option "; result += *argv; 
-        theUnknownOption = true; break; 
+        result = "unknown command line option "; result += *argv; break; 
       }
       else
       {
-        init_val(*argv, theQueriesOrFiles, 0);
-        //copy_args (argv);
-        /*break;*/
+        copy_args (argv);
+        break;
       }
     }
 


Follow ups