Merge lp:~zorba-coders/zorba/stack into lp:~zorba-coders/zorba/zorba-experimental

Proposed by Matthias Brantner
Status: Merged
Merged at revision: 10634
Proposed branch: lp:~zorba-coders/zorba/stack
Merge into: lp:~zorba-coders/zorba/zorba-experimental
Diff against target: 89328 lines (+46801/-14845)
822 files modified
CMakeConfiguration.txt (+0/-4)
CMakeLists.txt (+29/-7)
CPackSourceConfig.cmake.in (+1/-1)
ChangeLog (+88/-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 (+60/-45)
bin/path_util.h (+9/-24)
bin/zorbacmd.cpp (+87/-50)
bin/zorbacmdproperties.cpp (+14/-5)
bin/zorbacmdproperties.h (+7/-1)
bin/zorbacmdproperties.txt (+3/-1)
bin/zorbacmdproperties_base.h (+19/-3)
cmake_modules/FindLibedit.cmake (+46/-0)
cmake_modules/FindPHP5.cmake (+5/-0)
cmake_modules/ZorbaModule.cmake (+57/-29)
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 (+14/-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 (+4/-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 (+12/-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/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/xquery.h (+19/-1)
include/zorba/zorba.h (+1/-0)
modules/ExternalModules.conf (+16/-13)
modules/com/zorba-xquery/www/modules/CMakeLists.txt (+10/-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)
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 (+26/-0)
src/api/itemfactoryimpl.cpp (+61/-4)
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 (+26/-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 (+118/-4)
src/api/xqueryimpl.h (+6/-0)
src/api/zorbaimpl.cpp (+1/-1)
src/compiler/api/compiler_api.cpp (+19/-13)
src/compiler/api/compiler_api.h (+3/-2)
src/compiler/api/compilercb.cpp (+4/-0)
src/compiler/api/compilercb.h (+12/-2)
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 (+41/-16)
src/compiler/expression/flwor_expr.h (+41/-18)
src/compiler/expression/fo_expr.cpp (+4/-17)
src/compiler/expression/fo_expr.h (+5/-5)
src/compiler/expression/ft_expr.h (+2/-1)
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 (+55/-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/fold_rules.cpp (+0/-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 (+320/-241)
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 (+2/-2)
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 (+431/-391)
src/context/static_context.h (+105/-123)
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 (+65/-26)
src/diagnostics/dict_XX_cpp.xq (+1/-0)
src/diagnostics/pregenerated/diagnostic_list.cpp (+18/-6)
src/diagnostics/pregenerated/dict_en.cpp (+12/-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/-39)
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 (+277/-209)
src/functions/func_sequences_impl.h (+97/-56)
src/functions/func_serialize_impl.cpp (+38/-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 (+218/-11)
src/functions/udf.h (+47/-4)
src/runtime/booleans/BooleanImpl.cpp (+174/-195)
src/runtime/booleans/BooleanImpl.h (+1/-1)
src/runtime/collections/collections_impl.cpp (+21/-21)
src/runtime/core/arithmetic_impl.cpp (+45/-45)
src/runtime/core/arithmetic_impl.h (+18/-15)
src/runtime/core/constructors.cpp (+81/-77)
src/runtime/core/constructors.h (+15/-44)
src/runtime/core/flwor_iterator.cpp (+27/-30)
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/window_iterator.cpp (+3/-5)
src/runtime/core/path_iterators.h (+1/-1)
src/runtime/core/sequencetypes.cpp (+30/-47)
src/runtime/core/trycatch.cpp (+1/-1)
src/runtime/core/var_iterators.cpp (+67/-90)
src/runtime/core/var_iterators.h (+13/-13)
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 (+19/-12)
src/runtime/full_text/ft_stop_words_set.cpp (+4/-4)
src/runtime/full_text/icu_tokenizer.cpp (+44/-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/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 (+76/-76)
src/runtime/numerics/NumericsImpl.h (+2/-2)
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 (+12/-12)
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 (+233/-171)
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 (+98/-25)
src/store/api/item_factory.h (+4/-145)
src/store/api/shared_types.h (+3/-0)
src/store/api/store.h (+20/-9)
src/store/api/temp_seq.h (+47/-47)
src/store/api/update_consts.h (+1/-1)
src/store/api/xs_type_codes.h (+94/-0)
src/store/naive/atomic_items.cpp (+857/-100)
src/store/naive/atomic_items.h (+247/-67)
src/store/naive/item.cpp (+141/-0)
src/store/naive/loader_dtd.cpp (+92/-56)
src/store/naive/loader_fast.cpp (+31/-36)
src/store/naive/node_factory.cpp (+2/-2)
src/store/naive/node_factory.h (+2/-2)
src/store/naive/node_items.cpp (+636/-266)
src/store/naive/node_items.h (+175/-73)
src/store/naive/node_iterators.cpp (+35/-9)
src/store/naive/node_iterators.h (+63/-9)
src/store/naive/node_updates.cpp (+10/-10)
src/store/naive/nsbindings.cpp (+3/-3)
src/store/naive/nsbindings.h (+3/-2)
src/store/naive/ordpath.cpp (+94/-0)
src/store/naive/ordpath.h (+11/-4)
src/store/naive/pul_primitives.cpp (+25/-26)
src/store/naive/pul_primitives.h (+5/-1)
src/store/naive/qname_pool.cpp (+2/-2)
src/store/naive/qname_pool.h (+1/-1)
src/store/naive/shared_types.h (+3/-0)
src/store/naive/simple_collection.cpp (+4/-2)
src/store/naive/simple_collection.h (+2/-3)
src/store/naive/simple_index.cpp (+312/-302)
src/store/naive/simple_index.h (+163/-204)
src/store/naive/simple_index_general.cpp (+1560/-2172)
src/store/naive/simple_index_general.h (+313/-174)
src/store/naive/simple_index_value.cpp (+187/-51)
src/store/naive/simple_index_value.h (+84/-39)
src/store/naive/simple_item_factory.cpp (+86/-4)
src/store/naive/simple_item_factory.h (+21/-0)
src/store/naive/simple_lazy_temp_seq.cpp (+158/-96)
src/store/naive/simple_lazy_temp_seq.h (+29/-144)
src/store/naive/simple_pul.cpp (+7/-7)
src/store/naive/simple_store.cpp (+202/-181)
src/store/naive/simple_store.h (+71/-48)
src/store/naive/simple_temp_seq.cpp (+166/-219)
src/store/naive/simple_temp_seq.h (+42/-43)
src/store/naive/store_defs.h (+0/-78)
src/store/naive/store_properties.h (+36/-17)
src/system/globalenv.cpp (+73/-25)
src/system/globalenv.h (+41/-22)
src/system/zorba_properties.h (+50/-12)
src/system/zorba_properties.txt (+4/-2)
src/types/casting.cpp (+420/-195)
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 (+3/-3)
src/types/typemanagerimpl.h (+1/-1)
src/types/typeops.cpp (+31/-11)
src/types/typeops.h (+21/-5)
src/unit_tests/CMakeLists.txt (+0/-6)
src/unit_tests/test_debugger_protocol.cpp (+0/-414)
src/util/http_util.cpp (+2/-2)
src/util/string_util.h (+6/-0)
src/util/unicode_util.h (+4/-0)
src/util/utf8_util.cpp (+17/-0)
src/util/utf8_util_base.h (+27/-0)
src/zorbamisc/ns_consts.h (+1/-5)
src/zorbaserialization/zorba_class_serializer.cpp (+1/-0)
src/zorbatypes/URI.cpp (+0/-3)
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 (+14/-0)
swig/Zorba.i (+28/-1)
swig/java/CMakeLists.txt (+2/-0)
swig/php/CMakeLists.txt (+23/-6)
swig/php/XQueryProcessor.php (+397/-0)
swig/php/generate_proxy.php.in (+7/-4)
swig/php/test.xq (+1/-0)
swig/php/zorba_api.i (+7/-1)
swig/python/CMakeLists.txt (+2/-0)
swig/ruby/CMakeLists.txt (+10/-0)
swig/zorba_api.i (+4/-1)
test/apitest.cpp (+21/-6)
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/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/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/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/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 (+272/-18)
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/fulltext/ft-same-sentence-false-2.xq (+2/-0)
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/validate_xqdoc_01.xq (+4/-0)
test/rbkt/Queries/zorba/schemas/validate_xqdoc_02.xq (+4/-0)
test/rbkt/Queries/zorba/store/documents.xq (+1/-0)
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/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/specification.h (+1/-1)
test/rbkt/testdriver_common.cpp (+14/-3)
test/rbkt/testdriver_mt.cpp (+32/-5)
test/unit/CMakeLists.txt (+23/-0)
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/module2.xq (+6/-0)
test/unit/module4.xq (+6/-0)
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/unit/thesaurus.cpp (+9/-13)
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/stack
Reviewer Review Type Date Requested Status
Zorba Coders Pending
Review via email: mp+91380@code.launchpad.net

This proposal supersedes a proposal from 2012-02-01.

Commit message

...

Description of the change

...

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/stack into lp:~zorba-coders/zorba/zorba-experimental failed. Below is the output from the failed tests.

experimental build started for lp:~zorba-coders/zorba/stack. Check out http://stack.zorba-xquery.com/ in half an hour or so. Logfile at http://zorbatest.lambda.nu:8080/remotequeue/experimental/stack.log .

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

The attempt to merge lp:~zorba-coders/zorba/stack into lp:~zorba-coders/zorba/zorba-experimental failed. Below is the output from the failed tests.

experimental build started for lp:~zorba-coders/zorba/stack. Check out http://stack.zorba-xquery.com/ in half an hour or so. Logfile at http://zorbatest.lambda.nu:8080/remotequeue/experimental/stack.log .

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/stack into lp:~zorba-coders/zorba/zorba-experimental failed. Below is the output from the failed tests.

experimental build started for lp:~zorba-coders/zorba/stack. Check out http://stack.zorba-xquery.com/ in half an hour or so. Logfile at http://zorbatest.lambda.nu:8080/remotequeue/experimental/stack.log .

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-03 01:13:24 +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-03 01:13:24 +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
@@ -534,4 +556,4 @@
534# This dependency is zorba-only related, which is why it's added here556# 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 other557# and not within zorba-modules, which is for general use in other
536# non-zorba modules.558# non-zorba modules.
537ADD_DEPENDENCIES(check_uris gen_diag_modules)559ADD_DEPENDENCIES(check_core_uris gen_diag_modules)
538560
=== modified file 'CPackSourceConfig.cmake.in'
--- CPackSourceConfig.cmake.in 2009-10-30 16:24:51 +0000
+++ CPackSourceConfig.cmake.in 2012-02-03 01:13:24 +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-03 01:13:24 +0000
@@ -1,13 +1,61 @@
1Zorba - The XQuery Processor1Zorba - The XQuery Processor
22
3version 2.x3version 2.2
44
5 * Custom Full-text thesaurus.5 * No-copy optimization: avoids copying nodes during node-constructor expressions.
6 * Fixed bug #3401971 (node-by-reference on dynamic collections)6 * Added external function annotations %ann:propagates-input-nodes and
7 %ann:must-copy-input-nodes to be used by the no-copy optimization.
8 * Caching of results for recursive functions with atomic parameter and return types.
9 * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types.
10 * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context)
11 * Fixed bug 909126 (bug in cloning of var_expr)
12 * Fixed bug in destruction of exit_catcher_expr
13 * Types-related optimization for the comparison operators
14 * Fixed bug #911585 (management of variables during eval)
15 * Fixed bug #866423 (fn:empty and fn:exists iterators must reset their input in
16 case of early-out)
17 * Added index management function to the C++ api's StaticCollectionManager.
18 * Fixed bug #905041 (allow for the default element and function namespaces to be
19 set multiple times via the c++ api).
20 * Fixed bug #907872 (segfault when returning an input ItemSequence from an external function).
21 * Fixed bug #905050 (setting and getting the context item type via the c++ api).
22 * Added createDayTimeDuration, createYearMonthDuration, createDocumentNode, createCommentNode, createPiNode to api's ItemFactory.
23 * Added split function to the string module that allows for streamable tokenization but doesn't have regular expression
24 support.
25 * Fixed bug involving positional var and groupby
26 * zerr is not predeclared anymore to be http://www.zorba-xquery.com/errors
27 * Add new XQuery interface for the PHP bindings.
28 * Added API method Item::getNamespaceBindings().
29 * Added API method StaticContext::getNamespaceBindings() (see bug #905035)
30 * Deprecated StaticContext:getNamespaceURIByPrefix()
31 * Fixed bug #918211 (xqueryx fulltext w3c conformance generation)
32 * Fixed bug #918157 (Add XQFTTS to validation queue)
33
34version 2.1
35
36New Features:
37 * New node-position module. This module allows to obtain a representation of a node position, which
38 can be used to assess structural relationships with other nodes.
39 * New node-reference module. References can be obtained for any node, and
40 different nodes cannot have the same identifier.
41 * Custom Full-text thesaurus using Zorba URI resolver mechanism.
42 * Modified C++ API to add isSequential, getExternalVariables, isBoundContextItem and
43 isBoundExternalVariable Functions
44 * Collection allows to retrieve information about the type
45 and the annotations of a static collection.
46 * Implemented the probe-index-range-value for general indexes
47 * Added ExternalFunctionParameter class to be registered in the DynamicContext
48 * New module for compiling and executing XQueries from XQuery (xqxq)
49 * External functions are allowed to be updating (i.e. return a pending update list)
50
51Optimization:
7 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a52 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a
8 sequence of integers)53 sequence of integers)
9 * documentation improvements54 * Optimization for count(collection()) expressions
10 * installer improvements55 * Optimization of the fn:substring function in the case when its $start and $length arguments
56 are integers
57
58Bug Fixes/Other Changes:
11 * Fixed bug #3403291 (build for Fedora 15)59 * Fixed bug #3403291 (build for Fedora 15)
12 * Fixed bug #3397293 (Incorrect XQueryX error message)60 * Fixed bug #3397293 (Incorrect XQueryX error message)
13 * Fixed bug #3398637 (Nested element constructors cause loss of namespace bindings)61 * Fixed bug #3398637 (Nested element constructors cause loss of namespace bindings)
@@ -15,20 +63,19 @@
15 * Fixed bug #3404689 (assignment problem in flwor)63 * Fixed bug #3404689 (assignment problem in flwor)
16 * Fix for bug #3404450 (testdriver_mt problem: caching and validation of docs)64 * Fix for bug #3404450 (testdriver_mt problem: caching and validation of docs)
17 * Fixed installation bug to not install the .so for test modules65 * 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)66 * 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)67 * 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)68 * Fixed bug #3406191 (Namespace bindings lost after update due to bug in node detach)
22 * Fixed bug #3290122 (ZDST0003 needs collection name)69 * 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 all70 * Fixed bug #3406272 (merging of adjacent text nodes must be done after all
26 updates have been applied).71 updates have been applied).
72 * Don't raise warnings for unknown annotations.
27 * Fixed bug #3409344 (during detach, if the node being detached is the root of73 * 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 memory74 its tree, it should be detached from the tree as well; otherwise memory
29 corruption will occur)75 corruption will occur)
30 * Fixed bug # (Should not destroy the parent of a node that is being detached76 * Fixed bug # (Should not destroy the parent of a node that is being detached
31 before the detach is done).77 before the detach is done).
78 * Added const qualifier to StaticContext::getAuditEvent()
32 * Fixed bug #3408181 (available-collection() returns undeclared collections)79 * Fixed bug #3408181 (available-collection() returns undeclared collections)
33 * Fixed bug #859465 (Fatal error if a PUL contains two deactivate IC primitives)80 * 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)81 * Fixed bug #859467 (Fatal error if a PUL contains two activate Foreign Key primitives)
@@ -36,11 +83,10 @@
36 * Fixed bug #859522 (Fatal error if a PUL contains two delete document primitives)83 * 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)84 * 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)85 * Fixed bug #855314 (should not fold a constant expr that returns an error item)
39 * Added ExternalFunctionParameter class to be registered in the DynamicContext86 * 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)87 * 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)88 * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)
42 * Implemented the probe-index-range-value for general indexes89 * Removed ZSTR0005 and ZSTR0006 error codes
43 * Fixed bug #867662 ("nullptr" warning)
44 * Fixed bug #868258 (Assertion failure with two delete collection)90 * Fixed bug #868258 (Assertion failure with two delete collection)
45 * Fixed bug #871623 and #871629 (assertion failures with insertions in dynamic collections)91 * Fixed bug #871623 and #871629 (assertion failures with insertions in dynamic collections)
46 * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)92 * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)
@@ -54,6 +100,36 @@
54 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)100 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)
55 * Fixed bug #872799 (validate-in-place can set incorrect types)101 * Fixed bug #872799 (validate-in-place can set incorrect types)
56 * Fixed bug #855715 (Invalid escaped characters in regex not caught)102 * Fixed bug #855715 (Invalid escaped characters in regex not caught)
103 * Fixed bug #868325 (fn:analyze-string fails with some recursive subgroups)
104 * Fixed bug #872697 (segmentation fault with validation of NMTOKENS)
105 * General index cannot be declared as unique if the type of its key is
106 xs:anyAtomicType or xs:untypedAtomic.
107 * Added undo for node revalidation
108 * Optimization for count(collection()) expressions
109 * Fixed bug #867133 (SWIG PHP build failure on Mac OSX)
110 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)
111 * Fixed bug #872799 (validate-in-place can set incorrect types)
112 * Fixed bug #872850 (Serialization of Tumbling Window For fails)
113 * Fixed bug #855715 (Invalid escaped characters in regex not caught)
114 * Fixed bug #862089 (Split binary/xq install directories for modules) by
115 splitting "module path" into separate URI and Library paths
116 * Fixed bug #872502 (validation of the JSON module xqdoc fails)
117 * Fixed bug #897619 (testdriver_mt can not run the XQueryX tests)
118 * Fixed bug #867107 (xqdoc dependency to zorba is wrong)
119 * Fixed bug #897616 (Fix the generation of the XQFTTS report results for
120 W3C)
121
122version 2.0.3
123 * Fixed bug #867662 ("nullptr" warning)
124 * documentation improvements
125
126version 2.0.2
127 * Fixed bug #3401971 (node-by-reference on dynamic collections)
128 * documentation improvements
129 * installer improvements
130 * Fixed bug #3403291 (build for Fedora 15)
131 * Don't install the .so for test modules
132 * Fix for running ctest on Windows
57133
58version 2.0.1134version 2.0.1
59135
60136
=== modified file 'NOTICE.txt'
--- NOTICE.txt 2011-10-19 15:28:51 +0000
+++ NOTICE.txt 2012-02-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +0000
@@ -14,85 +14,100 @@
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
60void52static void
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
63 for (std::vector<std::string>::iterator lIter = lPath.begin();
64 lIter != lPath.end(); ++lIter) {
65 aResult.push_back(*lIter);
66 }
70}67}
7168
72void69void
73ModulePath::getModulePaths(70setPathsOnContext(
74 const ZorbaCMDProperties& aProperties,71 const ZorbaCMDProperties& aProperties,
75 std::vector<String>& aModulePaths)72 StaticContext_t& aStaticCtx)
76{73{
77 std::vector<std::string> lModulePaths; // result vector74 std::vector<String> lPath;
78 std::string lModulePath; // temporary variable for collections paths75 std::string lPathStr, lEnvStr;
7976
80 // 1. add the module paths from the command line properties77 // 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;78 filesystem_path lCWD;
92 lModulePaths.push_back(lCWD.get_path());79
9380 // setModulePaths() *overwrites* the URI path and lib path, so there's no
94 // convert std::string to zorba::String81 // sense in calling both. So if either --module-path or ZORBA_MODULE_PATH
95 convertVector(lModulePaths, aModulePaths);82 // exists, just use those.
83 aProperties.getModulePath(lPathStr);
84 lEnvStr = getPathFromEnvironment("ZORBA_MODULE_PATH");
85 if (lPathStr.length() > 0 || lEnvStr.length() > 0) {
86 tokenizePath(lPathStr, lPath);
87 tokenizePath(lEnvStr, lPath);
88 lPath.push_back(lCWD.get_path());
89 aStaticCtx->setModulePaths(lPath);
90 }
91 else {
92 // Compute and set URI path
93 aProperties.getURIPath(lPathStr);
94 tokenizePath(lPathStr, lPath);
95 lEnvStr = getPathFromEnvironment("ZORBA_URI_PATH");
96 tokenizePath(lEnvStr, lPath);
97 lPath.push_back(lCWD.get_path());
98 aStaticCtx->setURIPath(lPath);
99 lPath.clear();
100
101 // Compute and set lib path
102 aProperties.getLibPath(lPathStr);
103 tokenizePath(lPathStr, lPath);
104 lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH");
105 lPath.push_back(lCWD.get_path());
106 tokenizePath(lEnvStr, lPath);
107 aStaticCtx->setLibPath(lPath);
108 }
96}109}
97110
111} /* namespace ModulePath */
112
98} /* namespace zorba */113} /* namespace zorba */
99114
=== 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-03 01:13:24 +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,14 @@
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
35 std::vector<String>& aDest); 36 }
36
37 static void
38 tokenizeModulePath(const std::string& aModulePath,
39 std::vector<std::string>& aResult);
40
41 static void
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 */37} /* namespace zorba */
5338
54#endif39#endif
5540
=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp 2011-07-11 11:12:23 +0000
+++ bin/zorbacmd.cpp 2012-02-03 01:13:24 +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;
@@ -741,14 +752,14 @@
741752
742 // Start the engine753 // Start the engine
743754
744 timing.startTimer(TimingInfo::INIT_TIMER, 2);755 engineTiming.startTimer(TimingInfo::INIT_TIMER, 2);
745756
746 void* store = zorba::StoreManager::getStore();757 void* store = zorba::StoreManager::getStore();
747758
748 zorba::Zorba* lZorbaInstance = zorba::Zorba::getInstance(store);759 zorba::Zorba* lZorbaInstance = zorba::Zorba::getInstance(store);
749760
750 {761 {
751 timing.stopTimer(TimingInfo::INIT_TIMER, 2);762 engineTiming.stopTimer(TimingInfo::INIT_TIMER, 2);
752763
753 // For each query ...764 // For each query ...
754765
@@ -770,14 +781,14 @@
770 if (asFile)781 if (asFile)
771 {782 {
772 path.resolve_relative ();783 path.resolve_relative ();
773 qfile.reset (new std::ifstream (path.c_str ()));784 qfile.reset(new std::ifstream (path.c_str ()));
774 }785 }
775 else786 else
776 {787 {
777 qfile.reset (new std::istringstream(fURI));788 qfile.reset(new std::istringstream(fURI));
778 }789 }
779790
780 if ( asFile && (!qfile->good() || qfile->eof()) )791 if (asFile && (!qfile->good() || qfile->eof()))
781 {792 {
782 std::cerr << "file {" << fname << "} not found or not readable." << std::endl;793 std::cerr << "file {" << fname << "} not found or not readable." << std::endl;
783 lProperties.printHelp(std::cout);794 lProperties.printHelp(std::cout);
@@ -793,7 +804,8 @@
793 //804 //
794 // Print the query if requested805 // Print the query if requested
795 //806 //
796 if (lProperties.printQuery()) {807 if (lProperties.printQuery())
808 {
797 *lOutputStream << "\nQuery number " << queryNo << " :\n";809 *lOutputStream << "\nQuery number " << queryNo << " :\n";
798 std::copy (std::istreambuf_iterator<char> (*qfile),810 std::copy (std::istreambuf_iterator<char> (*qfile),
799 std::istreambuf_iterator<char> (),811 std::istreambuf_iterator<char> (),
@@ -836,8 +848,10 @@
836 }848 }
837849
838 // Parse the query850 // Parse the query
839 if (lProperties.parseOnly()) {851 if (lProperties.parseOnly())
840 try {852 {
853 try
854 {
841 zorba::XQuery_t lQuery = lZorbaInstance->createQuery();855 zorba::XQuery_t lQuery = lZorbaInstance->createQuery();
842 if (asFile) {856 if (asFile) {
843 lQuery->setFileName(path.get_path());857 lQuery->setFileName(path.get_path());
@@ -845,7 +859,8 @@
845859
846 lQuery->parse (*qfile);860 lQuery->parse (*qfile);
847 }861 }
848 catch (zorba::ZorbaException const& ze) {862 catch (zorba::ZorbaException const& ze)
863 {
849 std::cerr << ze << std::endl;864 std::cerr << ze << std::endl;
850 return 6;865 return 6;
851 }866 }
@@ -853,30 +868,44 @@
853868
854 // Compile and run it if necessary.869 // Compile and run it if necessary.
855 // Print timing information if requested.870 // Print timing information if requested.
856 else if (!debug) {871 else if (!debug)
857 if (compileOnly) {872 {
858 try {873 if (compileOnly)
874 {
875 try
876 {
859 zorba::XQuery_t aQuery = lZorbaInstance->createQuery();877 zorba::XQuery_t aQuery = lZorbaInstance->createQuery();
860 if (asFile) {878 if (asFile)
879 {
861 aQuery->setFileName(path.get_path());880 aQuery->setFileName(path.get_path());
862 }881 }
882
863 aQuery->parse(*qfile);883 aQuery->parse(*qfile);
884
864 qfile->clear();885 qfile->clear();
865 qfile->seekg(0); // go back to the beginning886 qfile->seekg(0); // go back to the beginning
866 } catch (zorba::XQueryException const& qe) {887 }
867 ErrorPrinter::print(qe, std::cerr, lProperties.printErrorsAsXml(), lProperties.indent());888 catch (zorba::XQueryException const& qe)
889 {
890 ErrorPrinter::print(qe,
891 std::cerr,
892 lProperties.printErrorsAsXml(),
893 lProperties.indent());
868 return 6;894 return 6;
869 }895 }
870 }896 }
871897
898 TimingInfo queryTiming(lProperties.multiple());
899
872 int status = compileAndExecute(lZorbaInstance,900 int status = compileAndExecute(lZorbaInstance,
873 lProperties,901 lProperties,
874 lStaticContext,902 lStaticContext,
875 path.get_path(),903 path.get_path(),
876 *qfile,904 *qfile,
877 *lOutputStream,905 *lOutputStream,
878 timing);906 queryTiming);
879 if (status != 0) {907 if (status != 0)
908 {
880 // reset the file handler (in case output option was provided)909 // reset the file handler (in case output option was provided)
881 // in order to delete the created output file910 // in order to delete the created output file
882 lFileStream.reset();911 lFileStream.reset();
@@ -884,21 +913,25 @@
884 return status;913 return status;
885 }914 }
886915
887 if (doTiming) {916 if (doTiming)
888 timing.print(std::cout);917 {
918 queryTiming.print(std::cout);
889 }919 }
890 }920 }
891921
892#ifdef ZORBA_WITH_DEBUGGER922#ifdef ZORBA_WITH_DEBUGGER
893 // Debug the query. Do not allow "compileOnly" flags and inline queries923 // Debug the query. Do not allow "compileOnly" flags and inline queries
894 else if (debug) {924 else if (debug)
895 if (compileOnly) {925 {
926 if (compileOnly)
927 {
896 std::cerr << "cannot debug a query if the compileOnly option is specified"928 std::cerr << "cannot debug a query if the compileOnly option is specified"
897 << std::endl;929 << std::endl;
898 return 7;930 return 7;
899 }931 }
900932
901 if (!asFile) {933 if (!asFile)
934 {
902 std::cerr << "Cannot debug inline queries." << std::endl;935 std::cerr << "Cannot debug inline queries." << std::endl;
903 return 8;936 return 8;
904 }937 }
@@ -908,7 +941,8 @@
908941
909 zorba::XQuery_t lQuery;942 zorba::XQuery_t lQuery;
910943
911 try {944 try
945 {
912 lQuery = lZorbaInstance->createQuery();946 lQuery = lZorbaInstance->createQuery();
913 lQuery->setFileName(lFileName);947 lQuery->setFileName(lFileName);
914 lQuery->setDebugMode(true);948 lQuery->setDebugMode(true);
@@ -927,21 +961,24 @@
927 lHost = "127.0.0.1";961 lHost = "127.0.0.1";
928 }962 }
929963
930 if (lProperties.debug()) {964 Zorba_SerializerOptions lSerOptions =
931 Zorba_SerializerOptions lSerOptions =965 Zorba_SerializerOptions::SerializerOptionsFromStringParams(
932 Zorba_SerializerOptions::SerializerOptionsFromStringParams(966 lProperties.getSerializerParameters());
933 lProperties.getSerializerParameters());967 createSerializerOptions(lSerOptions, lProperties);
934 createSerializerOptions(lSerOptions, lProperties);
935968
936 if (!lProperties.hasNoLogo() && !lProperties.debug()) {969 if (!lProperties.hasNoLogo())
937 std::cout << "Zorba XQuery Debugger Server\n" << copyright_str << std::endl;970 {
938 }971 std::cout << "Zorba XQuery Debugger Server\n" << copyright_str << std::endl;
939 lQuery->debug(*lOutputStream, lSerOptions, lHost, lProperties.getDebugPort());
940 }972 }
973
974 lQuery->debug(*lOutputStream, lSerOptions, lHost, lProperties.getDebugPort());
941 }975 }
942 catch (zorba::XQueryException const& qe)976 catch (zorba::XQueryException const& qe)
943 {977 {
944 ErrorPrinter::print(qe, std::cerr, lProperties.printErrorsAsXml(), lProperties.indent());978 ErrorPrinter::print(qe,
979 std::cerr,
980 lProperties.printErrorsAsXml(),
981 lProperties.indent());
945 return 5;982 return 5;
946 }983 }
947 catch (zorba::ZorbaException const& ze)984 catch (zorba::ZorbaException const& ze)
@@ -958,7 +995,7 @@
958995
959 if (doTiming)996 if (doTiming)
960 {997 {
961 timing.startTimer(TimingInfo::DEINIT_TIMER, 2);998 engineTiming.startTimer(TimingInfo::DEINIT_TIMER, 2);
962 }999 }
9631000
964 lZorbaInstance->shutdown();1001 lZorbaInstance->shutdown();
@@ -966,11 +1003,11 @@
9661003
967 if (doTiming)1004 if (doTiming)
968 {1005 {
969 timing.stopTimer(TimingInfo::DEINIT_TIMER, 2);1006 engineTiming.stopTimer(TimingInfo::DEINIT_TIMER, 2);
9701007
971 std::cout << std::endl << "Engine Shutdown Time : "1008 std::cout << std::endl << "Engine Shutdown Time : "
972 << timing.elapsedDeinitWalltime1009 << engineTiming.elapsedDeinitWalltime
973 << " (user: " << timing.elapsedDeinitCputime << ")"1010 << " (user: " << engineTiming.elapsedDeinitCputime << ")"
974 << " milliseconds" << std::endl;1011 << " milliseconds" << std::endl;
975 }1012 }
976 return 0;1013 return 0;
9771014
=== modified file 'bin/zorbacmdproperties.cpp'
--- bin/zorbacmdproperties.cpp 2011-07-21 19:21:25 +0000
+++ bin/zorbacmdproperties.cpp 2012-02-03 01:13:24 +0000
@@ -166,11 +166,20 @@
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}
174183
175std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const184std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const
176{185{
177186
=== modified file 'bin/zorbacmdproperties.h'
--- bin/zorbacmdproperties.h 2011-06-29 17:25:50 +0000
+++ bin/zorbacmdproperties.h 2012-02-03 01:13:24 +0000
@@ -84,8 +84,14 @@
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
89 bool isDebug(){ return theDebug; }95 bool isDebug(){ return theDebug; }
9096
91 bool hasNoLogo(){ return theNoLogo; }97 bool hasNoLogo(){ return theNoLogo; }
9298
=== modified file 'bin/zorbacmdproperties.txt'
--- bin/zorbacmdproperties.txt 2011-07-04 08:31:01 +0000
+++ bin/zorbacmdproperties.txt 2012-02-03 01:13:24 +0000
@@ -28,7 +28,9 @@
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.")
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").34("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.")35("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.")36("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.")
3537
=== modified file 'bin/zorbacmdproperties_base.h'
--- bin/zorbacmdproperties_base.h 2011-07-04 08:31:01 +0000
+++ bin/zorbacmdproperties_base.h 2012-02-03 01:13:24 +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", "--option", "--trailing-nl", "--stop-words", "--thesaurus", NULL };
38 return result;38 return result;
39 }39 }
40 bool theTiming;40 bool theTiming;
@@ -67,6 +67,8 @@
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;
71 std::vector<std::string> theOption;73 std::vector<std::string> theOption;
72 bool theTrailingNl;74 bool theTrailingNl;
@@ -127,6 +129,8 @@
127 const unsigned int &debugPort () const { return theDebugPort; }129 const unsigned int &debugPort () const { return theDebugPort; }
128 const bool &noLogo () const { return theNoLogo; }130 const bool &noLogo () const { return theNoLogo; }
129 const long &timeout () const { return theTimeout; }131 const long &timeout () const { return theTimeout; }
132 const std::string &uriPath () const { return theUriPath; }
133 const std::string &libPath () const { return theLibPath; }
130 const std::string &modulePath () const { return theModulePath; }134 const std::string &modulePath () const { return theModulePath; }
131 const std::vector<std::string> &option () const { return theOption; }135 const std::vector<std::string> &option () const { return theOption; }
132 const bool &trailingNl () const { return theTrailingNl; }136 const bool &trailingNl () const { return theTrailingNl; }
@@ -262,6 +266,16 @@
262 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }266 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);267 if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d);
264 }268 }
269 else if (strcmp (*argv, "--uri-path") == 0) {
270 int d = 2;
271 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
272 if (*argv == NULL) { result = "No value given for --uri-path option"; break; } init_val (*argv, theUriPath, d);
273 }
274 else if (strcmp (*argv, "--lib-path") == 0) {
275 int d = 2;
276 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
277 if (*argv == NULL) { result = "No value given for --lib-path option"; break; } init_val (*argv, theLibPath, d);
278 }
265 else if (strcmp (*argv, "--module-path") == 0) {279 else if (strcmp (*argv, "--module-path") == 0) {
266 int d = 2;280 int d = 2;
267 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }281 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
@@ -327,11 +341,13 @@
327"--compile-only\nOnly compile (don't execute)\n\n"341"--compile-only\nOnly compile (don't execute)\n\n"
328"--no-serializer\nDo not serialize (discard) result.\n\n"342"--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"343"--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"344"--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"345"--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"346"--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"347"--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"348"--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"
349"--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n"
350"--module-path\nPath (list of directories) to add to both the URI and Library paths.\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"351"--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"352"--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"353"--stop-words\nMapping specifying a stop-words URI to another.\n\n"
338354
=== added file 'cmake_modules/FindLibedit.cmake'
--- cmake_modules/FindLibedit.cmake 1970-01-01 00:00:00 +0000
+++ cmake_modules/FindLibedit.cmake 2012-02-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +0000
@@ -272,12 +272,12 @@
272 IF(NOT ${PROJECT_NAME} STREQUAL "zorba")272 IF(NOT ${PROJECT_NAME} STREQUAL "zorba")
273 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})273 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
274 INSTALL(TARGETS ${module_lib_target}274 INSTALL(TARGETS ${module_lib_target}
275 ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path}275 ${target_type} DESTINATION ${ZORBA_NONCORE_LIB_DIR}/${module_path}
276 COMPONENT ${component_name})276 COMPONENT ${component_name})
277 277
278 ELSE(NOT ${PROJECT_NAME} STREQUAL "zorba")278 ELSE(NOT ${PROJECT_NAME} STREQUAL "zorba")
279 INSTALL(TARGETS ${module_lib_target}279 INSTALL(TARGETS ${module_lib_target}
280 ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path})280 ${target_type} DESTINATION ${ZORBA_CORE_LIB_DIR}/${module_path})
281 ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")281 ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")
282 ENDIF (NOT MODULE_TEST_ONLY)282 ENDIF (NOT MODULE_TEST_ONLY)
283 283
@@ -296,7 +296,7 @@
296 ENDIF (patch_ver)296 ENDIF (patch_ver)
297 ENDIF (MODULE_VERSION)297 ENDIF (MODULE_VERSION)
298 FOREACH (version_infix "" ${version_infixes})298 FOREACH (version_infix "" ${version_infixes})
299 ADD_COPY_RULE ("${SOURCE_FILE}" "${module_path}/${module_filename}"299 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}"
300 "${version_infix}" "" "${MODULE_TEST_ONLY}")300 "${version_infix}" "" "${MODULE_TEST_ONLY}")
301 ENDFOREACH (version_infix)301 ENDFOREACH (version_infix)
302302
@@ -304,7 +304,7 @@
304 IF (module_lib_target)304 IF (module_lib_target)
305 GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)305 GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)
306 GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)306 GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)
307 ADD_COPY_RULE ("${lib_location}" "${module_path}/${lib_filename}"307 ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}"
308 "" "${module_lib_target}" "${MODULE_TEST_ONLY}")308 "" "${module_lib_target}" "${MODULE_TEST_ONLY}")
309 ENDIF (module_lib_target)309 ENDIF (module_lib_target)
310310
@@ -357,27 +357,30 @@
357 ADD_ZORBA_MANIFEST_ENTRY("schema" ${SCHEMA_URI} "")357 ADD_ZORBA_MANIFEST_ENTRY("schema" ${SCHEMA_URI} "")
358 ENDIF (NOT SCHEMA_TEST_ONLY)358 ENDIF (NOT SCHEMA_TEST_ONLY)
359359
360 ADD_COPY_RULE ("${SOURCE_FILE}" "${schema_path}/${schema_filename}"360 ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}"
361 "" "" "${SCHEMA_TEST_ONLY}")361 "" "" "${SCHEMA_TEST_ONLY}")
362362
363ENDMACRO (DECLARE_ZORBA_SCHEMA)363ENDMACRO (DECLARE_ZORBA_SCHEMA)
364364
365# Utility macro for setting up a build rule to copy a file to a365# 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 has366# particular (possibly versioned) file in a shared directory if such a file has
367# not already been output.367# not already been output.
368# FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared
369# directory to place output in (URI_PATH or LIB_PATH).
368# INPUT_FILE: Absolute path to file to copy.370# INPUT_FILE: Absolute path to file to copy.
369# OUTPUT_FILE: Relative path to output file (relative to URI_PATH).371# OUTPUT_FILE: Relative path to output file (relative to URI_PATH).
370# VERSION_ARG: Version; may be "" for non-versioned files.372# VERSION_ARG: Version; may be "" for non-versioned files.
371# DEPEND_TARGET: A CMake target name upon which the copy rule should depend;373# DEPEND_TARGET: A CMake target name upon which the copy rule should depend;
372# may be "".374# may be "".
373# TEST_ONLY: If 1, file is for testcases only; will be copied into375# TEST_ONLY: If 1, file is for testcases only; will be copied into
374# TEST_URI_PATH and will not be installed376# 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)377MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG
378 DEPEND_TARGET TEST_ONLY)
376 # Choose output base directory379 # Choose output base directory
377 IF (${TEST_ONLY} EQUAL 1)380 IF (${TEST_ONLY} EQUAL 1)
378 SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")381 SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH")
379 ELSE (${TEST_ONLY} EQUAL 1)382 ELSE (${TEST_ONLY} EQUAL 1)
380 SET (_output_basedir "${CMAKE_BINARY_DIR}/URI_PATH")383 SET (_output_basedir "${CMAKE_BINARY_DIR}/${FILE_TYPE}_PATH")
381 ENDIF (${TEST_ONLY} EQUAL 1)384 ENDIF (${TEST_ONLY} EQUAL 1)
382385
383 # Compute the modified output filename by inserting VERSION_ARG (if386 # Compute the modified output filename by inserting VERSION_ARG (if
@@ -404,19 +407,27 @@
404 IF (file_found EQUAL -1)407 IF (file_found EQUAL -1)
405 SET_PROPERTY (GLOBAL APPEND PROPERTY "${_dir_sym}-output-files"408 SET_PROPERTY (GLOBAL APPEND PROPERTY "${_dir_sym}-output-files"
406 "${_output_file}")409 "${_output_file}")
407 # Save the input file, output file, and any library dependency410 # Detect whether this is a core URI or not
408 # target for this rule in a global property411 IF (PROJECT_NAME STREQUAL "zorba")
412 SET (_is_core 1)
413 ELSE (PROJECT_NAME STREQUAL "zorba")
414 SET (_is_core 0)
415 ENDIF (PROJECT_NAME STREQUAL "zorba")
416
417 # Save the (input file, output file, any library dependency
418 # target, and whether this is a core or non-core file) for this
419 # rule in a global property
409 SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES420 SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES
410 "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}")421 "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}" "${_is_core}")
411422
412 # For .xq and .xsd files, also set up an INSTALL rule (if not TEST_ONLY).423 # For .xq and .xsd files, also set up an INSTALL rule (if not TEST_ONLY).
413 IF (NOT ${TEST_ONLY} EQUAL 1)424 IF (NOT ${TEST_ONLY} EQUAL 1)
414 IF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")425 IF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")
415 426
416 IF(NOT PROJECT_NAME STREQUAL "zorba")427 IF(NOT _is_core)
417 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME}) 428 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
418 INSTALL (FILES "${INPUT_FILE}"429 INSTALL (FILES "${INPUT_FILE}"
419 DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"430 DESTINATION "${ZORBA_NONCORE_URI_DIR}/${_output_path}"
420 RENAME "${_output_filename}"431 RENAME "${_output_filename}"
421 COMPONENT "${component_name}")432 COMPONENT "${component_name}")
422 433
@@ -434,13 +445,11 @@
434 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_INSTALL_TYPES Full)\n")445 FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_INSTALL_TYPES Full)\n")
435 ENDIF (NOT ${component_name}_cpack) 446 ENDIF (NOT ${component_name}_cpack)
436 447
437 ELSE(NOT PROJECT_NAME STREQUAL "zorba")448 ELSE(NOT _is_core)
438 INSTALL (FILES "${INPUT_FILE}"449 INSTALL (FILES "${INPUT_FILE}"
439 DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"450 DESTINATION "${ZORBA_CORE_URI_DIR}/${_output_path}"
440 RENAME "${_output_filename}")451 RENAME "${_output_filename}")
441 ENDIF(NOT PROJECT_NAME STREQUAL "zorba")452 ENDIF(NOT _is_core)
442
443
444 453
445 ENDIF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")454 ENDIF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")
446 ENDIF (NOT ${TEST_ONLY} EQUAL 1)455 ENDIF (NOT ${TEST_ONLY} EQUAL 1)
@@ -485,16 +494,17 @@
485 IF (POLICY CMP0007)494 IF (POLICY CMP0007)
486 CMAKE_POLICY (SET CMP0007 NEW)495 CMAKE_POLICY (SET CMP0007 NEW)
487 ENDIF (POLICY CMP0007)496 ENDIF (POLICY CMP0007)
488 MESSAGE (STATUS "Creating check_uris target")497 MESSAGE (STATUS "Creating check_core_uris and check_uris targets")
489 GET_PROPERTY (copy_rules GLOBAL PROPERTY ZORBA_URI_FILES)498 GET_PROPERTY (copy_rules GLOBAL PROPERTY ZORBA_URI_FILES)
490 SET (_output_files)499 SET (_output_files)
491 WHILE (copy_rules)500 WHILE (copy_rules)
492 # Pop three items off the list, and set up the corresponding501 # Pop four items off the list, and set up the corresponding
493 # rule502 # rule
494 LIST (GET copy_rules 0 _input_file)503 LIST (GET copy_rules 0 _input_file)
495 LIST (GET copy_rules 1 _output_file)504 LIST (GET copy_rules 1 _output_file)
496 LIST (GET copy_rules 2 _depend_target)505 LIST (GET copy_rules 2 _depend_target)
497 LIST (REMOVE_AT copy_rules 0 1 2)506 LIST (GET copy_rules 3 _is_core)
507 LIST (REMOVE_AT copy_rules 0 1 2 3)
498 SET (_depends "${_input_file}")508 SET (_depends "${_input_file}")
499 IF (_depend_target)509 IF (_depend_target)
500 LIST (APPEND _depends "${_depend_target}")510 LIST (APPEND _depends "${_depend_target}")
@@ -504,12 +514,30 @@
504 "${_input_file}" "${_output_file}"514 "${_input_file}" "${_output_file}"
505 DEPENDS ${_depends}515 DEPENDS ${_depends}
506 COMMENT "Copying ${_input_file} to URI path" VERBATIM)516 COMMENT "Copying ${_input_file} to URI path" VERBATIM)
507 LIST (APPEND _output_files "${_output_file}")517 IF (_is_core)
518 LIST (APPEND _core_output_files "${_output_file}")
519 ELSE (_is_core)
520 LIST (APPEND _noncore_output_files "${_output_file}")
521 ENDIF (_is_core)
508 ENDWHILE (copy_rules)522 ENDWHILE (copy_rules)
509 ADD_CUSTOM_TARGET (check_uris ALL DEPENDS ${_output_files} VERBATIM)523
510 SET_TARGET_PROPERTIES(check_uris PROPERTIES524 # Targets and dependencies:
511 FOLDER "Modules"525 # ALL depends on check_uris; check_uris depends on check_core_uris;
512 )526 # zorbacmd depends on check_core_uris.
527 ADD_CUSTOM_TARGET (check_uris ALL
528 DEPENDS ${_noncore_output_files} VERBATIM)
529 SET_TARGET_PROPERTIES(check_uris PROPERTIES FOLDER "Modules")
530 # Only create check_core_uris target and associated dependencies if
531 # there are any core URIs; there should never be any when building a
532 # standalone module project.
533 LIST (LENGTH _core_output_files _num_core)
534 IF (_num_core GREATER 0)
535 ADD_CUSTOM_TARGET (check_core_uris
536 DEPENDS ${_core_output_files} VERBATIM)
537 ADD_DEPENDENCIES(check_uris check_core_uris)
538 ADD_DEPENDENCIES(zorbacmd check_core_uris)
539 SET_TARGET_PROPERTIES(check_core_uris PROPERTIES FOLDER "Modules")
540 ENDIF (_num_core GREATER 0)
513 SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)541 SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)
514542
515 #add 'xqdoc' and 'xqdoc-xml' targets543 #add 'xqdoc' and 'xqdoc-xml' targets
@@ -695,7 +723,7 @@
695 COMMENT "Building XQDoc XML documentation ..."723 COMMENT "Building XQDoc XML documentation ..."
696 )724 )
697 MESSAGE(STATUS " added target xqdoc-xml")725 MESSAGE(STATUS " added target xqdoc-xml")
698 ADD_DEPENDENCIES(xqdoc-xml zorba_simplestore)726 ADD_DEPENDENCIES(xqdoc-xml zorbacmd check_core_uris)
699727
700 SET_TARGET_PROPERTIES (xqdoc-xml PROPERTIES728 SET_TARGET_PROPERTIES (xqdoc-xml PROPERTIES
701 EXCLUDE_FROM_DEFAULT_BUILD 1729 EXCLUDE_FROM_DEFAULT_BUILD 1
702730
=== modified file 'config/CMakeLists.txt'
--- config/CMakeLists.txt 2011-09-08 19:19:54 +0000
+++ config/CMakeLists.txt 2012-02-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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-03 01:13:24 +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)
42{42{
43 XQuery_t lQuery = aZorba->compileQuery("1+2");43 XQuery_t lQuery = aZorba->compileQuery("1+2");
4444
45 Iterator_t lIterator = lQuery->iterator();45 Iterator_t lIterator = lQuery->iterator();
46 lIterator->open();46 lIterator->open();
@@ -53,7 +53,7 @@
5353
54 lIterator->close();54 lIterator->close();
5555
56 return true;56 return true;
57}57}
5858
5959
@@ -61,7 +61,7 @@
61example_3(Zorba* aZorba)61example_3(Zorba* aZorba)
62{62{
6363
64 XQuery_t lQuery = aZorba->compileQuery("1 div 0"); 64 XQuery_t lQuery = aZorba->compileQuery("1 div 0");
65 try {65 try {
66 std::cout << lQuery << std::endl;66 std::cout << lQuery << std::endl;
67 } catch ( ZorbaException& e ) {67 } catch ( ZorbaException& e ) {
@@ -69,7 +69,7 @@
69 return true;69 return true;
70 }70 }
7171
72 return false;72 return false;
73}73}
7474
7575
@@ -125,9 +125,7 @@
125bool125bool
126example_7()126example_7()
127{127{
128
129 std::cout << Zorba::version() << std::endl;128 std::cout << Zorba::version() << std::endl;
130
131 return true;129 return true;
132}130}
133131
@@ -246,7 +244,8 @@
246bool244bool
247example_12(Zorba* aZorba)245example_12(Zorba* aZorba)
248{246{
249 XQuery_t lQuery = aZorba->compileQuery("<a><b attr='1'/><b attr='2'/></a>");247 XQuery_t lQuery = aZorba->compileQuery
248 ("<a xmlns:foo='http://www.zorba-xquery.com/'><b attr='1' xmlns:bar='http://www.zorba-xquery.com/uri2'/><b attr='2'/></a>");
250249
251 Iterator_t lIterator = lQuery->iterator();250 Iterator_t lIterator = lQuery->iterator();
252 lIterator->open();251 lIterator->open();
@@ -263,16 +262,24 @@
263 Item lNodeName;262 Item lNodeName;
264 lChild.getNodeName(lNodeName);263 lChild.getNodeName(lNodeName);
265 std::cout << "node name " << lNodeName.getStringValue() << std::endl;264 std::cout << "node name " << lNodeName.getStringValue() << std::endl;
265
266 Iterator_t lAttrIter = lChild.getAttributes();266 Iterator_t lAttrIter = lChild.getAttributes();
267
268 lAttrIter->open();267 lAttrIter->open();
269
270 Item lAttr;268 Item lAttr;
271 while (lAttrIter->next(lAttr)) 269 while (lAttrIter->next(lAttr))
272 {270 {
273 std::cout << " attribute value " << lAttr.getStringValue() << std::endl;271 std::cout << " attribute value " << lAttr.getStringValue() << std::endl;
274 }272 }
275 lAttrIter->close();273 lAttrIter->close();
274
275 NsBindings lBindings;
276 lChild.getNamespaceBindings(lBindings,
277 store::StoreConsts::ONLY_LOCAL_NAMESPACES);
278 for (NsBindings::const_iterator ite = lBindings.begin();
279 ite != lBindings.end(); ++ite) {
280 std::cout << " namespace binding " << ite->first
281 << "->" << ite->second << std::endl;
282 }
276 }283 }
277 lChildIter->close();284 lChildIter->close();
278 }285 }
279286
=== modified file 'doc/php/CMakeLists.txt'
--- doc/php/CMakeLists.txt 2011-06-20 12:44:21 +0000
+++ doc/php/CMakeLists.txt 2012-02-03 01:13:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2006-2008 The FLWOR Foundation.1# Copyright 2006-2012 The FLWOR Foundation.
2# 2#
3# Licensed under the Apache License, Version 2.0 (the "License");3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.4# you may not use this file except in compliance with the License.
55
=== modified file 'doc/php/examples/CMakeLists.txt'
--- doc/php/examples/CMakeLists.txt 2011-08-19 00:03:31 +0000
+++ doc/php/examples/CMakeLists.txt 2012-02-03 01:13:24 +0000
@@ -1,4 +1,4 @@
1# Copyright 2006-2008 The FLWOR Foundation.1# Copyright 2006-2012 The FLWOR Foundation.
2# 2#
3# Licensed under the Apache License, Version 2.0 (the "License");3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.4# you may not use this file except in compliance with the License.
@@ -20,14 +20,24 @@
20 MESSAGE(STATUS "PHP Path:" ${phpPath})20 MESSAGE(STATUS "PHP Path:" ${phpPath})
21 SET(phpExtensionPath ${CMAKE_BINARY_DIR}/swig/php)21 SET(phpExtensionPath ${CMAKE_BINARY_DIR}/swig/php)
22 MESSAGE(STATUS "PHP Extension Path: " ${phpExtensionPath})22 MESSAGE(STATUS "PHP Extension Path: " ${phpExtensionPath})
23 SET(phpIncludePath ${CMAKE_BINARY_DIR}/swig/php)
24 MESSAGE(STATUS "PHP Include Path: " ${phpExtensionPath})
23 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/php.ini.in ${CMAKE_CURRENT_BINARY_DIR}/php.ini)25 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/php.ini.in ${CMAKE_CURRENT_BINARY_DIR}/php.ini)
24 MESSAGE(STATUS "Configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/php.ini)26 MESSAGE(STATUS "Configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/php.ini)
25 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/simple.php.in ${CMAKE_CURRENT_BINARY_DIR}/simple.php)27 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/simple.php.in ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
26 MESSAGE(STATUS "Simple configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)28 MESSAGE(STATUS "Simple configuration file: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
27 ADD_TEST("php" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php)29 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/test.php.in ${CMAKE_CURRENT_BINARY_DIR}/test.php)
30 MESSAGE(STATUS "PHP test file configured: " ${CMAKE_CURRENT_BINARY_DIR}/test.php)
31 ADD_TEST("php1" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
28 MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)32 MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/simple.php)
29 33 ADD_TEST("php2" ${PHP5_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/test.php)
30 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/simple.php34
35 EXPECTED_FAILURE(php2 918592)
36
37 MESSAGE(STATUS "Installing: " ${CMAKE_CURRENT_BINARY_DIR}/test.php)
38
39
40 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/simple.php ${CMAKE_CURRENT_BINARY_DIR}/test.php
31 COMPONENT "php_examples"41 COMPONENT "php_examples"
32 DESTINATION42 DESTINATION
33 share/doc/zorba-${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER}/php/examples)43 share/doc/zorba-${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER}/php/examples)
3444
=== modified file 'doc/php/examples/php.ini.in'
--- doc/php/examples/php.ini.in 2009-10-30 16:34:37 +0000
+++ doc/php/examples/php.ini.in 2012-02-03 01:13:24 +0000
@@ -1,2 +1,3 @@
1enable_dl=On1enable_dl=On
2extension_dir=@phpExtensionPath@2extension_dir=@phpExtensionPath@
3include_path=".:@phpIncludePath@"
3\ No newline at end of file4\ No newline at end of file
45
=== modified file 'doc/php/examples/simple.php.in'
--- doc/php/examples/simple.php.in 2011-08-04 02:14:56 +0000
+++ doc/php/examples/simple.php.in 2012-02-03 01:13:24 +0000
@@ -1,6 +1,6 @@
1<?php1<?php
2/*2/*
3 * Copyright 2006-2008 The FLWOR Foundation.3 * Copyright 2006-2012 The FLWOR Foundation.
4 * 4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.6 * you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
14 * See the License for the specific language governing permissions and14 * See the License for the specific language governing permissions and
15 * limitations under the License.15 * limitations under the License.
16 */16 */
17require '@phpPath@/zorba_api_wrapper.php';17require '@phpPath@/Zorba/zorba_api_wrapper.php';
1818
19function example_1(Zorba $aZorba)19function example_1(Zorba $aZorba)
20{20{
2121
=== added file 'doc/php/examples/test.php.in'
--- doc/php/examples/test.php.in 1970-01-01 00:00:00 +0000
+++ doc/php/examples/test.php.in 2012-02-03 01:13:24 +0000
@@ -0,0 +1,120 @@
1<?php
2/*
3 * Copyright 2006-2012 The FLWOR Foundation.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17require '@phpPath@/Zorba/XQueryProcessor.php';
18
19function omitXMLDecl($xml)
20{
21 $xml = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '', $xml);
22 $xml = trim($xml);
23 return $xml;
24}
25
26function assertEquality($test, $reference, $label)
27{
28 $test = omitXMLDecl($test);
29 echo "=====================================\n";
30 var_dump($test);
31 var_dump($reference);
32 if($test != $reference) {
33 throw new Exception(
34 "Test "
35 . $label
36 . " failed. Result:\n"
37 . $test
38 . "\nDoesn't match reference:\n"
39 . $reference
40 );
41 }
42}
43/* Test 1 */
44$xquery = new XQueryProcessor();
45$xquery->importQuery('1+1');
46$result = $xquery->execute();
47assertEquality($result, '2', "1+1");
48
49/* Test 2 */
50$query = '
51declare variable $foo as xs:string external;
52declare variable $bar as xs:integer external;
53declare variable $doc1 as document-node() external;
54declare variable $doc2-str as xs:string external;
55declare variable $doc2 as document-node() := parse-xml($doc2-str);
56
57$foo, $bar, $doc1 , $doc2
58';
59
60$xquery->importQuery($query);
61
62$xquery->setVariable("foo", "bar");
63$xquery->setVariable("bar", 3);
64
65$doc = simplexml_load_string('<root />');
66$xquery->setVariable("doc1", $doc);
67
68$doc = "<root />";
69$xquery->setVariable("doc2-str", $doc);
70
71$result = trim($xquery->execute());
72assertEquality($result, "bar 3<root/><root/>", "Test PHP Types Mapping");
73
74/* Test 3 */
75$xquery->importQuery("(1, 2, <foo bar='bar' />)");
76$it = $xquery->getIterator();
77
78foreach($it as $pos => $value) {
79 switch($pos) {
80 case 0:
81 assertEquality($value, "1", "Consume the item at position {$pos}");
82 break;
83 case 1:
84 assertEquality($value, "2", "Consume the item at position {$pos}");
85 break;
86 case 3:
87 assertEquality($value, '<foo bar="bar"/>', "Consume the item at position {$pos}");
88 break;
89 }
90}
91
92//Let's do it again by leveraging the SPL IteratorAggregate
93foreach($xquery as $pos => $value) {
94 switch($pos) {
95 case 0:
96 assertEquality($value, "1", "Consume the item at position {$pos}");
97 break;
98 case 1:
99 assertEquality($value, "2", "Consume the item at position {$pos}");
100 break;
101 case 3:
102 assertEquality($value, '<foo bar="bar"/>', "Consume the item at position {$pos}");
103 break;
104 }
105}
106
107//Try the same query with execute
108$result = $xquery->execute();
109assertEquality($result, "1 2<foo bar=\"bar\"/>", "Execute To URI");
110
111/* Test 4 */
112$xquery->importQueryFromURI("@phpPath@/test.xq");
113$result = $xquery->execute();
114assertEquality($result, "2", "Test importQueryFromURI");
115
116/* Test 5 */
117//$xquery->importQueryFromURI("http://zorba.s3.amazonaws.com/test.xq");
118//$result = $xquery->execute();
119//assertEquality($result, "2", "Test importQueryFromURI");
120?>
0121
=== modified file 'doc/php/examples/zorba_api.php'
--- doc/php/examples/zorba_api.php 2010-01-27 13:25:24 +0000
+++ doc/php/examples/zorba_api.php 2012-02-03 01:13:24 +0000
@@ -1,6 +1,6 @@
1<?php1<?php
2/*2/*
3 * Copyright 2006-2008 The FLWOR Foundation.3 * Copyright 2006-2012 The FLWOR Foundation.
4 * 4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.6 * you may not use this file except in compliance with the License.
77
=== modified file 'doc/zorba/commandline.dox'
--- doc/zorba/commandline.dox 2011-07-24 22:28:31 +0000
+++ doc/zorba/commandline.dox 2012-02-03 01:13:24 +0000
@@ -112,8 +112,14 @@
112--timeout112--timeout
113Specify a timeout in seconds. After the specified time, the execution of the query will be aborted.113Specify a timeout in seconds. After the specified time, the execution of the query will be aborted.
114114
115--uri-path
116URI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.
117
118--lib-path
119Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.
120
115--module-path121--module-path
116Module paths added to the built-in resolver, i.e. where module imports are looking for modules.122Path (list of directories) to add to both the URI and Library paths.
117123
118--option124--option
119Set 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=value125Set 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
120126
=== modified file 'doc/zorba/conformance.dox'
--- doc/zorba/conformance.dox 2011-09-06 16:39:46 +0000
+++ doc/zorba/conformance.dox 2012-02-03 01:13:24 +0000
@@ -344,18 +344,18 @@
344 </tr>344 </tr>
345 <tr bgcolor="lightcyan">345 <tr bgcolor="lightcyan">
346 <td bgcolor="lightcyan">Minimal Conformance</td>346 <td bgcolor="lightcyan">Minimal Conformance</td>
347 <td align="center" bgcolor="palegreen">384/429<br />89.51%</td>347 <td align="center" bgcolor="palegreen">385/429<br />89.74%</td>
348 <td align="center" bgcolor="coral">24/429<br />5.59%</td>348 <td align="center" bgcolor="palegreen">374/429<br />87.18%</td>
349 </tr>349 </tr>
350 <tr bgcolor="lightcyan">350 <tr bgcolor="lightcyan">
351 <td bgcolor="lightcyan">Optional Features</td>351 <td bgcolor="lightcyan">Optional Features</td>
352 <td align="center" bgcolor="palegreen">106/125<br />84.8%</td>352 <td align="center" bgcolor="palegreen">106/125<br />84.8%</td>
353 <td align="center" bgcolor="coral">0/125<br />0%</td>353 <td align="center" bgcolor="palegreen">97/125<br />77.6%</td>
354 </tr>354 </tr>
355 <tr bgcolor="lightcyan">355 <tr bgcolor="lightcyan">
356 <td bgcolor="lightcyan">Use Cases</td>356 <td bgcolor="lightcyan">Use Cases</td>
357 <td align="center" bgcolor="palegreen">121/135<br />89.63%</td>357 <td align="center" bgcolor="palegreen">121/135<br />89.63%</td>
358 <td align="center" bgcolor="coral">0/135<br />0%</td>358 <td align="center" bgcolor="palegreen">103/135<br />76.3%</td>
359 </tr>359 </tr>
360 <tr bgcolor="lightcyan">360 <tr bgcolor="lightcyan">
361 <td bgcolor="lightcyan">Consistency in XQFTTS Catalog</td>361 <td bgcolor="lightcyan">Consistency in XQFTTS Catalog</td>
362362
=== modified file 'doc/zorba/conformanceXQFTTS.dox'
--- doc/zorba/conformanceXQFTTS.dox 2011-09-06 16:21:54 +0000
+++ doc/zorba/conformanceXQFTTS.dox 2012-02-03 01:13:24 +0000
@@ -1,8 +1,8 @@
1/** \page conformanceXQFTTS W3C XQuery and XPath Full Text 1.0 Conformance1/** \page conformanceXQFTTS W3C XQuery and XPath Full Text 1.0 Conformance
22
3Zorba achieves 89.51% on minimal conformance (and 84.8% on Optional Features) for the W3C XPath Full Text 1.0 Test Suite.3 Zorba achieves 89.74% on minimal conformance (84.8% on Optional Features) for the W3C XPath Full Text 1.0 Test Suite.
4Please see the table below for more details.4
55Please see the table below for more details.
6<table bgcolor="lightcyan">6<table bgcolor="lightcyan">
7 <tr>7 <tr>
8 <td>W3C XQuery and XPath Full Text 1.0 features</td>8 <td>W3C XQuery and XPath Full Text 1.0 features</td>
@@ -27,7 +27,7 @@
27 <tr bgcolor="lightcyan">27 <tr bgcolor="lightcyan">
28 <td bgcolor="lightcyan">    Section 2.2.2</td>28 <td bgcolor="lightcyan">    Section 2.2.2</td>
29 <td align="center" bgcolor="mediumseagreen">4/4</td>29 <td align="center" bgcolor="mediumseagreen">4/4</td>
30 <td align="center" bgcolor="coral">0/4</td>30 <td align="center" bgcolor="mediumseagreen">4/4</td>
31 </tr>31 </tr>
32 <tr bgcolor="lightcyan">32 <tr bgcolor="lightcyan">
33 <td bgcolor="lightcyan">    Section 2.3</td>33 <td bgcolor="lightcyan">    Section 2.3</td>
@@ -42,27 +42,27 @@
42 <tr bgcolor="lightcyan">42 <tr bgcolor="lightcyan">
43 <td bgcolor="lightcyan">    Section 3.2</td>43 <td bgcolor="lightcyan">    Section 3.2</td>
44 <td align="center" bgcolor="palegreen">4/5</td>44 <td align="center" bgcolor="palegreen">4/5</td>
45 <td align="center" bgcolor="coral">0/5</td>45 <td align="center" bgcolor="palegreen">4/5</td>
46 </tr>46 </tr>
47 <tr bgcolor="lightcyan">47 <tr bgcolor="lightcyan">
48 <td bgcolor="lightcyan">    Section 3.3</td>48 <td bgcolor="lightcyan">    Section 3.3</td>
49 <td align="center" bgcolor="mediumseagreen">2/2</td>49 <td align="center" bgcolor="mediumseagreen">2/2</td>
50 <td align="center" bgcolor="coral">0/2</td>50 <td align="center" bgcolor="mediumseagreen">2/2</td>
51 </tr>51 </tr>
52 <tr bgcolor="lightcyan">52 <tr bgcolor="lightcyan">
53 <td bgcolor="lightcyan">    Section 3.4</td>53 <td bgcolor="lightcyan">    Section 3.4</td>
54 <td align="center" bgcolor="mediumseagreen">2/2</td>54 <td align="center" bgcolor="mediumseagreen">2/2</td>
55 <td align="center" bgcolor="coral">0/2</td>55 <td align="center" bgcolor="mediumseagreen">2/2</td>
56 </tr>56 </tr>
57 <tr bgcolor="lightcyan">57 <tr bgcolor="lightcyan">
58 <td bgcolor="lightcyan">    Section 3.4.1</td>58 <td bgcolor="lightcyan">    Section 3.4.1</td>
59 <td align="center" bgcolor="mediumseagreen">1/1</td>59 <td align="center" bgcolor="mediumseagreen">1/1</td>
60 <td align="center" bgcolor="coral">0/1</td>60 <td align="center" bgcolor="mediumseagreen">1/1</td>
61 </tr>61 </tr>
62 <tr bgcolor="lightcyan">62 <tr bgcolor="lightcyan">
63 <td bgcolor="lightcyan">    Section 3.4.2</td>63 <td bgcolor="lightcyan">    Section 3.4.2</td>
64 <td align="center" bgcolor="mediumseagreen">4/4</td>64 <td align="center" bgcolor="mediumseagreen">4/4</td>
65 <td align="center" bgcolor="coral">0/4</td>65 <td align="center" bgcolor="mediumseagreen">4/4</td>
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: