Some fixes for (get-info :all-options)
authorMorgan Deters <mdeters@cs.nyu.edu>
Tue, 23 Jul 2013 20:59:45 +0000 (16:59 -0400)
committerMorgan Deters <mdeters@cs.nyu.edu>
Wed, 24 Jul 2013 00:33:54 +0000 (20:33 -0400)
src/options/mkoptions
src/options/options_template.cpp

index bfb35ff26a16f1986e461951cc7a6f431f3f847f..d856c7293485b982245c3b77bc7c449e30437ac4 100755 (executable)
@@ -675,14 +675,14 @@ template <> options::${internal}__option_t::type runHandlerAndPredicates(options
       bool)
         all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
 #line $lineno \"$kf\"
-  }{ std::vector<SExpr> v; v.push_back(\"$smtname\"); v.push_back(d_holder->$internal); opts.push_back(v); }"
+  }{ std::vector<SExpr> v; v.push_back(\"$smtname\"); v.push_back(SExpr::Keyword(d_holder->$internal ? \"true\" : \"false\")); opts.push_back(v); }"
         smt_getoption_handlers="${smt_getoption_handlers}
 #line $lineno \"$kf\"
   if(key == \"$smtname\") {
 #line $lineno \"$kf\"
     return SExprKeyword(options::$internal() ? \"true\" : \"false\");
   }";;
-      int|unsigned|int*_t|uint*_t|CVC4::Integer)
+      int|unsigned|int*_t|uint*_t|unsigned\ long|long|CVC4::Integer)
         all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
 #line $lineno \"$kf\"
   }{ std::vector<SExpr> v; v.push_back(\"$smtname\"); v.push_back(d_holder->$internal); opts.push_back(v); }"
@@ -783,6 +783,36 @@ template <> options::${internal}__option_t::type runHandlerAndPredicates(options
     return;
   }"
     fi
+  elif [ -n "$long_option" -o "$long_option_alternate" ] && [ "$internal" != - ]; then
+    case "$type" in
+    bool)
+      getoption_name="$long_option"
+      inv=
+      # case where we have a --disable but no corresponding --enable
+      if [ -z "$getoption_name" ]; then
+        getoption_name="$long_option_alternate"
+        inv='!'
+      fi
+      all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
+#line $lineno \"$kf\"
+  }{ std::vector<SExpr> v; v.push_back(\"$getoption_name\"); v.push_back(SExpr::Keyword((${inv}d_holder->$internal) ? \"true\" : \"false\")); opts.push_back(v); }";;
+    int|unsigned|int*_t|uint*_t|unsigned\ long|long|CVC4::Integer)
+        all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
+#line $lineno \"$kf\"
+  }{ std::vector<SExpr> v; v.push_back(\"$long_option\"); v.push_back(d_holder->$internal); opts.push_back(v); }";;
+    float|double)
+      all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
+#line $lineno \"$kf\"
+  }{ std::vector<SExpr> v; v.push_back(\"$long_option\"); v.push_back(Rational::fromDouble(d_holder->$internal)); opts.push_back(v); }";;
+    CVC4::Rational)
+      all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
+#line $lineno \"$kf\"
+  }{ std::vector<SExpr> v; v.push_back(\"$long_option\"); v.push_back(d_holder->$internal); opts.push_back(v); }";;
+    *)
+      all_modules_get_options="${all_modules_get_options:+$all_modules_get_options
+#line $lineno \"$kf\"
+  }{ std::stringstream ss; ss << d_holder->$internal; std::vector<SExpr> v; v.push_back(\"$long_option\"); v.push_back(ss.str()); opts.push_back(v); }";;
+    esac
   fi
 
   if [ "$type" = bool ]; then
index 04d8adaa0d9355278d9779136c2c8d366b3a1713..8af61b79fdb6663a4ef2761f789838a883ffdb8f 100644 (file)
@@ -49,7 +49,7 @@
 
 ${include_all_option_headers}
 
-#line 53 "${template}"
+#line 57 "${template}"
 
 #include "util/output.h"
 #include "options/options_holder.h"
@@ -58,7 +58,7 @@ ${include_all_option_headers}
 
 ${option_handler_includes}
 
-#line 62 "${template}"
+#line 66 "${template}"
 
 using namespace CVC4;
 using namespace CVC4::options;
@@ -195,7 +195,7 @@ void runBoolPredicates(T, std::string option, bool b, SmtEngine* smt) {
 
 ${all_custom_handlers}
 
-#line 199 "${template}"
+#line 203 "${template}"
 
 #ifdef CVC4_DEBUG
 #  define USE_EARLY_TYPE_CHECKING_BY_DEFAULT true
@@ -225,18 +225,18 @@ options::OptionsHolder::OptionsHolder() : ${all_modules_defaults}
 {
 }
 
-#line 229 "${template}"
+#line 233 "${template}"
 
 static const std::string mostCommonOptionsDescription = "\
 Most commonly-used CVC4 options:${common_documentation}";
 
-#line 234 "${template}"
+#line 238 "${template}"
 
 static const std::string optionsDescription = mostCommonOptionsDescription + "\n\
 \n\
 Additional CVC4 options:${remaining_documentation}";
 
-#line 240 "${template}"
+#line 244 "${template}"
 
 static const std::string optionsFootnote = "\n\
 [*] Each of these options has a --no-OPTIONNAME variant, which reverses the\n\
@@ -307,7 +307,7 @@ static struct option cmdlineOptions[] = {${all_modules_long_options}
   { NULL, no_argument, NULL, '\0' }
 };/* cmdlineOptions */
 
-#line 311 "${template}"
+#line 315 "${template}"
 
 static void preemptGetopt(int& argc, char**& argv, const char* opt) {
   const size_t maxoptlen = 128;
@@ -500,7 +500,7 @@ std::vector<std::string> Options::parseOptions(int argc, char* main_argv[]) thro
     switch(c) {
 ${all_modules_option_handlers}
 
-#line 492 "${template}"
+#line 508 "${template}"
 
     case ':':
       // This can be a long or short option, and the way to get at the
@@ -572,7 +572,7 @@ std::vector<std::string> Options::suggestCommandLineOptions(const std::string& o
 
 static const char* smtOptions[] = {
   ${all_modules_smt_options},
-#line 547 "${template}"
+#line 590 "${template}"
   NULL
 };/* smtOptions[] */
 
@@ -594,7 +594,7 @@ SExpr Options::getOptions() const throw() {
 
   ${all_modules_get_options}
 
-#line 569 "${template}"
+#line 612 "${template}"
 
   return SExpr(opts);
 }