**/
#include <string>
+#include <string.h>
+#include <stdlib.h>
#include <sstream>
#include "util/configuration.h"
#endif /* CVC4_DEBUG */
}
+int strcmpptr(const char **s1, const char **s2){
+ return strcmp(*s1,*s2);
+}
+
+bool Configuration::isDebugTag(char const *){
+#if CVC4_DEBUG
+ unsigned ntags = getNumDebugTags();
+ char const* const* tags = getDebugTags();
+ return (bsearch(&optarg, tags, ntags, sizeof(char *),
+ (int(*)(const void*,const void*))strcmpptr) != NULL);
+#else /* CVC4_DEBUG */
+ return false;
+#endif /* CVC4_DEBUG */
+}
+
unsigned Configuration::getNumTraceTags() {
#if CVC4_TRACING
/* -1 because a NULL pointer is inserted as the last value */
#endif /* CVC4_TRACING */
}
+bool Configuration::isTraceTag(char const *){
+#if CVC4_TRACING
+ unsigned ntags = getNumTraceTags();
+ char const* const* tags = getTraceTags();
+ return (bsearch(&optarg, tags, ntags, sizeof(char *),
+ (int(*)(const void*,const void*))strcmpptr) != NULL);
+#else /* CVC4_TRACING */
+ return false;
+#endif /* CVC4_TRACING */
+}
+
bool Configuration::isSubversionBuild() {
return IS_SUBVERSION_BUILD;
}
static bool isBuiltWithTlsSupport();
+ /* Return the number of debug tags */
static unsigned getNumDebugTags();
+ /* Return a sorted array of the debug tags name */
static char const* const* getDebugTags();
+ /* Test if the given argument is a known debug tag name */
+ static bool isDebugTag(char const *);
+ /* Return the number of trace tags */
static unsigned getNumTraceTags();
+ /* Return a sorted array of the trace tags name */
static char const* const* getTraceTags();
+ /* Test if the given argument is a known trace tag name */
+ static bool isTraceTag(char const *);
static bool isSubversionBuild();
static const char* getSubversionBranchName();
break;
case 't':
+ if(Configuration::isTracingBuild()) {
+ if(!Configuration::isTraceTag(optarg))
+ throw OptionException(string("trace tag ") + optarg +
+ string(" not available"));
+ } else {
+ throw OptionException("trace tags not available in non-tracing build");
+ }
Trace.on(optarg);
break;
case 'd':
+ if(Configuration::isDebugBuild()) {
+ if(!Configuration::isDebugTag(optarg))
+ throw OptionException(string("debug tag ") + optarg +
+ string(" not available"));
+ } else {
+ throw OptionException("debug tags not available in non-debug build");
+ }
Debug.on(optarg);
Trace.on(optarg);
break;