Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch into lp:zorba.
Requested reviews: Markos Zaharioudakis (markos-za) For more details, see: https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/95047 removed properties-generating scripts and restored zorba_properties.h and store_properties.h files. -- https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/95047 Your team Zorba Coders is subscribed to branch lp:zorba.
=== removed file 'scripts/gen_all_props' --- scripts/gen_all_props 2009-10-30 16:24:51 +0000 +++ scripts/gen_all_props 1970-01-01 00:00:00 +0000 @@ -1,31 +0,0 @@ -#/bin/bash -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -add_notice () { -echo -echo '// ******************************************' -echo '// * *' -echo '// * THIS IS A GENERATED FILE. DO NOT EDIT! *' -echo '// * SEE .txt FILE WITH SAME NAME *' -echo '// * *' -echo '// ******************************************' -echo -} - -cd `dirname $0`/.. -D=`pwd` -(cd src/system; { cat $D/src/util/empty.h; add_notice; $D/scripts/gen_po_props export zorba ZorbaProperties zorba_properties.txt; } >zorba_properties.h) # we just need to export this class because it's used outside of our library (in zorbacmd). -(cd src/store/naive; { cat $D/src/util/empty.h; add_notice; $D/scripts/gen_po_props noexport zorba::store StoreProperties store_properties.txt; } >store_properties.h) -(cd bin; { cat $D/src/util/empty.h; add_notice; $D/scripts/gen_po_props noexport zorbacmd ZorbaCMDPropertiesBase zorbacmdproperties.txt; } >zorbacmdproperties_base.h) === removed file 'scripts/gen_po_props' --- scripts/gen_po_props 2009-10-30 16:24:51 +0000 +++ scripts/gen_po_props 1970-01-01 00:00:00 +0000 @@ -1,248 +0,0 @@ -#!/usr/bin/env perl - -# Copyright 2006-2008 The FLWOR Foundation. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -use strict; -use warnings; - -my @options; - -sub long_to_getter { - my $result = $1; - $result =~ s/-(.)/\u$1/g; - return $result; -} - -sub load_options { - while (<>) { - if (m@ *\( *"([^,"]+)((,([^"]+))?)", *([a-zA-Z_]+::value< *(.*?) *> *\(&? *([a-zA-Z_]*) *\)(->default_value *\( *(.*) *\))?, *)?"([^"]+)" *\)@) { - my $short = $2 ? $4 : ""; - my $getter = long_to_getter ($1); - my $member = "the" . (uc substr ($getter, 0, 1)) . substr ($getter, 1); - my $type = "bool"; - my $has_val = 0; - my $default; - if ($5) { - $has_val = 1; - $type = $6; - if ($8) { $default = $9; } - if ($7) { $member = $7; } - } else { - $default = "false"; - } - push @options, { long => $1, short => $short, descr => $10, member => $member, getter => $getter, type => $type, has_val => $has_val, default => $default }; - # print "long $1 short $short mem $member\n"; - } elsif (m@^ *#(.*)$@) { - push @options, { directive => $1 }; - } - } -} - -sub print_long_opts { - print " const char **get_all_options () const {\n"; - print " static const char *result [] = { "; - for my $opt (@options) { - if ($opt->{directive}) { next; } - print "\"--$opt->{long}\", "; - } - print "NULL };\n"; - print (" return result;\n"); - print (" }\n"); -} - -sub print_members { - my %all_members; - for my $opt (@options) { - if ($opt->{directive}) { next; } - my $member = $opt->{member}; - if ($all_members {$member}) { next; } - $all_members {$member} = 1; - print <<"EOF"; - $opt->{type} $member; -EOF - } - print <<"EOF"; - -EOF -} - -sub print_getters { - for my $opt (@options) { - if ($opt->{directive}) { next; } - print <<"EOF"; - const $opt->{type} &$opt->{getter} () const { return $opt->{member}; } -EOF - } - print <<"EOF"; - -EOF -} - -sub print_help { - print <<"EOF"; - const char *get_help_msg () const { - return -EOF - - for my $opt (@options) { - if ($opt->{directive}) { print "#$opt->{directive}\n"; next; } - my $short = $opt->{short}; - my $shorthlp = $short ? ", -$short" : ""; - print "\"--$opt->{long}$shorthlp\\n$opt->{descr}\\n\\n\"\n"; - } - - print <<"EOF"; -; - } -EOF -} - -sub print_load_argv { - print <<"EOF"; - std::string load_argv (int argc, const char **argv) { - if (argv == NULL) return ""; - - std::string result; - for (++argv; *argv != NULL; ++argv) { - if (strcmp (*argv, "--help") == 0 || strcmp (*argv, "-h") == 0) - return "!HELP"; - else if (strcmp (*argv, "--version") == 0) - return "!VER"; -EOF - - for my $opt (@options) { - if ($opt->{directive}) { print "#$opt->{directive}\n"; next; } - my $short = $opt->{short}; - my $shortcmp = ($short eq "") ? "" : " || strncmp (*argv, \"-$short\", 2) == 0"; - print <<"EOF"; - else if (strcmp (*argv, "--$opt->{long}") == 0$shortcmp) { -EOF - if (! $opt->{has_val}) { print " $opt->{member} = true;\n"; } - else { - print " int d = 2;\n"; - print " if ((*argv) [1] == '-' || (*argv) [2] == '\\0') { d = 0; ++argv; }\n"; - print " if (*argv == NULL) { result = \"No value given for --$opt->{long} option\"; break; }"; - print " init_val (*argv, $opt->{member}, d);\n"; - } - print <<"EOF"; - } -EOF - - } - - print <<"EOF"; - else if (strcmp (*argv, "--") == 0) { - copy_args (++argv); - break; - } else if ((*argv) [0] == '-') { - result = "unknown command line option "; result += *argv; break; - } else { - copy_args (argv); - break; - } - } - - return result; - } - -EOF -} - -sub print_init () { - print <<"EOF"; - void initialize () { -EOF - for my $opt (@options) { - if (defined $opt->{default}) { - print " $opt->{member} = $opt->{default};\n"; - } - } - print <<"EOF"; - } -EOF -} - -# -# Main -# - -my $export = shift; -my $namespace = shift; -my @namespaces = split (/::/, $namespace); -my $classname = shift; -my $ifdef = $namespace; -$ifdef =~ s/::/_/g; -$ifdef = uc ($ifdef) . "_" . uc ($classname); - -load_options; - -print <<"EOF"; -#include <string> -#include <sstream> -#include <zorba/config.h> -#include <zorba/properties_base.h> -#include <cstring> - -#ifndef $ifdef -#define $ifdef -EOF - -foreach my $ns (@namespaces) { print "namespace $ns { "; } -print "\n"; - -if ($export eq "export") { - print "class ZORBA_DLL_PUBLIC $classname : public ::zorba::PropertiesBase {\n"; -} else { - print "class $classname : public ::zorba::PropertiesBase {\n"; -} - -print <<"EOF"; -protected: -EOF - -print_long_opts; - -print_members; - -print_init; - -print "public:\n"; - -print_getters; - -print_load_argv; - -print_help; - -print <<"EOF"; - - static const $classname *instance () { - static $classname result; - return &result; - } - - $classname () { initialize (); } - -}; - -EOF - -foreach my $ns (@namespaces) { print "} "; } -print " // namespaces\n"; - -print <<"EOF"; - -#endif // $ifdef -EOF === modified file 'src/store/naive/store_properties.h' --- src/store/naive/store_properties.h 2012-02-17 11:54:24 +0000 +++ src/store/naive/store_properties.h 2012-02-28 21:01:20 +0000 @@ -15,13 +15,6 @@ */ /* vim:set et sw=2 ts=2: */ -// ****************************************** -// * * -// * THIS IS A GENERATED FILE. DO NOT EDIT! * -// * SEE .txt FILE WITH SAME NAME * -// * * -// ****************************************** - #include <string> #include <sstream> #include <zorba/config.h> @@ -30,47 +23,65 @@ #ifndef ZORBA_STORE_STOREPROPERTIES #define ZORBA_STORE_STOREPROPERTIES -namespace zorba { namespace store { -class StoreProperties : public ::zorba::PropertiesBase { +namespace zorba +{ +namespace store +{ + + +class StoreProperties : public ::zorba::PropertiesBase +{ protected: - const char **get_all_options () const { + const char** get_all_options() const + { static const char *result [] = { "--build-dataguide", "--store-trace-level", NULL }; return result; } + bool theBuildDataguide; long theStoreTraceLevel; - void initialize () { + void initialize () + { theBuildDataguide = false; theStoreTraceLevel = 0; } public: - const bool &buildDataguide () const { return theBuildDataguide; } - const long &storeTraceLevel () const { return theStoreTraceLevel; } + const bool& buildDataguide() const { return theBuildDataguide; } + const long& storeTraceLevel() const { return theStoreTraceLevel; } - std::string load_argv (int argc, const char **argv) { + std::string load_argv(int argc, const char **argv) + { if (argv == NULL) return ""; std::string result; - for (++argv; *argv != NULL; ++argv) { + for (++argv; *argv != NULL; ++argv) + { if (strcmp (*argv, "--help") == 0 || strcmp (*argv, "-h") == 0) return "!HELP"; else if (strcmp (*argv, "--version") == 0) return "!VER"; - else if (strcmp (*argv, "--build-dataguide") == 0) { + else if (strcmp (*argv, "--build-dataguide") == 0) + { theBuildDataguide = true; } - else if (strcmp (*argv, "--store-trace-level") == 0) { + else if (strcmp (*argv, "--store-trace-level") == 0) + { int d = 2; if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } if (*argv == NULL) { result = "No value given for --store-trace-level option"; break; } init_val (*argv, theStoreTraceLevel, d); } - else if (strcmp (*argv, "--") == 0) { + else if (strcmp (*argv, "--") == 0) + { copy_args (++argv); break; - } else if ((*argv) [0] == '-') { + } + else if ((*argv) [0] == '-') + { result = "unknown command line option "; result += *argv; break; - } else { + } + else + { copy_args (argv); break; } @@ -79,20 +90,21 @@ return result; } - const char *get_help_msg () const { + const char* get_help_msg () const + { return "--build-dataguide\nbuild-dataguide (true/false)\n\n" "--store-trace-level\nstore trace level (<= 0 : no tracing)\n\n" ; } - static const StoreProperties *instance () { + static const StoreProperties* instance() + { static StoreProperties result; return &result; } - StoreProperties () { initialize (); } - + StoreProperties() { initialize(); } }; } } // namespaces === modified file 'src/system/zorba_properties.h' --- src/system/zorba_properties.h 2012-02-17 11:54:24 +0000 +++ src/system/zorba_properties.h 2012-02-28 21:01:20 +0000 @@ -15,13 +15,6 @@ */ /* vim:set et sw=2 ts=2: */ -// ****************************************** -// * * -// * THIS IS A GENERATED FILE. DO NOT EDIT! * -// * SEE .txt FILE WITH SAME NAME * -// * * -// ****************************************** - #include <string> #include <sstream> #include <zorba/config.h> @@ -30,13 +23,20 @@ #ifndef ZORBA_ZORBAPROPERTIES #define ZORBA_ZORBAPROPERTIES -namespace zorba { -class ZORBA_DLL_PUBLIC ZorbaProperties : public ::zorba::PropertiesBase { +namespace zorba +{ + +class ZORBA_DLL_PUBLIC ZorbaProperties : public ::zorba::PropertiesBase +{ protected: - const char **get_all_options () const { - static const char *result [] = { "--trace-parsing", "--trace-scanning", "--use-serializer", "--optimizer", "--result-file", "--debug-file", "--abort", "--query", "--print-query", "--print-time", "--print-ast", "--print-xqdoc", "--print-translated", "--print-normalized", "--print-optimized", "--print-iterator-tree", "--print-item-flow", "--print-static-types", "--dump-lib", "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt", "--print-locations", "--force-gflwor", "--reorder-globals", "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting", "--infer-joins", "--no-copy-optim", "--serialize-only-query", "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug", "--compile-only", "--tz", "--external-var", "--serializer-param", "--iter-plan-test", "--dot-plan-file", "--max-udf-call-depth", NULL }; + const char** get_all_options() const + { + static const char* result [] = + { "--trace-parsing", "--trace-scanning", "--use-serializer", "--optimizer", "--result-file", "--debug-file", "--abort", "--query", "--print-query", "--print-time", "--print-ast", "--print-xqdoc", "--print-translated", "--print-normalized", "--print-optimized", "--print-iterator-tree", "--print-item-flow", "--print-static-types", "--dump-lib", "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt", "--print-locations", "--force-gflwor", "--reorder-globals", "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting", "--infer-joins", "--no-copy-optim", "--serialize-only-query", "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug", "--compile-only", "--tz", "--external-var", "--serializer-param", "--iter-plan-test", "--dot-plan-file", "--max-udf-call-depth", NULL }; + return result; } + bool theTraceParsing; bool theTraceScanning; bool theUseSerializer; @@ -68,7 +68,7 @@ bool theLoopHoisting; bool theInferJoins; bool theNoCopyOptim; - bool theSerializeOnlyQuery; + int theSerializeOnlyQuery; bool theTraceTranslator; bool theTraceCodegen; bool theTraceFulltext; @@ -81,7 +81,8 @@ std::string theDotPlanFile; uint32_t theMaxUdfCallDepth; - void initialize () { + void initialize() + { theTraceParsing = false; theTraceScanning = false; theUseSerializer = false; @@ -110,7 +111,7 @@ theLoopHoisting = true; theInferJoins = true; theNoCopyOptim = true; - theSerializeOnlyQuery = false; + theSerializeOnlyQuery = -1; theTraceTranslator = false; theTraceCodegen = false; theTraceFulltext = false; @@ -119,6 +120,7 @@ theIterPlanTest = false; theMaxUdfCallDepth = 1024; } + public: const bool &traceParsing () const { return theTraceParsing; } const bool &traceScanning () const { return theTraceScanning; } @@ -150,8 +152,8 @@ const bool &inlineUdf () const { return theInlineUdf; } const bool &loopHoisting () const { return theLoopHoisting; } const bool &inferJoins () const { return theInferJoins; } - const bool &noCopyOptim () const { return theNoCopyOptim; } - const bool &serializeOnlyQuery () const { return theSerializeOnlyQuery; } + const bool &noCopyOptim() const { return theNoCopyOptim; } + const int& serializeOnlyQuery() const { return theSerializeOnlyQuery; } const bool &traceTranslator () const { return theTraceTranslator; } const bool &traceCodegen () const { return theTraceCodegen; } const bool &traceFulltext () const { return theTraceFulltext; } @@ -164,7 +166,8 @@ const std::string &dotPlanFile () const { return theDotPlanFile; } const uint32_t &maxUdfCallDepth () const { return theMaxUdfCallDepth; } - std::string load_argv (int argc, const char **argv) { + std::string load_argv (int argc, const char **argv) + { if (argv == NULL) return ""; std::string result; @@ -185,12 +188,14 @@ else if (strcmp (*argv, "--optimizer") == 0 || strncmp (*argv, "-O", 2) == 0) { int d = 2; if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } - if (*argv == NULL) { result = "No value given for --optimizer option"; break; } init_val (*argv, theOptimizer, d); + if (*argv == NULL) { result = "No value given for --optimizer option"; break; } + init_val (*argv, theOptimizer, d); } else if (strcmp (*argv, "--result-file") == 0 || strncmp (*argv, "-o", 2) == 0) { int d = 2; if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } - if (*argv == NULL) { result = "No value given for --result-file option"; break; } init_val (*argv, theResultFile, d); + if (*argv == NULL) { result = "No value given for --result-file option"; break; } + init_val (*argv, theResultFile, d); } else if (strcmp (*argv, "--debug-file") == 0) { int d = 2; @@ -285,15 +290,20 @@ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } if (*argv == NULL) { result = "No value given for --infer-joins option"; break; } init_val (*argv, theInferJoins, d); } - else if (strcmp (*argv, "--no-copy-optim") == 0) { + else if (strcmp (*argv, "--no-copy-optim") == 0) + { int d = 2; if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } - if (*argv == NULL) { result = "No value given for --no-copy-optim option"; break; } init_val (*argv, theNoCopyOptim, d); + if (*argv == NULL) { result = "No value given for --no-copy-optim option"; break; } + init_val (*argv, theNoCopyOptim, d); } - else if (strcmp (*argv, "--serialize-only-query") == 0) { + else if (strcmp (*argv, "--serialize-only-query") == 0) + { int d = 2; if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } - if (*argv == NULL) { result = "No value given for --serialize-only-query option"; break; } init_val (*argv, theSerializeOnlyQuery, d); + if (*argv == NULL) + { result = "No value given for --serialize-only-query option"; break; } + init_val(*argv, theSerializeOnlyQuery, d); } #ifndef NDEBUG else if (strcmp (*argv, "--trace-translator") == 0 || strncmp (*argv, "-l", 2) == 0) { @@ -354,7 +364,9 @@ return result; } - const char *get_help_msg () const { + + const char* get_help_msg() const + { return "--trace-parsing, -p\ntrace parsing\n\n" "--trace-scanning, -s\ntrace scanning\n\n" @@ -386,8 +398,8 @@ "--inline-udf\ninline functions (1=enabled (default), 0=off)\n\n" "--loop-hoisting\nhoist expressions out of loops (1=enabled (default), 0=off)\n\n" "--infer-joins\ninfer joins (1=enabled (default), 0=off)\n\n" -"--no-copy-optim\nno copy optim (1=enabled (default), 0=off)\n\n" -"--serialize-only-query\nserialize-only query (1=true, 0=false (default))\n\n" +"--no-copy-optim\napply the no-copy optimization (1=enabled (default), 0=off)\n\n" +"--serialize-only-query\nserialize-only-query (<0=unknown (default), 1=enabled, 0=off)\n\n" #ifndef NDEBUG "--trace-translator, -l\ntrace the translator\n\n" "--trace-codegen, -c\ntrace the codegenerator\n\n" @@ -404,15 +416,16 @@ ; } - static const ZorbaProperties *instance () { + static const ZorbaProperties* instance() + { static ZorbaProperties result; return &result; } - ZorbaProperties () { initialize (); } - + ZorbaProperties() { initialize (); } }; + } // namespaces #endif // ZORBA_ZORBAPROPERTIES === modified file 'src/system/zorba_properties.txt' --- src/system/zorba_properties.txt 2012-01-11 17:30:25 +0000 +++ src/system/zorba_properties.txt 2012-02-28 21:01:20 +0000 @@ -29,7 +29,7 @@ ("loop-hoisting", po::value<bool>()->default_value (true), "hoist expressions out of loops (1=enabled (default), 0=off)") ("infer-joins", po::value<bool>()->default_value (true), "infer joins (1=enabled (default), 0=off)") ("no-copy-optim", po::value<bool>()->default_value(true), "no copy optim (1=enabled (default), 0=off)") - ("serialize-only-query", po::value<bool>()->default_value(false), "serialize-only query (1=true, 0=false (default))") + ("serialize-only-query", po::value<int>()->default_value(-1), "serialize-only query (1=true, 0=false, -1 unknown (default))") #ifndef NDEBUG ("trace-translator,l", "trace the translator") ("trace-codegen,c", "trace the codegenerator")
-- Mailing list: https://launchpad.net/~zorba-coders Post to : [email protected] Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp

