Merge lp:~zorba-coders/zorba/module-schema-tools into lp:~zorba-coders/zorba/zorba-experimental

Proposed by Cezar Andrei
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/module-schema-tools
Merge into: lp:~zorba-coders/zorba/zorba-experimental
Diff against target: 167867 lines (+83368/-47243)
924 files modified
CMakeConfiguration.txt (+0/-4)
CMakeLists.txt (+32/-9)
CPackSourceConfig.cmake.in (+1/-1)
ChangeLog (+99/-12)
NOTICE.txt (+1/-1)
bin/CMakeLists.txt (+58/-19)
bin/debug_client/debug_command.cpp (+0/-99)
bin/debug_client/event_handler_init.cpp.in (+0/-41)
bin/debug_client/lock_free_queue.cpp (+0/-16)
bin/debug_client/message-handler.xq (+0/-165)
bin/debugger/command.h (+164/-211)
bin/debugger/command_arg.h (+237/-0)
bin/debugger/command_line_handler.cpp (+364/-204)
bin/debugger/command_line_handler.h (+116/-58)
bin/debugger/command_prompt.cpp (+287/-0)
bin/debugger/command_prompt.h (+72/-0)
bin/debugger/config.h.cmake (+24/-0)
bin/debugger/event_handler.cpp (+81/-76)
bin/debugger/event_handler.h (+25/-12)
bin/debugger/lock_free_queue.h (+10/-2)
bin/debugger/main.cpp (+340/-18)
bin/debugger/process_listener.cpp (+105/-0)
bin/debugger/process_listener.h (+75/-0)
bin/debugger/tuple.h (+6/-0)
bin/debugger/xqdb_client.cpp (+63/-0)
bin/debugger/xqdb_client.h (+51/-0)
bin/path_util.cpp (+77/-45)
bin/path_util.h (+15/-24)
bin/zorbacmd.cpp (+95/-50)
bin/zorbacmdproperties.cpp (+19/-5)
bin/zorbacmdproperties.h (+10/-1)
bin/zorbacmdproperties.txt (+4/-1)
bin/zorbacmdproperties_base.h (+27/-3)
cmake_modules/FindLibedit.cmake (+46/-0)
cmake_modules/FindPHP5.cmake (+5/-0)
cmake_modules/ZorbaModule.cmake (+258/-101)
config/CMakeLists.txt (+5/-5)
config/ZorbaConfig.cmake.in (+7/-4)
doc/cxx/examples/errors.cpp (+4/-4)
doc/cxx/examples/simple.cpp (+17/-10)
doc/php/CMakeLists.txt (+1/-1)
doc/php/examples/CMakeLists.txt (+12/-4)
doc/php/examples/php.ini.in (+1/-0)
doc/php/examples/simple.php.in (+2/-2)
doc/php/examples/test.php.in (+120/-0)
doc/php/examples/zorba_api.php (+1/-1)
doc/zorba/commandline.dox (+7/-1)
doc/zorba/conformance.dox (+4/-4)
doc/zorba/conformanceXQFTTS.dox (+74/-74)
doc/zorba/external_functions.dox (+2/-2)
doc/zorba/ft_thesaurus.dox (+34/-33)
doc/zorba/impl_dep_features.dox (+2/-2)
doc/zorba/modules_authoring.dox (+2/-3)
doc/zorba/modules_authoring_2.dox (+7/-3)
doc/zorba/modules_building_in.dox (+1/-1)
doc/zorba/options.dox (+233/-54)
doc/zorba/uriresolvers.dox (+120/-38)
doc/zorba/xqddf.dox (+206/-153)
doc/zorba/xqdoc/templates/main.html (+36/-24)
include/zorba/config.h.cmake (+15/-10)
include/zorba/debugger_client.h (+14/-2)
include/zorba/dynamic_context.h (+14/-1)
include/zorba/internal/type_traits.h (+3/-1)
include/zorba/internal/unique_ptr.h (+2/-2)
include/zorba/item.h (+29/-3)
include/zorba/item_factory.h (+60/-1)
include/zorba/options.h (+19/-4)
include/zorba/pregenerated/diagnostic_list.h (+12/-4)
include/zorba/properties_base.h (+37/-1)
include/zorba/static_collection_manager.h (+66/-3)
include/zorba/static_context.h (+619/-529)
include/zorba/thesaurus.h (+24/-28)
include/zorba/uri_resolvers.h (+18/-3)
include/zorba/util/file.h (+2/-0)
include/zorba/xquery.h (+19/-1)
include/zorba/zorba.h (+13/-2)
modules/ExternalModules.conf (+15/-13)
modules/com/zorba-xquery/www/modules/CMakeLists.txt (+13/-1)
modules/com/zorba-xquery/www/modules/debugger/dbgp-message-handler.xq (+277/-0)
modules/com/zorba-xquery/www/modules/http-client.xq.src/http_response_handler.cpp (+4/-4)
modules/com/zorba-xquery/www/modules/node-position.xq (+524/-0)
modules/com/zorba-xquery/www/modules/pregenerated/errors.xq (+16/-8)
modules/com/zorba-xquery/www/modules/pregenerated/warnings.xq (+20/-1)
modules/com/zorba-xquery/www/modules/store/static/indexes/dml.xq (+187/-60)
modules/com/zorba-xquery/www/modules/string.xq (+21/-1)
modules/com/zorba-xquery/www/modules/xqdoc2xhtml/index.xq (+20/-13)
schemas/CMakeLists.txt (+24/-0)
schemas/xhtml/xhtml-lat1.ent (+196/-0)
schemas/xhtml/xhtml-special.ent (+80/-0)
schemas/xhtml/xhtml-symbol.ent (+237/-0)
schemas/xhtml/xhtml1-frameset.dtd (+1235/-0)
schemas/xhtml/xhtml1-strict.dtd (+978/-0)
schemas/xhtml/xhtml1-transitional.dtd (+1201/-0)
scripts/sanity_checks/README.txt (+2/-2)
scripts/sanity_checks/conformance_xqftts.xqi (+4/-5)
scripts/sanity_checks/conformance_xqts.xqi (+3/-3)
src/annotations/annotations.cpp (+324/-292)
src/annotations/annotations.h (+100/-59)
src/api/annotationimpl.cpp (+1/-1)
src/api/collectionimpl.cpp (+4/-9)
src/api/dynamiccontextimpl.cpp (+33/-0)
src/api/dynamiccontextimpl.h (+7/-0)
src/api/functionimpl.cpp (+1/-1)
src/api/item.cpp (+33/-1)
src/api/itemfactoryimpl.cpp (+66/-5)
src/api/itemfactoryimpl.h (+25/-3)
src/api/options.cpp (+26/-12)
src/api/serialization/serializer.cpp (+123/-51)
src/api/serialization/serializer.h (+4/-4)
src/api/staticcollectionmanagerimpl.cpp (+287/-0)
src/api/staticcollectionmanagerimpl.h (+37/-0)
src/api/staticcontextimpl.cpp (+207/-80)
src/api/staticcontextimpl.h (+27/-23)
src/api/thesaurus.cpp (+0/-4)
src/api/uri_resolver_wrappers.cpp (+66/-30)
src/api/uri_resolver_wrappers.h (+6/-6)
src/api/uriresolverimpl.cpp (+5/-0)
src/api/uriresolverimpl.h (+2/-0)
src/api/xmldatamanagerimpl.cpp (+5/-6)
src/api/xqueryimpl.cpp (+120/-5)
src/api/xqueryimpl.h (+6/-0)
src/api/zorbaimpl.cpp (+11/-1)
src/api/zorbaimpl.h (+2/-0)
src/compiler/api/compiler_api.cpp (+19/-13)
src/compiler/api/compiler_api.h (+3/-2)
src/compiler/api/compilercb.cpp (+21/-0)
src/compiler/api/compilercb.h (+17/-4)
src/compiler/codegen/plan_visitor.cpp (+112/-79)
src/compiler/expression/abstract_expr_visitor.h (+1/-0)
src/compiler/expression/expr.cpp (+49/-52)
src/compiler/expression/expr.h (+97/-55)
src/compiler/expression/expr_annotations.cpp (+0/-58)
src/compiler/expression/expr_base.cpp (+119/-26)
src/compiler/expression/expr_base.h (+66/-26)
src/compiler/expression/expr_classes.h (+1/-0)
src/compiler/expression/expr_iter.cpp (+11/-2)
src/compiler/expression/expr_put.cpp (+53/-25)
src/compiler/expression/expr_type.cpp (+46/-61)
src/compiler/expression/expr_visitor.h (+1/-0)
src/compiler/expression/flwor_expr.cpp (+48/-17)
src/compiler/expression/flwor_expr.h (+41/-18)
src/compiler/expression/fo_expr.cpp (+23/-26)
src/compiler/expression/fo_expr.h (+5/-5)
src/compiler/expression/ft_expr.cpp (+9/-0)
src/compiler/expression/ft_expr.h (+4/-3)
src/compiler/expression/ftnode.cpp (+209/-6)
src/compiler/expression/ftnode.h (+77/-26)
src/compiler/expression/path_expr.h (+5/-5)
src/compiler/expression/script_exprs.cpp (+163/-17)
src/compiler/expression/script_exprs.h (+101/-12)
src/compiler/expression/update_exprs.cpp (+60/-73)
src/compiler/expression/update_exprs.h (+51/-50)
src/compiler/expression/var_expr.cpp (+56/-1)
src/compiler/expression/var_expr.h (+110/-32)
src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp (+1/-1)
src/compiler/rewriter/framework/rewriter_context.h (+59/-31)
src/compiler/rewriter/rewriters/default_optimizer.cpp (+10/-0)
src/compiler/rewriter/rules/flwor_rules.cpp (+4/-0)
src/compiler/rewriter/rules/fold_rules.cpp (+8/-16)
src/compiler/rewriter/rules/hoist_rules.cpp (+2/-1)
src/compiler/rewriter/rules/nodeid_rules.cpp (+785/-26)
src/compiler/rewriter/rules/path_rules.cpp (+4/-4)
src/compiler/rewriter/rules/rule_base.h (+1/-0)
src/compiler/rewriter/rules/ruleset.h (+52/-5)
src/compiler/rewriter/rules/type_rules.cpp (+51/-40)
src/compiler/rewriter/tools/dataflow_annotations.cpp (+542/-5)
src/compiler/rewriter/tools/dataflow_annotations.h (+37/-1)
src/compiler/rewriter/tools/expr_tools.cpp (+536/-6)
src/compiler/rewriter/tools/udf_graph.cpp (+6/-4)
src/compiler/translator/translator.cpp (+326/-248)
src/compiler/xqddf/value_index.cpp (+35/-22)
src/compiler/xqddf/value_index.h (+53/-27)
src/compiler/xqueryx/xqueryx_to_xquery.cpp (+4/-1)
src/compiler/xqueryx/xqueryx_xslt.cpp (+578/-86)
src/compiler/xqueryx/xqueryx_xslt.h (+2/-1)
src/context/default_uri_mappers.cpp (+29/-9)
src/context/default_uri_mappers.h (+6/-6)
src/context/default_url_resolvers.cpp (+5/-5)
src/context/default_url_resolvers.h (+19/-5)
src/context/dynamic_context.cpp (+45/-22)
src/context/dynamic_context.h (+30/-19)
src/context/dynamic_loader.cpp (+8/-17)
src/context/dynamic_loader.h (+2/-3)
src/context/namespace_context.cpp (+4/-2)
src/context/namespace_context.h (+5/-1)
src/context/root_static_context.cpp (+78/-37)
src/context/root_static_context.h (+5/-3)
src/context/root_static_context_init.cpp.in (+9/-2)
src/context/static_context.cpp (+470/-391)
src/context/static_context.h (+120/-125)
src/context/static_context_consts.h (+1/-34)
src/context/thesaurus_wrappers.cpp (+0/-21)
src/context/thesaurus_wrappers.h (+0/-10)
src/context/uri_resolver.cpp (+32/-12)
src/context/uri_resolver.h (+34/-8)
src/debugger/debugger_client.cpp (+0/-2)
src/debugger/debugger_clientimpl.cpp (+549/-453)
src/debugger/debugger_clientimpl.h (+17/-10)
src/debugger/debugger_common.h (+3/-10)
src/debugger/debugger_commons.cpp (+128/-25)
src/debugger/debugger_commons.h (+11/-15)
src/debugger/debugger_communicator.cpp (+12/-9)
src/debugger/debugger_communicator.h (+4/-4)
src/debugger/debugger_protocol.cpp (+40/-16)
src/debugger/debugger_protocol.h (+3/-0)
src/debugger/debugger_runtime.cpp (+330/-104)
src/debugger/debugger_runtime.h (+37/-20)
src/debugger/debugger_server.cpp (+292/-90)
src/debugger/debugger_server.h (+24/-1)
src/debugger/socket_streambuf.cpp (+68/-55)
src/debugger/socket_streambuf.h (+20/-9)
src/diagnostics/diagnostic_en.xml (+70/-26)
src/diagnostics/dict_XX_cpp.xq (+1/-0)
src/diagnostics/pregenerated/diagnostic_list.cpp (+18/-6)
src/diagnostics/pregenerated/dict_en.cpp (+13/-3)
src/functions/CMakeLists.txt (+1/-0)
src/functions/external_function.cpp (+85/-5)
src/functions/external_function.h (+5/-1)
src/functions/func_accessors_impl.cpp (+81/-61)
src/functions/func_accessors_impl.h (+5/-0)
src/functions/func_apply.cpp (+1/-1)
src/functions/func_arithmetic.cpp (+23/-20)
src/functions/func_booleans_impl.cpp (+60/-40)
src/functions/func_collections_impl.cpp (+44/-2)
src/functions/func_durations_dates_times_impl.cpp (+2/-2)
src/functions/func_enclosed.cpp (+14/-11)
src/functions/func_errors_and_diagnostics_impl.cpp (+11/-2)
src/functions/func_eval.cpp (+4/-4)
src/functions/func_hoist.cpp (+40/-34)
src/functions/func_index_ddl.cpp (+1/-1)
src/functions/func_index_ddl.h (+11/-11)
src/functions/func_node_sort_distinct.cpp (+48/-13)
src/functions/func_node_sort_distinct.h (+8/-6)
src/functions/func_numerics_impl.cpp (+152/-152)
src/functions/func_reflection.cpp (+7/-4)
src/functions/func_sequences_impl.cpp (+279/-213)
src/functions/func_sequences_impl.h (+97/-56)
src/functions/func_serialize_impl.cpp (+39/-0)
src/functions/func_strings_impl.cpp (+21/-2)
src/functions/func_var_decl.cpp (+6/-64)
src/functions/function.cpp (+57/-18)
src/functions/function.h (+15/-13)
src/functions/function_consts.h (+5/-6)
src/functions/library.cpp (+2/-0)
src/functions/pregenerated/func_accessors.cpp (+0/-20)
src/functions/pregenerated/func_accessors.h (+70/-58)
src/functions/pregenerated/func_any_uri.h (+4/-2)
src/functions/pregenerated/func_base64.h (+8/-4)
src/functions/pregenerated/func_booleans.h (+21/-9)
src/functions/pregenerated/func_collections.h (+171/-65)
src/functions/pregenerated/func_context.h (+32/-16)
src/functions/pregenerated/func_documents.h (+22/-10)
src/functions/pregenerated/func_durations_dates_times.h (+84/-42)
src/functions/pregenerated/func_errors_and_diagnostics.h (+21/-11)
src/functions/pregenerated/func_fetch.h (+8/-4)
src/functions/pregenerated/func_fnput.h (+6/-2)
src/functions/pregenerated/func_function_item_iter.h (+12/-6)
src/functions/pregenerated/func_ic_ddl.h (+12/-6)
src/functions/pregenerated/func_maps.h (+32/-16)
src/functions/pregenerated/func_maths.h (+104/-52)
src/functions/pregenerated/func_node_position.cpp (+584/-0)
src/functions/pregenerated/func_node_position.h (+409/-0)
src/functions/pregenerated/func_nodes.h (+128/-54)
src/functions/pregenerated/func_numerics.h (+35/-21)
src/functions/pregenerated/func_other_diagnostics.h (+8/-4)
src/functions/pregenerated/func_parse_fragment.h (+4/-2)
src/functions/pregenerated/func_parsing_and_serializing.h (+10/-4)
src/functions/pregenerated/func_qnames.h (+41/-19)
src/functions/pregenerated/func_random.h (+12/-6)
src/functions/pregenerated/func_schema.h (+27/-11)
src/functions/pregenerated/func_sctx.h (+100/-50)
src/functions/pregenerated/func_sequences.h (+255/-185)
src/functions/pregenerated/func_strings.cpp (+60/-0)
src/functions/pregenerated/func_strings.h (+154/-63)
src/functions/pregenerated/func_xqdoc.h (+8/-4)
src/functions/pregenerated/function_enum.h (+27/-1)
src/functions/signature.cpp (+92/-62)
src/functions/signature.h (+9/-1)
src/functions/udf.cpp (+242/-16)
src/functions/udf.h (+53/-5)
src/runtime/accessors/accessors_impl.cpp (+22/-22)
src/runtime/booleans/BooleanImpl.cpp (+200/-218)
src/runtime/booleans/BooleanImpl.h (+1/-1)
src/runtime/collections/collections_impl.cpp (+21/-21)
src/runtime/core/arithmetic_impl.cpp (+50/-52)
src/runtime/core/arithmetic_impl.h (+18/-15)
src/runtime/core/constructors.cpp (+93/-99)
src/runtime/core/constructors.h (+15/-44)
src/runtime/core/flwor_iterator.cpp (+40/-44)
src/runtime/core/flwor_iterator.h (+1/-0)
src/runtime/core/fncall_iterator.cpp (+171/-25)
src/runtime/core/fncall_iterator.h (+39/-6)
src/runtime/core/gflwor/common.cpp (+45/-27)
src/runtime/core/gflwor/common.h (+4/-2)
src/runtime/core/gflwor/groupby_iterator.cpp (+9/-14)
src/runtime/core/gflwor/orderby_iterator.cpp (+10/-10)
src/runtime/core/gflwor/window_iterator.cpp (+3/-5)
src/runtime/core/path_iterators.h (+1/-1)
src/runtime/core/sequencetypes.cpp (+204/-156)
src/runtime/core/trycatch.cpp (+1/-1)
src/runtime/core/var_iterators.cpp (+178/-124)
src/runtime/core/var_iterators.h (+47/-29)
src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp (+6/-7)
src/runtime/errors_and_diagnostics/other_diagnostics_impl.cpp (+13/-7)
src/runtime/eval/eval.cpp (+71/-35)
src/runtime/eval/eval.h (+18/-9)
src/runtime/fetch/fetch_impl.cpp (+11/-9)
src/runtime/full_text/apply.cpp (+20/-12)
src/runtime/full_text/ft_stop_words_set.cpp (+4/-4)
src/runtime/full_text/icu_tokenizer.cpp (+51/-24)
src/runtime/full_text/icu_tokenizer.h (+2/-2)
src/runtime/full_text/thesauri/wn_synset.cpp (+4/-2)
src/runtime/full_text/thesaurus.cpp (+22/-27)
src/runtime/full_text/thesaurus.h (+2/-27)
src/runtime/function_item/dynamic_fncall_iterator.cpp (+26/-6)
src/runtime/indexing/index_ddl.cpp (+52/-15)
src/runtime/indexing/index_ddl.h (+37/-30)
src/runtime/introspection/sctx_impl.cpp (+1/-1)
src/runtime/misc/materialize.cpp (+1/-1)
src/runtime/nodes/node_position_impl.cpp (+756/-0)
src/runtime/nodes/pregenerated/node_position.cpp (+710/-0)
src/runtime/nodes/pregenerated/node_position.h (+858/-0)
src/runtime/numerics/NumericsImpl.cpp (+99/-113)
src/runtime/numerics/NumericsImpl.h (+2/-2)
src/runtime/numerics/numerics_impl.cpp (+30/-58)
src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp (+13/-6)
src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h (+2/-0)
src/runtime/qnames/qnames_impl.cpp (+41/-48)
src/runtime/scripting/scripting.cpp (+7/-8)
src/runtime/sequences/sequences_impl.cpp (+42/-24)
src/runtime/spec/accessors/accessors.xml (+48/-14)
src/runtime/spec/booleans/booleans.xml (+28/-15)
src/runtime/spec/codegen-h.xq (+36/-12)
src/runtime/spec/collections/collections.xml (+22/-0)
src/runtime/spec/errors_and_diagnostics/errors_and_diagnostics.xml (+3/-0)
src/runtime/spec/fnput/fnput.xml (+2/-1)
src/runtime/spec/mappings.xml (+5/-1)
src/runtime/spec/nodes/node_position.xml (+439/-0)
src/runtime/spec/nodes/nodes.xml (+320/-236)
src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml (+5/-0)
src/runtime/spec/plan_iter_visitor_h.xq (+4/-4)
src/runtime/spec/printer_visitor_cpp.xq (+2/-2)
src/runtime/spec/printer_visitor_h.xq (+1/-1)
src/runtime/spec/qnames/qnames.xml (+17/-0)
src/runtime/spec/schema/schema.xml (+19/-0)
src/runtime/spec/sequences/sequences.xml (+17/-0)
src/runtime/spec/store/documents.xml (+1/-0)
src/runtime/spec/strings/strings.xml (+61/-7)
src/runtime/store/maps_impl.cpp (+16/-3)
src/runtime/strings/pregenerated/strings.cpp (+70/-0)
src/runtime/strings/pregenerated/strings.h (+89/-0)
src/runtime/strings/strings_impl.cpp (+428/-101)
src/runtime/update/update.cpp (+2/-1)
src/runtime/visitors/planiter_visitor_impl_code.h (+51/-52)
src/runtime/visitors/planiter_visitor_impl_include.h (+5/-6)
src/runtime/visitors/pregenerated/planiter_visitor.h (+131/-1)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+365/-0)
src/runtime/visitors/pregenerated/printer_visitor.h (+78/-0)
src/runtime/visitors/printer_visitor_impl.cpp (+234/-173)
src/runtime/visitors/printer_visitor_impl.h (+56/-51)
src/runtime/xqdoc/xqdoc_impl.cpp (+4/-4)
src/store/api/annotation.h (+17/-15)
src/store/api/index.h (+60/-22)
src/store/api/item.h (+106/-27)
src/store/api/item_factory.h (+4/-145)
src/store/api/iterator.h (+2/-0)
src/store/api/shared_types.h (+3/-0)
src/store/api/store.h (+20/-9)
src/store/api/temp_seq.h (+51/-47)
src/store/api/update_consts.h (+1/-1)
src/store/api/xs_type_codes.h (+94/-0)
src/store/naive/atomic_items.cpp (+922/-254)
src/store/naive/atomic_items.h (+267/-89)
src/store/naive/collection_set.cpp (+2/-2)
src/store/naive/dataguide.cpp (+1/-1)
src/store/naive/inmemorystore.cpp (+2/-2)
src/store/naive/inmemorystorec.cpp (+1/-1)
src/store/naive/item.cpp (+204/-28)
src/store/naive/item_iterator.cpp (+1/-1)
src/store/naive/item_vector.cpp (+4/-2)
src/store/naive/loader_dtd.cpp (+103/-67)
src/store/naive/loader_fast.cpp (+42/-47)
src/store/naive/node_factory.cpp (+6/-6)
src/store/naive/node_factory.h (+3/-3)
src/store/naive/node_items.cpp (+653/-285)
src/store/naive/node_items.h (+177/-75)
src/store/naive/node_iterators.cpp (+38/-12)
src/store/naive/node_iterators.h (+63/-9)
src/store/naive/node_updates.cpp (+39/-21)
src/store/naive/nsbindings.cpp (+4/-4)
src/store/naive/nsbindings.h (+3/-2)
src/store/naive/ordpath.cpp (+96/-2)
src/store/naive/ordpath.h (+11/-4)
src/store/naive/properties.cpp (+1/-1)
src/store/naive/pul_primitive_factory.cpp (+3/-3)
src/store/naive/pul_primitives.cpp (+37/-38)
src/store/naive/pul_primitives.h (+5/-1)
src/store/naive/qname_pool.cpp (+8/-8)
src/store/naive/qname_pool.h (+1/-1)
src/store/naive/shared_types.h (+3/-0)
src/store/naive/simple_collection.cpp (+10/-8)
src/store/naive/simple_collection.h (+2/-3)
src/store/naive/simple_index.cpp (+316/-306)
src/store/naive/simple_index.h (+163/-204)
src/store/naive/simple_index_general.cpp (+1564/-2176)
src/store/naive/simple_index_general.h (+313/-174)
src/store/naive/simple_index_value.cpp (+188/-52)
src/store/naive/simple_index_value.h (+84/-39)
src/store/naive/simple_item_factory.cpp (+97/-15)
src/store/naive/simple_item_factory.h (+21/-0)
src/store/naive/simple_iterator_factory.cpp (+6/-6)
src/store/naive/simple_lazy_temp_seq.cpp (+169/-97)
src/store/naive/simple_lazy_temp_seq.h (+31/-144)
src/store/naive/simple_pul.cpp (+55/-55)
src/store/naive/simple_store.cpp (+227/-206)
src/store/naive/simple_store.h (+71/-48)
src/store/naive/simple_temp_seq.cpp (+185/-229)
src/store/naive/simple_temp_seq.h (+49/-51)
src/store/naive/store_defs.h (+0/-78)
src/store/naive/string_pool.cpp (+1/-1)
src/system/globalenv.cpp (+73/-25)
src/system/globalenv.h (+41/-22)
src/system/properties.h (+21/-0)
src/system/zorba_properties.h (+28/-2)
src/system/zorba_properties.txt (+5/-2)
src/types/casting.cpp (+471/-228)
src/types/casting.h (+37/-15)
src/types/root_typemanager.cpp (+11/-11)
src/types/root_typemanager.h (+6/-9)
src/types/schema/revalidateUtils.cpp (+3/-3)
src/types/schema/schema.cpp (+7/-7)
src/types/schema/schema.h (+2/-2)
src/types/typeconstants.h (+1/-51)
src/types/typeimpl.cpp (+1/-1)
src/types/typeimpl.h (+7/-7)
src/types/typemanager.h (+6/-3)
src/types/typemanagerimpl.cpp (+5/-8)
src/types/typemanagerimpl.h (+1/-1)
src/types/typeops.cpp (+31/-12)
src/types/typeops.h (+21/-5)
src/unit_tests/CMakeLists.txt (+13/-1)
src/unit_tests/stemmer.cpp (+9/-1)
src/unit_tests/string.cpp (+11/-1)
src/unit_tests/string_instantiate.cpp (+9/-1)
src/unit_tests/test_debugger_protocol.cpp (+0/-414)
src/unit_tests/thesaurus.cpp (+18/-14)
src/unit_tests/tokenizer.cpp (+9/-1)
src/unit_tests/unique_ptr.cpp (+8/-1)
src/unit_tests/unit_test_list.h (+8/-3)
src/unit_tests/unit_tests.cpp (+9/-1)
src/util/ascii_util.h (+1/-6)
src/util/file.cpp (+12/-0)
src/util/fs_util.cpp (+35/-0)
src/util/fs_util.h (+23/-0)
src/util/http_util.cpp (+9/-4)
src/util/http_util.h (+0/-2)
src/util/regex.h (+2/-2)
src/util/regex_ascii.h (+0/-2)
src/util/string_util.h (+6/-2)
src/util/unicode_util.h (+4/-9)
src/util/uri_util.cpp (+2/-2)
src/util/utf8_util.cpp (+17/-0)
src/util/utf8_util.h (+0/-5)
src/util/utf8_util_base.h (+27/-12)
src/util/xml_util.h (+0/-1)
src/zorbamisc/ns_consts.h (+1/-5)
src/zorbaserialization/archiver.cpp (+4/-1)
src/zorbaserialization/archiver.h (+1/-1)
src/zorbaserialization/zorba_class_serializer.cpp (+1/-0)
src/zorbaserialization/zorba_class_serializer.h (+3/-5)
src/zorbatypes/URI.cpp (+18/-5)
src/zorbatypes/rchandle.h (+9/-2)
src/zorbatypes/rclist.h (+37/-0)
src/zorbautils/hashmap_itemh.h (+112/-0)
swig/CMakeLists.txt (+2/-7)
swig/ItemFactory.h (+69/-0)
swig/ItemFactory.i (+192/-0)
swig/StaticContext.h (+69/-0)
swig/StaticContext.i (+43/-107)
swig/XQuery.i (+89/-8)
swig/Zorba.i (+28/-1)
swig/java/CMakeLists.txt (+6/-1)
swig/php/CMakeLists.txt (+17/-27)
swig/php/XQueryProcessor.php (+397/-0)
swig/php/generate_proxy.php.in (+0/-209)
swig/php/test.xq (+1/-0)
swig/php/zorba_api.i (+7/-1)
swig/php/zorba_api_wrapper.php (+1215/-0)
swig/python/CMakeLists.txt (+2/-0)
swig/ruby/CMakeLists.txt (+10/-0)
swig/various.i (+184/-0)
swig/zorba_api.i (+12/-2)
test/apitest.cpp (+21/-6)
test/http-test-data/docroot/http-test-data/http2.xml (+4/-0)
test/rbkt/ExpCompilerResults/IterPlan/iterscript.cmake (+14/-10)
test/rbkt/ExpCompilerResults/IterPlan/zorba/error/trace1.iter (+8/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/hashjoins/idx5.iter (+1/-1)
test/rbkt/ExpCompilerResults/IterPlan/zorba/misc/hoist4.iter (+7/-7)
test/rbkt/ExpCompilerResults/IterPlan/zorba/misc/inline_var1.iter (+2/-2)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter (+375/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter (+375/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide2-c.iter (+139/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide2-nc.iter (+139/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dblp-q0.iter (+182/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9065.iter (+62/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9198.iter (+75/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9199.iter (+75/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9212.iter (+83/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9389.iter (+70/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9390.iter (+70/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-9392.iter (+71/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-gary1.iter (+227/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-idx1.iter (+105/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-idx4.iter (+168/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/hashjoin-q8.iter (+102/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/path17.iter (+70/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q1.iter (+49/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q10.iter (+246/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q11.iter (+103/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q12.iter (+115/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q13.iter (+45/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q14.iter (+39/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q15.iter (+50/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q16.iter (+65/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q17.iter (+47/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q18.iter (+38/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q19.iter (+56/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q2.iter (+43/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q20.iter (+192/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q3.iter (+139/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q4.iter (+126/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q5.iter (+41/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q6.iter (+29/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q7.iter (+39/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q8.iter (+107/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/q9.iter (+169/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/udfs1.iter (+58/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/paths/pred_order.iter (+2/-2)
test/rbkt/ExpCompilerResults/IterPlan/zorba/string/SubstringFunc/SubstringFunc2.iter (+10/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/string/SubstringFunc/SubstringFunc3.iter (+14/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/udf/udf-fib-rec.iter (+42/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/udf/udf1.iter (+5/-5)
test/rbkt/ExpCompilerResults/IterPlan/zorba/xray/ppm_10.iter (+18/-23)
test/rbkt/ExpQueryResults/zorba/debugger/dmh/break_response.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/debugger/dmh/break_response_no_info.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/error/trace1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/eval/eval9.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/eval/invoke1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/fetch/fetch_random_file.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/fulltext/ft-expr-clone-1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/fulltext/ft-same-sentence-false-2.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/groupby/posvar.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/index/auctions1.xml.res (+3/-3)
test/rbkt/ExpQueryResults/zorba/index/numbers.xml.res (+21/-0)
test/rbkt/ExpQueryResults/zorba/misc/baseuri.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/dataguide-c.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/dataguide-nc.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/dataguide2-c.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/dataguide2-nc.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/dblp-q0.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-9198.xml.res (+19/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-9199.xml.res (+19/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-9212.xml.res (+49/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-9389.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-9390.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-9392.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-gary1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-idx1.xml.res (+254/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-idx4.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/hashjoin-q8.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/parser_test.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/path17.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q10.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q11.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q12.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q13.xml.res (+18/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q14.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q17.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q18.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q19.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q2.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q20.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q3.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q5.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q6.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q7.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q8.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/q9.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/no-copy/udfs1.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_1.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_1_parsed.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_2.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_2_parsed.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_3.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_3_parsed.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_4.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_4_parsed.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/nodes/position_err.xml.res (+6/-0)
test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/schemas/validate_xqdoc_02.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/spec/xquery_1_1.xml.res (+0/-4)
test/rbkt/ExpQueryResults/zorba/spec/xquery_3_0.xml.res (+4/-0)
test/rbkt/ExpQueryResults/zorba/string/Regex/regex_a4.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/string/tokenize01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/string/tokenize02.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/string/tokenize03.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/string/tokenize04.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/udf/udf-fib-rec-BIG_INTEGER.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/udf/udf-fib-rec.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/updates/no_hoist.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/updates/recursive.xml.res (+2/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding02.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding03.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding04.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding06.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding07.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding09.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding10.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding11.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding12.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding13.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/sliding14.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling01.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling02.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling04.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling05.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling07.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling08.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling09.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling10.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling24.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling26.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling27.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling28.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling29.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling30.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling32.xml.res (+12/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling33.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling34.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling35.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling36.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling38.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling39.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling40.xml.res (+24/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling41.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling45.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling46.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling47.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/tumbling48.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/windowing/windowing12.xml.res (+1/-0)
test/rbkt/Queries/CMakeLists.txt (+274/-19)
test/rbkt/Queries/w3c_known_failures.txt (+49/-90)
test/rbkt/Queries/w3c_known_failures_XQueryX.txt (+88/-0)
test/rbkt/Queries/zorba/annotations/annot-unknown-02.spec (+1/-1)
test/rbkt/Queries/zorba/annotations/annot-unknown-02.xq (+10/-6)
test/rbkt/Queries/zorba/annotations/annot-unknown-04.spec (+1/-1)
test/rbkt/Queries/zorba/annotations/annot-unknown-04.xq (+9/-6)
test/rbkt/Queries/zorba/debugger/dmh/break_response.xq (+5/-0)
test/rbkt/Queries/zorba/debugger/dmh/break_response_no_info.xq (+7/-0)
test/rbkt/Queries/zorba/error/trace1.xq (+6/-0)
test/rbkt/Queries/zorba/eval/eval9.xq (+6/-0)
test/rbkt/Queries/zorba/eval/invoke1.xq (+5/-0)
test/rbkt/Queries/zorba/eval/invoke1_1.xqlib (+10/-0)
test/rbkt/Queries/zorba/eval/invoke1_2.xqlib (+3/-0)
test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_random_file.xq (+4/-0)
test/rbkt/Queries/zorba/fulltext/ft-expr-clone-1.xq (+10/-0)
test/rbkt/Queries/zorba/fulltext/ft-same-sentence-false-2.xq (+2/-0)
test/rbkt/Queries/zorba/fulltext/ft-same-sentence-true-2.xq (+1/-1)
test/rbkt/Queries/zorba/fulltext/ft-same-sentence-true-3.xq (+1/-1)
test/rbkt/Queries/zorba/fulltext/ft-same-sentence-true-4.xq (+1/-1)
test/rbkt/Queries/zorba/groupby/posvar.xq (+17/-0)
test/rbkt/Queries/zorba/index/auctions1.xml (+1/-0)
test/rbkt/Queries/zorba/index/auctions1.xq (+1/-1)
test/rbkt/Queries/zorba/index/numbers.xml (+10/-0)
test/rbkt/Queries/zorba/index/numbers.xq (+75/-0)
test/rbkt/Queries/zorba/index/numbers.xqlib (+28/-0)
test/rbkt/Queries/zorba/misc/baseuri.xml (+1/-0)
test/rbkt/Queries/zorba/misc/baseuri.xq (+2/-0)
test/rbkt/Queries/zorba/modules/libraryModule15.xqlib (+8/-3)
test/rbkt/Queries/zorba/no-copy/auction.xml (+2182/-0)
test/rbkt/Queries/zorba/no-copy/books.xml (+25/-0)
test/rbkt/Queries/zorba/no-copy/dataguide-c.xq (+87/-0)
test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq (+91/-0)
test/rbkt/Queries/zorba/no-copy/dataguide2-c.xq (+33/-0)
test/rbkt/Queries/zorba/no-copy/dataguide2-nc.xq (+38/-0)
test/rbkt/Queries/zorba/no-copy/dblp-q0.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/dblp-q0.xq (+32/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9065.xq (+9/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9198.xq (+13/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9199.xq (+11/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9212.xq (+15/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9389.xq (+13/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9390.xq (+15/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-9392.xq (+14/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-gary1.xq (+42/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-idx1.xq (+12/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-idx4.xq (+33/-0)
test/rbkt/Queries/zorba/no-copy/hashjoin-q8.xq (+17/-0)
test/rbkt/Queries/zorba/no-copy/parser_test.xq (+3/-0)
test/rbkt/Queries/zorba/no-copy/path17.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/path17.xq (+12/-0)
test/rbkt/Queries/zorba/no-copy/q1.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q1.xq (+9/-0)
test/rbkt/Queries/zorba/no-copy/q10.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q10.xq (+36/-0)
test/rbkt/Queries/zorba/no-copy/q11.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q11.xq (+13/-0)
test/rbkt/Queries/zorba/no-copy/q12.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q12.xq (+16/-0)
test/rbkt/Queries/zorba/no-copy/q13.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q13.xq (+9/-0)
test/rbkt/Queries/zorba/no-copy/q14.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q14.xq (+11/-0)
test/rbkt/Queries/zorba/no-copy/q15.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q15.xq (+10/-0)
test/rbkt/Queries/zorba/no-copy/q16.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q16.xq (+17/-0)
test/rbkt/Queries/zorba/no-copy/q17.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q17.xq (+10/-0)
test/rbkt/Queries/zorba/no-copy/q18.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q18.xq (+17/-0)
test/rbkt/Queries/zorba/no-copy/q19.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q19.xq (+13/-0)
test/rbkt/Queries/zorba/no-copy/q2.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q2.xq (+10/-0)
test/rbkt/Queries/zorba/no-copy/q20.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q20.xq (+34/-0)
test/rbkt/Queries/zorba/no-copy/q3.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q3.xq (+14/-0)
test/rbkt/Queries/zorba/no-copy/q4.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q4.xq (+14/-0)
test/rbkt/Queries/zorba/no-copy/q5.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q5.xq (+13/-0)
test/rbkt/Queries/zorba/no-copy/q6.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q6.xq (+10/-0)
test/rbkt/Queries/zorba/no-copy/q7.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q7.xq (+11/-0)
test/rbkt/Queries/zorba/no-copy/q8.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q8.xq (+14/-0)
test/rbkt/Queries/zorba/no-copy/q9.spec (+3/-0)
test/rbkt/Queries/zorba/no-copy/q9.xq (+20/-0)
test/rbkt/Queries/zorba/no-copy/simple_parser.xqlib (+2207/-0)
test/rbkt/Queries/zorba/no-copy/test1.xq (+17/-0)
test/rbkt/Queries/zorba/no-copy/udfs1.xq (+31/-0)
test/rbkt/Queries/zorba/no-copy/udfs2.xq (+31/-0)
test/rbkt/Queries/zorba/nodes/position.xml (+15/-0)
test/rbkt/Queries/zorba/nodes/position_1.xq (+97/-0)
test/rbkt/Queries/zorba/nodes/position_1_parsed.xq (+98/-0)
test/rbkt/Queries/zorba/nodes/position_2.xq (+157/-0)
test/rbkt/Queries/zorba/nodes/position_2_parsed.xq (+156/-0)
test/rbkt/Queries/zorba/nodes/position_3.xq (+32/-0)
test/rbkt/Queries/zorba/nodes/position_3_parsed.xq (+34/-0)
test/rbkt/Queries/zorba/nodes/position_4.xq (+84/-0)
test/rbkt/Queries/zorba/nodes/position_4_parsed.xq (+81/-0)
test/rbkt/Queries/zorba/nodes/position_err.xq (+60/-0)
test/rbkt/Queries/zorba/schemas/local-xhtml.spec (+1/-0)
test/rbkt/Queries/zorba/schemas/local-xhtml.xq (+6/-0)
test/rbkt/Queries/zorba/schemas/validate_xqdoc_01.xq (+4/-0)
test/rbkt/Queries/zorba/schemas/validate_xqdoc_02.xq (+4/-0)
test/rbkt/Queries/zorba/spec/XQuery_3.0.html (+28771/-30944)
test/rbkt/Queries/zorba/spec/xquery_1_1.spec (+0/-5)
test/rbkt/Queries/zorba/spec/xquery_1_1.xq (+0/-69)
test/rbkt/Queries/zorba/spec/xquery_3_0.spec (+5/-0)
test/rbkt/Queries/zorba/spec/xquery_3_0.xq (+69/-0)
test/rbkt/Queries/zorba/spec/xquery_spec.xqi (+4/-13)
test/rbkt/Queries/zorba/store/documents.xq (+1/-0)
test/rbkt/Queries/zorba/store/example_3.xq (+4/-4)
test/rbkt/Queries/zorba/string/Regex/regex_a4.xq (+1/-0)
test/rbkt/Queries/zorba/string/token01.txt (+1/-0)
test/rbkt/Queries/zorba/string/token02.txt (+1/-0)
test/rbkt/Queries/zorba/string/token03.txt (+1/-0)
test/rbkt/Queries/zorba/string/token04.txt (+1/-0)
test/rbkt/Queries/zorba/string/tokenize01.xq (+5/-0)
test/rbkt/Queries/zorba/string/tokenize02.xq (+5/-0)
test/rbkt/Queries/zorba/string/tokenize03.xq (+5/-0)
test/rbkt/Queries/zorba/string/tokenize04.xq (+5/-0)
test/rbkt/Queries/zorba/udf/udf-fib-rec.spec (+1/-0)
test/rbkt/Queries/zorba/udf/udf-fib-rec.xq (+8/-0)
test/rbkt/Queries/zorba/updates/no_hoist.xq (+8/-0)
test/rbkt/Queries/zorba/updates/recursive.xq (+11/-0)
test/rbkt/Queries/zorba/versioning/import-chain1.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import-chain2.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import1.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import2.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import3.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import4.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import5.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import6.xq (+1/-1)
test/rbkt/Queries/zorba/versioning/import7.xq (+1/-1)
test/rbkt/Queries/zorba/windowing/sliding01.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/sliding02.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/sliding03.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/sliding04.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/sliding05.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/sliding06.xq (+6/-0)
test/rbkt/Queries/zorba/windowing/sliding07.xq (+10/-0)
test/rbkt/Queries/zorba/windowing/sliding08.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/sliding08.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/sliding09.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/sliding10.xq (+18/-0)
test/rbkt/Queries/zorba/windowing/sliding11.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/sliding12.xq (+7/-0)
test/rbkt/Queries/zorba/windowing/sliding13.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/sliding14.xq (+12/-0)
test/rbkt/Queries/zorba/windowing/tumbling01.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling02.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/tumbling04.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling05.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/tumbling06.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling07.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling08.xq (+6/-0)
test/rbkt/Queries/zorba/windowing/tumbling09.xq (+6/-0)
test/rbkt/Queries/zorba/windowing/tumbling10.xq (+10/-0)
test/rbkt/Queries/zorba/windowing/tumbling11.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling11.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling14.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling14.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling15.spec (+2/-0)
test/rbkt/Queries/zorba/windowing/tumbling15.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling16.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling16.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling17.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling17.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling18.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling18.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling19.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling19.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling20.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling20.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling21.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling21.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling22.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling22.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling24.xq (+6/-0)
test/rbkt/Queries/zorba/windowing/tumbling25.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/tumbling26.xq (+3/-0)
test/rbkt/Queries/zorba/windowing/tumbling27.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling28.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling29.xq (+17/-0)
test/rbkt/Queries/zorba/windowing/tumbling31.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling31.xq (+3/-0)
test/rbkt/Queries/zorba/windowing/tumbling32.xq (+19/-0)
test/rbkt/Queries/zorba/windowing/tumbling33.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/tumbling34.xq (+6/-0)
test/rbkt/Queries/zorba/windowing/tumbling35.xq (+8/-0)
test/rbkt/Queries/zorba/windowing/tumbling36.xq (+5/-0)
test/rbkt/Queries/zorba/windowing/tumbling37.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling37.xq (+8/-0)
test/rbkt/Queries/zorba/windowing/tumbling38.xq (+8/-0)
test/rbkt/Queries/zorba/windowing/tumbling39.xq (+12/-0)
test/rbkt/Queries/zorba/windowing/tumbling40.xq (+27/-0)
test/rbkt/Queries/zorba/windowing/tumbling41.xq (+9/-0)
test/rbkt/Queries/zorba/windowing/tumbling42.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling42.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling43.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling43.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling44.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/tumbling44.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling45.xq (+4/-0)
test/rbkt/Queries/zorba/windowing/tumbling46.xq (+17/-0)
test/rbkt/Queries/zorba/windowing/tumbling47.xq (+20/-0)
test/rbkt/Queries/zorba/windowing/tumbling48.xq (+18/-0)
test/rbkt/Queries/zorba/windowing/tumbling49.xq (+12/-0)
test/rbkt/Queries/zorba/windowing/windowing12.xq (+9/-0)
test/rbkt/Queries/zorba/windowing/windowing13.spec (+1/-0)
test/rbkt/Queries/zorba/windowing/windowing13.xq (+4/-0)
test/rbkt/Queries/zorba/xmark/q10.xq (+8/-4)
test/rbkt/Queries/zorba/xqddf/test-node-reference.xq (+2/-0)
test/rbkt/Scripts/w3c/Readme.txt (+17/-7)
test/rbkt/Scripts/w3c/Submit_xqts.cmake (+23/-9)
test/rbkt/Scripts/w3c/generate-submission-xqftts.xq (+4/-4)
test/rbkt/Scripts/w3c/generate-submission-xqts.xq (+4/-9)
test/rbkt/Scripts/w3c/import_w3c_full_text_testsuite.sh (+1/-1)
test/rbkt/Scripts/w3c/import_w3c_testsuite.sh (+1/-1)
test/rbkt/itertest.xq.in (+58/-44)
test/rbkt/modules/CMakeLists.txt (+9/-3)
test/rbkt/modules/bad-ver.xq (+1/-1)
test/rbkt/modules/java/CMakeLists.txt (+39/-0)
test/rbkt/modules/java/Test.java (+7/-0)
test/rbkt/modules/module-A.xq (+1/-1)
test/rbkt/modules/module-B.xq (+1/-1)
test/rbkt/modules/random-file.txt (+1/-0)
test/rbkt/modules/ver.xq (+1/-1)
test/rbkt/modules/ver2.xq (+1/-1)
test/rbkt/specification.h (+1/-1)
test/rbkt/testdriver.cpp (+1/-0)
test/rbkt/testdriver_common.cpp (+14/-3)
test/rbkt/testdriver_mt.cpp (+32/-5)
test/unit/CMakeLists.txt (+33/-10)
test/unit/context_item.cpp (+158/-0)
test/unit/context_item1.xq (+4/-0)
test/unit/context_item2.xq (+6/-0)
test/unit/cxx_api_ch1.xq (+26/-0)
test/unit/cxx_api_ch2.xq (+17/-0)
test/unit/cxx_api_ch3.xq (+20/-0)
test/unit/cxx_api_ch4.xq (+19/-0)
test/unit/cxx_api_changes.cpp (+345/-0)
test/unit/datetime.cpp (+2/-0)
test/unit/ext_main3.xq (+21/-0)
test/unit/ext_mod2.xq (+19/-0)
test/unit/external_function.cpp (+59/-1)
test/unit/guestbook.xq (+9/-0)
test/unit/guestbook_main.xq (+1/-1)
test/unit/main_invoke.xq (+9/-0)
test/unit/mini_http.xq (+40/-0)
test/unit/module2.xq (+6/-0)
test/unit/module4.xq (+6/-0)
test/unit/plan_serializer.cpp (+37/-13)
test/unit/static_context.cpp (+75/-0)
test/unit/staticcollectionmanager.cpp (+65/-2)
test/unit/testGetExtVarA.xq (+13/-0)
test/unit/testGetExtVarB.xq (+6/-0)
test/update/CMakeLists.txt (+1/-1)
test/update/Queries/zorba/store/sc3.spec (+0/-2)
test/update/Scripts/Readme.txt (+8/-5)
test/update/Scripts/XQUTS.xml (+1/-1)
test/update/Scripts/generate-submission-xquts.xq (+11/-4)
test/update/Scripts/import_w3c_update_testsuite.sh (+1/-1)
test/update/Scripts/zorba-xquts-submission.xml (+858/-0)
test/update/Scripts/zorba-xqutsx-submission.xml (+858/-0)
test/zperf/src/start.xq (+154/-100)
To merge this branch: bzr merge lp:~zorba-coders/zorba/module-schema-tools
Reviewer Review Type Date Requested Status
Cezar Andrei Approve
Review via email: mp+94229@code.launchpad.net

Commit message

Testing schema-tools which includes xmlbeans.

Description of the change

Testing schema-tools which includes xmlbeans.

To post a comment you must log in.
Revision history for this message
Cezar Andrei (cezar-andrei) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
10624. By Cezar Andrei <email address hidden>

Make external libraries load only ones, even if they are required multiple times.

10625. By Cezar Andrei <email address hidden>

Merge from trunk, fix conflicts.
Remove schema-module from ExternalModules.conf

10626. By Cezar Andrei <email address hidden>

Fix for Win32 code.

10627. By Cezar Andrei <email address hidden>

Adding win32 dirent.h implementation.

10628. By Cezar Andrei <email address hidden>

Merge Rodolfo's changes.

10629. By Cezar Andrei <email address hidden>

Since dirent.h for windows is in no need to do something special in lsdir.

10630. By Cezar Andrei <email address hidden>

Enable schema-tools module for merging into experimental.

10631. By Cezar Andrei <email address hidden>

Merge from trunk.

10632. By Cezar Andrei <email address hidden>

Refactor DymanicLoader::loadModule.
Remove commented macro.

10633. By Cezar Andrei <email address hidden>

Revert store_properties.h to trunk version.

10634. By Cezar Andrei <email address hidden>

Added dirent.h entry in NOTICE.xml.

10635. By Cezar Andrei <email address hidden>

Update NOTICE.txt

10636. By Cezar Andrei <email address hidden>

Remove java version output and comment.

10637. By Cezar Andrei <email address hidden>

Ficx spelling.

10638. By Cezar Andrei <email address hidden>

Rename getProperties to getPropertiesGlobal.

10639. By Cezar Andrei <email address hidden>

Remove schema-tools module from ExternalModules.conf

10640. By Cezar Andrei <email address hidden>

Fix ExternalModule.conf to the latest in trunk.

10641. By Cezar Andrei <email address hidden>

Fix wrong merge of options.

10642. By Cezar Andrei <email address hidden>

Merge from trunk.

10643. By Cezar Andrei <email address hidden>

Removed the top comment about this file beeing generated.
Fix some indentation.

10644. By Cezar Andrei <email address hidden>

Fix indentation src/system/zorba_properties.h.

10645. By Cezar Andrei <email address hidden>

Include schema-tools as external module for experimental.

10646. By Cezar Andrei <email address hidden>

Comment out reference to schema-tools module.
Removed swig IStream class and references.

10647. By Chris Hillery

Merge from trunk.

10648. By Chris Hillery

Significantly enhance modules/CMakeLists.txt to automatically figure
out in what order to add non-core module projects to Zorba. This was
necessary to extend the functionality of the automatically-created
moduleConfig.cmake files used in inter-module dependencies. These
files can now reference a "use file" to enable information such as
include directories to be shared to dependent modules.

10649. By Chris Hillery

Tweak DAG-formation algorithm to skip dependencies that aren't on other
module projects.

10650. By Chris Hillery

Move auto-creation of module package Config.cmake file to
DONE_DECLARING_ZORBA_URIS(), and extended it to support _INCLUDE_DIRS
and _LIBRARIES. The latter is automatically populated with all dynamic
libs created by DECLARE_ZORBA_MODULE().

10651. By Chris Hillery

Fix build dependencies for .jar files and inter-dependent modules.

10652. By Chris Hillery

Work around CMake bug with LIST(REMOVE_DUPLICATES).

10653. By Chris Hillery

Add util-jvm module.

10654. By Cezar Andrei <email address hidden>

Merge from trunk.

10655. By Cezar Andrei <email address hidden>

Add entries in ChangeLog.

10656. By Chris Hillery

Removing orphaned JVM classpath fields from static_context.

10657. By Chris Hillery

Merge from trunk.

10658. By Chris Hillery

Yet another crack at making the build dependencies for modules and zorba
completely consistent and correct.

10659. By Chris Hillery

Merge from trunk; remove erroneous swig merge.

10660. By Chris Hillery

Merge from trunk.

10661. By Chris Hillery

Merge from trunk.

10662. By Chris Hillery

Merge from trunk.

10663. By Chris Hillery

Unwanted file.

Unmerged revisions

10663. By Chris Hillery

Unwanted file.

10662. By Chris Hillery

Merge from trunk.

10661. By Chris Hillery

Merge from trunk.

10660. By Chris Hillery

Merge from trunk.

10659. By Chris Hillery

Merge from trunk; remove erroneous swig merge.

10658. By Chris Hillery

Yet another crack at making the build dependencies for modules and zorba
completely consistent and correct.

10657. By Chris Hillery

Merge from trunk.

10656. By Chris Hillery

Removing orphaned JVM classpath fields from static_context.

10655. By Cezar Andrei <email address hidden>

Add entries in ChangeLog.

10654. By Cezar Andrei <email address hidden>

Merge from trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeConfiguration.txt'
--- CMakeConfiguration.txt 2011-09-16 19:55:59 +0000
+++ CMakeConfiguration.txt 2012-02-22 17:11:27 +0000
@@ -70,10 +70,6 @@
70SET(ZORBA_FOR_ONE_THREAD_ONLY OFF CACHE BOOL "compile zorba for single threaded use")70SET(ZORBA_FOR_ONE_THREAD_ONLY OFF CACHE BOOL "compile zorba for single threaded use")
71MESSAGE(STATUS "ZORBA_FOR_ONE_THREAD_ONLY: " ${ZORBA_FOR_ONE_THREAD_ONLY})71MESSAGE(STATUS "ZORBA_FOR_ONE_THREAD_ONLY: " ${ZORBA_FOR_ONE_THREAD_ONLY})
7272
73# by default the zorba command line client is deactivated until it gets to a more stable and userfriendly state
74SET(ZORBA_WITH_DEBUGGER_CLIENT OFF CACHE BOOL "build and install zorbas command line debugger client")
75MESSAGE(STATUS "ZORBA_WITH_DEBUGGER_CLIENT: " ${ZORBA_WITH_DEBUGGER_CLIENT})
76
77IF (DEFINED UNIX)73IF (DEFINED UNIX)
78 IF (NOT DEFINED ZORBA_HAVE_PTHREAD_H AND NOT DEFINED ZORBA_FOR_ONE_THREAD_ONLY)74 IF (NOT DEFINED ZORBA_HAVE_PTHREAD_H AND NOT DEFINED ZORBA_FOR_ONE_THREAD_ONLY)
79 MESSAGE(FATAL_ERROR "pthread is not available")75 MESSAGE(FATAL_ERROR "pthread is not available")
8076
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2011-10-09 13:56:39 +0000
+++ CMakeLists.txt 2012-02-22 17:11:27 +0000
@@ -417,13 +417,35 @@
417417
418# zorba versioning418# zorba versioning
419SET(ZORBA_MAJOR_NUMBER "2")419SET(ZORBA_MAJOR_NUMBER "2")
420SET(ZORBA_MINOR_NUMBER "0")420SET(ZORBA_MINOR_NUMBER "1")
421SET(ZORBA_PATCH_NUMBER "1")421SET(ZORBA_PATCH_NUMBER "0")
422SET(ZORBA_VERSION ${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER})422SET(ZORBA_VERSION ${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER})
423MESSAGE(STATUS "Zorba version number: ${ZORBA_VERSION}")423MESSAGE(STATUS "Zorba version number: ${ZORBA_VERSION}")
424SET(ZORBA_MODULES_INSTALL_DIR "share/zorba-${ZORBA_VERSION}/modules"424
425 CACHE STRING "Path (relative to installdir) to modules" FORCE)425SET(ZORBA_LIB_DIRNAME "lib" CACHE STRING
426MARK_AS_ADVANCED(ZORBA_MODULES_INSTALL_DIR)426 "directory name for libs (may want to set to 'lib64' on 64-bit Linux platforms)")
427
428# Directories for modules and schemas. "Core" are those which are
429# shipped with Zorba and must be present for correct Zorba
430# functionality. "Non-core" are developed independently of Zorba and
431# have different version lifecycles.
432#
433# URI dir is for things resolved by URI - specifically modules (.xq
434# files) and schemas (.xsd files) - which are platform-
435# independent. Lib dir is for platform-specific files, specifically
436# shared libraries for module external functions.
437SET(ZORBA_NONCORE_URI_DIR "share/zorba/uris"
438 CACHE STRING "Path (relative to installdir) to non-core modules/schemas")
439MARK_AS_ADVANCED(ZORBA_NONCORE_URI_DIR)
440SET(ZORBA_CORE_URI_DIR "${ZORBA_NONCORE_URI_DIR}/core/${ZORBA_VERSION}"
441 CACHE STRING "Path (relative to installdir) to core modules/schemas")
442MARK_AS_ADVANCED(ZORBA_CORE_URI_DIR)
443SET(ZORBA_NONCORE_LIB_DIR "${ZORBA_LIB_DIRNAME}/zorba"
444 CACHE STRING "Path (relative to installdir) to non-core libraries")
445MARK_AS_ADVANCED(ZORBA_NONCORE_LIB_DIR)
446SET(ZORBA_CORE_LIB_DIR "${ZORBA_NONCORE_LIB_DIR}/core/${ZORBA_VERSION}"
447 CACHE STRING "Path (relative to installdir) to core libraries")
448MARK_AS_ADVANCED(ZORBA_CORE_LIB_DIR)
427449
428# add compiler variables450# add compiler variables
429ADD_DEFINITIONS(${DEFINITIONS})451ADD_DEFINITIONS(${DEFINITIONS})
@@ -460,7 +482,7 @@
460 SET(ZORBA_CMAKE_DIR "cmake" CACHE STRING482 SET(ZORBA_CMAKE_DIR "cmake" CACHE STRING
461 "Relative path to CMake files in Zorba installation")483 "Relative path to CMake files in Zorba installation")
462ELSE (WIN32)484ELSE (WIN32)
463 SET(ZORBA_CMAKE_DIR "share/zorba-${ZORBA_VERSION}/cmake" CACHE STRING485 SET(ZORBA_CMAKE_DIR "share/cmake/zorba-${ZORBA_VERSION}" CACHE STRING
464 "Relative path to CMake files in Zorba installation")486 "Relative path to CMake files in Zorba installation")
465ENDIF (WIN32)487ENDIF (WIN32)
466488
@@ -476,14 +498,15 @@
476# Subdirectory ordering: We need to include "test" before "config" so498# Subdirectory ordering: We need to include "test" before "config" so
477# ZorbaConfig knows about testdriver. We need to include "config"499# ZorbaConfig knows about testdriver. We need to include "config"
478# before "modules" so external modules will be able to find500# before "modules" so external modules will be able to find
479# ZorbaConfig.cmake.501# ZorbaConfig.cmake. We need to include "modules" before "include" so
502# config.h can know eg. whether we found CURL.
480503
481ADD_SUBDIRECTORY(test)504ADD_SUBDIRECTORY(test)
482ADD_SUBDIRECTORY(config)505ADD_SUBDIRECTORY(config)
483ADD_SUBDIRECTORY(include)
484ADD_SUBDIRECTORY(doc)506ADD_SUBDIRECTORY(doc)
485ADD_SUBDIRECTORY(schemas)507ADD_SUBDIRECTORY(schemas)
486ADD_SUBDIRECTORY(modules)508ADD_SUBDIRECTORY(modules)
509ADD_SUBDIRECTORY(include)
487510
488ADD_DEFINITIONS(-Dzorba_EXPORTS)511ADD_DEFINITIONS(-Dzorba_EXPORTS)
489ADD_SUBDIRECTORY(src)512ADD_SUBDIRECTORY(src)
@@ -534,4 +557,4 @@
534# This dependency is zorba-only related, which is why it's added here557# This dependency is zorba-only related, which is why it's added here
535# and not within zorba-modules, which is for general use in other558# and not within zorba-modules, which is for general use in other
536# non-zorba modules.559# non-zorba modules.
537ADD_DEPENDENCIES(check_uris gen_diag_modules)560ADD_DEPENDENCIES(check_core_uris gen_diag_modules)
538561
=== modified file 'CPackSourceConfig.cmake.in'
--- CPackSourceConfig.cmake.in 2009-10-30 16:24:51 +0000
+++ CPackSourceConfig.cmake.in 2012-02-22 17:11:27 +0000
@@ -19,7 +19,7 @@
1919
20SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")20SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
21SET(CPACK_GENERATOR "TGZ;TZ")21SET(CPACK_GENERATOR "TGZ;TZ")
22SET(CPACK_IGNORE_FILES "test/coverity/;dist/;_CPack_Packages/;build/;build./;CVS/;/\\.svn/;\\.swp$;\\.#;/#")22SET(CPACK_IGNORE_FILES "test/coverity/;dist/;_CPack_Packages/;build/;build./;CVS/;/\\.svn/;\\.swp$;\\.#;/#;\\.bzr/")
23SET(CPACK_INSTALLED_DIRECTORIES "@CMAKE_SOURCE_DIR@;/")23SET(CPACK_INSTALLED_DIRECTORIES "@CMAKE_SOURCE_DIR@;/")
24SET(CPACK_INSTALL_CMAKE_PROJECTS "")24SET(CPACK_INSTALL_CMAKE_PROJECTS "")
25SET(CPACK_MODULE_PATH "")25SET(CPACK_MODULE_PATH "")
2626
=== modified file 'ChangeLog'
--- ChangeLog 2011-10-20 23:05:55 +0000
+++ ChangeLog 2012-02-22 17:11:27 +0000
@@ -1,13 +1,72 @@
1Zorba - The XQuery Processor1Zorba - The XQuery Processor
22
3version 2.x3version 2.2
44
5 * Custom Full-text thesaurus.5 * Fixed bug 923015 (clone() not implemented for full-text expressions)
6 * Fixed bug #3401971 (node-by-reference on dynamic collections)6 * No-copy optimization: avoids copying nodes during node-constructor expressions.
7 * Added external function annotations %ann:propagates-input-nodes and
8 %ann:must-copy-input-nodes to be used by the no-copy optimization.
9 * Caching of results for recursive functions with atomic parameter and return types.
10 * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types.
11 * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context)
12 * Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator)
13 * Fixed bug 909126 (bug in cloning of var_expr)
14 * Fixed bug in destruction of exit_catcher_expr
15 * Types-related optimizations for runtime operators (comparisons, FnBoolean, Or, And,
16 Compare, instance-of, cast, castable, treat, promote).
17 * Fixed bug #911585 (management of variables during eval)
18 * Fixed bug #866423 (fn:empty and fn:exists iterators must reset their input in
19 case of early-out)
20 * Added index management function to the C++ api's StaticCollectionManager.
21 * Fixed bug #872288 (reset recursive flag during node rename)
22 * Fixed bug #905041 (allow for the default element and function namespaces to be
23 set multiple times via the c++ api).
24 * Fixed bug #907872 (segfault when returning an input ItemSequence from an external function).
25 * Fixed bug #905050 (setting and getting the context item type via the c++ api).
26 * Added createDayTimeDuration, createYearMonthDuration, createDocumentNode, createCommentNode, createPiNode to api's ItemFactory.
27 * Added split function to the string module that allows for streamable tokenization but doesn't have regular expression
28 support.
29 * Fixed bug involving positional var and groupby
30 * Optimization: preallocate and reuse temp sequence iterator for LetVarITerator
31 and CtxVarIterator.
32 * Optimization: enhanced push-down of positional predicate into LetVarITerator
33 and CtxVarIterator.
34 * zerr is not predeclared anymore to be http://www.zorba-xquery.com/errors
35 * Add new XQuery interface for the PHP bindings.
36 * Added API method Item::getNamespaceBindings().
37 * Fixed bug #917981 (disallow declaring same module twice).
38 * Added API method StaticContext::getNamespaceBindings() (see bug #905035)
39 * Deprecated StaticContext:getNamespaceURIByPrefix()
40 * Fixed bug 921624 (slow queries with bogus example.com schema URIs)
41 * Fixed bug #918211 (xqueryx fulltext w3c conformance generation)
42 * Fixed bug #918157 (Add XQFTTS to validation queue)
43 * Fixed bug with unversioned modules with C++ external functions
44
45version 2.1
46
47New Features:
48 * New node-position module. This module allows to obtain a representation of a node position, which
49 can be used to assess structural relationships with other nodes.
50 * New node-reference module. References can be obtained for any node, and
51 different nodes cannot have the same identifier.
52 * Custom Full-text thesaurus using Zorba URI resolver mechanism.
53 * Modified C++ API to add isSequential, getExternalVariables, isBoundContextItem and
54 isBoundExternalVariable Functions
55 * Collection allows to retrieve information about the type
56 and the annotations of a static collection.
57 * Implemented the probe-index-range-value for general indexes
58 * Added ExternalFunctionParameter class to be registered in the DynamicContext
59 * New module for compiling and executing XQueries from XQuery (xqxq)
60 * External functions are allowed to be updating (i.e. return a pending update list)
61
62Optimization:
7 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a63 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a
8 sequence of integers)64 sequence of integers)
9 * documentation improvements65 * Optimization for count(collection()) expressions
10 * installer improvements66 * Optimization of the fn:substring function in the case when its $start and $length arguments
67 are integers
68
69Bug Fixes/Other Changes:
11 * Fixed bug #3403291 (build for Fedora 15)70 * Fixed bug #3403291 (build for Fedora 15)
12 * Fixed bug #3397293 (Incorrect XQueryX error message)71 * Fixed bug #3397293 (Incorrect XQueryX error message)
13 * Fixed bug #3398637 (Nested element constructors cause loss of namespace bindings)72 * Fixed bug #3398637 (Nested element constructors cause loss of namespace bindings)
@@ -15,20 +74,19 @@
15 * Fixed bug #3404689 (assignment problem in flwor)74 * Fixed bug #3404689 (assignment problem in flwor)
16 * Fix for bug #3404450 (testdriver_mt problem: caching and validation of docs)75 * Fix for bug #3404450 (testdriver_mt problem: caching and validation of docs)
17 * Fixed installation bug to not install the .so for test modules76 * Fixed installation bug to not install the .so for test modules
18 * Fix for running ctest on Windows
19 * Fixed bug #3390410 (Adding a node to a collection causes out of bound in vector)77 * Fixed bug #3390410 (Adding a node to a collection causes out of bound in vector)
20 * Fixed bug #3406200 (node types were not being moved to new tree during node detach)78 * Fixed bug #3406200 (node types were not being moved to new tree during node detach)
21 * Fixed bug #3406191 (Namespace bindings lost after update due to bug in node detach)79 * Fixed bug #3406191 (Namespace bindings lost after update due to bug in node detach)
22 * Fixed bug #3290122 (ZDST0003 needs collection name)80 * Fixed bug #3290122 (ZDST0003 needs collection name)
23 * Collection allows to retrieve information about the type
24 and the annotations of a static collection.
25 * Fixed bug #3406272 (merging of adjacent text nodes must be done after all81 * Fixed bug #3406272 (merging of adjacent text nodes must be done after all
26 updates have been applied).82 updates have been applied).
83 * Don't raise warnings for unknown annotations.
27 * Fixed bug #3409344 (during detach, if the node being detached is the root of84 * Fixed bug #3409344 (during detach, if the node being detached is the root of
28 its tree, it should be detached from the tree as well; otherwise memory85 its tree, it should be detached from the tree as well; otherwise memory
29 corruption will occur)86 corruption will occur)
30 * Fixed bug # (Should not destroy the parent of a node that is being detached87 * Fixed bug # (Should not destroy the parent of a node that is being detached
31 before the detach is done).88 before the detach is done).
89 * Added const qualifier to StaticContext::getAuditEvent()
32 * Fixed bug #3408181 (available-collection() returns undeclared collections)90 * Fixed bug #3408181 (available-collection() returns undeclared collections)
33 * Fixed bug #859465 (Fatal error if a PUL contains two deactivate IC primitives)91 * Fixed bug #859465 (Fatal error if a PUL contains two deactivate IC primitives)
34 * Fixed bug #859467 (Fatal error if a PUL contains two activate Foreign Key primitives)92 * Fixed bug #859467 (Fatal error if a PUL contains two activate Foreign Key primitives)
@@ -36,11 +94,10 @@
36 * Fixed bug #859522 (Fatal error if a PUL contains two delete document primitives)94 * Fixed bug #859522 (Fatal error if a PUL contains two delete document primitives)
37 * Fixed bug #859968 (Using put on an attribute produces an invalid XDM instance and may cause segmentation faults)95 * Fixed bug #859968 (Using put on an attribute produces an invalid XDM instance and may cause segmentation faults)
38 * Fixed bug #855314 (should not fold a constant expr that returns an error item)96 * Fixed bug #855314 (should not fold a constant expr that returns an error item)
39 * Added ExternalFunctionParameter class to be registered in the DynamicContext97 * Fixed bug when parsing a document with a base-uri attribute.
40 * Fixed bug #863320 (Sentence is incorrectly incremented when token characters end without sentence terminator)98 * Fixed bug #863320 (Sentence is incorrectly incremented when token characters end without sentence terminator)
41 * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)99 * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)
42 * Implemented the probe-index-range-value for general indexes100 * Removed ZSTR0005 and ZSTR0006 error codes
43 * Fixed bug #867662 ("nullptr" warning)
44 * Fixed bug #868258 (Assertion failure with two delete collection)101 * Fixed bug #868258 (Assertion failure with two delete collection)
45 * Fixed bug #871623 and #871629 (assertion failures with insertions in dynamic collections)102 * Fixed bug #871623 and #871629 (assertion failures with insertions in dynamic collections)
46 * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)103 * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)
@@ -54,6 +111,36 @@
54 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)111 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)
55 * Fixed bug #872799 (validate-in-place can set incorrect types)112 * Fixed bug #872799 (validate-in-place can set incorrect types)
56 * Fixed bug #855715 (Invalid escaped characters in regex not caught)113 * Fixed bug #855715 (Invalid escaped characters in regex not caught)
114 * Fixed bug #868325 (fn:analyze-string fails with some recursive subgroups)
115 * Fixed bug #872697 (segmentation fault with validation of NMTOKENS)
116 * General index cannot be declared as unique if the type of its key is
117 xs:anyAtomicType or xs:untypedAtomic.
118 * Added undo for node revalidation
119 * Optimization for count(collection()) expressions
120 * Fixed bug #867133 (SWIG PHP build failure on Mac OSX)
121 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)
122 * Fixed bug #872799 (validate-in-place can set incorrect types)
123 * Fixed bug #872850 (Serialization of Tumbling Window For fails)
124 * Fixed bug #855715 (Invalid escaped characters in regex not caught)
125 * Fixed bug #862089 (Split binary/xq install directories for modules) by
126 splitting "module path" into separate URI and Library paths
127 * Fixed bug #872502 (validation of the JSON module xqdoc fails)
128 * Fixed bug #897619 (testdriver_mt can not run the XQueryX tests)
129 * Fixed bug #867107 (xqdoc dependency to zorba is wrong)
130 * Fixed bug #897616 (Fix the generation of the XQFTTS report results for
131 W3C)
132
133version 2.0.3
134 * Fixed bug #867662 ("nullptr" warning)
135 * documentation improvements
136
137version 2.0.2
138 * Fixed bug #3401971 (node-by-reference on dynamic collections)
139 * documentation improvements
140 * installer improvements
141 * Fixed bug #3403291 (build for Fedora 15)
142 * Don't install the .so for test modules
143 * Fix for running ctest on Windows
57144
58version 2.0.1145version 2.0.1
59146
60147
=== modified file 'NOTICE.txt'
--- NOTICE.txt 2011-10-19 15:28:51 +0000
+++ NOTICE.txt 2012-02-22 17:11:27 +0000
@@ -1,5 +1,5 @@
1-----------1-----------
2Zorba 2.0.12Zorba 2.1.0
3-----------3-----------
44
5(Note: This file is generated automatically from NOTICE.xml.5(Note: This file is generated automatically from NOTICE.xml.
66
=== modified file 'bin/CMakeLists.txt'
--- bin/CMakeLists.txt 2011-08-05 02:21:55 +0000
+++ bin/CMakeLists.txt 2012-02-22 17:11:27 +0000
@@ -15,33 +15,38 @@
15INCLUDE_DIRECTORIES(AFTER ${CMAKE_SOURCE_DIR}/src/)15INCLUDE_DIRECTORIES(AFTER ${CMAKE_SOURCE_DIR}/src/)
16INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR})16INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR})
1717
18IF(ZORBA_WITH_DEBUGGER_CLIENT)18IF (ZORBA_WITH_DEBUGGER)
19 CONFIGURE_FILE (debug_client/event_handler_init.cpp.in debug_client/event_handler_init.cpp)19 IF (NOT WIN32)
20 20 FIND_PACKAGE (Libedit)
21 SET(DEBUG_CLIENT_SRCS21 IF (LIBEDIT_FOUND)
22 debug_client/tuple.h22 INCLUDE_DIRECTORIES (${LIBEDIT_INCLUDE_DIRS})
23 debug_client/main.cpp23 SET (LIBEDIT_LIBS ${LIBEDIT_LIBRARIES})
24 debug_client/debug_command.h24 SET (ZORBA_HAVE_LIBEDIT_H ${LIBEDIT_FOUND})
25 debug_client/debug_command.cpp25 ENDIF (LIBEDIT_FOUND)
26 debug_client/command_line_handler.h26 ENDIF (NOT WIN32)
27 debug_client/command_line_handler.cpp27
28 debug_client/lock_free_queue.h28 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/debugger/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/debugger/config.h)
29 debug_client/event_handler.h29 MESSAGE(STATUS "configured ${CMAKE_CURRENT_SOURCE_DIR}/debugger/config.h.cmake --> ${CMAKE_CURRENT_BINARY_DIR}/debugger/config.h")
30 debug_client/event_handler.cpp30 INCLUDE_DIRECTORIES (BEFORE ${CMAKE_CURRENT_BINARY_DIR}/debugger)
31 ${CMAKE_CURRENT_BINARY_DIR}/debug_client/event_handler_init.cpp31
32 SET (DEBUG_CLIENT_SRCS
33 debugger/main.cpp
34 debugger/xqdb_client.cpp
35 debugger/process_listener.cpp
36 debugger/command_prompt.cpp
37 debugger/command_line_handler.cpp
38 debugger/event_handler.cpp
32 )39 )
33 40
34 CONFIGURE_FILE (debug_client/message-handler.xq message-handler.xq)41 ZORBA_GENERATE_EXE ("xqdb" "${DEBUG_CLIENT_SRCS}" "${LIBEDIT_LIBS}" "xqdb" "bin")
35 42ENDIF (ZORBA_WITH_DEBUGGER)
36 ZORBA_GENERATE_EXE("debuggercmd" "${DEBUG_CLIENT_SRCS}" "" "debugger" "bin")
37ENDIF(ZORBA_WITH_DEBUGGER_CLIENT)
3843
39SET(SRCS44SET(SRCS
40 zorbacmd.cpp45 zorbacmd.cpp
41 zorbacmdproperties.cpp46 zorbacmdproperties.cpp
42 error_printer.cpp47 error_printer.cpp
43 util.cpp48 util.cpp
44 module_path.cpp49 path_util.cpp
45)50)
4651
47INCLUDE("${CMAKE_SOURCE_DIR}/cmake_modules/ZorbaGenerateExe.cmake")52INCLUDE("${CMAKE_SOURCE_DIR}/cmake_modules/ZorbaGenerateExe.cmake")
@@ -84,3 +89,37 @@
84# test the --option option to set an option in the static context89# test the --option option to set an option in the static context
85ZORBA_ADD_TEST(bin/zorba_option zorbacmd -q "${CMAKE_CURRENT_SOURCE_DIR}/test/option.xq" -f --option "{http://www.zorba-xquery.com}option=value")90ZORBA_ADD_TEST(bin/zorba_option zorbacmd -q "${CMAKE_CURRENT_SOURCE_DIR}/test/option.xq" -f --option "{http://www.zorba-xquery.com}option=value")
86ZORBA_SET_TEST_PROPERTY(bin/zorba_option PASS_REGULAR_EXPRESSION "value")91ZORBA_SET_TEST_PROPERTY(bin/zorba_option PASS_REGULAR_EXPRESSION "value")
92
93# test the --uri-path, --lib-path, and --module-path args.
94# Use the versioning tests as they utilize test modules already.
95SET (_testdir
96 "${CMAKE_CURRENT_SOURCE_DIR}/../test/rbkt/Queries/zorba/versioning")
97SET (_uridir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")
98SET (_libdir "${CMAKE_BINARY_DIR}/TEST_LIB_PATH")
99ZORBA_ADD_TEST(bin/zorba_uri_path_1 zorbacmd -f -q "${_testdir}/import1.xq"
100 --uri-path "${_uridir}")
101ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_1
102 PASS_REGULAR_EXPRESSION "hello, v2")
103
104ZORBA_ADD_TEST(bin/zorba_uri_path_2 zorbacmd -f -q "${_testdir}/external1.xq"
105 --uri-path "${_uridir}")
106ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_2
107 PASS_REGULAR_EXPRESSION "ZXQP0008")
108
109ZORBA_ADD_TEST(bin/zorba_uri_path_3 zorbacmd -f -q "${_testdir}/external1.xq"
110 --uri-path "${_uridir}" --lib-path "${_libdir}")
111ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_3
112 PASS_REGULAR_EXPRESSION "hello, v2")
113
114IF(WIN32)
115 SET(PATH_SEP ";")
116ELSE(WIN32)
117 SET(PATH_SEP ":")
118ENDIF(WIN32)
119ZORBA_ADD_TEST(bin/zorba_module_path_1 zorbacmd -f -q "${_testdir}/external1.xq"
120 --module-path "${_libdir}${PATH_SEP}${_uridir}")
121ZORBA_SET_TEST_PROPERTY(bin/zorba_module_path_1
122 PASS_REGULAR_EXPRESSION "hello, v2")
123
124# test compilation of the perf script
125ZORBA_ADD_TEST(bin/zorba_compilechk4 zorbacmd -q "${CMAKE_CURRENT_SOURCE_DIR}/../test/zperf/src/start.xq" -f --compile-only)
87126
=== removed file 'bin/debug_client/debug_command.cpp'
--- bin/debug_client/debug_command.cpp 2011-07-01 01:53:24 +0000
+++ bin/debug_client/debug_command.cpp 1970-01-01 00:00:00 +0000
@@ -1,99 +0,0 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include <iostream>
17#include "debug_client/debug_command.h"
18
19namespace zorba { namespace debugclient {
20
21
22 void CommandLine::execute()
23 {
24 for (;;) {
25 std::cout << "zdb>> ";
26 std::string command;
27 std::getline(std::cin, command);
28 std::vector<std::string> args;
29 args << command;
30 std::map<std::string, UntypedCommand*>::iterator lIter = theCommands.find(args[0]);
31 if (lIter == theCommands.end()) {
32 std::cout << args[0] << ": Command not found" << std::endl;
33 continue;
34 }
35 if (!lIter->second->execute(args))
36 continue;
37 return;
38 }
39 }
40
41
42 CommandLine::~CommandLine()
43 {
44 for (std::map<std::string, UntypedCommand*>::iterator i = theCommands.begin();
45 i != theCommands.end(); ++i)
46 {
47 delete i->second;
48 }
49 }
50
51 CommandLine& CommandLine::operator<<(UntypedCommand *aCommand)
52 {
53 theCommands.insert(std::make_pair(aCommand->get_name(), aCommand));
54 return *this;
55 }
56}}
57
58namespace std {
59 vector<string>& operator<< (vector<string>& vec, const string& str)
60 {
61 string::size_type before = 0;
62 string::size_type pos = str.find(" ", 0);
63 while (pos != str.npos) {
64 std::string lSub = str.substr(before, pos - before);
65 if (lSub[0] == '"') {
66 std::string::size_type lBeforeCopy = before;
67 do {
68 lBeforeCopy = str.find("\"", lBeforeCopy + 1);
69 } while (pos != str.npos && str.size() > pos + 1 && str[pos + 1] == '\\');
70 pos = lBeforeCopy;
71 lSub = str.substr(before + 1, pos - before - 1);
72 }
73 vec.push_back(lSub);
74 before = pos + 1;
75 pos = str.find(" ", before);
76 }
77 std::string lSub = str.substr(before);
78 if (lSub[0] == '"') {
79 pos = str.find("\"", before + 1);
80 lSub = str.substr(before + 1, pos - before - 1);
81 }
82 vec.push_back(lSub);
83 return vec;
84 }
85
86 set<string>& operator<< (set<string>& vec, const string& str)
87 {
88 string::size_type before = 0;
89 string::size_type pos = str.find(" ", 0);
90 while (pos != str.npos) {
91 vec.insert(str.substr(before, pos));
92 before = pos + 1;
93 pos = str.find(" ", before);
94 }
95 vec.insert(str.substr(before));
96 return vec;
97 }
98
99}
1000
=== removed file 'bin/debug_client/event_handler_init.cpp.in'
--- bin/debug_client/event_handler_init.cpp.in 2011-07-01 01:53:24 +0000
+++ bin/debug_client/event_handler_init.cpp.in 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include <fstream>
17#include "debug_client/event_handler.h"
18
19namespace zorba { namespace debugclient {
20
21 std::istream* EventHandler::getCurrentDirectory() {
22 const char* build_dir = "@CMAKE_BINARY_DIR@/bin/message-handler.xq";
23 const char* install_dir =
24#ifndef WIN32
25 "@CMAKE_INSTALL_PREFIX@/bin/";
26#else
27 "C:/Program Files/Zorba XQuery Processor @ZORBA_MAJOR_NUMBER@.@ZORBA_MINOR_NUMBER@.@ZORBA_PATCH_NUMBER@/bin/";
28#endif
29 std::auto_ptr<std::ifstream> stream(new std::ifstream(build_dir));
30 if (stream->good()) {
31 return stream.release();
32 }
33 stream.reset(new std::ifstream(install_dir));
34 if (stream->good()) {
35 return stream.release();
36 }
37 return 0;
38 }
39
40}} // end of namespace zorba::debugclient
41
420
=== removed file 'bin/debug_client/lock_free_queue.cpp'
--- bin/debug_client/lock_free_queue.cpp 2011-07-01 01:53:24 +0000
+++ bin/debug_client/lock_free_queue.cpp 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include "lock_free_queue.h"
170
=== removed file 'bin/debug_client/message-handler.xq'
--- bin/debug_client/message-handler.xq 2011-08-26 23:36:24 +0000
+++ bin/debug_client/message-handler.xq 1970-01-01 00:00:00 +0000
@@ -1,165 +0,0 @@
1(:
2 : Copyright 2006-2009 The FLWOR Foundation.
3 :
4 : Licensed under the Apache License, Version 2.0 (the "License");
5 : you may not use this file except in compliance with the License.
6 : You may obtain a copy of the License at
7 :
8 : http://www.apache.org/licenses/LICENSE-2.0
9 :
10 : Unless required by applicable law or agreed to in writing, software
11 : distributed under the License is distributed on an "AS IS" BASIS,
12 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : See the License for the specific language governing permissions and
14 : limitations under the License.
15:)
16
17import module namespace refl = 'http://www.zorba-xquery.com/modules/reflection';
18import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";
19import module namespace base64 = "http://www.zorba-xquery.com/modules/converters/base64";
20
21
22declare variable $local:localns as xs:string := 'http://www.w3.org/2005/xquery-local-functions';
23
24
25declare variable $local:endl as xs:string := '
26';
27
28declare function local:has-to-stop($resp as element())
29{
30 fn:not(($resp/@command/data(.) eq "stop" and $resp/@reason/data(.) eq "ok")
31 or ($resp/@status/data(.) eq "stopped")
32 or ($resp/@status/data(.) eq "stopping"))
33};
34
35declare function local:status($resp as element())
36{
37 fn:concat(
38 "Status: ", $resp/@status/data(.), $local:endl,
39 "Reason: ", $resp/@reason/data(.), $local:endl,
40 let $msg := $resp/text()
41 return
42 if (fn:empty($msg) or $msg eq "") then
43 ""
44 else
45 fn:concat($msg, $local:endl)
46 )
47};
48
49
50declare function local:run($resp as element()) {
51 if ($resp/@status/data(.) eq "starting") then
52 "Starting query"
53 else
54 local:status($resp)
55};
56
57declare function local:stop($resp as element())
58{
59 local:status($resp)
60};
61
62declare function local:breakpoint_set($resp as element())
63{
64 if ($resp/error) then
65 fn:concat("Error when setting a breakpoint: ", if ($resp/error/message) then $resp/error/message/text() else concat(" errcode: ", data($resp/error/@code)))
66 else
67 fn:concat("set breakpoint with id ", data($resp/@id), " and state ", data($resp/@state))
68};
69
70declare function local:breakpoint_list($resp as element())
71{
72 string-join(
73 for $b in $resp/breakpoint
74 return concat("Breakpoint ", data($b/@id), " at ", data($b/@filename), ":", data($b/@lineno), " ", data($b/@state)),
75 $local:endl
76 )
77};
78
79declare function local:breakpoint_remove($resp as element())
80{
81 "Breakpoint removed"
82};
83
84declare function local:stack_depth($resp as element())
85{
86 concat("Depth: ", data($resp/@depth))
87};
88
89declare function local:stack_get($resp as element())
90{
91 string-join(
92 for $s in $resp/stack
93 return concat("Level ", data($s/@level), " at ", data($s/@filename), ":", data($s/@lineno)),
94 $local:endl
95 )
96};
97
98
99declare function local:context_names($resp as element())
100{
101 string-join(
102 for $c in $resp/context
103 return concat("Context: ", data($c/@name), " id: ", data($c/@id)),
104 $local:endl
105 )
106};
107
108declare function local:context_get($resp as element())
109{
110 string-join(
111 for $p in $resp/property
112 return concat(data($p/@fullname), ": [", data($p/@type), "]",
113 if ($p/text() ne "") then concat(": ", base64:decode($p/text())) else ""),
114 $local:endl
115 )
116};
117
118declare function local:eval($resp as element())
119{
120 if (data($resp/@success) eq "1") then
121 local:context_get($resp)
122 else
123 concat("Eval failed", ":", $resp/error/message/text())
124};
125
126declare function local:process-response($resp as element())
127{
128 if (data($resp/@command) eq "") then
129 (fn:true(), $resp/@transaction_id/data(.), local:status($resp))
130 else
131 let $fun-cont-name := fn:QName($local:localns, concat("local:", $resp/@command/data(.), "-cont"))
132 let $fun-msg-name := fn:QName($local:localns, concat("local:", $resp/@command/data(.)))
133 return (
134 if (sctx:function-arguments-count($fun-cont-name) = 1) then
135 refl:invoke($fun-cont-name, $resp)
136 else
137 local:has-to-stop($resp),
138 $resp/@transaction_id/data(.),
139 if (sctx:function-arguments-count($fun-msg-name) = 1) then
140 refl:invoke($fun-msg-name, $resp)
141 else
142 "Recieved a message - command not implemented"
143 )
144};
145
146declare function local:process-init($init as element())
147{
148 fn:true(),
149 0,
150 fn:concat(fn:string-join(
151 ('Established connection with', $init/@language/data(.), 'client', $init/@appid/data(.)), ' '), '
152')
153};
154
155declare function local:main($response as element()) {
156 let $process-fun as xs:QName := fn:QName($local:localns, concat("local:process-", node-name($response)))
157 return
158 if (sctx:function-arguments-count($process-fun) = 1) then
159 refl:invoke($process-fun, $response)
160 else (
161 true(),
162 ($response/@transaction_id, 0)[1]/data(.),
163 "ERROR: Recieved unknown node from client"
164 )
165};
1660
=== renamed directory 'bin/debug_client' => 'bin/debugger'
=== renamed file 'bin/debug_client/debug_command.h' => 'bin/debugger/command.h'
--- bin/debug_client/debug_command.h 2011-07-04 08:05:46 +0000
+++ bin/debugger/command.h 2012-02-22 17:11:27 +0000
@@ -14,7 +14,9 @@
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16#pragma once16#pragma once
17#include <zorba/config.h>17#ifndef ZORBA_DEBUGGER_COMMAND_H
18#define ZORBA_DEBUGGER_COMMAND_H
19
18#include <string>20#include <string>
19#include <vector>21#include <vector>
20#include <iostream>22#include <iostream>
@@ -23,151 +25,18 @@
23#include <sstream>25#include <sstream>
24#include <memory>26#include <memory>
25#include <typeinfo>27#include <typeinfo>
26#include "debug_client/tuple.h"28
2729#include <zorba/config.h>
28namespace zorba { namespace debugclient {30
31#include "command_arg.h"
32#include "tuple.h"
33
34
35namespace zorba { namespace debugger {
29 36
30 class DebugClientParseException : public std::exception {37 class DebugClientParseException : public std::exception {
31 };38 };
32 39
33 template<typename Tuple>
34 class CommandArg;
35
36 template<typename Tuple>
37 class CommandArgInstance {
38 public:
39 virtual int get_index() const = 0;
40 virtual const CommandArg<Tuple>* get_arg() const = 0;
41 virtual void insertValue(Tuple& t) = 0;
42 virtual bool isSet(Tuple& t) const = 0;
43 };
44
45 template<typename T, int Idx, typename Tuple>
46 class TypedCommandArgInstance : public CommandArgInstance<Tuple>
47 {
48 public:
49 TypedCommandArgInstance(T aValue, const CommandArg<Tuple>* aArg)
50 : theValue(aValue), theArg(aArg) {}
51 virtual int get_index() const { return Idx; }
52 virtual const CommandArg<Tuple>* get_arg() const { return theArg; }
53 virtual void insertValue(Tuple& t)
54 {
55 ZORBA_TR1_NS::get<Idx>(t).first = true;
56 ZORBA_TR1_NS::get<Idx>(t).second = theValue;
57 }
58 virtual bool isSet(Tuple& t) const
59 {
60 return ZORBA_TR1_NS::get<Idx>(t).first;
61 }
62 private:
63 T theValue;
64 const CommandArg<Tuple>* theArg;
65 };
66
67 template<typename Tuple>
68 class CommandArgType {
69 public:
70 virtual CommandArgInstance<Tuple>* parse(const std::string& str,
71 const CommandArg<Tuple>* arg) = 0;
72 virtual bool isVoid() const = 0;
73 virtual bool isSet(Tuple& t) const = 0;
74 virtual ~CommandArgType() {}
75 };
76
77 template<typename T, int Idx, typename Tuple>
78 class TypedCommandArgType : public CommandArgType<Tuple> {
79 public:
80 typedef T Type;
81 public: // implementation
82 TypedCommandArgType(bool aIsVoid) : theIsVoid(aIsVoid) {}
83 TypedCommandArgType(const T& aValue,
84 bool aIsVoid)
85 : theDefault(aValue), theIsVoid(aIsVoid) {}
86 virtual CommandArgInstance<Tuple>* parse(const std::string& str,
87 const CommandArg<Tuple>* arg)
88 {
89 T aValue;
90 std::stringstream stream(str);
91 stream >> aValue;
92 if (stream.fail()) {
93 std::cerr << "Could not parse argument of type "
94 << typeid(T).name()
95 << std::endl;
96 return 0;
97 }
98 return new TypedCommandArgInstance<T, Idx, Tuple>(aValue, arg);
99 }
100 virtual bool isVoid() const { return theIsVoid; }
101 virtual bool isSet(Tuple& t) const
102 {
103 return ZORBA_TR1_NS::get<Idx>(t).first;
104 }
105 private:
106 TypedCommandArgType<T, Idx, Tuple>() {}
107 T theDefault;
108 bool theIsVoid;
109 };
110
111 template<typename Tuple>
112 class CommandArg {
113 public:
114 CommandArg(unsigned aId,
115 CommandArgType<Tuple>* aType,
116 const std::set<std::string>& aFlags,
117 const std::string& aDescription,
118 bool aIsRequired)
119 : theId(aId),
120 theType(aType),
121 theFlags(aFlags),
122 theDescription(aDescription),
123 theIsRequired(aIsRequired)
124 {
125 }
126 ~CommandArg() { delete theType; }
127 unsigned get_id() const { return theId; }
128 bool canHandle(const std::string& arg) const
129 {
130 if (theFlags.find(arg) != theFlags.end()) {
131 return true;
132 }
133 return false;
134 }
135 CommandArgInstance<Tuple>* parse(const std::string& str) const
136 {
137 return theType->parse(str, this);
138 }
139 bool isVoid() const {
140 return theType->isVoid();
141 }
142 bool isRequired() const { return theIsRequired; }
143 std::string get_name() const {
144 return *(theFlags.begin());
145 }
146 bool isSet(Tuple& t) const
147 {
148 return theType->isSet(t);
149 }
150 private:
151 unsigned theId;
152 CommandArgType<Tuple>* theType;
153 std::set<std::string> theFlags;
154 std::string theDescription;
155 bool theIsRequired;
156 };
157}} // end namespace zorba
158
159namespace std {
160
161 /**
162 * This is a helper split function
163 */
164 vector<string>& operator<< (vector<string>& vec, const string& str);
165
166 set<string>& operator<< (set<string>& vec, const string& str);
167} //end namespace std
168
169namespace zorba { namespace debugclient {
170
171 template<typename Func, typename Tuple, int CommandIdx>40 template<typename Func, typename Tuple, int CommandIdx>
172 class CommandInstance41 class CommandInstance
173 {42 {
@@ -188,8 +57,10 @@
188 57
189 class UntypedCommand {58 class UntypedCommand {
190 public:59 public:
191 virtual std::string get_name() const = 0;60 virtual std::string getName() const = 0;
192 virtual std::string get_description() const = 0;61 virtual std::set<std::string> getAliases() const = 0;
62 virtual std::string getDescription() const = 0;
63 virtual void printHelp() const = 0;
193 virtual bool execute(const std::vector<std::string>& args) = 0;64 virtual bool execute(const std::vector<std::string>& args) = 0;
194 };65 };
195 66
@@ -197,77 +68,141 @@
197 class Command : public UntypedCommand {68 class Command : public UntypedCommand {
198 public:69 public:
199 Command(const std::string& aName, Func& aFunction, const std::string& aDescription)70 Command(const std::string& aName, Func& aFunction, const std::string& aDescription)
200 : theName(aName), theFunction(aFunction), theDescription(aDescription) {}71 : theName(aName), theFunction(aFunction), theDescription(aDescription)
72 {}
73
74 Command(const std::string& aName, const std::set<std::string> aAliases, Func& aFunction, const std::string& aDescription)
75 : theName(aName), theAliases(aAliases), theFunction(aFunction), theDescription(aDescription)
76 {}
77
201 ~Command();78 ~Command();
79
202 public:80 public:
203 Command& operator() (unsigned aId,81
204 const std::string& aFlags,82 void
205 CommandArgType<Tuple>* aType,83 addArgument(
206 const std::string& aDescription = "",84 unsigned aId,
207 bool isRequired = false);85 const std::string& aFlags,
208 virtual std::string get_name() const { return theName; }86 CommandArgType<Tuple>* aType,
209 virtual std::string get_description() const { return theDescription; }87 const std::string& aDescription = "",
88 bool isRequired = false);
89
90 static void
91 splitNames(
92 const std::string& names,
93 std::set<std::string>& set);
94
95 virtual std::string
96 getName() const
97 {
98 return theName;
99 }
100
101 virtual std::set<std::string> getAliases() const
102 {
103 return theAliases;
104 }
105
106 virtual std::string
107 getDescription() const
108 {
109 return theDescription;
110 }
111
112 virtual void
113 printHelp() const;
114
210 virtual bool execute(const std::vector<std::string>& args)115 virtual bool execute(const std::vector<std::string>& args)
211 {116 {
212 CommandInstance<Func, Tuple, CommandIdx> instance(theFunction, theTuple);117 CommandInstance<Func, Tuple, CommandIdx> instance(theFunction, theTuple);
213 if (instance.parseArguments(args, theArgs))118 if (instance.parseArguments(args, theArgs)) {
214 instance.execute();119 instance.execute();
215 else120 return true;
216 return false;121 }
217 return true;122 return false;
218 }123 }
219 private:124 private:
220 std::string theName;125 std::string theName;
126 std::set<std::string> theAliases;
221 Func& theFunction;127 Func& theFunction;
222 Tuple theTuple;128 Tuple theTuple;
223 std::string theDescription;129 std::string theDescription;
224 std::map<std::string, CommandArg<Tuple>* > theArgs;130 std::map<std::string, CommandArg<Tuple>*> theArgs;
225 };131 };
226 132
227 class CommandLine {133/*****************************************************************************/
228 public:134/*****************************************************************************/
229 ~CommandLine();135
230 public:136template<typename Func, typename Tuple, int CommandIdx>
231 void execute();137Command<Func, Tuple, CommandIdx>::~Command()
232 CommandLine& operator<< (UntypedCommand* aCommand);138{
233 private:139 typedef std::map<std::string, CommandArg<Tuple>*> ArgType;
234 std::map<std::string, UntypedCommand*> theCommands;140 for (typename ArgType::iterator i = theArgs.begin(); i != theArgs.end(); ++i) {
235 };141 delete i->second;
236 142 }
237 template<typename Func, typename Tuple, int CommandIdx>143}
238 Command<Func, Tuple, CommandIdx>::~Command()144
239 {145template<typename Func, typename Tuple, int CommandIdx>
240 typedef std::map<std::string, CommandArg<Tuple>* > ArgType;146void
241 for (typename ArgType::iterator i = theArgs.begin(); i != theArgs.end(); ++i) {147Command<Func, Tuple, CommandIdx>::printHelp() const
242 delete i->second;148{
243 }149 std::cout << "Purpose: " << getDescription() << std::endl;
244 }150
245 151 typename std::map<std::string, CommandArg<Tuple>*>::const_iterator lIter = theArgs.begin();
246 152 if (lIter == theArgs.end()) {
247 template<typename Func, typename Tuple, int CommandIdx>153 std::cout << "This command has no arguments." << std::endl;
248 Command<Func, Tuple, CommandIdx>& 154 std::cout << std::endl;
249 Command<Func, Tuple, CommandIdx>::operator() (unsigned aId,155 return;
250 const std::string& aFlags,156 }
251 CommandArgType<Tuple>* aType,157
252 const std::string& aDescription,158 std::cout << "Arguments:" << std::endl << std::endl;
253 bool isRequired)159 for (; lIter != theArgs.end(); ++lIter) {
254 {160 std::cout << " " << lIter->first << "\t" << lIter->second->getDescription() << std::endl;
255 std::set<std::string> args;161 }
256 args << aFlags;162 std::cout << std::endl;
257 for (std::set<std::string>::iterator i = args.begin(); i != args.end(); ++i) {163}
258 std::string toAdd = (i->size() == 1) ? "-" + *i : "--" + *i;164
259 theArgs.insert(std::make_pair(toAdd,165template<typename Func, typename Tuple, int CommandIdx>
260 new CommandArg<Tuple>(aId,166void
261 aType,167Command<Func, Tuple, CommandIdx>::splitNames(const std::string& aNames, std::set<std::string>& aSet)
262 args,168{
263 aDescription,169 std::string::size_type before = 0;
264 isRequired)170 std::string::size_type pos = aNames.find(" ", 0);
265 )171 while (pos != aNames.npos) {
266 );172 std::string lName = aNames.substr(before, pos);
267 }173 if (lName != "") {
268 return *this;174 aSet.insert(lName);
269 }175 }
270 176 before = pos + 1;
177 pos = aNames.find(" ", before);
178 }
179 std::string lName = aNames.substr(before);
180 if (lName != "") {
181 aSet.insert(lName);
182 }
183}
184
185template<typename Func, typename Tuple, int CommandIdx>
186void
187Command<Func, Tuple, CommandIdx>::addArgument(
188 unsigned aId,
189 const std::string& aFlags,
190 CommandArgType<Tuple>* aType,
191 const std::string& aDescription,
192 bool isRequired)
193{
194 std::set<std::string> lNames;
195 splitNames(aFlags, lNames);
196
197 for (std::set<std::string>::iterator i = lNames.begin(); i != lNames.end(); ++i) {
198 std::string toAdd = (i->size() == 1) ? "-" + *i : "--" + *i;
199 CommandArg<Tuple>* lArg = new CommandArg<Tuple>(aId, aType, lNames, aDescription, isRequired);
200 theArgs.insert(std::make_pair(toAdd, lArg));
201 }
202}
203
204/*****************************************************************************/
205
271 template<typename Tuple, typename T, int Idx>206 template<typename Tuple, typename T, int Idx>
272 CommandArgType<Tuple>* createArgType(Tuple t)207 CommandArgType<Tuple>* createArgType(Tuple t)
273 {208 {
@@ -290,6 +225,16 @@
290 return new Command<Func, Tuple, CommandIdx>(aName, aFunction, aDescription);225 return new Command<Func, Tuple, CommandIdx>(aName, aFunction, aDescription);
291 }226 }
292 227
228 template<int CommandIdx, typename Tuple, typename Func>
229 Command<Func, Tuple, CommandIdx>* createCommand(Tuple t,
230 const std::string& aName,
231 const std::set<std::string>& aAliases,
232 Func& aFunction,
233 const std::string& aDescription)
234 {
235 return new Command<Func, Tuple, CommandIdx>(aName, aAliases, aFunction, aDescription);
236 }
237
293 template<typename Func, typename Tuple, int CommandIdx>238 template<typename Func, typename Tuple, int CommandIdx>
294 bool CommandInstance<Func, Tuple, CommandIdx>::239 bool CommandInstance<Func, Tuple, CommandIdx>::
295 parseArguments(const std::vector<std::string>& args,240 parseArguments(const std::vector<std::string>& args,
@@ -301,29 +246,34 @@
301 for (ArgType::size_type i = 1; i < size; ++i) {246 for (ArgType::size_type i = 1; i < size; ++i) {
302 typename CArgType::const_iterator pos = aCommandArgs.find(args[i]);247 typename CArgType::const_iterator pos = aCommandArgs.find(args[i]);
303 if (pos == aCommandArgs.end()) {248 if (pos == aCommandArgs.end()) {
304 std::cerr << "Error: Unknown Argument " << args[i] << std::endl;249 std::cerr << "Error: Unknown option " << args[i] << std::endl;
305 parseError = true;250 parseError = true;
306 return false;251 return false;
307 }252 }
308 const CommandArg<Tuple>& arg = *(pos->second);253 const CommandArg<Tuple>& arg = *(pos->second);
309 if (!arg.isVoid() && args[++i][0] == '-') {
310 std::cerr << "Did not expect parameter for option " << args[i] << std::endl;
311 return false;
312 }
313 std::auto_ptr<CommandArgInstance<Tuple> > instance;254 std::auto_ptr<CommandArgInstance<Tuple> > instance;
314 if (arg.isVoid()) {255 if (arg.isVoid()) {
315 instance.reset(arg.parse("1"));256 instance.reset(arg.parse("1"));
316 } else {257 } else {
258 ++i;
259 if (i >= size) {
260 std::cerr << "Error: Missing value for argument " << args[i - 1] << std::endl;
261 parseError = true;
262 allSet = false;
263 return false;
264 }
317 instance.reset(arg.parse(args[i]));265 instance.reset(arg.parse(args[i]));
318 }266 }
319 instance->insertValue(theTuple);267 if (instance.get()) {
268 instance->insertValue(theTuple);
269 }
320 }270 }
321 bool allSet = true;271 bool allSet = true;
322 for (typename CArgType::const_iterator i = aCommandArgs.begin();272 for (typename CArgType::const_iterator i = aCommandArgs.begin();
323 i != aCommandArgs.end(); ++i)273 i != aCommandArgs.end(); ++i)
324 {274 {
325 if (i->second->isRequired() && !i->second->isSet(theTuple)) {275 if (i->second->isRequired() && !i->second->isSet(theTuple)) {
326 std::cerr << "Error: Argument " << i->second->get_name() << " not set" << std::endl;276 std::cerr << "Error: Argument -" << i->second->getName() << " not set" << std::endl;
327 allSet = false;277 allSet = false;
328 }278 }
329 }279 }
@@ -336,4 +286,7 @@
336 theFunction.template handle<CommandIdx>(this->theTuple);286 theFunction.template handle<CommandIdx>(this->theTuple);
337 }287 }
338288
339}} // end of namespace zorba::debugclient289} // namespace zorba
290} // namespace debugger
291
292#endif // ZORBA_DEBUGGER_COMMAND_H
340293
=== added file 'bin/debugger/command_arg.h'
--- bin/debugger/command_arg.h 1970-01-01 00:00:00 +0000
+++ bin/debugger/command_arg.h 2012-02-22 17:11:27 +0000
@@ -0,0 +1,237 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17#ifndef ZORBA_DEBUGGER_COMMAND_ARG_H
18#define ZORBA_DEBUGGER_COMMAND_ARG_H
19
20#include <string>
21#include <iostream>
22#include <set>
23#include <sstream>
24
25#include "tuple.h"
26
27
28namespace zorba { namespace debugger {
29
30template<typename Tuple>
31class CommandArg;
32
33template<typename Tuple>
34class CommandArgInstance {
35 public:
36 virtual int get_index() const = 0;
37 virtual const CommandArg<Tuple>* get_arg() const = 0;
38 virtual void insertValue(Tuple& t) = 0;
39 virtual bool isSet(Tuple& t) const = 0;
40};
41
42template<typename T, int Idx, typename Tuple>
43class TypedCommandArgInstance : public CommandArgInstance<Tuple>
44{
45 public:
46 TypedCommandArgInstance(T aValue, const CommandArg<Tuple>* aArg)
47 : theValue(aValue), theArg(aArg)
48 {
49 }
50
51 virtual int
52 get_index() const
53 {
54 return Idx;
55 }
56
57 virtual const CommandArg<Tuple>*
58 get_arg() const
59 {
60 return theArg;
61 }
62
63 virtual void
64 insertValue(Tuple& t)
65 {
66 ZORBA_TR1_NS::get<Idx>(t).first = true;
67 ZORBA_TR1_NS::get<Idx>(t).second = theValue;
68 }
69
70 virtual bool isSet(Tuple& t) const
71 {
72 return ZORBA_TR1_NS::get<Idx>(t).first;
73 }
74
75 private:
76
77 T theValue;
78 const CommandArg<Tuple>* theArg;
79};
80
81template<typename Tuple>
82class CommandArgType
83{
84 public:
85 virtual CommandArgInstance<Tuple>*
86 parse(
87 const std::string& str,
88 const CommandArg<Tuple>* arg) = 0;
89
90 virtual bool
91 isVoid() const = 0;
92
93 virtual bool
94 isSet(Tuple& t) const = 0;
95
96 virtual ~CommandArgType() {}
97};
98
99 template<typename T, int Idx, typename Tuple>
100 class TypedCommandArgType : public CommandArgType<Tuple> {
101 public:
102 typedef T Type;
103 public: // implementation
104 TypedCommandArgType(bool aIsVoid) : theIsVoid(aIsVoid) {}
105 TypedCommandArgType(const T& aValue,
106 bool aIsVoid)
107 : theDefault(aValue), theIsVoid(aIsVoid) {}
108 virtual CommandArgInstance<Tuple>* parse(const std::string& str,
109 const CommandArg<Tuple>* arg)
110 {
111 T aValue;
112
113 // special treatment for strings
114 // this is a double hack:
115 // - we check the type name if this starts with: class std::basic_string
116 // - we use void* in readEntireString to workaround the template type T
117 // which would otherwise complain during compilation if types and
118 // operators do not match
119 // TOSO: probably someone can find a more elegant solution
120 std::string lTypeName(typeid(T).name());
121 if (lTypeName.find("class std::basic_string") == 0) {
122 readEntireString(str, &aValue);
123 } else {
124 std::stringstream stream(str);
125 std::stringstream out;
126 stream >> aValue;
127 if (stream.fail()) {
128 std::cerr << "Error: Could not parse value \"" << str << "\" as type "
129 << typeid(T).name()
130 << std::endl;
131 return 0;
132 }
133 }
134
135 return new TypedCommandArgInstance<T, Idx, Tuple>(aValue, arg);
136 }
137 virtual bool isVoid() const { return theIsVoid; }
138 virtual bool isSet(Tuple& t) const
139 {
140 return ZORBA_TR1_NS::get<Idx>(t).first;
141 }
142 private:
143 void readEntireString(std::string aIn, void* aValue)
144 {
145 *((std::string*)aValue) = aIn;
146 }
147
148 TypedCommandArgType<T, Idx, Tuple>() {}
149 T theDefault;
150 bool theIsVoid;
151 };
152
153 template<typename Tuple>
154 class CommandArg {
155 public:
156 CommandArg(unsigned aId,
157 CommandArgType<Tuple>* aType,
158 const std::set<std::string>& aNames,
159 const std::string& aDescription,
160 bool aIsRequired)
161 : theId(aId),
162 theType(aType),
163 theNames(aNames),
164 theDescription(aDescription),
165 theIsRequired(aIsRequired)
166 {
167 }
168
169 ~CommandArg()
170 {
171 delete theType;
172 }
173
174 unsigned
175 get_id() const
176 {
177 return theId;
178 }
179
180 bool
181 canHandle(const std::string& arg) const
182 {
183 if (theNames.find(arg) != theNames.end()) {
184 return true;
185 }
186 return false;
187 }
188
189 CommandArgInstance<Tuple>*
190 parse(const std::string& str) const
191 {
192 return theType->parse(str, this);
193 }
194
195 bool
196 isVoid() const
197 {
198 return theType->isVoid();
199 }
200
201 bool
202 isRequired() const
203 {
204 return theIsRequired;
205 }
206
207 std::string
208 getName() const
209 {
210 return *(theNames.begin());
211 }
212
213 std::string
214 getDescription() const
215 {
216 return theDescription;
217 }
218
219 bool
220 isSet(Tuple& t) const
221 {
222 return theType->isSet(t);
223 }
224
225 private:
226
227 unsigned theId;
228 CommandArgType<Tuple>* theType;
229 std::set<std::string> theNames;
230 std::string theDescription;
231 bool theIsRequired;
232 };
233
234} // namespace zorba
235} // namespace debugger
236
237#endif // ZORBA_DEBUGGER_COMMAND_ARG_H
0238
=== modified file 'bin/debugger/command_line_handler.cpp'
--- bin/debug_client/command_line_handler.cpp 2011-07-01 01:53:24 +0000
+++ bin/debugger/command_line_handler.cpp 2012-02-22 17:11:27 +0000
@@ -1,4 +1,4 @@
1/*1 /*
2 * Copyright 2006-2008 The FLWOR Foundation.2 * Copyright 2006-2008 The FLWOR Foundation.
3 *3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");4 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,225 +23,385 @@
23# define msleep Sleep23# define msleep Sleep
24#endif24#endif
2525
26namespace zorba { namespace debugclient {26#include "command_prompt.h"
27
28
29namespace zorba { namespace debugger {
27 30
28 using namespace ::std;
29 using namespace ::ZORBA_TR1_NS;31 using namespace ::ZORBA_TR1_NS;
30 32
31 CommandLineHandler::CommandLineHandler(unsigned short port,33CommandLineHandler::CommandLineHandler(
32 LockFreeConsumer<std::size_t>& aConsumer,34 unsigned short port,
33 LockFreeConsumer<bool>& aContinueQueue,35 LockFreeConsumer<std::size_t>& aConsumer,
34 EventHandler& aHandler,36 LockFreeConsumer<bool>& aContinueQueue,
35 CommandLine& aCommandLine)37 EventHandler* aHandler,
38 CommandPrompt* aCommandPrompt)
36 : theConsumer(aConsumer),39 : theConsumer(aConsumer),
37 theContinueQueue(aContinueQueue),40 theContinueQueue(aContinueQueue),
38 theClient(DebuggerClient::createDebuggerClient(&aHandler, port, "localhost")),41 theClient(DebuggerClient::createDebuggerClient(aHandler, port, "localhost")),
39 theCommandLine(aCommandLine),42 theCommandLine(aCommandPrompt),
40 theQuit(false), theContinue(false), theWaitFor(0)43 theQuit(false), theTerminated(true), theContinue(false), theWaitFor(0)
41 {44 {
42 addCommands();45 addCommands();
43 }46 }
44 47
45 CommandLineHandler::~CommandLineHandler()48CommandLineHandler::~CommandLineHandler()
46 {49{
47 }50}
48 51
49 void CommandLineHandler::execute()52void
50 {53CommandLineHandler::execute()
51 theClient->accept();54{
52 std::set<std::size_t> lIdList;55 theClient->accept();
53 do {56 std::set<std::size_t> lIdList;
57 do {
58 getNextId(lIdList);
59 while (lIdList.find(theWaitFor) == lIdList.end()) {
54 getNextId(lIdList);60 getNextId(lIdList);
55 while (!theQuit && lIdList.find(theWaitFor) == lIdList.end()) {61 msleep(20);
56 getNextId(lIdList);62 }
57 msleep(20);63 bool lCanQuit;
58 }64 while (!theContinueQueue.consume(lCanQuit)) {
59 while (!theContinueQueue.consume(theQuit)) {65 msleep(20);
60 msleep(20);66 }
61 }67 if (lCanQuit) {
62 theQuit = !theQuit;68 theTerminated = true;
63 if (!theQuit) {69 }
64 theCommandLine.execute();70 theCommandLine->execute();
65 while (theContinue) {71 while (theContinue) {
66 theContinue = false;72 theContinue = false;
67 theCommandLine.execute();73 theCommandLine->execute();
68 }74 }
69 }75 } while (!theQuit);
70 } while (!theQuit);76}
71 }77
72 78void
73 void CommandLineHandler::getNextId(std::set<std::size_t>& aIdList)79CommandLineHandler::getNextId(std::set<std::size_t>& aIdList)
74 {80{
75 std::size_t result;81 std::size_t result;
76 if (theConsumer.consume(result)) {82 if (theConsumer.consume(result)) {
77 aIdList.insert(result);83 aIdList.insert(result);
78 }84 }
79 }85}
80 86
81 template<>87template<>
82 void CommandLineHandler::handle<Status>(ZORBA_TR1_NS::tuple<> &t)88void
83 {89CommandLineHandler::handle<Status>(ZORBA_TR1_NS::tuple<> &t)
84 theWaitFor = theClient->status();90{
85 }91 theWaitFor = theClient->status();
86 92}
87 template<>93
88 void CommandLineHandler::handle<Quit>(ZORBA_TR1_NS::tuple<> &t)94template<>
89 {95void
96CommandLineHandler::handle<Variables>(ZORBA_TR1_NS::tuple<> &t)
97{
98 theWaitFor = theClient->variables();
99}
100
101template<>
102void
103CommandLineHandler::handle<Quit>(ZORBA_TR1_NS::tuple<> &t)
104{
105 if (!theTerminated) {
90 bool answered = false;106 bool answered = false;
91 while (!answered) {107 while (!answered) {
92 std::cout << "Do you really want to stop debugging and exit? (y/n) ";108 std::cout << "Do you really want to stop debugging and exit? (y/n) ";
93 char answer;109 std::string lAnswer;
94 std::cin >> answer;110 std::getline(std::cin, lAnswer);
95 std::cout << std::endl;111 if (lAnswer == "y" || lAnswer == "yes") {
96 if (answer == 'y') {
97 answered = true;112 answered = true;
98 } else if (answered == 'n') {113 } else if (lAnswer == "n" || lAnswer == "no") {
99 theContinue = true;114 theContinue = true;
100 return;115 return;
101 }116 }
102 }117 }
103 theWaitFor = theClient->stop();118 }
104 theClient->quit();119 theWaitFor = theClient->stop(true);
105 }120 theClient->quit();
106 121 theQuit = true;
107 template<>122}
108 void CommandLineHandler::handle<Run>(ZORBA_TR1_NS::tuple<> &t)123
109 {124template<>
110 theWaitFor = theClient->run();125void
111 }126CommandLineHandler::handle<Run>(ZORBA_TR1_NS::tuple<> &t)
112 127{
113 template<>128 theTerminated = false;
114 void CommandLineHandler::handle<BreakpointSet>(std::tr1::tuple<bstring, bstring, bint> &t)129 theWaitFor = theClient->run();
115 {130}
116 DebuggerClient::BreakpointType lType = DebuggerClient::Line;131
117 bool lEnabled = true;132template<>
118 if (get<0>(t).first) {133void
119 if (get<0>(t).second == "disabled") {134CommandLineHandler::handle<Stop>(ZORBA_TR1_NS::tuple<> &t)
120 lEnabled = false;135{
121 }136 theWaitFor = theClient->stop(false);
122 }137}
123 theWaitFor = theClient->breakpoint_set(lType,138
124 lEnabled,139template<>
125 get<1>(t).second,140void
126 get<2>(t).second);141CommandLineHandler::handle<BreakpointSet>(std::tr1::tuple<bstring, bstring, bint> &aTuple)
127 }142{
128 143 DebuggerClient::BreakpointType lType = DebuggerClient::Line;
129 template<>144 bool lEnabled = true;
130 void CommandLineHandler::handle<BreakpointGet>(tuple<bint> &aTuple)145 if (get<0>(aTuple).first) {
131 {146 if (get<0>(aTuple).second == "disabled") {
132 theWaitFor = theClient->breakpoint_get(get<0>(aTuple).second);147 lEnabled = false;
133 }148 }
134 149 }
135 template<>150 theWaitFor = theClient->breakpoint_set(lType,
136 void CommandLineHandler::handle<BreakpointDel>(tuple<bint> &aTuple)151 lEnabled,
137 {152 get<1>(aTuple).second,
138 theWaitFor = theClient->breakpoint_remove(get<0>(aTuple).second);153 get<2>(aTuple).second);
139 }154}
140 155
141 template<>156template<>
142 void CommandLineHandler::handle<BreakpointList>(tuple<> &t)157void
143 {158CommandLineHandler::handle<BreakpointGet>(tuple<bint> &aTuple)
144 theWaitFor = theClient->breakpoint_list();159{
145 }160 theWaitFor = theClient->breakpoint_get(get<0>(aTuple).second);
146 161}
147 template<>162
148 void CommandLineHandler::handle<StackDepth>(tuple<> &t)163template<>
149 {164void
150 theWaitFor = theClient->stack_depth();165CommandLineHandler::handle<BreakpointRemove>(tuple<bint> &aTuple)
151 }166{
152 167 theWaitFor = theClient->breakpoint_remove(get<0>(aTuple).second);
153 template<>168}
154 void CommandLineHandler::handle<StackGet>(tuple<bint> &aTuple)169
155 {170template<>
156 if (get<0>(aTuple).first) {171void
157 theWaitFor = theClient->stack_get(get<0>(aTuple).second);172CommandLineHandler::handle<BreakpointList>(tuple<> &aTuple)
158 } else {173{
159 theWaitFor = theClient->stack_get();174 theWaitFor = theClient->breakpoint_list();
160 }175}
161 }176
162 177template<>
163 template<>178void
164 void CommandLineHandler::handle<ContextNames>(tuple<>& aTuple)179CommandLineHandler::handle<StackDepth>(tuple<> &aTuple)
165 {180{
166 theWaitFor = theClient->context_names();181 theWaitFor = theClient->stack_depth();
167 }182}
168 183
169 template<>184template<>
170 void CommandLineHandler::handle<ContextGet>(tuple<bint> &aTuple)185void
171 {186CommandLineHandler::handle<StackGet>(tuple<bint> &aTuple)
172 if (get<0>(aTuple).first)187{
173 theWaitFor = theClient->context_get(get<0>(aTuple).second);188 if (get<0>(aTuple).first) {
174 else189 theWaitFor = theClient->stack_get(get<0>(aTuple).second);
175 theWaitFor = theClient->context_get();190 } else {
176 }191 theWaitFor = theClient->stack_get();
177 192 }
178 template<>193}
179 void CommandLineHandler::handle<Eval>(tuple<bstring>& aTuple)194
180 {195template<>
181 theWaitFor = theClient->eval(get<0>(aTuple).second);196void
182 }197CommandLineHandler::handle<ContextNames>(tuple<>& aTuple)
183 198{
184 void CommandLineHandler::addCommands()199 theWaitFor = theClient->context_names();
185 {200}
186 theCommandLine << createCommand<Status>(tuple<>(), "status", *this,201
187 "Gets the status of the server");202template<>
188 theCommandLine << createCommand<Quit>(tuple<>(), "quit", *this,203void CommandLineHandler::handle<ContextGet>(tuple<bint, bint> &aTuple)
189 "Stops debugging and quits the client");204{
190 theCommandLine << createCommand<Run>(tuple<>(), "run", *this, "Run the Query");205 int lDepth = -1;
191 {206 int lContext = -1;
192 Command<CommandLineHandler, tuple<bstring, bstring, bint>, BreakpointSet>* lCommand =207
193 createCommand<BreakpointSet>(tuple<bstring, bstring, bint>(), "break", *this, "Set a breakpoint");208 if (get<0>(aTuple).first) {
194 (*lCommand)(0, "s", createArgType<tuple<bstring, bstring, bint>, std::string, 0>(tuple<bstring, bstring, bint>()),209 lDepth = get<0>(aTuple).second;
195 "breakpoint state (enabled or disabled - default: enabled)", false);210 }
196 (*lCommand)(1, "f", createArgType<tuple<bstring, bstring, bint>, std::string, 1>(tuple<bstring, bstring, bint>()),211 if (get<1>(aTuple).first) {
197 "The name of the file where to stop", true);212 lContext = get<1>(aTuple).second;
198 (*lCommand)(2, "l", createArgType<tuple<bstring, bstring, bint>, int, 2>(tuple<bstring, bstring, bint>()),213 }
199 "The line number", true);214 theWaitFor = theClient->context_get(lDepth, lContext);
200 215}
201 theCommandLine << lCommand;216
202 }217template<>
203 {218void CommandLineHandler::handle<Source>(tuple<bint, bint, bstring> &aTuple)
204 Command<CommandLineHandler, tuple<bint>, BreakpointGet>* lCommand219{
205 = createCommand<BreakpointGet>(tuple<bint>(), "binfo", *this, 220 theWaitFor = theClient->source(
206 "Get information about a given breakpoint");221 get<2>(aTuple).second,
207 (*lCommand)(0, "i", createArgType<tuple<bint>, int, 0>(tuple<bint>()),222 get<0>(aTuple).second,
208 "The id of the breakpoint", true);223 get<1>(aTuple).second);
209 224}
210 theCommandLine << lCommand;225
211 }226template<>
212 {227void CommandLineHandler::handle<Eval>(tuple<bstring>& aTuple)
213 Command<CommandLineHandler, tuple<bint>, BreakpointDel>* lCommand228{
214 = createCommand<BreakpointDel>(tuple<bint>(), "bdel", *this, "Delete a breakpoint with a given id");229 theWaitFor = theClient->eval(get<0>(aTuple).second);
215 (*lCommand)(0, "i", createArgType<tuple<bint>, int, 0>(tuple<bint>()), "The id of the breakpoint", true);230}
216 231
217 theCommandLine << lCommand;232template<>
218 }233void
219 theCommandLine << createCommand<BreakpointList>(tuple<>(), "blist", *this, "List all set breakpoints");234CommandLineHandler::handle<StepIn>(ZORBA_TR1_NS::tuple<> &t)
220 theCommandLine << createCommand<StackDepth>(tuple<>(), "sdepth", *this, "Get the depth of the stack");235{
221 {236 theTerminated = false;
222 Command<CommandLineHandler, tuple<bint>, StackGet>* lCommand237 theWaitFor = theClient->step_into();
223 = createCommand<StackGet>(tuple<bint>(), "sget", *this, "Get information about one or all stack frames");238}
224 (*lCommand)(0, "d", createArgType<tuple<bint>, int, 0>(tuple<bint>()), "The stack entry two show (show all if not provided)", false);239
225 theCommandLine << lCommand;240template<>
226 }241void
227 theCommandLine << createCommand<ContextNames>(tuple<>(), "cnames", *this, "Get the names of the avilable contexts");242CommandLineHandler::handle<StepOut>(ZORBA_TR1_NS::tuple<> &t)
228 {243{
229 Command<CommandLineHandler, tuple<bint>, ContextGet>* lCommand244 theWaitFor = theClient->step_out();
230 = createCommand<ContextGet>(tuple<bint>(), "cget", *this, "Get a context");245}
231 246
232 (*lCommand)(0, "c", createArgType<tuple<bint>, int, 0>(tuple<bint>()), "The id of the context", false);247template<>
233 248void
234 theCommandLine << lCommand;249CommandLineHandler::handle<StepOver>(ZORBA_TR1_NS::tuple<> &t)
235 }250{
236 {251 theTerminated = false;
237 Command<CommandLineHandler, tuple<bstring>, Eval>* lCommand252 theWaitFor = theClient->step_over();
238 = createCommand<Eval>(tuple<bstring>(), "eval", *this, "Evaluate a function");253}
239 254
240 (*lCommand)(0, "c", createArgType<tuple<bstring>, std::string, 0>(tuple<bstring>()), "The command to evaluate", true);255void
241 256CommandLineHandler::addCommands()
242 theCommandLine << lCommand;257{
243 }258 typedef tuple<> TUPLE;
244 }259 typedef tuple<bint> TUPLE_INT;
245 260 typedef tuple<bstring> TUPLE_STR;
246}} // namespace zorba::debugclient261 typedef tuple<bint, bint> TUPLE_INT_INT;
247262 typedef tuple<bstring, bstring, bint> TUPLE_STR_STR_INT;
263 typedef tuple<bint, bint, bstring> TUPLE_INT_INT_STR;
264
265 // DBGP: status
266 *theCommandLine << createCommand<Status>(TUPLE(), "status", *this, "Gets the status of the server");
267
268 // ALIAS: variables (context_get -c -1)
269 {
270 std::set<std::string> lAliases;
271 lAliases.insert("vars");
272 *theCommandLine << createCommand<Variables>(TUPLE(), "variables", lAliases, *this, "Gets the variables visible in the current scope");
273 }
274
275 // META: quit
276 *theCommandLine << createCommand<Quit>(TUPLE(), "quit", *this, "Stops debugging and quits the client");
277
278 // DBGP: run
279 *theCommandLine << createCommand<Run>(TUPLE(), "run", *this, "Run the query");
280
281 // DBGP: stop
282 *theCommandLine << createCommand<Stop>(TUPLE(), "stop", *this, "Stop the query");
283
284 // DBGP: breakpoint_set
285 {
286 std::set<std::string> lAliases;
287 lAliases.insert("break");
288 Command<CommandLineHandler, TUPLE_STR_STR_INT, BreakpointSet>* lCommand =
289 createCommand<BreakpointSet>(TUPLE_STR_STR_INT(), "bset", lAliases, *this, "Set a breakpoint");
290
291 lCommand->addArgument(0, "s", createArgType<TUPLE_STR_STR_INT, std::string, 0>(TUPLE_STR_STR_INT()), "breakpoint state (optional, 'enabled' or 'disabled', default: enabled)", false);
292 lCommand->addArgument(1, "f", createArgType<TUPLE_STR_STR_INT, std::string, 1>(TUPLE_STR_STR_INT()), "name of the file where to stop", true);
293 lCommand->addArgument(2, "l", createArgType<TUPLE_STR_STR_INT, int, 2>(TUPLE_STR_STR_INT()), "line number", true);
294
295 *theCommandLine << lCommand;
296 }
297
298 // DBGP: breakpoint_get
299 {
300 Command<CommandLineHandler, TUPLE_INT, BreakpointGet>* lCommand =
301 createCommand<BreakpointGet>(TUPLE_INT(), "bget", *this, "Get information about a given breakpoint");
302
303 lCommand->addArgument(0, "d", createArgType<TUPLE_INT, int, 0>(TUPLE_INT()), "breakpoint ID", true);
304
305 *theCommandLine << lCommand;
306 }
307
308 // DBGP: breakpoint_remove
309 {
310 std::set<std::string> lAliases;
311 lAliases.insert("clear");
312 lAliases.insert("delete");
313 Command<CommandLineHandler, TUPLE_INT, BreakpointRemove>* lCommand =
314 createCommand<BreakpointRemove>(TUPLE_INT(), "bremove", lAliases, *this, "Delete a breakpoint");
315
316 lCommand->addArgument(0, "d", createArgType<TUPLE_INT, int, 0>(TUPLE_INT()), "breakpoint ID", true);
317
318 *theCommandLine << lCommand;
319 }
320
321 // DBGP: breakpoint_list
322 *theCommandLine << createCommand<BreakpointList>(TUPLE(), "blist", *this, "List all set breakpoints");
323
324 // DBGP: stack_depth
325 *theCommandLine << createCommand<StackDepth>(TUPLE(), "sdepth", *this, "Get the depth of the stack");
326
327 // DBGP: stack_get
328 {
329 Command<CommandLineHandler, TUPLE_INT, StackGet>* lCommand =
330 createCommand<StackGet>(TUPLE_INT(), "sget", *this, "Get information about one or all stack frames");
331
332 lCommand->addArgument(0, "d", createArgType<TUPLE_INT, int, 0>(TUPLE_INT()), "stack frame to show: 0 for current stack frame, N for the main module (optional, all frames are shown if not provided)", false);
333
334 *theCommandLine << lCommand;
335 }
336
337 // DBGP: context_names
338 *theCommandLine << createCommand<ContextNames>(tuple<>(), "cnames", *this, "Get the names of the avilable contexts");
339 // the DBGP -d arguments for this command is omitted since we always have/return: 0 - Local, 1 - Global
340
341 // DBGP: context_get
342 {
343 Command<CommandLineHandler, TUPLE_INT_INT, ContextGet>* lCommand =
344 createCommand<ContextGet>(TUPLE_INT_INT(), "cget", *this, "Get a context (list variables in this context)");
345
346 lCommand->addArgument(0, "d", createArgType<TUPLE_INT_INT, int, 0>(TUPLE_INT_INT()), "stack depth (optional, default: 0)", false);
347 lCommand->addArgument(0, "c", createArgType<TUPLE_INT_INT, int, 1>(TUPLE_INT_INT()), "context ID: 0 for Local, 1 for Global (optional, default: 0)", false);
348
349 *theCommandLine << lCommand;
350 }
351
352 // DBGP: source
353 {
354 std::set<std::string> lAliases;
355 lAliases.insert("list");
356 Command<CommandLineHandler, TUPLE_INT_INT_STR, Source>* lCommand =
357 createCommand<Source>(TUPLE_INT_INT_STR(), "source", lAliases, *this, "List source code");
358
359 lCommand->addArgument(0, "b", createArgType<TUPLE_INT_INT_STR, int, 0>(TUPLE_INT_INT_STR()), "begin line (optional, default: first line)", false);
360 lCommand->addArgument(1, "e", createArgType<TUPLE_INT_INT_STR, int, 1>(TUPLE_INT_INT_STR()), "end line (optional, default: last line)", false);
361 lCommand->addArgument(2, "f", createArgType<TUPLE_INT_INT_STR, std::string, 2>(TUPLE_INT_INT_STR()), "file URI (optional, default: the file in the top-most stack frame during execution, main module otherwise)", false);
362
363 *theCommandLine << lCommand;
364 }
365
366 // DBGP: eval
367 {
368 std::set<std::string> lAliases;
369 lAliases.insert("print");
370 Command<CommandLineHandler, TUPLE_STR, Eval>* lCommand =
371 createCommand<Eval>(TUPLE_STR(), "eval", lAliases, *this, "Evaluate an expression");
372
373 // TODO: this argument should not be here at all. Eval has the form: eval -i transaction_id -- {DATA}
374 // Eval should be called with a command like: eval 1 + 3
375 // - no need for an argument name
376 // - everything following the fist contiguous set of whitespaces are sent as string
377 lCommand->addArgument(0, "c", createArgType<TUPLE_STR, std::string, 0>(TUPLE_STR()), "expression to evaluate", true);
378
379 *theCommandLine << lCommand;
380 }
381
382 // DBGP: step_in
383 {
384 std::set<std::string> lAliases;
385 lAliases.insert("step");
386 lAliases.insert("s");
387 *theCommandLine << createCommand<StepIn>(TUPLE(), "in", lAliases, *this, "Step in");
388 }
389
390 // DBGP: step_out
391 {
392 std::set<std::string> lAliases;
393 lAliases.insert("finish");
394 *theCommandLine << createCommand<StepOut>(TUPLE(), "out", lAliases, *this, "Step out");
395 }
396
397 // DBGP: step_over
398 {
399 std::set<std::string> lAliases;
400 lAliases.insert("next");
401 lAliases.insert("n");
402 *theCommandLine << createCommand<StepOver>(TUPLE(), "over", lAliases, *this, "Step over");
403 }
404}
405
406} // namespace zorba
407} // namespace debugger
248408
=== modified file 'bin/debugger/command_line_handler.h'
--- bin/debug_client/command_line_handler.h 2011-07-01 01:53:24 +0000
+++ bin/debugger/command_line_handler.h 2012-02-22 17:11:27 +0000
@@ -14,46 +14,71 @@
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16#pragma once16#pragma once
17#ifndef ZORBA_DEBUGGER_COMMAND_LINE_HANDLER_H
18#define ZORBA_DEBUGGER_COMMAND_LINE_HANDLER_H
1719
18#include <set>20#include <set>
19#include <cassert>21#include <cassert>
22
20#include <zorba/debugger_client.h>23#include <zorba/debugger_client.h>
21#include "debug_command.h"24
25#include "command.h"
22#include "event_handler.h"26#include "event_handler.h"
2327
24namespace zorba { namespace debugclient {28
25 29namespace zorba { namespace debugger {
30
31 class CommandPrompt;
32
26 enum Commands {33 enum Commands {
27 Status,34 Status,
35 Variables,
36 Quit,
28 Run,37 Run,
38 Stop,
29 BreakpointSet,39 BreakpointSet,
30 BreakpointGet,40 BreakpointGet,
31 BreakpointDel,41 BreakpointRemove,
32 BreakpointList,42 BreakpointList,
33 StackDepth,43 StackDepth,
34 StackGet,44 StackGet,
35 ContextNames,45 ContextNames,
36 ContextGet,46 ContextGet,
47 Source,
37 Eval,48 Eval,
38 Quit49 StepIn,
50 StepOut,
51 StepOver
39 };52 };
40 53
41 class CommandLineHandler {54class CommandLineHandler
55{
42 private:56 private:
57
43 typedef std::pair<bool, std::string> bstring;58 typedef std::pair<bool, std::string> bstring;
44 typedef std::pair<bool, int> bint;59 typedef std::pair<bool, int> bint;
60
45 public:61 public:
46 CommandLineHandler(unsigned short port,62
47 LockFreeConsumer<std::size_t>& aConsumer,63 CommandLineHandler(
48 LockFreeConsumer<bool>& aContinueQueue,64 unsigned short port,
49 EventHandler& aHandler,65 LockFreeConsumer<std::size_t>& aConsumer,
50 CommandLine& aCommandLine);66 LockFreeConsumer<bool>& aContinueQueue,
67 EventHandler* aHandler,
68 CommandPrompt* aCommandPrompt);
69
51 ~CommandLineHandler();70 ~CommandLineHandler();
71
52 public:72 public:
53 void execute();73 void execute();
74
54 public: // Handlers75 public: // Handlers
76
55 template<int>77 template<int>
56 void handle(ZORBA_TR1_NS::tuple<>& aTuple) { assert(false); }78 void handle(ZORBA_TR1_NS::tuple<>& aTuple)
79 {
80 assert(false);
81 }
57 82
58 template<int>83 template<int>
59 void handle(ZORBA_TR1_NS::tuple<bstring, bstring, bint>& t)84 void handle(ZORBA_TR1_NS::tuple<bstring, bstring, bint>& t)
@@ -62,63 +87,96 @@
62 }87 }
63 88
64 template<int>89 template<int>
90 void handle(ZORBA_TR1_NS::tuple<bint, bint, bstring>& t)
91 {
92 assert(false);
93 }
94
95 template<int>
65 void handle(ZORBA_TR1_NS::tuple<bint>& aTuple)96 void handle(ZORBA_TR1_NS::tuple<bint>& aTuple)
66 {97 {
67 assert(false);98 assert(false);
68 }99 }
69 100
70 template<int>101 template<int>
102 void handle(ZORBA_TR1_NS::tuple<bint, bint>& aTuple)
103 {
104 assert(false);
105 }
106
107 template<int>
71 void handle(ZORBA_TR1_NS::tuple<bstring>& aTuple)108 void handle(ZORBA_TR1_NS::tuple<bstring>& aTuple)
72 {109 {
73 assert(false);110 assert(false);
74 }111 }
112
75 private:113 private:
76 LockFreeConsumer<std::size_t>& theConsumer;114 LockFreeConsumer<std::size_t>& theConsumer;
77 LockFreeConsumer<bool>& theContinueQueue;115 LockFreeConsumer<bool>& theContinueQueue;
78 DebuggerClient* theClient;116 DebuggerClient* theClient;
79 CommandLine& theCommandLine;117 CommandPrompt* theCommandLine;
80 bool theQuit;118 bool theQuit;
81 bool theContinue;119 bool theTerminated;
82 std::size_t theWaitFor;120 bool theContinue;
121 std::size_t theWaitFor;
122
83 private:123 private:
84 void getNextId(std::set<std::size_t>& aIdList);124 void getNextId(std::set<std::size_t>& aIdList);
85 void addCommands();125 void addCommands();
86 };126};
87 127
88 template<>128template<>
89 void CommandLineHandler::handle<Status> (ZORBA_TR1_NS::tuple<>& t);129void CommandLineHandler::handle<Status> (ZORBA_TR1_NS::tuple<>& t);
90 130
91 template<>131template<>
92 void CommandLineHandler::handle<Quit> (ZORBA_TR1_NS::tuple<>& t);132void CommandLineHandler::handle<Quit> (ZORBA_TR1_NS::tuple<>& t);
93 133
94 template<>134template<>
95 void CommandLineHandler::handle<Run> (ZORBA_TR1_NS::tuple<> &t);135void CommandLineHandler::handle<Run> (ZORBA_TR1_NS::tuple<> &t);
96 136
97 template<>137template<>
98 void CommandLineHandler::handle<StackDepth> (ZORBA_TR1_NS::tuple<>& t);138void CommandLineHandler::handle<Stop> (ZORBA_TR1_NS::tuple<> &t);
99 139
100 template<>140template<>
101 void CommandLineHandler::handle<BreakpointList> (ZORBA_TR1_NS::tuple<>& aTuple);141void CommandLineHandler::handle<StackDepth> (ZORBA_TR1_NS::tuple<>& t);
102 142
103 template<>143template<>
104 void CommandLineHandler::handle<BreakpointSet> (ZORBA_TR1_NS::tuple<bstring, bstring, bint> &t);144void CommandLineHandler::handle<BreakpointList> (ZORBA_TR1_NS::tuple<>& aTuple);
105 145
106 template<>146template<>
107 void CommandLineHandler::handle<BreakpointGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);147void CommandLineHandler::handle<BreakpointSet> (ZORBA_TR1_NS::tuple<bstring, bstring, bint> &t);
108 148
109 template<>149template<>
110 void CommandLineHandler::handle<BreakpointDel>(ZORBA_TR1_NS::tuple<bint> &aTuple);150void CommandLineHandler::handle<BreakpointGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);
111 151
112 template<>152template<>
113 void CommandLineHandler::handle<StackGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);153void CommandLineHandler::handle<BreakpointRemove>(ZORBA_TR1_NS::tuple<bint> &aTuple);
114 154
115 template<>155template<>
116 void CommandLineHandler::handle<ContextNames>(ZORBA_TR1_NS::tuple<> &aTuple);156void CommandLineHandler::handle<StackGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);
117 157
118 template<>158template<>
119 void CommandLineHandler::handle<ContextGet>(ZORBA_TR1_NS::tuple<bint> &aTuple);159void CommandLineHandler::handle<ContextNames>(ZORBA_TR1_NS::tuple<> &aTuple);
120 160
121 template<>161template<>
122 void CommandLineHandler::handle<Eval>(ZORBA_TR1_NS::tuple<bstring>& aTuple);162void CommandLineHandler::handle<ContextGet>(ZORBA_TR1_NS::tuple<bint, bint> &aTuple);
123 163
124}} // close namespaces zorba::debugclient164template<>
165void CommandLineHandler::handle<Source>(ZORBA_TR1_NS::tuple<bint, bint, bstring> &aTuple);
166
167template<>
168void CommandLineHandler::handle<Eval>(ZORBA_TR1_NS::tuple<bstring>& aTuple);
169
170template<>
171void CommandLineHandler::handle<StepIn> (ZORBA_TR1_NS::tuple<> &t);
172
173template<>
174void CommandLineHandler::handle<StepOut> (ZORBA_TR1_NS::tuple<> &t);
175
176template<>
177void CommandLineHandler::handle<StepOver> (ZORBA_TR1_NS::tuple<> &t);
178
179} // namespace zorba
180} // namespace debugger
181
182#endif // ZORBA_DEBUGGER_COMMAND_LINE_HANDLER_H
125183
=== added file 'bin/debugger/command_prompt.cpp'
--- bin/debugger/command_prompt.cpp 1970-01-01 00:00:00 +0000
+++ bin/debugger/command_prompt.cpp 2012-02-22 17:11:27 +0000
@@ -0,0 +1,287 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include "command_prompt.h"
17
18#include <string>
19#include <vector>
20#include <map>
21#include <iostream>
22
23#include "command.h"
24
25
26namespace zorba { namespace debugger {
27
28#ifdef ZORBA_HAVE_LIBEDIT_H
29const char*
30prompt(EditLine* aEl) {
31 return "(xqdb) ";
32}
33#endif
34
35CommandPrompt::CommandPrompt()
36{
37#ifdef ZORBA_HAVE_LIBEDIT_H
38 theEditLine = el_init("xqdb", stdin, stdout, stderr);
39 theHistory = history_init();
40 HistEvent lHistoryEvent;
41 history(theHistory, &lHistoryEvent, H_SETSIZE, 100);
42
43 el_set(theEditLine, EL_PROMPT, prompt);
44
45 el_set(theEditLine, EL_HIST, history, theHistory);
46 el_set(theEditLine, EL_EDITOR, "emacs");
47#endif
48}
49
50CommandPrompt::~CommandPrompt()
51{
52#ifdef ZORBA_HAVE_LIBEDIT_H
53 history_end(theHistory);
54 el_end(theEditLine);
55#endif
56
57 std::map<std::string, UntypedCommand*>::iterator lIter;
58 for (lIter = theCommands.begin(); lIter != theCommands.end(); ++lIter) {
59 delete lIter->second;
60 }
61}
62
63void
64CommandPrompt::printHelp(UntypedCommand* aCommand)
65{
66 // if no command is provided, print all the available commands
67 if (!aCommand) {
68 std::cout << "Available commands:" << std::endl;
69
70 // print the names of all commands
71 std::map<std::string, UntypedCommand*>::iterator lIter = theCommands.begin();
72 while (lIter != theCommands.end()) {
73 std::cout << " " << (*lIter).first;
74 std::set<std::string> lAliases = (*lIter).second->getAliases();
75 std::set<std::string>::const_iterator lAliasIter = lAliases.begin();
76 while (lAliasIter != lAliases.end()) {
77 std::cout << ", " << *lAliasIter;
78 lAliasIter++;
79 }
80 std::cout << std::endl;
81 lIter++;
82 }
83
84 // some hints for detailed help
85 std::cout << std::endl;
86 std::cout << "Type help <command> to get more information about one command." << std::endl;
87 std::cout << std::endl;
88 } else {
89 // ok, so we have a command; then print the help
90 aCommand->printHelp();
91 }
92}
93
94void
95CommandPrompt::execute()
96{
97 bool lWithOutput = true;
98
99 for (;;) {
100#ifdef ZORBA_HAVE_LIBEDIT_H
101 const char* lBuf;
102 int lCharsRead = -1;
103 lBuf = el_gets(theEditLine, &lCharsRead);
104 std::string lCommandLine(lBuf, lCharsRead - 1);
105#else
106 if (lWithOutput) {
107 std::cout << "(xqdb) ";
108 }
109 lWithOutput = true;
110 std::string lCommandLine;
111 std::getline(std::cin, lCommandLine);
112 if (std::cin.fail()) {
113 lWithOutput = false;
114 std::cin.clear();
115 continue;
116 }
117#endif
118
119 std::vector<std::string> lArgs;
120
121 // split the command into arguments
122 parseLine(lCommandLine, lArgs);
123 std::string::size_type lSize = lArgs.size();
124
125 // empty command? do nothing!
126 if (lSize == 0) {
127 lArgs = theLastArgs;
128 if (lArgs.size() == 0) {
129 continue;
130 }
131 }
132#ifdef ZORBA_HAVE_LIBEDIT_H
133 else {
134 HistEvent lHistoryEvent;
135 history(theHistory, &lHistoryEvent, H_ENTER, lCommandLine.c_str());
136 }
137#endif
138 theLastArgs = lArgs;
139
140 UntypedCommand* lCommand = NULL;
141
142 // help is not a command but a hook here
143 if (lArgs.at(0) == "h" || lArgs.at(0) == "help") {
144 std::string lCmd = "";
145
146 // if the user needs the help for a specific command
147 if (lSize > 1) {
148 // do nothing if we don't have a command starting with this prefix?
149 // findCommand will print the appropriate errors
150 if (!findCommand(lArgs[1], lCommand)) {
151 continue;
152 }
153 }
154 printHelp(lCommand);
155 continue;
156 }
157 if (findCommand(lArgs[0], lCommand) && lCommand->execute(lArgs)) {
158 return;
159 }
160 continue;
161 }
162}
163
164CommandPrompt&
165CommandPrompt::operator<<(UntypedCommand *aCommand)
166{
167 theCommands.insert(std::make_pair(aCommand->getName(), aCommand));
168 return *this;
169}
170
171bool
172CommandPrompt::findCommand(const std::string& aPrefix, UntypedCommand*& aCommand)
173{
174 std::vector<UntypedCommand*> lFoundCommands;
175
176 std::map<std::string, UntypedCommand*>::iterator lIter = theCommands.begin();
177 while (lIter != theCommands.end()) {
178 // if a command name is equal with the prefix, this is the command we want
179 if ((*lIter).first == aPrefix) {
180 aCommand = (*lIter).second;
181 return true;
182 }
183
184 bool lIsCandidate = false;
185
186 // add this command to candidate commands if the prefix matches
187 if ((*lIter).first.find(aPrefix) == 0) {
188 lFoundCommands.push_back((*lIter).second);
189 lIsCandidate = true;
190 }
191
192 // now process the aliases
193 std::set<std::string> lAliases = (*lIter).second->getAliases();
194 std::set<std::string>::const_iterator lAliasIter = lAliases.begin();
195 while (lAliasIter != lAliases.end()) {
196 // if a command alias is equal with the prefix, this is the command we want
197 if (*lAliasIter == aPrefix) {
198 aCommand = (*lIter).second;
199 return true;
200 }
201
202 // add this command to candidate commands if the prefix matches one alias
203 // and if the command is not already added
204 if (!lIsCandidate && (*lAliasIter).find(aPrefix) == 0) {
205 lFoundCommands.push_back((*lIter).second);
206 break;
207 }
208 lAliasIter++;
209 }
210
211 lIter++;
212 }
213
214 if (lFoundCommands.empty()) {
215 std::cout << "Command not found: " << aPrefix << std::endl;
216 return false;
217 }
218
219 if (lFoundCommands.size() > 1) {
220 std::cout << "Ambigous command: " << aPrefix << std::endl;
221 // show all possible commands that start with this prefix
222 for (std::string::size_type i = 0; i < lFoundCommands.size(); i++) {
223 UntypedCommand* lCommand = lFoundCommands.at(i);
224
225 // commands
226 if (lCommand->getName().find(aPrefix) == 0) {
227 std::cout << " " << lCommand->getName() << std::endl;
228 }
229
230 // and aliases
231 std::set<std::string> lAliases = lCommand->getAliases();
232 std::set<std::string>::const_iterator lAliasIter = lAliases.begin();
233 while (lAliasIter != lAliases.end()) {
234 if ((*lAliasIter).find(aPrefix) == 0) {
235 std::cout << " " << *lAliasIter << std::endl;
236 }
237 lAliasIter++;
238 }
239 }
240 return false;
241 }
242
243 aCommand = lFoundCommands[0];
244 return true;
245}
246
247void
248CommandPrompt::parseLine(const std::string& aLine, std::vector<std::string>& aVector)
249{
250 std::string::size_type lBefore = 0;
251 std::string::size_type lPos = aLine.find_first_of(" \t", 0);
252
253 while (lPos != aLine.npos) {
254 std::string lSub = aLine.substr(lBefore, lPos - lBefore);
255
256 // if two consecutive spaces, you get an empty string here
257 if (lSub != "") {
258 if (lSub[0] == '"') {
259 std::string::size_type lBeforeCopy = lBefore;
260 do {
261 lBeforeCopy = aLine.find("\"", lBeforeCopy + 1);
262 } while (lPos != aLine.npos && aLine.size() > lPos + 1 && aLine[lPos + 1] == '\\');
263 lPos = lBeforeCopy;
264 lSub = aLine.substr(lBefore + 1, lPos - lBefore - 1);
265 }
266 aVector.push_back(lSub);
267 }
268
269 lBefore = lPos + 1;
270 lPos = aLine.find_first_of(" \t", lBefore);
271 }
272 std::string lSub = aLine.substr(lBefore);
273
274 // catching the case when the command ends with a space
275 if (lSub == "") {
276 return;
277 }
278
279 if (lSub[0] == '"') {
280 lPos = aLine.find("\"", lBefore + 1);
281 lSub = aLine.substr(lBefore + 1, lPos - lBefore - 1);
282 }
283 aVector.push_back(lSub);
284}
285
286} // namespace zorba
287} // namespace debugger
0288
=== added file 'bin/debugger/command_prompt.h'
--- bin/debugger/command_prompt.h 1970-01-01 00:00:00 +0000
+++ bin/debugger/command_prompt.h 2012-02-22 17:11:27 +0000
@@ -0,0 +1,72 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17#ifndef ZORBA_DEBUGGER_COMMAND_PROMPT_H
18#define ZORBA_DEBUGGER_COMMAND_PROMPT_H
19
20#include <string>
21#include <map>
22#include <vector>
23
24#include "config.h"
25
26#ifdef ZORBA_HAVE_LIBEDIT_H
27# include <histedit.h>
28#endif
29
30
31namespace zorba { namespace debugger {
32
33class UntypedCommand;
34
35class CommandPrompt
36{
37 public:
38 CommandPrompt();
39 ~CommandPrompt();
40
41 public:
42
43 void execute();
44
45 CommandPrompt& operator<< (UntypedCommand* command);
46
47 private:
48
49 void
50 printHelp(UntypedCommand* command);
51
52 bool
53 findCommand(const std::string& prefix, UntypedCommand*& command);
54
55 void
56 parseLine(const std::string& line, std::vector<std::string>& vector);
57
58 private:
59 std::map<std::string, UntypedCommand*> theCommands;
60 std::vector<std::string> theLastArgs;
61
62#ifdef ZORBA_HAVE_LIBEDIT_H
63 EditLine* theEditLine;
64 History* theHistory;
65#endif
66};
67
68
69} // namespace zorba
70} // namespace debugger
71
72#endif // ZORBA_DEBUGGER_COMMAND_PROMPT_H
073
=== added file 'bin/debugger/config.h.cmake'
--- bin/debugger/config.h.cmake 1970-01-01 00:00:00 +0000
+++ bin/debugger/config.h.cmake 2012-02-22 17:11:27 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// This header is configured by Zorba's build process -- DO NOT EDIT!
18
19#ifndef ZORBA_DEBUGGER_CONFIG_H
20#define ZORBA_DEBUGGER_CONFIG_H
21
22#cmakedefine ZORBA_HAVE_LIBEDIT_H
23
24#endif /* ZORBA_DEBUGGER_CONFIG_H */
025
=== modified file 'bin/debugger/event_handler.cpp'
--- bin/debug_client/event_handler.cpp 2011-07-01 01:53:24 +0000
+++ bin/debugger/event_handler.cpp 2012-02-22 17:11:27 +0000
@@ -13,88 +13,93 @@
13 * See the License for the specific language governing permissions and13 * See the License for the specific language governing permissions and
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16
17#include "event_handler.h"
18
19#include <sstream>
20
16#include <zorba/zorba.h>21#include <zorba/zorba.h>
17#include <zorba/store_manager.h>22#include <zorba/store_manager.h>
18#include <zorba/iterator.h>23#include <zorba/iterator.h>
19#include <sstream>
20#include "debug_client/event_handler.h"
2124
22namespace zorba { namespace debugclient {25namespace zorba { namespace debugger {
23 26
24 EventHandler::EventHandler(LockFreeProducer<std::size_t>& aQueue, LockFreeProducer<bool>& aContProducer)27EventHandler::EventHandler(LockFreeProducer<std::size_t>& aQueue, LockFreeProducer<bool>& aContProducer)
25 : theIdQueue(aQueue), theContinueProducer(aContProducer),28 : theIdQueue(aQueue), theContinueProducer(aContProducer),
26 theStore(StoreManager::getStore()),29 theStore(StoreManager::getStore()),
27 theZorbaInstance(Zorba::getInstance(theStore)),30 theZorbaInstance(Zorba::getInstance(theStore)),
28 theStaticContext(theZorbaInstance->createStaticContext())31 theStaticContext(theZorbaInstance->createStaticContext())
29 32{
30 {33}
31 try {34
32 Zorba_CompilerHints_t lHints;35EventHandler::~EventHandler()
33 lHints.opt_level = ZORBA_OPT_LEVEL_O1;36{
34 std::auto_ptr<std::istream> stream(getCurrentDirectory());37 theStaticContext = 0;
35 zorba::String query;38 theZorbaInstance->shutdown();
36 char buffer[1024];39 StoreManager::shutdownStore(theStore);
37 std::string::size_type s;40}
38 while ((s = stream->readsome(buffer, 1024))) {41
39 query.append(std::string(buffer, s));42void
40 }43EventHandler::init()
41 theStaticContext->loadProlog(query, lHints);44{
42 } catch (zorba::ZorbaException& e) {45 try {
43 std::cerr << "Exception: I was not able to load the query file:" << std::endl;46 Zorba_CompilerHints_t lHints;
44 std::cerr << e.what() << std::endl;47 lHints.opt_level = ZORBA_OPT_LEVEL_O1;
45 throw;48 zorba::String lProlog("import module namespace dmh = 'http://www.zorba-xquery.com/modules/debugger/dbgp-message-handler';");
46 }49 theStaticContext->loadProlog(lProlog, lHints);
47 }50 } catch (zorba::ZorbaException& e) {
48 51 std::cerr << "Exception: I was not able to load the query file:" << std::endl;
49 EventHandler::~EventHandler()52 std::cerr << e.what() << std::endl;
50 {53 throw;
51 theStaticContext = 0;54 }
52 theZorbaInstance->shutdown();55}
53 StoreManager::shutdownStore(theStore);56
54 }57void
55 58EventHandler::parseMessage(const std::string &aMessage)
56 void EventHandler::parseMessage(const std::string &aMessage)59{
57 {60 try {
58 try {61#ifndef NDEBUG
59 zorba::String queryString = "local:main(";62 // uncomment this to see the raw messages received by the event handler
60 queryString += aMessage + ")";63 //std::cout << "Processing response: " << aMessage << std::endl;
61 XQuery_t query = theZorbaInstance->compileQuery(queryString, theStaticContext);64#endif
62 Iterator_t lIter = query->iterator();65 // the query to process the response
63 Item item;66 std::stringstream lQueryStream;
64 lIter->open();67 lQueryStream << "dmh:process(" << aMessage << ")";
65 bool doContinue = false;68 XQuery_t lQuery = theZorbaInstance->compileQuery(lQueryStream.str(), theStaticContext);
66 lIter->next(item);69
67 {70 // get the query result sequrence:
68 const std::string& continueString = item.getStringValue().str();71 // 1. a message
69 if (continueString == "true") {72 Iterator_t lIter = lQuery->iterator();
70 doContinue = true;73 Item lItem;
71 } else if (continueString == "false") {74 lIter->open();
72 doContinue = false;75 lIter->next(lItem);
73 } else {76 std::size_t lId;
74 std::stringstream stream(continueString);77 std::stringstream lStream(lItem.getStringValue().c_str());
75 stream >> doContinue;78 lStream >> lId;
76 }79
77 }80 // 2. an "idle" flag (to disable quit confirmation)
78 lIter->next(item);81 bool lCanQuit = false;
79 std::size_t lId;82 if (lIter->next(lItem)) {
80 {83 String lMessage = lItem.getStringValue();
81 std::stringstream stream(item.getStringValue().c_str());84 lCanQuit = lMessage == "idle";
82 stream >> lId;85 std::cout << std::endl << lItem.getStringValue() << std::endl;
83 }86 }
84 lIter->next(item);87 theContinueProducer.produce(lCanQuit);
85 std::cout << item.getStringValue() << std::endl;88
86 theContinueProducer.produce(doContinue);89 // go and solve the event with this id
87 theIdQueue.produce(lId);90 theIdQueue.produce(lId);
88 } catch (ZorbaException& e) {91 } catch (ZorbaException& e) {
89 std::cerr << "FATAL: could not execute query: " << std::endl;92 std::cerr << "FATAL: could not execute query: " << std::endl;
90 std::cerr << e << std::endl;93 std::cerr << e << std::endl;
91 std::cerr << "This is a bug, please report to zorba-users@lists.sourceforge.net" << std::endl;94 std::cerr << "This is a bug, please report it at http://bugs.launchpad.net/zorba" << std::endl;
92 theContinueProducer.produce(false);95 }
93 }96}
94 }97
95 98void
96 void EventHandler::error(unsigned int errcode, const std::string &msg)99EventHandler::error(unsigned int errcode, const std::string &msg)
97 {100{
98 std::cerr << "Error " << errcode << ": " << msg << std::endl;101 std::cerr << "Error " << errcode << ": " << msg << std::endl;
99 }102}
100}}103
104} // namespace zorba
105} // namespace debugger
101106
=== modified file 'bin/debugger/event_handler.h'
--- bin/debug_client/event_handler.h 2011-07-01 01:53:24 +0000
+++ bin/debugger/event_handler.h 2012-02-22 17:11:27 +0000
@@ -14,33 +14,46 @@
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16#pragma once16#pragma once
17#ifndef ZORBA_DEBUGGER_EVENT_HANDLER_H
18#define ZORBA_DEBUGGER_EVENT_HANDLER_H
19
17#include <string>20#include <string>
18#include <iostream>21#include <iostream>
22
19#include <zorba/debugger_event_handler.h>23#include <zorba/debugger_event_handler.h>
20#include <zorba/static_context.h>24#include <zorba/static_context.h>
25
21#include "lock_free_queue.h"26#include "lock_free_queue.h"
2227
23namespace zorba {28
24 class Zorba;29namespace zorba { namespace debugger {
25}30
2631class EventHandler : public zorba::DebuggerEventHandler
27namespace zorba { namespace debugclient {32{
28
29 class EventHandler : public zorba::DebuggerEventHandler
30 {
31 public:33 public:
32 EventHandler(LockFreeProducer<std::size_t>& aQueue, LockFreeProducer<bool>& aContQueue);34 EventHandler(
35 LockFreeProducer<std::size_t>& aQueue,
36 LockFreeProducer<bool>& aContQueue);
37
33 ~EventHandler();38 ~EventHandler();
39
34 public:40 public:
35 virtual void parseMessage(const std::string& aMessage);41 virtual void parseMessage(const std::string& aMessage);
42
36 virtual void error(unsigned int errcode, const std::string& msg);43 virtual void error(unsigned int errcode, const std::string& msg);
44
45 virtual void init();
46
37 private:47 private:
38 static std::istream* getCurrentDirectory();
39 LockFreeProducer<std::size_t>& theIdQueue;48 LockFreeProducer<std::size_t>& theIdQueue;
40 LockFreeProducer<bool>& theContinueProducer;49 LockFreeProducer<bool>& theContinueProducer;
41 void* theStore;50 void* theStore;
42 Zorba* theZorbaInstance;51 Zorba* theZorbaInstance;
43 StaticContext_t theStaticContext;52 StaticContext_t theStaticContext;
44 };53
54};
45 55
46}} // end of namespace zorba::debugclient56} // namespace zorba
57} // namespace debugger
58
59#endif // ZORBA_DEBUGGER_EVENT_HANDLER_H
4760
=== modified file 'bin/debugger/lock_free_queue.h'
--- bin/debug_client/lock_free_queue.h 2011-07-01 01:53:24 +0000
+++ bin/debugger/lock_free_queue.h 2012-02-22 17:11:27 +0000
@@ -14,10 +14,14 @@
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16#pragma once16#pragma once
17#ifndef ZORBA_DEBUGGER_LOCK_FREE_QUEUE_H
18#define ZORBA_DEBUGGER_LOCK_FREE_QUEUE_H
19
17#include <iostream>20#include <iostream>
18#include <list>21#include <list>
1922
20namespace zorba { namespace debugclient {23
24namespace zorba { namespace debugger {
2125
22template<typename T>26template<typename T>
23class LockFreeProducer27class LockFreeProducer
@@ -80,4 +84,8 @@
80 }84 }
81 return false;85 return false;
82}86}
83}} // namespace zorba::debugclient87
88} // namespace zorba
89} // namespace debugger
90
91#endif // ZORBA_DEBUGGER_LOCK_FREE_QUEUE_H
8492
=== modified file 'bin/debugger/main.cpp'
--- bin/debug_client/main.cpp 2011-07-01 01:53:24 +0000
+++ bin/debugger/main.cpp 2012-02-22 17:11:27 +0000
@@ -13,12 +13,286 @@
13 * See the License for the specific language governing permissions and13 * See the License for the specific language governing permissions and
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16
17#ifdef WIN32
18# include <windows.h>
19# include <string.h>
20# include <strsafe.h>
21#endif
22
23#include <vector>
24
16#include <zorba/config.h>25#include <zorba/config.h>
17#include "debug_command.h"26
18#include "command_line_handler.h"27#include "xqdb_client.h"
28#include "process_listener.h"
29
1930
20using namespace zorba;31using namespace zorba;
21using namespace zorba::debugclient;32using namespace zorba::debugger;
33
34
35std::auto_ptr<XqdbClient> theClient;
36
37// this will make sure the xqdb process will not quit when Ctrl-C is pressed
38#ifdef WIN32
39BOOL WINAPI
40ctrlC_Handler(DWORD aCtrlType)
41{
42 if (CTRL_C_EVENT == aCtrlType) {
43 return true;
44 }
45 return false;
46}
47#else
48void
49ctrlC_Handler(int lParam)
50{
51 // an empty sugnal handler on Linux should do the job
52}
53#endif
54
55
56// this handler function is passed the the zorba process listener and will
57// the client if the zorba process terminates
58void
59onExitProcess(ExitCode aExitCode) {
60 std::cout << std::endl << "Terminating debugger client." << std::endl;
61
62#ifndef WIN32
63 XqdbClient* lClient = theClient.release();
64 if (lClient) {
65 delete lClient;
66 }
67#endif
68
69 exit(aExitCode);
70}
71
72
73int
74startZorba(std::string& aExec, std::vector<std::string>& aArgs, std::auto_ptr<ProcessListener>& aProcessListener)
75{
76#ifdef WIN32
77 // **************************
78 // start a process on Windows
79
80 DWORD iReturnVal = 0;
81
82 std::wstring lExec;
83 std::wstring lArgs;
84
85 lExec.assign(aExec.begin(), aExec.end());
86
87 // the executable must be the first in the list of arguments
88 lArgs.append(L"\"");
89 lArgs.append(lExec);
90 lArgs.append(L"\"");
91
92 for (std::vector<std::string>::size_type j = 0; j < aArgs.size(); j++) {
93 std::string lArg(aArgs.at(j));
94 std::wstring lArgW;
95 lArgW.assign(lArg.begin(), lArg.end());
96 lArgs.append(L" ");
97 lArgs.append(lArgW);
98 }
99
100 // CreateProcessW can modify Parameters thus we allocate needed memory
101 wchar_t * pwszParam = new wchar_t[lArgs.size() + 1];
102 if (pwszParam == 0) {
103 return 1;
104 }
105 const wchar_t* pchrTemp = lArgs.c_str();
106 wcscpy_s(pwszParam, lArgs.size() + 1, pchrTemp);
107
108 // CreateProcess API initialization
109 STARTUPINFOW siStartupInfo;
110 PROCESS_INFORMATION piProcessInfo;
111 memset(&siStartupInfo, 0, sizeof(siStartupInfo));
112 memset(&piProcessInfo, 0, sizeof(piProcessInfo));
113 siStartupInfo.cb = sizeof(siStartupInfo);
114
115 BOOL lResult = CreateProcessW(
116 const_cast<LPCWSTR>(lExec.c_str()),
117 pwszParam, 0, 0, false,
118 CREATE_DEFAULT_ERROR_MODE, 0, 0,
119 &siStartupInfo, &piProcessInfo);
120
121 if (lResult) {
122 // Watch the process
123 aProcessListener.reset(new ProcessListener(piProcessInfo.dwProcessId, &onExitProcess));
124 }
125 else {
126 // CreateProcess failed
127 iReturnVal = GetLastError();
128 LPVOID lpMsgBuf;
129 LPVOID lpDisplayBuf;
130
131 FormatMessage(
132 FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
133 NULL,
134 iReturnVal,
135 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
136 (LPTSTR) &lpMsgBuf,
137 0, NULL);
138
139 // Display the error message and exit the process
140
141 lpDisplayBuf = (LPVOID)LocalAlloc(
142 LMEM_ZEROINIT,
143 (lstrlen((LPCTSTR)lpMsgBuf) + 40) * sizeof(TCHAR));
144
145 StringCchPrintf(
146 (LPTSTR)lpDisplayBuf,
147 LocalSize(lpDisplayBuf) / sizeof(TCHAR),
148 TEXT("Error (%d) when starting zorba: %s"),
149 iReturnVal,
150 lpMsgBuf);
151
152 std::wstring lErrorW((wchar_t*)lpDisplayBuf);
153 std::string lError;
154 lError.assign(lErrorW.begin(), lErrorW.end());
155 std::cout << lError << std::endl;
156
157 LocalFree(lpMsgBuf);
158 LocalFree(lpDisplayBuf);
159 }
160
161 // Free memory
162 delete[]pwszParam;
163 pwszParam = 0;
164
165 // Release handles
166 CloseHandle(piProcessInfo.hProcess);
167 CloseHandle(piProcessInfo.hThread);
168
169 return iReturnVal;
170
171#else
172 // ************************
173 // start a process on Linux
174
175 pid_t pID = fork();
176 if (pID == 0) {
177 // Code only executed by child process
178 std::stringstream lCommand;
179 lCommand << aExec;
180 for (std::vector<std::string>::size_type j = 0; j < aArgs.size(); j++) {
181 lCommand << " " << aArgs.at(j);
182 }
183
184 int lRes = system(lCommand.str().c_str());
185 exit(lRes);
186 }
187 else {
188 // Code only executed by parent process
189 if (pID < 0) {
190 std::cerr << "Failed to fork Zorba" << std::endl;
191 return pID;
192 }
193
194 // Watch the process
195 aProcessListener.reset(new ProcessListener(pID, &onExitProcess));
196
197 return 0;
198 }
199#endif
200}
201
202void printUsage(std::string& aProgram)
203{
204 std::cerr << "Usage:" << std::endl
205 << " " << aProgram << " <zorba_arguments>" << std::endl
206 << " this will start a debugger command line and a zorba process with the given arguments" << std::endl;
207}
208
209bool
210processArguments(
211 int argc,
212 char* argv[],
213 std::string& aProgram,
214 bool& aStandalone,
215 std::string& aZorba,
216 unsigned int& aPort,
217 std::vector<std::string>& aZorbaArgs)
218{
219 aPort = 28028;
220
221 // find the path to Zorba and this executable name
222 aProgram = argv[0];
223
224#ifdef WIN32
225 char lSep = '\\';
226#else
227 char lSep = '/';
228#endif
229 std::string::size_type lPos = aProgram.find_last_of(lSep);
230
231 std::stringstream lZs;
232
233 if (lPos == aProgram.npos) {
234 lZs << "." << lSep;
235 } else {
236 lZs << aProgram.substr(0, lPos + 1);
237 aProgram = aProgram.substr(lPos + 1);
238 }
239 lZs << "zorba";
240#ifdef WIN32
241 lZs << ".exe";
242#endif
243 aZorba = lZs.str();
244
245
246 bool lHasFileArg = false;
247 bool lHasQueryArg = false;
248 bool lHasQueryVal = false;
249
250 // find if the user asked for help or specified a specific port
251 for (int i = 1; i < argc; i++) {
252 std::string lArg = argv[i];
253 if (lArg == "-h" || lArg == "--help") {
254 return false;
255 }
256 else if (lArg == "-p" || lArg == "--debug-port") {
257 // if there is one more argument
258 if (i < argc - 1) {
259 // get the port value
260 int lPort;
261 std::stringstream lStream(argv[i + 1]);
262 lStream >> lPort;
263 if (!lStream.fail()) {
264 aPort = lPort;
265 }
266 }
267 }
268 else if (lArg == "-f") {
269 lHasFileArg = true;
270 }
271 else if (lArg == "-q") {
272 lHasQueryArg = true;
273 if (++i < argc) {
274 lHasQueryVal = true;
275 }
276 }
277 }
278
279 if (!lHasFileArg || !lHasQueryArg || !lHasQueryVal) {
280 std::cout << "Not enough arguments to start Zorba." << std::endl;
281 std::cout << "Running the standalone XQuery debugger client on port: " << aPort << std::endl;
282 return true;
283 }
284
285 // zorba will need the -d flag
286 aZorbaArgs.push_back("-d");
287
288 // gather all arguments (excepting the program name)
289 for (int i = 1; i < argc; i++) {
290 aZorbaArgs.push_back(argv[i]);
291 }
292
293 aStandalone = false;
294 return true;
295}
22296
23#ifndef _WIN32_WCE297#ifndef _WIN32_WCE
24int298int
@@ -28,24 +302,72 @@
28_tmain(int argc, _TCHAR* argv[])302_tmain(int argc, _TCHAR* argv[])
29#endif303#endif
30{304{
31 int port = 28028;305#ifdef WIN32
32 if (argv[1]) {306 SetConsoleCtrlHandler(ctrlC_Handler, TRUE);
33 std::stringstream stream(argv[1]);307#else
34 stream >> port;308 signal(SIGINT, ctrlC_Handler);
35 if (stream.fail() || argv[2]) {309#endif
36 std::cerr << "Unknown argument. USAGE: " << argv[0] << " [PORT]" << std::endl;310
37 return 2;311 // **************************************************************************
312 // processing arguments
313
314 std::string lProgram, lZorbaExec;
315 unsigned int lPort = 28028;
316 std::vector<std::string> lZorbaArgs;
317
318 bool lStandalone = true;
319 if (!processArguments(argc, argv, lProgram, lStandalone, lZorbaExec, lPort, lZorbaArgs)) {
320 printUsage(lProgram);
321 return 1;
322 }
323
324#ifndef NDEBUG
325 // **************************************************************************
326 // debug reporting
327
328 if (!lStandalone) {
329 std::cout << "Communication port: " << lPort << std::endl;
330 std::cout << "Zorba executable: " << lZorbaExec << std::endl;
331 std::cout << "Zorba arguments: ";
332 for (std::vector<std::string>::size_type j = 0; j < lZorbaArgs.size(); j++) {
333 std::cout << lZorbaArgs.at(j) << " ";
38 }334 }
335 std::cout << std::endl;
39 }336 }
337#endif
338
40 try {339 try {
41 LockFreeQueue<std::size_t> lQueue;340 // **************************************************************************
42 LockFreeQueue<bool> lContEvent;341 // start a zorba
43 EventHandler lHandler(lQueue, lContEvent);342
44 CommandLine cli;343 // This is a process listener used to watch the Zorba process termination.
45 CommandLineHandler handler(port, lQueue, lContEvent, lHandler, cli);344 std::auto_ptr<ProcessListener> lProcessListener;
46 handler.execute();345
346 if (!lStandalone) {
347 int lResult = startZorba(lZorbaExec, lZorbaArgs, lProcessListener);
348 if (lResult) {
349 return lResult;
350 }
351 } else {
352 std::cout << "Listening for an incomming Zorba connection on port " << lPort << "..." << std::endl;
353 }
354
355 // **************************************************************************
356 // start the debugger command line
357
358 theClient.reset(new XqdbClient(lPort));
359 theClient->start();
360
47 } catch (...) {361 } catch (...) {
48 return 4;362 return -1;
49 }363 }
364
365#ifndef WIN32
366 XqdbClient* lClient = theClient.release();
367 if (lClient) {
368 delete lClient;
369 }
370#endif
371
50 return 0;372 return 0;
51}373}
52374
=== added file 'bin/debugger/process_listener.cpp'
--- bin/debugger/process_listener.cpp 1970-01-01 00:00:00 +0000
+++ bin/debugger/process_listener.cpp 2012-02-22 17:11:27 +0000
@@ -0,0 +1,105 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "process_listener.h"
18
19#include <iostream>
20
21#ifdef ZORBA_HAVE_PTHREAD_H
22# include <cassert>
23#endif
24
25
26namespace zorba { namespace debugger {
27
28ProcessListener::ProcessListener(ProcessId aProcessID, ExitCallbackType aCallback)
29 : theProcessID(aProcessID), theCallback(aCallback)
30{
31#ifdef WIN32
32 theThread = CreateThread(NULL, 0, &run, (void*) this, 0, &theThreadId);
33#else
34 if (pthread_create(&theThread, NULL, &run, (void*) this)) {
35 assert(false);
36 }
37#endif
38}
39
40ProcessListener::~ProcessListener()
41{
42}
43
44ProcessId
45ProcessListener::getProcessID()
46{
47 return theProcessID;
48}
49
50ExitCallbackType
51ProcessListener::getCallback()
52{
53 return theCallback;
54}
55
56
57ZORBA_THREAD_RETURN
58ProcessListener::run(void* params)
59{
60 ProcessListener* lThis = static_cast<ProcessListener*>(params);
61 ExitCode lExitCode = -1;
62 ProcessId lPid = lThis->getProcessID();
63
64#ifdef WIN32
65 HANDLE lProcessHandle = OpenProcess(SYNCHRONIZE, false, lPid);
66 if (lProcessHandle != NULL) {
67 // wait for the process to exit
68 DWORD lResult = WaitForSingleObject(lProcessHandle, INFINITE);
69
70 // find out the process exit code if possible
71 if (!GetExitCodeProcess(lProcessHandle, &lExitCode)) {
72 lExitCode = -1;
73 }
74 DWORD dw = GetLastError();
75
76 // wait a little for zorba to dump the garbage
77 Sleep(1000);
78 }
79#else
80 int lChildExitStatus;
81
82 // wait for the process to exit
83 waitpid(lPid, &lChildExitStatus, 0);
84
85 // find out the process exit code if possible
86 if (WIFEXITED(lChildExitStatus)) {
87 lExitCode = WEXITSTATUS(lChildExitStatus);
88 }
89
90 // wait a little for zorba to dump the garbage
91 sleep(1);
92#endif
93
94 // and call the callback when this happened
95 ExitCallbackType lCallback = lThis->getCallback();
96 lCallback(lExitCode);
97
98 for (int i = 0; i < 10; i++) {
99 std::cout << i << std::endl;
100 }
101 return NULL;
102}
103
104} // namespace zorba
105} // namespace debugger
0106
=== added file 'bin/debugger/process_listener.h'
--- bin/debugger/process_listener.h 1970-01-01 00:00:00 +0000
+++ bin/debugger/process_listener.h 2012-02-22 17:11:27 +0000
@@ -0,0 +1,75 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17#ifndef ZORBA_DEBUGGER_PROCESS_LISTENER_H
18#define ZORBA_DEBUGGER_PROCESS_LISTENER_H
19
20#include <zorba/config.h>
21
22#ifdef ZORBA_HAVE_PTHREAD_H
23# include <pthread.h>
24# include <sys/wait.h>
25 typedef pthread_t ThreadId;
26 typedef pid_t ProcessId;
27 typedef int ExitCode;
28# define ZORBA_THREAD_RETURN void *
29#else
30# include <windows.h>
31 typedef DWORD ThreadId;
32 typedef DWORD ProcessId;
33 typedef DWORD ExitCode;
34# define ZORBA_THREAD_RETURN DWORD WINAPI
35#endif
36
37typedef void (*ExitCallbackType)(ExitCode);
38
39
40namespace zorba { namespace debugger {
41
42class ProcessListener
43{
44 public:
45 ProcessListener(ProcessId processID, ExitCallbackType callback);
46
47 ~ProcessListener();
48
49 ProcessId
50 getProcessID();
51
52 ExitCallbackType
53 getCallback();
54
55 private:
56
57 static ZORBA_THREAD_RETURN run(void* params);
58
59 private:
60
61#ifdef ZORBA_HAVE_PTHREAD_H
62 pthread_t theThread;
63#else
64 ThreadId theThreadId;
65 HANDLE theThread;
66#endif
67
68 ProcessId theProcessID;
69 ExitCallbackType theCallback;
70};
71
72} // namespace zorba
73} // namespace debugger
74
75#endif // ZORBA_DEBUGGER_PROCESS_LISTENER_H
076
=== modified file 'bin/debugger/tuple.h'
--- bin/debug_client/tuple.h 2011-07-04 08:05:46 +0000
+++ bin/debugger/tuple.h 2012-02-22 17:11:27 +0000
@@ -14,9 +14,15 @@
14 * limitations under the License.14 * limitations under the License.
15 */15 */
16#pragma once16#pragma once
17#ifndef ZORBA_DEBUGGER_TUPLE_H
18#define ZORBA_DEBUGGER_TUPLE_H
19
17#include <zorba/config.h>20#include <zorba/config.h>
21
18#if ZORBA_TR1_IN_TR1_SUBDIRECTORY22#if ZORBA_TR1_IN_TR1_SUBDIRECTORY
19# include <tr1/tuple>23# include <tr1/tuple>
20#else24#else
21# include <tuple>25# include <tuple>
22#endif26#endif
27
28#endif // ZORBA_DEBUGGER_TUPLE_H
2329
=== added file 'bin/debugger/xqdb_client.cpp'
--- bin/debugger/xqdb_client.cpp 1970-01-01 00:00:00 +0000
+++ bin/debugger/xqdb_client.cpp 2012-02-22 17:11:27 +0000
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "xqdb_client.h"
18
19#include <iostream>
20
21#ifdef ZORBA_HAVE_PTHREAD_H
22# include <cassert>
23#endif
24
25
26namespace zorba { namespace debugger {
27
28XqdbClient::XqdbClient(unsigned int aPort)
29{
30 theIdQueue = new LockFreeQueue<std::size_t>();
31 theQuitQueue = new LockFreeQueue<bool>();
32 theEventHandler = new EventHandler(*theIdQueue, *theQuitQueue);
33 theEventHandler->init();
34
35 theCommandPrompt = new CommandPrompt();
36 theCommandLineHandler = new CommandLineHandler(aPort, *theIdQueue, *theQuitQueue, theEventHandler, theCommandPrompt);
37}
38
39XqdbClient::~XqdbClient()
40{
41 if (theCommandLineHandler) {
42 delete theCommandLineHandler;
43 }
44 if (theCommandPrompt) {
45 delete theCommandPrompt;
46 }
47 if (theEventHandler) {
48 delete theEventHandler;
49 }
50
51 delete theIdQueue;
52 delete theQuitQueue;
53}
54
55void
56XqdbClient::start()
57{
58 theCommandLineHandler->execute();
59}
60
61
62} // namespace zorba
63} // namespace debugger
064
=== added file 'bin/debugger/xqdb_client.h'
--- bin/debugger/xqdb_client.h 1970-01-01 00:00:00 +0000
+++ bin/debugger/xqdb_client.h 2012-02-22 17:11:27 +0000
@@ -0,0 +1,51 @@
1/*
2 * Copyright 2006-2008 The FLWOR Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17#ifndef ZORBA_DEBUGGER_XQDB_CLIENT_H
18#define ZORBA_DEBUGGER_XQDB_CLIENT_H
19
20#include "command_prompt.h"
21#include "command_line_handler.h"
22
23
24namespace zorba { namespace debugger {
25
26class XqdbClient {
27
28 public:
29
30 XqdbClient(unsigned int aPort);
31
32 ~XqdbClient();
33
34 void
35 start();
36
37 private:
38
39 LockFreeQueue<std::size_t>* theIdQueue;
40 LockFreeQueue<bool>* theQuitQueue;
41
42 EventHandler* theEventHandler;
43 CommandPrompt* theCommandPrompt;
44 CommandLineHandler* theCommandLineHandler;
45};
46
47
48} // namespace zorba
49} // namespace debugger
50
51#endif // ZORBA_DEBUGGER_XQDB_CLIENT_H
052
=== renamed file 'bin/module_path.cpp' => 'bin/path_util.cpp'
--- bin/module_path.cpp 2011-05-25 16:40:26 +0000
+++ bin/path_util.cpp 2012-02-22 17:11:27 +0000
@@ -14,85 +14,117 @@
14 * limitations under the License.14 * limitations under the License.
15 */15 */
1616
17#include "module_path.h"17#include "path_util.h"
1818
19#include <stdlib.h>19#include <stdlib.h>
20#include "zorba/zorba_string.h"20//#include "zorba/zorba_string.h"
21#include "zorba/util/path.h"21#include "zorba/util/path.h"
2222
23#include "util.h"23#include "util.h"
24#include "zorbacmdproperties.h"24#include "zorbacmdproperties.h"
25#include <zorba/static_context.h>
2526
26namespace zorba {27namespace zorba {
2728
28std::string29namespace PathUtil {
29ModulePath::getEnvironmentModulePath()30
31static std::string
32getPathFromEnvironment(std::string const& aEnvVar)
30{33{
31 std::string lEnvName("ZORBA_MODULE_PATH");
32#ifdef WIN3234#ifdef WIN32
33 char* lBuffer;35 char* lBuffer;
34 size_t lLen=0;36 size_t lLen=0;
35 errno_t lErr = getenv_s(&lLen, NULL, 0, lEnvName.c_str());37 errno_t lErr = getenv_s(&lLen, NULL, 0, aEnvVar.c_str());
36 if (lErr || !lLen) return "";38 if (lErr || !lLen) return "";
37 lBuffer = (char*)malloc(lLen * sizeof(char));39 lBuffer = (char*)malloc(lLen * sizeof(char));
38 if (!lBuffer) return "";40 if (!lBuffer) return "";
39 getenv_s(&lLen, lBuffer, lLen, lEnvName.c_str());41 getenv_s(&lLen, lBuffer, lLen, aEnvVar.c_str());
40 std::string lRes(lBuffer);42 std::string lRes(lBuffer);
41 free(lBuffer);43 free(lBuffer);
42 return lRes;44 return lRes;
43#else45#else
44 const char* lEnvValue = getenv(lEnvName.c_str());46 const char* lEnvValue = getenv(aEnvVar.c_str());
45 return lEnvValue!=0?lEnvValue:"";47 return lEnvValue != 0 ? lEnvValue : "";
46#endif48#endif
47}49}
4850
49void
50ModulePath::convertVector(
51 const std::vector<std::string>& aSource,
52 std::vector<String>& aDest)
53{
54 for (std::vector<std::string>::const_iterator lIter = aSource.begin();
55 lIter != aSource.end(); ++lIter) {
56 aDest.push_back(*lIter);
57 }
58}
5951
60void52void
61ModulePath::tokenizeModulePath(53tokenizePath(
62 const std::string& aModulePath,54 const std::string& aPathStr,
63 std::vector<std::string>& aResult)55 std::vector<String>& aResult)
64{56{
57 std::vector<std::string> lPath;
65#ifdef WIN3258#ifdef WIN32
66 Util::tokenize(aModulePath, ";", aResult);59 Util::tokenize(aPathStr, ";", lPath);
67#else60#else
68 Util::tokenize(aModulePath, ":", aResult);61 Util::tokenize(aPathStr, ":", lPath);
69#endif62#endif
70}63 for (std::vector<std::string>::iterator lIter = lPath.begin();
64 lIter != lPath.end(); ++lIter) {
65 aResult.push_back(*lIter);
66 }
67}
68
69
70String
71concatenatePaths( const std::vector<String>& aPathList)
72{
73 String delimiter(filesystem_path::get_path_separator());
74
75 String lResult;
76 for (std::vector<String>::const_iterator lIter = aPathList.begin();
77 lIter != aPathList.end(); ++lIter)
78 {
79 lResult += delimiter + *lIter;
80 }
81
82 return lResult;
83}
84
7185
72void86void
73ModulePath::getModulePaths(87setPathsOnContext(
74 const ZorbaCMDProperties& aProperties,88 const ZorbaCMDProperties& aProperties,
75 std::vector<String>& aModulePaths)89 StaticContext_t& aStaticCtx)
76{90{
77 std::vector<std::string> lModulePaths; // result vector91 std::vector<String> lPath;
78 std::string lModulePath; // temporary variable for collections paths92 std::string lPathStr, lEnvStr;
7993
80 // 1. add the module paths from the command line properties94 // Compute the current working directory to append to all paths.
81 aProperties.getModulePaths(lModulePath);
82
83 tokenizeModulePath(lModulePath, lModulePaths);
84
85 // 2. add the module paths from the environment
86 lModulePath = ModulePath::getEnvironmentModulePath();
87
88 tokenizeModulePath(lModulePath, lModulePaths);
89
90 // 3. add the current working directory as module path
91 filesystem_path lCWD;95 filesystem_path lCWD;
92 lModulePaths.push_back(lCWD.get_path());96
9397 // setModulePaths() *overwrites* the URI path and lib path, so there's no
94 // convert std::string to zorba::String98 // sense in calling both. So if either --module-path or ZORBA_MODULE_PATH
95 convertVector(lModulePaths, aModulePaths);99 // exists, just use those.
100 aProperties.getModulePath(lPathStr);
101 lEnvStr = getPathFromEnvironment("ZORBA_MODULE_PATH");
102 if (lPathStr.length() > 0 || lEnvStr.length() > 0) {
103 tokenizePath(lPathStr, lPath);
104 tokenizePath(lEnvStr, lPath);
105 lPath.push_back(lCWD.get_path());
106 aStaticCtx->setModulePaths(lPath);
107 }
108 else {
109 // Compute and set URI path
110 aProperties.getURIPath(lPathStr);
111 tokenizePath(lPathStr, lPath);
112 lEnvStr = getPathFromEnvironment("ZORBA_URI_PATH");
113 tokenizePath(lEnvStr, lPath);
114 lPath.push_back(lCWD.get_path());
115 aStaticCtx->setURIPath(lPath);
116 lPath.clear();
117
118 // Compute and set lib path
119 aProperties.getLibPath(lPathStr);
120 tokenizePath(lPathStr, lPath);
121 lPath.push_back(lCWD.get_path());
122 lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH");
123 tokenizePath(lEnvStr, lPath);
124 aStaticCtx->setLibPath(lPath);
125 }
96}126}
97127
128} /* namespace ModulePath */
129
98} /* namespace zorba */130} /* namespace zorba */
99131
=== renamed file 'bin/module_path.h' => 'bin/path_util.h'
--- bin/module_path.h 2010-02-12 08:57:04 +0000
+++ bin/path_util.h 2012-02-22 17:11:27 +0000
@@ -18,6 +18,7 @@
1818
19#include <vector>19#include <vector>
20#include <string>20#include <string>
21#include <zorba/api_shared_types.h>
2122
22class ZorbaCMDProperties;23class ZorbaCMDProperties;
2324
@@ -25,30 +26,20 @@
2526
26 class String;27 class String;
2728
28 class ModulePath {29 namespace PathUtil {
29 protected:30
30 static std::string31 void
31 getEnvironmentModulePath();32 setPathsOnContext(const ZorbaCMDProperties& aProperties,
3233 zorba::StaticContext_t& aStaticCtx);
33 static void34
34 convertVector(const std::vector<std::string>& aSource,35 void
35 std::vector<String>& aDest); 36 tokenizePath(const std::string& aPathStr, std::vector<String>& aResult);
3637
37 static void38
38 tokenizeModulePath(const std::string& aModulePath,39 String
39 std::vector<std::string>& aResult);40 concatenatePaths( const std::vector<String>& aPathList);
4041
41 static void42 }
42 getInstalledModulePath(const std::string& aModulePath,
43 std::vector<std::string>& aResult);
44
45 public:
46 static void
47 getModulePaths(const ZorbaCMDProperties& aProperties,
48 std::vector<String>& aModulePaths);
49
50
51 };
52} /* namespace zorba */43} /* namespace zorba */
5344
54#endif45#endif
5546
=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp 2011-07-11 11:12:23 +0000
+++ bin/zorbacmd.cpp 2012-02-22 17:11:27 +0000
@@ -43,7 +43,7 @@
4343
44#include "error_printer.h"44#include "error_printer.h"
45#include "util.h"45#include "util.h"
46#include "module_path.h"46#include "path_util.h"
4747
48// For setting the base URI from the current directory48// For setting the base URI from the current directory
49#include <zorba/util/path.h>49#include <zorba/util/path.h>
@@ -70,7 +70,7 @@
7070
71#ifndef ZORBA_NO_FULL_TEXT71#ifndef ZORBA_NO_FULL_TEXT
72OneToOneURIMapper theStopWordsMapper(EntityData::STOP_WORDS);72OneToOneURIMapper theStopWordsMapper(EntityData::STOP_WORDS);
73OneToOneURIMapper theThesaurusMapper(EntityData::THESAURUS, URIMapper::COMPONENT);73OneToOneURIMapper theThesaurusMapper(EntityData::THESAURUS);
74#endif74#endif
7575
76bool76bool
@@ -85,10 +85,8 @@
85 // 2. environment ZORBA_MODULE_PATH85 // 2. environment ZORBA_MODULE_PATH
86 // 3. current working directory86 // 3. current working directory
87 {87 {
88 std::vector<String> lModulePaths;88 std::vector<String> lModulePath;
89 ModulePath::getModulePaths(aProperties, lModulePaths);89 PathUtil::setPathsOnContext(aProperties, aStaticContext);
90
91 aStaticContext->setModulePaths(lModulePaths);
92 }90 }
9391
94 if (aProperties.boundarySpace().size() != 0 )92 if (aProperties.boundarySpace().size() != 0 )
@@ -509,12 +507,24 @@
509 Zorba_CompilerHints lHints;507 Zorba_CompilerHints lHints;
510508
511 // default is O1 in the Zorba_CompilerHints constructor509 // default is O1 in the Zorba_CompilerHints constructor
512 if (properties.optimizationLevel() == "O0") {510 if (properties.optimizationLevel() == "O0")
511 {
513 lHints.opt_level = ZORBA_OPT_LEVEL_O0;512 lHints.opt_level = ZORBA_OPT_LEVEL_O0;
514 } else if (properties.optimizationLevel() == "O2") {513 }
514 else if (properties.optimizationLevel() == "O2")
515 {
515 lHints.opt_level = ZORBA_OPT_LEVEL_O2;516 lHints.opt_level = ZORBA_OPT_LEVEL_O2;
516 }517 }
517518
519 lHints.for_serialization_only = true;
520
521#if ZORBACMD_LOAD_SYSTEM_PROPERTIES
522 if (Properties::instance()->serializeOnlyQuery() == 0)
523 {
524 lHints.for_serialization_only = false;
525 }
526#endif
527
518 // default is false528 // default is false
519 if (properties.libModule())529 if (properties.libModule())
520 {530 {
@@ -577,8 +587,6 @@
577 return 12;587 return 12;
578 }588 }
579589
580 // if (diagnosticHandler.
581
582 //590 //
583 // Create and populate the dynamic context591 // Create and populate the dynamic context
584 //592 //
@@ -661,19 +669,22 @@
661 XmlDataManager* store = zorbaInstance->getXmlDataManager();669 XmlDataManager* store = zorbaInstance->getXmlDataManager();
662670
663 timing.startTimer(TimingInfo::UNLOAD_TIMER, i);671 timing.startTimer(TimingInfo::UNLOAD_TIMER, i);
672
664 DocumentManager* lMgr = store->getDocumentManager();673 DocumentManager* lMgr = store->getDocumentManager();
665 ItemSequence_t lSeq = lMgr->availableDocuments();674 ItemSequence_t lSeq = lMgr->availableDocuments();
666 Iterator_t lIter = lSeq->getIterator();675 Iterator_t lIter = lSeq->getIterator();
667 lIter->open();676 lIter->open();
668 Item lURI;677 Item lURI;
669 while (lIter->next(lURI)) {678 while (lIter->next(lURI))
679 {
670 lMgr->remove(lURI.getStringValue());680 lMgr->remove(lURI.getStringValue());
671 }681 }
682
672 timing.stopTimer(TimingInfo::UNLOAD_TIMER, i);683 timing.stopTimer(TimingInfo::UNLOAD_TIMER, i);
673684
674 timing.stopTimer(TimingInfo::TOTAL_TIMER, i);685 timing.stopTimer(TimingInfo::TOTAL_TIMER, i);
675 }686 }
676 }687 } // for each execution
677688
678 return 0;689 return 0;
679}690}
@@ -704,7 +715,7 @@
704 return 1;715 return 1;
705 }716 }
706717
707 TimingInfo timing(lProperties.multiple());718 TimingInfo engineTiming(lProperties.multiple());
708719
709 bool doTiming = lProperties.timing();720 bool doTiming = lProperties.timing();
710 bool debug = false;721 bool debug = false;
@@ -738,17 +749,25 @@
738 return 3;749 return 3;
739 }750 }
740751
752 // Add command line --classpath option in front of config/env CLASSPATH
753 Properties* globalProperties = Properties::instance();
754 std::string cmdJvmClassPath;
755 lProperties.getJVMClassPath(cmdJvmClassPath);
756 std::string configJvmClassPath;
757 globalProperties->getJVMClassPath(configJvmClassPath);
758 globalProperties->setJVMClassPath(cmdJvmClassPath +
759 filesystem_path::get_path_separator() + configJvmClassPath);
741760
742 // Start the engine761 // Start the engine
743762
744 timing.startTimer(TimingInfo::INIT_TIMER, 2);763 engineTiming.startTimer(TimingInfo::INIT_TIMER, 2);
745764
746 void* store = zorba::StoreManager::getStore();765 void* store = zorba::StoreManager::getStore();
747766
748 zorba::Zorba* lZorbaInstance = zorba::Zorba::getInstance(store);767 zorba::Zorba* lZorbaInstance = zorba::Zorba::getInstance(store);
749768
750 {769 {
751 timing.stopTimer(TimingInfo::INIT_TIMER, 2);770 engineTiming.stopTimer(TimingInfo::INIT_TIMER, 2);
752771
753 // For each query ...772 // For each query ...
754773
@@ -770,14 +789,14 @@
770 if (asFile)789 if (asFile)
771 {790 {
772 path.resolve_relative ();791 path.resolve_relative ();
773 qfile.reset (new std::ifstream (path.c_str ()));792 qfile.reset(new std::ifstream (path.c_str ()));
774 }793 }
775 else794 else
776 {795 {
777 qfile.reset (new std::istringstream(fURI));796 qfile.reset(new std::istringstream(fURI));
778 }797 }
779798
780 if ( asFile && (!qfile->good() || qfile->eof()) )799 if (asFile && (!qfile->good() || qfile->eof()))
781 {800 {
782 std::cerr << "file {" << fname << "} not found or not readable." << std::endl;801 std::cerr << "file {" << fname << "} not found or not readable." << std::endl;
783 lProperties.printHelp(std::cout);802 lProperties.printHelp(std::cout);
@@ -793,7 +812,8 @@
793 //812 //
794 // Print the query if requested813 // Print the query if requested
795 //814 //
796 if (lProperties.printQuery()) {815 if (lProperties.printQuery())
816 {
797 *lOutputStream << "\nQuery number " << queryNo << " :\n";817 *lOutputStream << "\nQuery number " << queryNo << " :\n";
798 std::copy (std::istreambuf_iterator<char> (*qfile),818 std::copy (std::istreambuf_iterator<char> (*qfile),
799 std::istreambuf_iterator<char> (),819 std::istreambuf_iterator<char> (),
@@ -836,8 +856,10 @@
836 }856 }
837857
838 // Parse the query858 // Parse the query
839 if (lProperties.parseOnly()) {859 if (lProperties.parseOnly())
840 try {860 {
861 try
862 {
841 zorba::XQuery_t lQuery = lZorbaInstance->createQuery();863 zorba::XQuery_t lQuery = lZorbaInstance->createQuery();
842 if (asFile) {864 if (asFile) {
843 lQuery->setFileName(path.get_path());865 lQuery->setFileName(path.get_path());
@@ -845,7 +867,8 @@
845867
846 lQuery->parse (*qfile);868 lQuery->parse (*qfile);
847 }869 }
848 catch (zorba::ZorbaException const& ze) {870 catch (zorba::ZorbaException const& ze)
871 {
849 std::cerr << ze << std::endl;872 std::cerr << ze << std::endl;
850 return 6;873 return 6;
851 }874 }
@@ -853,30 +876,44 @@
853876
854 // Compile and run it if necessary.877 // Compile and run it if necessary.
855 // Print timing information if requested.878 // Print timing information if requested.
856 else if (!debug) {879 else if (!debug)
857 if (compileOnly) {880 {
858 try {881 if (compileOnly)
882 {
883 try
884 {
859 zorba::XQuery_t aQuery = lZorbaInstance->createQuery();885 zorba::XQuery_t aQuery = lZorbaInstance->createQuery();
860 if (asFile) {886 if (asFile)
887 {
861 aQuery->setFileName(path.get_path());888 aQuery->setFileName(path.get_path());
862 }889 }
890
863 aQuery->parse(*qfile);891 aQuery->parse(*qfile);
892
864 qfile->clear();893 qfile->clear();
865 qfile->seekg(0); // go back to the beginning894 qfile->seekg(0); // go back to the beginning
866 } catch (zorba::XQueryException const& qe) {895 }
867 ErrorPrinter::print(qe, std::cerr, lProperties.printErrorsAsXml(), lProperties.indent());896 catch (zorba::XQueryException const& qe)
897 {
898 ErrorPrinter::print(qe,
899 std::cerr,
900 lProperties.printErrorsAsXml(),
901 lProperties.indent());
868 return 6;902 return 6;
869 }903 }
870 }904 }
871905
906 TimingInfo queryTiming(lProperties.multiple());
907
872 int status = compileAndExecute(lZorbaInstance,908 int status = compileAndExecute(lZorbaInstance,
873 lProperties,909 lProperties,
874 lStaticContext,910 lStaticContext,
875 path.get_path(),911 path.get_path(),
876 *qfile,912 *qfile,
877 *lOutputStream,913 *lOutputStream,
878 timing);914 queryTiming);
879 if (status != 0) {915 if (status != 0)
916 {
880 // reset the file handler (in case output option was provided)917 // reset the file handler (in case output option was provided)
881 // in order to delete the created output file918 // in order to delete the created output file
882 lFileStream.reset();919 lFileStream.reset();
@@ -884,21 +921,25 @@
884 return status;921 return status;
885 }922 }
886923
887 if (doTiming) {924 if (doTiming)
888 timing.print(std::cout);925 {
926 queryTiming.print(std::cout);
889 }927 }
890 }928 }
891929
892#ifdef ZORBA_WITH_DEBUGGER930#ifdef ZORBA_WITH_DEBUGGER
893 // Debug the query. Do not allow "compileOnly" flags and inline queries931 // Debug the query. Do not allow "compileOnly" flags and inline queries
894 else if (debug) {932 else if (debug)
895 if (compileOnly) {933 {
934 if (compileOnly)
935 {
896 std::cerr << "cannot debug a query if the compileOnly option is specified"936 std::cerr << "cannot debug a query if the compileOnly option is specified"
897 << std::endl;937 << std::endl;
898 return 7;938 return 7;
899 }939 }
900940
901 if (!asFile) {941 if (!asFile)
942 {
902 std::cerr << "Cannot debug inline queries." << std::endl;943 std::cerr << "Cannot debug inline queries." << std::endl;
903 return 8;944 return 8;
904 }945 }
@@ -908,7 +949,8 @@
908949
909 zorba::XQuery_t lQuery;950 zorba::XQuery_t lQuery;
910951
911 try {952 try
953 {
912 lQuery = lZorbaInstance->createQuery();954 lQuery = lZorbaInstance->createQuery();
913 lQuery->setFileName(lFileName);955 lQuery->setFileName(lFileName);
914 lQuery->setDebugMode(true);956 lQuery->setDebugMode(true);
@@ -927,21 +969,24 @@
927 lHost = "127.0.0.1";969 lHost = "127.0.0.1";
928 }970 }
929971
930 if (lProperties.debug()) {972 Zorba_SerializerOptions lSerOptions =
931 Zorba_SerializerOptions lSerOptions =973 Zorba_SerializerOptions::SerializerOptionsFromStringParams(
932 Zorba_SerializerOptions::SerializerOptionsFromStringParams(974 lProperties.getSerializerParameters());
933 lProperties.getSerializerParameters());975 createSerializerOptions(lSerOptions, lProperties);
934 createSerializerOptions(lSerOptions, lProperties);
935976
936 if (!lProperties.hasNoLogo() && !lProperties.debug()) {977 if (!lProperties.hasNoLogo())
937 std::cout << "Zorba XQuery Debugger Server\n" << copyright_str << std::endl;978 {
938 }979 std::cout << "Zorba XQuery Debugger Server\n" << copyright_str << std::endl;
939 lQuery->debug(*lOutputStream, lSerOptions, lHost, lProperties.getDebugPort());
940 }980 }
981
982 lQuery->debug(*lOutputStream, lSerOptions, lHost, lProperties.getDebugPort());
941 }983 }
942 catch (zorba::XQueryException const& qe)984 catch (zorba::XQueryException const& qe)
943 {985 {
944 ErrorPrinter::print(qe, std::cerr, lProperties.printErrorsAsXml(), lProperties.indent());986 ErrorPrinter::print(qe,
987 std::cerr,
988 lProperties.printErrorsAsXml(),
989 lProperties.indent());
945 return 5;990 return 5;
946 }991 }
947 catch (zorba::ZorbaException const& ze)992 catch (zorba::ZorbaException const& ze)
@@ -958,7 +1003,7 @@
9581003
959 if (doTiming)1004 if (doTiming)
960 {1005 {
961 timing.startTimer(TimingInfo::DEINIT_TIMER, 2);1006 engineTiming.startTimer(TimingInfo::DEINIT_TIMER, 2);
962 }1007 }
9631008
964 lZorbaInstance->shutdown();1009 lZorbaInstance->shutdown();
@@ -966,11 +1011,11 @@
9661011
967 if (doTiming)1012 if (doTiming)
968 {1013 {
969 timing.stopTimer(TimingInfo::DEINIT_TIMER, 2);1014 engineTiming.stopTimer(TimingInfo::DEINIT_TIMER, 2);
9701015
971 std::cout << std::endl << "Engine Shutdown Time : "1016 std::cout << std::endl << "Engine Shutdown Time : "
972 << timing.elapsedDeinitWalltime1017 << engineTiming.elapsedDeinitWalltime
973 << " (user: " << timing.elapsedDeinitCputime << ")"1018 << " (user: " << engineTiming.elapsedDeinitCputime << ")"
974 << " milliseconds" << std::endl;1019 << " milliseconds" << std::endl;
975 }1020 }
976 return 0;1021 return 0;
9771022
=== modified file 'bin/zorbacmdproperties.cpp'
--- bin/zorbacmdproperties.cpp 2011-07-21 19:21:25 +0000
+++ bin/zorbacmdproperties.cpp 2012-02-22 17:11:27 +0000
@@ -166,11 +166,25 @@
166}166}
167167
168168
169void ZorbaCMDProperties::getModulePaths(std::string& aPaths) const169void ZorbaCMDProperties::getModulePath(std::string& aPath) const
170{170{
171 aPaths = theModulePath;171 aPath = theModulePath;
172}172}
173173
174void ZorbaCMDProperties::getURIPath(std::string& aPath) const
175{
176 aPath = theUriPath;
177}
178
179void ZorbaCMDProperties::getLibPath(std::string& aPath) const
180{
181 aPath = theLibPath;
182}
183
184void ZorbaCMDProperties::getJVMClassPath(std::string& aPath) const
185{
186 aPath = theClasspath;
187}
174188
175std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const189std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const
176{190{
177191
=== modified file 'bin/zorbacmdproperties.h'
--- bin/zorbacmdproperties.h 2011-06-29 17:25:50 +0000
+++ bin/zorbacmdproperties.h 2012-02-22 17:11:27 +0000
@@ -84,8 +84,17 @@
84 getSerializerParameters() const;84 getSerializerParameters() const;
8585
86 void86 void
87 getModulePaths(std::string&) const;87 getModulePath(std::string&) const;
88 88
89 void
90 getURIPath(std::string&) const;
91
92 void
93 getLibPath(std::string&) const;
94
95 void
96 getJVMClassPath(std::string&) const;
97
89 bool isDebug(){ return theDebug; }98 bool isDebug(){ return theDebug; }
9099
91 bool hasNoLogo(){ return theNoLogo; }100 bool hasNoLogo(){ return theNoLogo; }
92101
=== modified file 'bin/zorbacmdproperties.txt'
--- bin/zorbacmdproperties.txt 2011-07-04 08:31:01 +0000
+++ bin/zorbacmdproperties.txt 2012-02-22 17:11:27 +0000
@@ -28,7 +28,10 @@
28("debug-port,p", po::value<unsigned int>()->default_value (28028), "The port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028")28("debug-port,p", po::value<unsigned int>()->default_value (28028), "The port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028")
29("no-logo", "Print no logo when starting.")29("no-logo", "Print no logo when starting.")
30("timeout", po::value<long>()->default_value(-1), "Specify a timeout in seconds. After the specified time, the execution of the query will be aborted.")30("timeout", po::value<long>()->default_value(-1), "Specify a timeout in seconds. After the specified time, the execution of the query will be aborted.")
31("module-path", po::value<std::string>(), "Module paths added to the built-in resolver, i.e. where module imports are looking for modules.")31("uri-path", po::value<std::string>(), "URI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.")
32("lib-path", po::value<std::string>(), "Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.")
33("module-path", po::value<std::string>(), "Path (list of directories) to add to both the URI and Library paths.")
34("classpath", po::value<std::string>(), "JVM classpath to be used by modules using Java implementations")
32("option", po::value<std::vector<std::string> >(), "Set an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value").35("option", po::value<std::vector<std::string> >(), "Set an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value").
33("trailing-nl", "Output a trailing newline after the result of the query.")36("trailing-nl", "Output a trailing newline after the result of the query.")
34("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.")37("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.")
3538
=== modified file 'bin/zorbacmdproperties_base.h'
--- bin/zorbacmdproperties_base.h 2011-07-04 08:31:01 +0000
+++ bin/zorbacmdproperties_base.h 2012-02-22 17:11:27 +0000
@@ -34,7 +34,7 @@
34class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase {34class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase {
35protected:35protected:
36 const char **get_all_options () const {36 const char **get_all_options () const {
37 static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--module-path", "--option", "--trailing-nl", "--stop-words", "--thesaurus", NULL };37 static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--uri-path", "--lib-path", "--module-path", "--classpath", "--option", "--trailing-nl", "--stop-words", "--thesaurus", NULL };
38 return result;38 return result;
39 }39 }
40 bool theTiming;40 bool theTiming;
@@ -67,7 +67,10 @@
67 unsigned int theDebugPort;67 unsigned int theDebugPort;
68 bool theNoLogo;68 bool theNoLogo;
69 long theTimeout;69 long theTimeout;
70 std::string theUriPath;
71 std::string theLibPath;
70 std::string theModulePath;72 std::string theModulePath;
73 std::string theClasspath;
71 std::vector<std::string> theOption;74 std::vector<std::string> theOption;
72 bool theTrailingNl;75 bool theTrailingNl;
73 std::vector<std::string> theStopWords;76 std::vector<std::string> theStopWords;
@@ -127,7 +130,10 @@
127 const unsigned int &debugPort () const { return theDebugPort; }130 const unsigned int &debugPort () const { return theDebugPort; }
128 const bool &noLogo () const { return theNoLogo; }131 const bool &noLogo () const { return theNoLogo; }
129 const long &timeout () const { return theTimeout; }132 const long &timeout () const { return theTimeout; }
133 const std::string &uriPath () const { return theUriPath; }
134 const std::string &libPath () const { return theLibPath; }
130 const std::string &modulePath () const { return theModulePath; }135 const std::string &modulePath () const { return theModulePath; }
136 const std::string &classpath () const { return theClasspath; }
131 const std::vector<std::string> &option () const { return theOption; }137 const std::vector<std::string> &option () const { return theOption; }
132 const bool &trailingNl () const { return theTrailingNl; }138 const bool &trailingNl () const { return theTrailingNl; }
133 const std::vector<std::string> &stopWords () const { return theStopWords; }139 const std::vector<std::string> &stopWords () const { return theStopWords; }
@@ -262,11 +268,26 @@
262 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }268 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
263 if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d);269 if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d);
264 }270 }
271 else if (strcmp (*argv, "--uri-path") == 0) {
272 int d = 2;
273 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
274 if (*argv == NULL) { result = "No value given for --uri-path option"; break; } init_val (*argv, theUriPath, d);
275 }
276 else if (strcmp (*argv, "--lib-path") == 0) {
277 int d = 2;
278 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
279 if (*argv == NULL) { result = "No value given for --lib-path option"; break; } init_val (*argv, theLibPath, d);
280 }
265 else if (strcmp (*argv, "--module-path") == 0) {281 else if (strcmp (*argv, "--module-path") == 0) {
266 int d = 2;282 int d = 2;
267 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }283 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
268 if (*argv == NULL) { result = "No value given for --module-path option"; break; } init_val (*argv, theModulePath, d);284 if (*argv == NULL) { result = "No value given for --module-path option"; break; } init_val (*argv, theModulePath, d);
269 }285 }
286 else if (strcmp (*argv, "--classpath") == 0) {
287 int d = 2;
288 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
289 if (*argv == NULL) { result = "No value given for --classpath option"; break; } init_val (*argv, theClasspath, d);
290 }
270 else if (strcmp (*argv, "--option") == 0) {291 else if (strcmp (*argv, "--option") == 0) {
271 int d = 2;292 int d = 2;
272 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }293 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
@@ -327,11 +348,14 @@
327"--compile-only\nOnly compile (don't execute)\n\n"348"--compile-only\nOnly compile (don't execute)\n\n"
328"--no-serializer\nDo not serialize (discard) result.\n\n"349"--no-serializer\nDo not serialize (discard) result.\n\n"
329"--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n"350"--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n"
330"--debug-host, -p\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"351"--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
331"--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n"352"--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n"
332"--no-logo\nPrint no logo when starting.\n\n"353"--no-logo\nPrint no logo when starting.\n\n"
333"--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n"354"--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n"
334"--module-path\nModule paths added to the built-in resolver, i.e. where module imports are looking for modules.\n\n"355"--uri-path\nURI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.\n\n"
356"--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n"
357"--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n"
358"--classpath\nJVM classpath to be used by modules using Java implementations\n\n"
335"--option\nSet an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value\n\n"359"--option\nSet an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value\n\n"
336"--trailing-nl\nOutput a trailing newline after the result of the query.\n\n"360"--trailing-nl\nOutput a trailing newline after the result of the query.\n\n"
337"--stop-words\nMapping specifying a stop-words URI to another.\n\n"361"--stop-words\nMapping specifying a stop-words URI to another.\n\n"
338362
=== added file 'cmake_modules/FindLibedit.cmake'
--- cmake_modules/FindLibedit.cmake 1970-01-01 00:00:00 +0000
+++ cmake_modules/FindLibedit.cmake 2012-02-22 17:11:27 +0000
@@ -0,0 +1,46 @@
1# Copyright 2011 The FLWOR Foundation.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# - Try to find the libedit library
16#
17# Once done this will define
18#
19# LIBEDIT_FOUND - True if libedit library is found
20# LIBEDIT_INCLUDE_DIRS - Directory to include to get libedit headers
21# LIBEDIT_LIBRARIES - Libraries to link against for the libedit library
22#
23
24FIND_PATH (
25 LIBEDIT_INCLUDE
26 editline/readline.h
27 PATHS ${LIBEDIT_INCLUDE_DIR} /usr/include /usr/local/include
28)
29MESSAGE(STATUS ${LIBEDIT_INCLUDE})
30
31FIND_LIBRARY (
32 LIBEDIT_LIBRARY
33 NAMES edit
34 PATHS ${LIBEDIT_LIBRARY_DIR} /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
35)
36MESSAGE(STATUS ${LIBEDIT_LIBRARY})
37
38SET (LIBEDIT_INCLUDE_DIRS ${LIBEDIT_INCLUDE})
39SET (LIBEDIT_LIBRARIES ${LIBEDIT_LIBRARY})
40
41FIND_PACKAGE_HANDLE_STANDARD_ARGS (
42 Libedit
43 DEFAULT_MSG
44 LIBEDIT_INCLUDE LIBEDIT_LIBRARY
45)
46
047
=== modified file 'cmake_modules/FindPHP5.cmake'
--- cmake_modules/FindPHP5.cmake 2011-08-19 00:03:31 +0000
+++ cmake_modules/FindPHP5.cmake 2012-02-22 17:11:27 +0000
@@ -97,6 +97,11 @@
97 _zend_rsrc_list_get_rsrc_type97 _zend_rsrc_list_get_rsrc_type
98 _zend_wrong_param_count98 _zend_wrong_param_count
99 _zval_used_for_init99 _zval_used_for_init
100 _zval_is_true
101 _zend_lookup_class
102 __object_init
103 __zend_hash_add_or_update
104 _php_strtolower
100 )105 )
101 SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS106 SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
102 "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")107 "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")
103108
=== modified file 'cmake_modules/ZorbaModule.cmake'
--- cmake_modules/ZorbaModule.cmake 2011-10-10 10:31:20 +0000
+++ cmake_modules/ZorbaModule.cmake 2012-02-22 17:11:27 +0000
@@ -66,7 +66,8 @@
66#66#
67# Parameters:67# Parameters:
68# URI - URI to mangle68# URI - URI to mangle
69# EXT - extension to ensure URI ends with69# EXT - extension to ensure URI ends with (may be empty; if set, must
70# include leading "."
70# DIR_VAR - variable to set with the directory part of the mangled path71# DIR_VAR - variable to set with the directory part of the mangled path
71# FILE_VAR - variable to set with the file part of the mangled path72# FILE_VAR - variable to set with the file part of the mangled path
72MACRO (MANGLE_URI URI EXT DIR_VAR FILE_VAR)73MACRO (MANGLE_URI URI EXT DIR_VAR FILE_VAR)
@@ -89,13 +90,14 @@
8990
90 # Convert final component into proper filename91 # Convert final component into proper filename
91 IF (NOT final_comp)92 IF (NOT final_comp)
92 SET (${FILE_VAR} "index.${EXT}")93 SET (${FILE_VAR} "index${EXT}")
93 ELSE (NOT final_comp)94 ELSE (NOT final_comp)
94 IF ("${final_comp}" MATCHES "\\.${EXT}$")95 # \\ necessary to escape the leading . in EXT
96 IF ("${final_comp}" MATCHES "\\${EXT}$")
95 SET (${FILE_VAR} "${final_comp}")97 SET (${FILE_VAR} "${final_comp}")
96 ELSE ("${final_comp}" MATCHES "\\.${EXT}$")98 ELSE ("${final_comp}" MATCHES "\\${EXT}$")
97 SET (${FILE_VAR} "${final_comp}.${EXT}")99 SET (${FILE_VAR} "${final_comp}${EXT}")
98 ENDIF ("${final_comp}" MATCHES "\\.${EXT}$")100 ENDIF ("${final_comp}" MATCHES "\\${EXT}$")
99 ENDIF (NOT final_comp)101 ENDIF (NOT final_comp)
100102
101 # Stick the reversed authority back on the front of the path: done!103 # Stick the reversed authority back on the front of the path: done!
@@ -138,8 +140,7 @@
138 ENDIF (NOT IS_ABSOLUTE "${MODULE_FILE}")140 ENDIF (NOT IS_ABSOLUTE "${MODULE_FILE}")
139 GET_FILENAME_COMPONENT (module_name "${MODULE_FILE}" NAME)141 GET_FILENAME_COMPONENT (module_name "${MODULE_FILE}" NAME)
140142
141143 MANGLE_URI (${MODULE_URI} ".xq" module_path module_filename)
142 MANGLE_URI (${MODULE_URI} "xq" module_path module_filename)
143144
144 # Compute a CMake-symbol-safe version of the target URI, for storing145 # Compute a CMake-symbol-safe version of the target URI, for storing
145 # things in CMake properties.146 # things in CMake properties.
@@ -159,41 +160,51 @@
159 MATH (EXPR num_zorba_modules "${num_zorba_modules} + 1")160 MATH (EXPR num_zorba_modules "${num_zorba_modules} + 1")
160 SET_PROPERTY (GLOBAL PROPERTY ZORBA_MODULE_COUNT ${num_zorba_modules})161 SET_PROPERTY (GLOBAL PROPERTY ZORBA_MODULE_COUNT ${num_zorba_modules})
161162
162 # Compute the version numbers, if any provided.163 # If no version specified, it is effectively treated as 0.0.0.
163 IF (MODULE_VERSION)164 IF (NOT MODULE_VERSION)
164 STRING (REPLACE "." ";" version "${MODULE_VERSION}")165 SET (MODULE_VERSION "0.0.0")
165 LIST (LENGTH version version_len)166 ENDIF (NOT MODULE_VERSION)
166 IF (NOT (version_len EQUAL 2) OR (version_len EQUAL 3))167
167 MESSAGE (FATAL_ERROR168 # Compute a unique integer, version_int, based on the version
168 "Version ${MODULE_VERSION} not of form 'major.minor[.patch]'")169 # number, so we can more easily compare with other versions later.
169 ENDIF (NOT (version_len EQUAL 2) OR (version_len EQUAL 3))170 STRING (REPLACE "." ";" version "${MODULE_VERSION}")
170 LIST (GET version 0 major_ver)171 LIST (LENGTH version version_len)
171 LIST (GET version 1 minor_ver)172 IF (NOT ( (version_len EQUAL 2) OR (version_len EQUAL 3) ) )
172 IF (version_len EQUAL 3)173 MESSAGE (FATAL_ERROR
173 LIST (GET version 2 patch_ver)174 "Version ${version_len} ${MODULE_VERSION} not of form 'major.minor[.patch]'")
174 MATH (EXPR version_int175 ENDIF (NOT ( (version_len EQUAL 2) OR (version_len EQUAL 3) ) )
175 "${major_ver} * 100000000 + ${minor_ver} * 100000 + ${patch_ver}")176 LIST (GET version 0 major_ver)
176 ELSE (version_len EQUAL 3)177 LIST (GET version 1 minor_ver)
177 SET (patch_ver)178 IF (version_len EQUAL 3)
178 MATH (EXPR version_int "${major_ver} * 100000000 + ${minor_ver} * 100000")179 LIST (GET version 2 patch_ver)
179 ENDIF (version_len EQUAL 3)180 MATH (EXPR version_int
180181 "${major_ver} * 100000000 + ${minor_ver} * 100000 + ${patch_ver}")
181 # We maintain a global CMake property named after the target URI182 ELSE (version_len EQUAL 3)
182 # which remembers all versions of this URI which have been183 SET (patch_ver)
183 # declared. If a *lower* version has already been declared, the184 MATH (EXPR version_int "${major_ver} * 100000000 + ${minor_ver} * 100000")
184 # output file rules will be messed up, so die.185 ENDIF (version_len EQUAL 3)
185 GET_PROPERTY (target_versions GLOBAL PROPERTY "${uri_sym}-versions")186
186 FOREACH (known_ver ${target_versions})187 # We maintain a global CMake property named after the target URI
187 IF (known_ver LESS version_int)188 # which remembers all versions of this URI which have been
188 MESSAGE (FATAL_ERROR189 # declared. If a *lower* version has already been declared, the
189 "The module ${MODULE_URI} has already been declared with a "190 # output file rules will be messed up, so die. If the *same* version
190 "lower version number than ${MODULE_VERSION}. "191 # has already been declare, XQdoc will be messed up, so die.
191 "Please call DECLARE_ZORBA_MODULE() for higher versions of the same "192 GET_PROPERTY (target_versions GLOBAL PROPERTY "${uri_sym}-versions")
192 "module first.")193 FOREACH (known_ver ${target_versions})
193 ENDIF (known_ver LESS version_int)194 IF (known_ver LESS version_int)
194 ENDFOREACH (known_ver)195 MESSAGE (FATAL_ERROR
195 SET_PROPERTY (GLOBAL APPEND PROPERTY "${uri_sym}-versions" ${version_int})196 "The module ${MODULE_URI} has already been declared with a "
196 ENDIF (MODULE_VERSION)197 "lower version number than ${MODULE_VERSION}. "
198 "Please call DECLARE_ZORBA_MODULE() for higher versions of the same "
199 "module first.")
200 ElSEIF (known_ver EQUAL version_int)
201 MESSAGE (FATAL_ERROR
202 "The module ${MODULE_URI} has already been declared with the "
203 "version number ${MODULE_VERSION}. You cannot declare the same "
204 "module twice.")
205 ENDIF (known_ver LESS version_int)
206 ENDFOREACH (known_ver)
207 SET_PROPERTY (GLOBAL APPEND PROPERTY "${uri_sym}-versions" ${version_int})
197208
198 # Add to module manifest (except test modules).209 # Add to module manifest (except test modules).
199 IF (NOT MODULE_TEST_ONLY)210 IF (NOT MODULE_TEST_ONLY)
@@ -250,6 +261,11 @@
250 SET(module_lib_target "modlib${num_zorba_modules}_${module_name}")261 SET(module_lib_target "modlib${num_zorba_modules}_${module_name}")
251 ADD_LIBRARY(${module_lib_target} SHARED ${SRC_FILES})262 ADD_LIBRARY(${module_lib_target} SHARED ${SRC_FILES})
252 GET_FILENAME_COMPONENT(module_filewe "${module_filename}" NAME_WE)263 GET_FILENAME_COMPONENT(module_filewe "${module_filename}" NAME_WE)
264 IF (MODULE_VERSION)
265 # If there's a version, insert it into the module library name
266 SET (module_filewe "${module_filewe}_${MODULE_VERSION}")
267 ENDIF (MODULE_VERSION)
268
253 # It seems like it would be nice to set the VERSION and/or269 # It seems like it would be nice to set the VERSION and/or
254 # SOVERSION target properties here. However: On Windows, it270 # SOVERSION target properties here. However: On Windows, it
255 # doesn't seem to do anything (the .rc file configured above271 # doesn't seem to do anything (the .rc file configured above
@@ -260,7 +276,7 @@
260 # target property isn't desirable.276 # target property isn't desirable.
261 # FOLDER is to group IDE projects into folders.277 # FOLDER is to group IDE projects into folders.
262 SET_TARGET_PROPERTIES (${module_lib_target} PROPERTIES278 SET_TARGET_PROPERTIES (${module_lib_target} PROPERTIES
263 OUTPUT_NAME "${module_filewe}_${MODULE_VERSION}${SUFFIX}"279 OUTPUT_NAME "${module_filewe}${SUFFIX}"
264 ${target_type}_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.src"280 ${target_type}_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.src"
265 FOLDER "Modules"281 FOLDER "Modules"
266 )282 )
@@ -272,12 +288,12 @@
272 IF(NOT ${PROJECT_NAME} STREQUAL "zorba")288 IF(NOT ${PROJECT_NAME} STREQUAL "zorba")
273 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})289 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
274 INSTALL(TARGETS ${module_lib_target}290 INSTALL(TARGETS ${module_lib_target}
275 ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path}291 ${target_type} DESTINATION ${ZORBA_NONCORE_LIB_DIR}/${module_path}
276 COMPONENT ${component_name})292 COMPONENT ${component_name})
277 293
278 ELSE(NOT ${PROJECT_NAME} STREQUAL "zorba")294 ELSE(NOT ${PROJECT_NAME} STREQUAL "zorba")
279 INSTALL(TARGETS ${module_lib_target}295 INSTALL(TARGETS ${module_lib_target}
280 ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path})296 ${target_type} DESTINATION ${ZORBA_CORE_LIB_DIR}/${module_path})
281 ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")297 ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")
282 ENDIF (NOT MODULE_TEST_ONLY)298 ENDIF (NOT MODULE_TEST_ONLY)
283 299
@@ -296,16 +312,16 @@
296 ENDIF (patch_ver)312 ENDIF (patch_ver)
297 ENDIF (MODULE_VERSION)313 ENDIF (MODULE_VERSION)
298 FOREACH (version_infix "" ${version_infixes})314 FOREACH (version_infix "" ${version_infixes})
299 ADD_COPY_RULE ("${SOURCE_FILE}" "${module_path}/${module_filename}"315 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}"
300 "${version_infix}" "" "${MODULE_TEST_ONLY}")316 "${version_infix}" "" 1 "${MODULE_TEST_ONLY}")
301 ENDFOREACH (version_infix)317 ENDFOREACH (version_infix)
302318
303 # Also copy the dynamic library from the location it was built.319 # Also copy the dynamic library from the location it was built.
304 IF (module_lib_target)320 IF (module_lib_target)
305 GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)321 GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)
306 GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)322 GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)
307 ADD_COPY_RULE ("${lib_location}" "${module_path}/${lib_filename}"323 ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}"
308 "" "${module_lib_target}" "${MODULE_TEST_ONLY}")324 "" "${module_lib_target}" 0 "${MODULE_TEST_ONLY}")
309 ENDIF (module_lib_target)325 ENDIF (module_lib_target)
310326
311 # Last but not least, whip up a test case that ensures the module327 # Last but not least, whip up a test case that ensures the module
@@ -350,34 +366,152 @@
350 SET (SOURCE_FILE "${SCHEMA_FILE}")366 SET (SOURCE_FILE "${SCHEMA_FILE}")
351 ENDIF (NOT IS_ABSOLUTE "${SCHEMA_FILE}")367 ENDIF (NOT IS_ABSOLUTE "${SCHEMA_FILE}")
352 GET_FILENAME_COMPONENT (schema_name "${SCHEMA_FILE}" NAME)368 GET_FILENAME_COMPONENT (schema_name "${SCHEMA_FILE}" NAME)
353 MANGLE_URI (${SCHEMA_URI} "xsd" schema_path schema_filename)369 MANGLE_URI (${SCHEMA_URI} ".xsd" schema_path schema_filename)
354370
355 # Add to schema manifest (except test schema).371 # Add to schema manifest (except test schema).
356 IF (NOT SCHEMA_TEST_ONLY)372 IF (NOT SCHEMA_TEST_ONLY)
357 ADD_ZORBA_MANIFEST_ENTRY("schema" ${SCHEMA_URI} "")373 ADD_ZORBA_MANIFEST_ENTRY("schema" ${SCHEMA_URI} "")
358 ENDIF (NOT SCHEMA_TEST_ONLY)374 ENDIF (NOT SCHEMA_TEST_ONLY)
359375
360 ADD_COPY_RULE ("${SOURCE_FILE}" "${schema_path}/${schema_filename}"376 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}"
361 "" "" "${SCHEMA_TEST_ONLY}")377 "" "" 1 "${SCHEMA_TEST_ONLY}")
362378
363ENDMACRO (DECLARE_ZORBA_SCHEMA)379ENDMACRO (DECLARE_ZORBA_SCHEMA)
364380
381# Macro which declares a file to be loaded by URI. This sets up the
382# installation of the file into the URI_PATH folder so it will be
383# found at runtime.
384#
385# Args: URI - the URI of the file
386# FILE - path to file (if not absolute, will be resolved
387# relative to CMAKE_CURRENT_SOURCE_DIR)
388# TEST_ONLY - (optional) File is for testcases only and should not
389# be installed
390MACRO (DECLARE_ZORBA_URI_FILE)
391 # QQQ Refactor - this macro is basically identical to DECLARE_ZORBA_SCHEMA
392 PARSE_ARGUMENTS(URI_FILE "" "URI;FILE" "TEST_ONLY" ${ARGN})
393 IF (NOT URI_FILE_FILE)
394 MESSAGE (FATAL_ERROR "'FILE' argument is required for ZORBA_DECLARE_URI_FILE()")
395 ENDIF (NOT URI_FILE_FILE)
396 IF (NOT URI_FILE_URI)
397 MESSAGE (FATAL_ERROR "'URI' argument is required for ZORBA_DECLARE_URI_FILE()")
398 ENDIF (NOT URI_FILE_URI)
399 IF (NOT IS_ABSOLUTE "${URI_FILE_FILE}")
400 SET (SOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${URI_FILE_FILE}")
401 ELSE (NOT IS_ABSOLUTE "${URI_FILE_FILE}")
402 SET (SOURCE_FILE "${URI_FILE_FILE}")
403 ENDIF (NOT IS_ABSOLUTE "${URI_FILE_FILE}")
404 GET_FILENAME_COMPONENT (uri_file_name "${URI_FILE_FILE}" NAME)
405 # Don't enforce any extension on general files
406 MANGLE_URI (${URI_FILE_URI} "" uri_file_path uri_file_filename)
407
408 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${uri_file_path}/${uri_file_filename}"
409 "" "" 1 "${URI_FILE_TEST_ONLY}")
410
411ENDMACRO (DECLARE_ZORBA_URI_FILE)
412
413# Inform Zorba of a .jar file that should be made available on the CLASSPATH
414# of the JVM, should the JVM be started. QQQ more doc needed
415#
416# Args: FILE - path to file (must be absolute)
417# EXTERNAL - (optional) FILE specifies a path that should be added
418# to CLASSPATH as-is
419# TEST_ONLY - (optional) Jar file is for testcases only and should not
420# be installed
421
422MACRO (DECLARE_ZORBA_JAR)
423 PARSE_ARGUMENTS (JAR "FILE" "" "TEST_ONLY;EXTERNAL" ${ARGN})
424 IF (NOT JAR_FILE)
425 MESSAGE (FATAL_ERROR "'FILE' argument is required for DECLARE_ZORBA_JAR")
426 ENDIF (NOT JAR_FILE)
427
428 # Initialize classpath file and set up copy rule (once per project)
429 SET (_CP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-classpath.txt")
430 GET_PROPERTY (_known_project GLOBAL PROPERTY "${PROJECT_NAME}-jars")
431 IF (NOT _known_project)
432 FILE (REMOVE "${_CP_FILE}")
433 SET_PROPERTY (GLOBAL PROPERTY "${PROJECT_NAME}-jars" 1)
434 ADD_COPY_RULE ("LIB" "${_CP_FILE}" "jars/${PROJECT_NAME}-classpath.txt"
435 "" "" 1 "${JAR_TEST_ONLY}")
436 ENDIF (NOT _known_project)
437
438 # Iterate over all supplied jar files
439 FOREACH (_jar_file ${JAR_FILE})
440
441 IF (JAR_EXTERNAL)
442 # Put absolute path into classpath file
443 FILE (APPEND "${_CP_FILE}" "${_jar_file}\n")
444 ELSE (JAR_EXTERNAL)
445 # Copy jar to jars/ directory and add relative path to classpath file
446 GET_FILENAME_COMPONENT (_output_filename "${_jar_file}" NAME)
447 ADD_COPY_RULE ("LIB" "${_jar_file}" "jars/${_output_filename}" "" ""
448 1 "${JAR_TEST_ONLY}")
449 FILE (APPEND "${_CP_FILE}" "${_output_filename}\n")
450 ENDIF (JAR_EXTERNAL)
451
452 ENDFOREACH (_jar_file)
453ENDMACRO (DECLARE_ZORBA_JAR)
454
455# Inform Zorba of a .jar file that should be made available on the CLASSPATH
456# of the JVM, should the JVM be started. QQQ more doc needed
457#
458# Args: FILE - path to file (must be absolute)
459# EXTERNAL - (optional) FILE specifies a path that should be added
460# to CLASSPATH as-is
461# TEST_ONLY - (optional) Jar file is for testcases only and should not
462# be installed
463
464#MACRO (DECLARE_ZORBA_JAR)
465# PARSE_ARGUMENTS (JAR "" "FILE" "TEST_ONLY;EXTERNAL" ${ARGN})
466# IF (NOT JAR_FILE)
467# MESSAGE (FATAL_ERROR "'JAR' argument is required for DECLARE_ZORBA_JAR")
468# ENDIF (NOT JAR_FILE)
469# IF (NOT IS_ABSOLUTE "${JAR_FILE}")
470# SET (JAR_FILE "${CMAKE_CURRENT_BINARY_DIR}/${JAR_FILE}")
471# ENDIF (NOT IS_ABSOLUTE "${JAR_FILE}")
472#
473# SET (_LIST_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-classpath.txt")
474# IF (JAR_EXTERNAL)
475# # Remember whether we've seen external jars for this project yet
476# GET_PROPERTY (_known_project GLOBAL PROPERTY "${PROJECT_NAME}-ext-jars")
477# IF (NOT _known_project)
478# FILE (REMOVE "${_LIST_FILE}")
479# SET_PROPERTY (GLOBAL PROPERTY "${PROJECT_NAME}-ext-jars" 1)
480# ADD_COPY_RULE ("LIB" "${_LIST_FILE}" "jars/${PROJECT_NAME}-classpath.txt"
481# "" "" 1 0)
482# ENDIF (NOT _known_project)
483# FILE (APPEND "${_LIST_FILE}" "${JAR_FILE}\n")
484# ELSE (JAR_EXTERNAL)
485# GET_FILENAME_COMPONENT (_output_filename "${JAR_FILE}" NAME)
486# ADD_COPY_RULE ("LIB" "${JAR_FILE}" "jars/${_output_filename}" "" ""
487# 1 "${JAR_TEST_ONLY}")
488# ENDIF (JAR_EXTERNAL)
489#ENDMACRO (DECLARE_ZORBA_JAR)
490
491
492
365# Utility macro for setting up a build rule to copy a file to a493# Utility macro for setting up a build rule to copy a file to a
366# particular (possible versioned) file in URI_PATH if such a file has494# particular (possibly versioned) file in a shared directory if such a
367# not already been output.495# file has not already been output.
496#
497# FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared
498# directory to place output in (URI_PATH or LIB_PATH).
368# INPUT_FILE: Absolute path to file to copy.499# INPUT_FILE: Absolute path to file to copy.
369# OUTPUT_FILE: Relative path to output file (relative to URI_PATH).500# OUTPUT_FILE: Relative path to output file (relative to URI_PATH).
370# VERSION_ARG: Version; may be "" for non-versioned files.501# VERSION_ARG: Version; may be "" for non-versioned files.
371# DEPEND_TARGET: A CMake target name upon which the copy rule should depend;502# DEPEND_TARGET: A CMake target name upon which the copy rule should depend;
372# may be "".503# may be "".
504# INSTALL: If 1, an INSTALL() directive will be executed to put the
505# file into the install image.
373# TEST_ONLY: If 1, file is for testcases only; will be copied into506# TEST_ONLY: If 1, file is for testcases only; will be copied into
374# TEST_URI_PATH and will not be installed507# TEST_URI_PATH/TEST_LIB_PATH and will not be installed.
375MACRO (ADD_COPY_RULE INPUT_FILE OUTPUT_FILE VERSION_ARG DEPEND_TARGET TEST_ONLY)508MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG
509 DEPEND_TARGET INSTALL TEST_ONLY)
376 # Choose output base directory510 # Choose output base directory
377 IF (${TEST_ONLY} EQUAL 1)511 IF (${TEST_ONLY} EQUAL 1)
378 SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")512 SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH")
379 ELSE (${TEST_ONLY} EQUAL 1)513 ELSE (${TEST_ONLY} EQUAL 1)
380 SET (_output_basedir "${CMAKE_BINARY_DIR}/URI_PATH")514 SET (_output_basedir "${CMAKE_BINARY_DIR}/${FILE_TYPE}_PATH")
381 ENDIF (${TEST_ONLY} EQUAL 1)515 ENDIF (${TEST_ONLY} EQUAL 1)
382516
383 # Compute the modified output filename by inserting VERSION_ARG (if517 # Compute the modified output filename by inserting VERSION_ARG (if
@@ -404,46 +538,50 @@
404 IF (file_found EQUAL -1)538 IF (file_found EQUAL -1)
405 SET_PROPERTY (GLOBAL APPEND PROPERTY "${_dir_sym}-output-files"539 SET_PROPERTY (GLOBAL APPEND PROPERTY "${_dir_sym}-output-files"
406 "${_output_file}")540 "${_output_file}")
407 # Save the input file, output file, and any library dependency541 # Detect whether this is a core URI or not
408 # target for this rule in a global property542 IF (PROJECT_NAME STREQUAL "zorba")
543 SET (_is_core 1)
544 ELSE (PROJECT_NAME STREQUAL "zorba")
545 SET (_is_core 0)
546 ENDIF (PROJECT_NAME STREQUAL "zorba")
547
548 # Save the (input file, output file, any library dependency
549 # target, and whether this is a core or non-core file) for this
550 # rule in a global property
409 SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES551 SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES
410 "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}")552 "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}" "${_is_core}")
411553
412 # For .xq and .xsd files, also set up an INSTALL rule (if not TEST_ONLY).554 # Also set up an INSTALL rule (unless TEST_ONLY).
413 IF (NOT ${TEST_ONLY} EQUAL 1)555 IF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) )
414 IF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")
415 556
416 IF(NOT PROJECT_NAME STREQUAL "zorba")557 IF(NOT _is_core)
417 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME}) 558 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
418 INSTALL (FILES "${INPUT_FILE}"559 INSTALL (FILES "${INPUT_FILE}"
419 DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"560 DESTINATION "${ZORBA_NONCORE_${FILE_TYPE}_DIR}/${_output_path}"
420 RENAME "${_output_filename}"561 RENAME "${_output_filename}"
421 COMPONENT "${component_name}")562 COMPONENT "${component_name}")
422 563
423 IF (NOT ${component_name}_cpack)564 IF (NOT ${component_name}_cpack)
424 SET (${component_name}_cpack 1)565 SET (${component_name}_cpack 1)
425 566
426 STRING(TOUPPER ${component_name} component_name2)567 STRING(TOUPPER ${component_name} component_name2)
427 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_GROUP \"external_modules\")\n")568 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_GROUP \"external_modules\")\n")
428 569
429 STRING(REPLACE "zorba_" "" component_display_name ${component_name})570 STRING(REPLACE "zorba_" "" component_display_name ${component_name})
430 STRING(REPLACE "_" " " component_display_name ${component_display_name})571 STRING(REPLACE "_" " " component_display_name ${component_display_name})
431 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DISPLAY_NAME \"${component_display_name}\")\n")572 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DISPLAY_NAME \"${component_display_name}\")\n")
432 573
433 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DESCRIPTION \"Install the functionalities of the ${component_display_name}.\")\n")574 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DESCRIPTION \"Install the functionalities of the ${component_display_name}.\")\n")
434 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_INSTALL_TYPES Full)\n")575 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_INSTALL_TYPES Full)\n")
435 ENDIF (NOT ${component_name}_cpack) 576 ENDIF (NOT ${component_name}_cpack)
436 577
437 ELSE(NOT PROJECT_NAME STREQUAL "zorba")578 ELSE(NOT _is_core)
438 INSTALL (FILES "${INPUT_FILE}"579 INSTALL (FILES "${INPUT_FILE}"
439 DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"580 DESTINATION "${ZORBA_CORE_${FILE_TYPE}_DIR}/${_output_path}"
440 RENAME "${_output_filename}")581 RENAME "${_output_filename}")
441 ENDIF(NOT PROJECT_NAME STREQUAL "zorba")582 ENDIF(NOT _is_core)
442
443
444 583
445 ENDIF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")584 ENDIF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) )
446 ENDIF (NOT ${TEST_ONLY} EQUAL 1)
447 ENDIF (file_found EQUAL -1)585 ENDIF (file_found EQUAL -1)
448ENDMACRO (ADD_COPY_RULE)586ENDMACRO (ADD_COPY_RULE)
449587
@@ -485,16 +623,17 @@
485 IF (POLICY CMP0007)623 IF (POLICY CMP0007)
486 CMAKE_POLICY (SET CMP0007 NEW)624 CMAKE_POLICY (SET CMP0007 NEW)
487 ENDIF (POLICY CMP0007)625 ENDIF (POLICY CMP0007)
488 MESSAGE (STATUS "Creating check_uris target")626 MESSAGE (STATUS "Creating check_core_uris and check_uris targets")
489 GET_PROPERTY (copy_rules GLOBAL PROPERTY ZORBA_URI_FILES)627 GET_PROPERTY (copy_rules GLOBAL PROPERTY ZORBA_URI_FILES)
490 SET (_output_files)628 SET (_output_files)
491 WHILE (copy_rules)629 WHILE (copy_rules)
492 # Pop three items off the list, and set up the corresponding630 # Pop four items off the list, and set up the corresponding
493 # rule631 # rule
494 LIST (GET copy_rules 0 _input_file)632 LIST (GET copy_rules 0 _input_file)
495 LIST (GET copy_rules 1 _output_file)633 LIST (GET copy_rules 1 _output_file)
496 LIST (GET copy_rules 2 _depend_target)634 LIST (GET copy_rules 2 _depend_target)
497 LIST (REMOVE_AT copy_rules 0 1 2)635 LIST (GET copy_rules 3 _is_core)
636 LIST (REMOVE_AT copy_rules 0 1 2 3)
498 SET (_depends "${_input_file}")637 SET (_depends "${_input_file}")
499 IF (_depend_target)638 IF (_depend_target)
500 LIST (APPEND _depends "${_depend_target}")639 LIST (APPEND _depends "${_depend_target}")
@@ -504,12 +643,30 @@
504 "${_input_file}" "${_output_file}"643 "${_input_file}" "${_output_file}"
505 DEPENDS ${_depends}644 DEPENDS ${_depends}
506 COMMENT "Copying ${_input_file} to URI path" VERBATIM)645 COMMENT "Copying ${_input_file} to URI path" VERBATIM)
507 LIST (APPEND _output_files "${_output_file}")646 IF (_is_core)
647 LIST (APPEND _core_output_files "${_output_file}")
648 ELSE (_is_core)
649 LIST (APPEND _noncore_output_files "${_output_file}")
650 ENDIF (_is_core)
508 ENDWHILE (copy_rules)651 ENDWHILE (copy_rules)
509 ADD_CUSTOM_TARGET (check_uris ALL DEPENDS ${_output_files} VERBATIM)652
510 SET_TARGET_PROPERTIES(check_uris PROPERTIES653 # Targets and dependencies:
511 FOLDER "Modules"654 # ALL depends on check_uris; check_uris depends on check_core_uris;
512 )655 # zorbacmd depends on check_core_uris.
656 ADD_CUSTOM_TARGET (check_uris ALL
657 DEPENDS ${_noncore_output_files} VERBATIM)
658 SET_TARGET_PROPERTIES(check_uris PROPERTIES FOLDER "Modules")
659 # Only create check_core_uris target and associated dependencies if
660 # there are any core URIs; there should never be any when building a
661 # standalone module project.
662 LIST (LENGTH _core_output_files _num_core)
663 IF (_num_core GREATER 0)
664 ADD_CUSTOM_TARGET (check_core_uris
665 DEPENDS ${_core_output_files} VERBATIM)
666 ADD_DEPENDENCIES(check_uris check_core_uris)
667 ADD_DEPENDENCIES(zorbacmd check_core_uris)
668 SET_TARGET_PROPERTIES(check_core_uris PROPERTIES FOLDER "Modules")
669 ENDIF (_num_core GREATER 0)
513 SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)670 SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)
514671
515 #add 'xqdoc' and 'xqdoc-xml' targets672 #add 'xqdoc' and 'xqdoc-xml' targets
@@ -695,7 +852,7 @@
695 COMMENT "Building XQDoc XML documentation ..."852 COMMENT "Building XQDoc XML documentation ..."
696 )853 )
697 MESSAGE(STATUS " added target xqdoc-xml")854 MESSAGE(STATUS " added target xqdoc-xml")
698 ADD_DEPENDENCIES(xqdoc-xml zorba_simplestore)855 ADD_DEPENDENCIES(xqdoc-xml zorbacmd check_core_uris)
699856
700 SET_TARGET_PROPERTIES (xqdoc-xml PROPERTIES857 SET_TARGET_PROPERTIES (xqdoc-xml PROPERTIES
701 EXCLUDE_FROM_DEFAULT_BUILD 1858 EXCLUDE_FROM_DEFAULT_BUILD 1
702859
=== modified file 'config/CMakeLists.txt'
--- config/CMakeLists.txt 2011-09-08 19:19:54 +0000
+++ config/CMakeLists.txt 2012-02-22 17:11:27 +0000
@@ -34,7 +34,8 @@
34SET(Zorba_EXE_PATH "${ZORBA_ROOT}/bin/zorba")34SET(Zorba_EXE_PATH "${ZORBA_ROOT}/bin/zorba")
35SET(Zorba_EXTERNALMODULECONFIG_FILE35SET(Zorba_EXTERNALMODULECONFIG_FILE
36 "${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}/ExternalModuleConfig.cmake.in") 36 "${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}/ExternalModuleConfig.cmake.in")
37SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_ROOT}/${ZORBA_MODULES_INSTALL_DIR}")37SET(Zorba_NONCORE_URI_DIR "${ZORBA_ROOT}/${ZORBA_NONCORE_URI_DIR}")
38SET(Zorba_NONCORE_LIB_DIR "${ZORBA_ROOT}/${ZORBA_NONCORE_LIB_DIR}")
3839
39CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"40CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
40 "${CMAKE_CURRENT_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)41 "${CMAKE_CURRENT_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
@@ -58,7 +59,7 @@
58 STRING (REPLACE ".exe" ".bat" Zorba_TESTDRIVER ${Zorba_TESTDRIVER})59 STRING (REPLACE ".exe" ".bat" Zorba_TESTDRIVER ${Zorba_TESTDRIVER})
59ENDIF (WIN32)60ENDIF (WIN32)
6061
61SET(Zorba_EXE_PATH "${ZORBA_EXE}")62SET(Zorba_EXE_PATH "${ZORBA_EXE}")
62SET(Zorba_EXTERNALMODULECONFIG_FILE63SET(Zorba_EXTERNALMODULECONFIG_FILE
63 "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in")64 "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in")
64# Note: We also set these two into the parent's scope, so that it is65# Note: We also set these two into the parent's scope, so that it is
@@ -67,10 +68,9 @@
67 "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in"68 "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in"
68 PARENT_SCOPE)69 PARENT_SCOPE)
69SET(Zorba_EXE "${ZORBA_EXE}" PARENT_SCOPE)70SET(Zorba_EXE "${ZORBA_EXE}" PARENT_SCOPE)
71SET(Zorba_NONCORE_URI_DIR "${ZORBA_NONCORE_URI_DIR}")
72SET(Zorba_NONCORE_LIB_DIR "${ZORBA_NONCORE_LIB_DIR}")
7073
71# Note: This value doesn't really make much sense, but neither does any
72# other value
73SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_MODULES_INSTALL_DIR}")
74CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"74CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
75 "${CMAKE_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)75 "${CMAKE_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
7676
7777
=== modified file 'config/ZorbaConfig.cmake.in'
--- config/ZorbaConfig.cmake.in 2011-08-24 09:09:02 +0000
+++ config/ZorbaConfig.cmake.in 2012-02-22 17:11:27 +0000
@@ -47,10 +47,13 @@
47 "Path to Zorba's testdriver" FORCE)47 "Path to Zorba's testdriver" FORCE)
48SET_NORMALIZED (Zorba_EXE "@Zorba_EXE_PATH@" CACHE PATH "Path to Zorba executable" FORCE)48SET_NORMALIZED (Zorba_EXE "@Zorba_EXE_PATH@" CACHE PATH "Path to Zorba executable" FORCE)
4949
50# Tell the user project where modules are installed. Note: This variable50# Tell the user project where (non-core) modules are installed. Note:
51# is all-uppercase because it is also used internally by Zorba's build.51# These variables are all-uppercase because they are also used
52SET (ZORBA_MODULES_INSTALL_DIR "@Zorba_MODULES_INSTALL_DIR@"52# internally by Zorba's build.
53 CACHE STRING "Path to Zorba modules in this Zorba installation" FORCE)53SET (ZORBA_NONCORE_URI_DIR "@Zorba_NONCORE_URI_DIR@"
54 CACHE STRING "Path to Zorba to non-core modules/schemas in this Zorba installation" FORCE)
55SET (ZORBA_NONCORE_LIB_DIR "@Zorba_NONCORE_LIB_DIR@"
56 CACHE STRING "Path to Zorba to non-core libraries in this Zorba installation" FORCE)
5457
55# Tell the user project where to find the "USE" file.58# Tell the user project where to find the "USE" file.
56# This file uses the above settings to configure the user project.59# This file uses the above settings to configure the user project.
5760
=== modified file 'doc/cxx/examples/errors.cpp'
--- doc/cxx/examples/errors.cpp 2011-08-11 05:11:12 +0000
+++ doc/cxx/examples/errors.cpp 2012-02-22 17:11:27 +0000
@@ -139,12 +139,12 @@
139 // make sure that the warning zwarn::ZWST0002 is turned139 // make sure that the warning zwarn::ZWST0002 is turned
140 // into an error140 // into an error
141 StaticContext_t lCtx = aZorba->createStaticContext();141 StaticContext_t lCtx = aZorba->createStaticContext();
142 lCtx->declareOption(lQName, "ZWST0002");142 lCtx->declareOption(lQName, "ZWST0003");
143143
144 std::ostringstream s;144 std::ostringstream s;
145 s << "declare namespace unknown = 'unknown-annotation';" << std::endl145 s << "declare namespace z = 'http://www.zorba-xquery.com/annotations';" << std::endl
146 << "declare %unknown:test variable $var := 3;" << std::endl146 << "declare %z:sequential function local:foo() { 1 };" << std::endl
147 << "$var" << std::endl;147 << "local:foo()" << std::endl;
148 XQuery_t lQuery = aZorba->compileQuery(s.str(), lCtx); 148 XQuery_t lQuery = aZorba->compileQuery(s.str(), lCtx);
149149
150 std::cout << lQuery << std::endl;150 std::cout << lQuery << std::endl;
151151
=== modified file 'doc/cxx/examples/simple.cpp'
--- doc/cxx/examples/simple.cpp 2011-06-14 14:21:49 +0000
+++ doc/cxx/examples/simple.cpp 2012-02-22 17:11:27 +0000
@@ -33,14 +33,14 @@
3333
34 std::cout << lQuery << std::endl;34 std::cout << lQuery << std::endl;
3535
36 return true;36 return true;
37}37}
3838
3939
40bool40bool
41example_2(Zorba* aZorba)41example_2(Zorba* aZorba)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: