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

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

Commit message

Testing schema-tools which includes xmlbeans.

Description of the change

Testing schema-tools which includes xmlbeans.

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

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

10625. By Cezar Andrei <email address hidden>

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

10626. By Cezar Andrei <email address hidden>

Fix for Win32 code.

10627. By Cezar Andrei <email address hidden>

Adding win32 dirent.h implementation.

10628. By Cezar Andrei <email address hidden>

Merge Rodolfo's changes.

10629. By Cezar Andrei <email address hidden>

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

10630. By Cezar Andrei <email address hidden>

Enable schema-tools module for merging into experimental.

10631. By Cezar Andrei <email address hidden>

Merge from trunk.

10632. By Cezar Andrei <email address hidden>

Refactor DymanicLoader::loadModule.
Remove commented macro.

10633. By Cezar Andrei <email address hidden>

Revert store_properties.h to trunk version.

10634. By Cezar Andrei <email address hidden>

Added dirent.h entry in NOTICE.xml.

10635. By Cezar Andrei <email address hidden>

Update NOTICE.txt

10636. By Cezar Andrei <email address hidden>

Remove java version output and comment.

10637. By Cezar Andrei <email address hidden>

Ficx spelling.

10638. By Cezar Andrei <email address hidden>

Rename getProperties to getPropertiesGlobal.

10639. By Cezar Andrei <email address hidden>

Remove schema-tools module from ExternalModules.conf

10640. By Cezar Andrei <email address hidden>

Fix ExternalModule.conf to the latest in trunk.

10641. By Cezar Andrei <email address hidden>

Fix wrong merge of options.

10642. By Cezar Andrei <email address hidden>

Merge from trunk.

10643. By Cezar Andrei <email address hidden>

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

10644. By Cezar Andrei <email address hidden>

Fix indentation src/system/zorba_properties.h.

10645. By Cezar Andrei <email address hidden>

Include schema-tools as external module for experimental.

10646. By Cezar Andrei <email address hidden>

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

10647. By Chris Hillery

Merge from trunk.

10648. By Chris Hillery

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

10649. By Chris Hillery

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

10650. By Chris Hillery

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

10651. By Chris Hillery

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

10652. By Chris Hillery

Work around CMake bug with LIST(REMOVE_DUPLICATES).

10653. By Chris Hillery

Add util-jvm module.

10654. By Cezar Andrei <email address hidden>

Merge from trunk.

10655. By Cezar Andrei <email address hidden>

Add entries in ChangeLog.

10656. By Chris Hillery

Removing orphaned JVM classpath fields from static_context.

10657. By Chris Hillery

Merge from trunk.

10658. By Chris Hillery

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

10659. By Chris Hillery

Merge from trunk; remove erroneous swig merge.

10660. By Chris Hillery

Merge from trunk.

10661. By Chris Hillery

Merge from trunk.

10662. By Chris Hillery

Merge from trunk.

10663. By Chris Hillery

Unwanted file.

Unmerged revisions

10663. By Chris Hillery

Unwanted file.

10662. By Chris Hillery

Merge from trunk.

10661. By Chris Hillery

Merge from trunk.

10660. By Chris Hillery

Merge from trunk.

10659. By Chris Hillery

Merge from trunk; remove erroneous swig merge.

10658. By Chris Hillery

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

10657. By Chris Hillery

Merge from trunk.

10656. By Chris Hillery

Removing orphaned JVM classpath fields from static_context.

10655. By Cezar Andrei <email address hidden>

Add entries in ChangeLog.

10654. By Cezar Andrei <email address hidden>

Merge from trunk.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeConfiguration.txt'
2--- CMakeConfiguration.txt 2011-09-16 19:55:59 +0000
3+++ CMakeConfiguration.txt 2012-02-22 17:11:27 +0000
4@@ -70,10 +70,6 @@
5 SET(ZORBA_FOR_ONE_THREAD_ONLY OFF CACHE BOOL "compile zorba for single threaded use")
6 MESSAGE(STATUS "ZORBA_FOR_ONE_THREAD_ONLY: " ${ZORBA_FOR_ONE_THREAD_ONLY})
7
8-# by default the zorba command line client is deactivated until it gets to a more stable and userfriendly state
9-SET(ZORBA_WITH_DEBUGGER_CLIENT OFF CACHE BOOL "build and install zorbas command line debugger client")
10-MESSAGE(STATUS "ZORBA_WITH_DEBUGGER_CLIENT: " ${ZORBA_WITH_DEBUGGER_CLIENT})
11-
12 IF (DEFINED UNIX)
13 IF (NOT DEFINED ZORBA_HAVE_PTHREAD_H AND NOT DEFINED ZORBA_FOR_ONE_THREAD_ONLY)
14 MESSAGE(FATAL_ERROR "pthread is not available")
15
16=== modified file 'CMakeLists.txt'
17--- CMakeLists.txt 2011-10-09 13:56:39 +0000
18+++ CMakeLists.txt 2012-02-22 17:11:27 +0000
19@@ -417,13 +417,35 @@
20
21 # zorba versioning
22 SET(ZORBA_MAJOR_NUMBER "2")
23-SET(ZORBA_MINOR_NUMBER "0")
24-SET(ZORBA_PATCH_NUMBER "1")
25+SET(ZORBA_MINOR_NUMBER "1")
26+SET(ZORBA_PATCH_NUMBER "0")
27 SET(ZORBA_VERSION ${ZORBA_MAJOR_NUMBER}.${ZORBA_MINOR_NUMBER}.${ZORBA_PATCH_NUMBER})
28 MESSAGE(STATUS "Zorba version number: ${ZORBA_VERSION}")
29-SET(ZORBA_MODULES_INSTALL_DIR "share/zorba-${ZORBA_VERSION}/modules"
30- CACHE STRING "Path (relative to installdir) to modules" FORCE)
31-MARK_AS_ADVANCED(ZORBA_MODULES_INSTALL_DIR)
32+
33+SET(ZORBA_LIB_DIRNAME "lib" CACHE STRING
34+ "directory name for libs (may want to set to 'lib64' on 64-bit Linux platforms)")
35+
36+# Directories for modules and schemas. "Core" are those which are
37+# shipped with Zorba and must be present for correct Zorba
38+# functionality. "Non-core" are developed independently of Zorba and
39+# have different version lifecycles.
40+#
41+# URI dir is for things resolved by URI - specifically modules (.xq
42+# files) and schemas (.xsd files) - which are platform-
43+# independent. Lib dir is for platform-specific files, specifically
44+# shared libraries for module external functions.
45+SET(ZORBA_NONCORE_URI_DIR "share/zorba/uris"
46+ CACHE STRING "Path (relative to installdir) to non-core modules/schemas")
47+MARK_AS_ADVANCED(ZORBA_NONCORE_URI_DIR)
48+SET(ZORBA_CORE_URI_DIR "${ZORBA_NONCORE_URI_DIR}/core/${ZORBA_VERSION}"
49+ CACHE STRING "Path (relative to installdir) to core modules/schemas")
50+MARK_AS_ADVANCED(ZORBA_CORE_URI_DIR)
51+SET(ZORBA_NONCORE_LIB_DIR "${ZORBA_LIB_DIRNAME}/zorba"
52+ CACHE STRING "Path (relative to installdir) to non-core libraries")
53+MARK_AS_ADVANCED(ZORBA_NONCORE_LIB_DIR)
54+SET(ZORBA_CORE_LIB_DIR "${ZORBA_NONCORE_LIB_DIR}/core/${ZORBA_VERSION}"
55+ CACHE STRING "Path (relative to installdir) to core libraries")
56+MARK_AS_ADVANCED(ZORBA_CORE_LIB_DIR)
57
58 # add compiler variables
59 ADD_DEFINITIONS(${DEFINITIONS})
60@@ -460,7 +482,7 @@
61 SET(ZORBA_CMAKE_DIR "cmake" CACHE STRING
62 "Relative path to CMake files in Zorba installation")
63 ELSE (WIN32)
64- SET(ZORBA_CMAKE_DIR "share/zorba-${ZORBA_VERSION}/cmake" CACHE STRING
65+ SET(ZORBA_CMAKE_DIR "share/cmake/zorba-${ZORBA_VERSION}" CACHE STRING
66 "Relative path to CMake files in Zorba installation")
67 ENDIF (WIN32)
68
69@@ -476,14 +498,15 @@
70 # Subdirectory ordering: We need to include "test" before "config" so
71 # ZorbaConfig knows about testdriver. We need to include "config"
72 # before "modules" so external modules will be able to find
73-# ZorbaConfig.cmake.
74+# ZorbaConfig.cmake. We need to include "modules" before "include" so
75+# config.h can know eg. whether we found CURL.
76
77 ADD_SUBDIRECTORY(test)
78 ADD_SUBDIRECTORY(config)
79-ADD_SUBDIRECTORY(include)
80 ADD_SUBDIRECTORY(doc)
81 ADD_SUBDIRECTORY(schemas)
82 ADD_SUBDIRECTORY(modules)
83+ADD_SUBDIRECTORY(include)
84
85 ADD_DEFINITIONS(-Dzorba_EXPORTS)
86 ADD_SUBDIRECTORY(src)
87@@ -534,4 +557,4 @@
88 # This dependency is zorba-only related, which is why it's added here
89 # and not within zorba-modules, which is for general use in other
90 # non-zorba modules.
91-ADD_DEPENDENCIES(check_uris gen_diag_modules)
92+ADD_DEPENDENCIES(check_core_uris gen_diag_modules)
93
94=== modified file 'CPackSourceConfig.cmake.in'
95--- CPackSourceConfig.cmake.in 2009-10-30 16:24:51 +0000
96+++ CPackSourceConfig.cmake.in 2012-02-22 17:11:27 +0000
97@@ -19,7 +19,7 @@
98
99 SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
100 SET(CPACK_GENERATOR "TGZ;TZ")
101-SET(CPACK_IGNORE_FILES "test/coverity/;dist/;_CPack_Packages/;build/;build./;CVS/;/\\.svn/;\\.swp$;\\.#;/#")
102+SET(CPACK_IGNORE_FILES "test/coverity/;dist/;_CPack_Packages/;build/;build./;CVS/;/\\.svn/;\\.swp$;\\.#;/#;\\.bzr/")
103 SET(CPACK_INSTALLED_DIRECTORIES "@CMAKE_SOURCE_DIR@;/")
104 SET(CPACK_INSTALL_CMAKE_PROJECTS "")
105 SET(CPACK_MODULE_PATH "")
106
107=== modified file 'ChangeLog'
108--- ChangeLog 2011-10-20 23:05:55 +0000
109+++ ChangeLog 2012-02-22 17:11:27 +0000
110@@ -1,13 +1,72 @@
111 Zorba - The XQuery Processor
112
113-version 2.x
114-
115- * Custom Full-text thesaurus.
116- * Fixed bug #3401971 (node-by-reference on dynamic collections)
117+version 2.2
118+
119+ * Fixed bug 923015 (clone() not implemented for full-text expressions)
120+ * No-copy optimization: avoids copying nodes during node-constructor expressions.
121+ * Added external function annotations %ann:propagates-input-nodes and
122+ %ann:must-copy-input-nodes to be used by the no-copy optimization.
123+ * Caching of results for recursive functions with atomic parameter and return types.
124+ * Added %ann:cache and %ann:no-cache to enable or disable caching of results of functions with atomic parameter and return types.
125+ * Fixed bug 917923 (bug in copying outer var values into the eval dynamic context)
126+ * Fixed bug 924063 (sentence is incorrectly incremented when token characters end without sentence terminator)
127+ * Fixed bug 909126 (bug in cloning of var_expr)
128+ * Fixed bug in destruction of exit_catcher_expr
129+ * Types-related optimizations for runtime operators (comparisons, FnBoolean, Or, And,
130+ Compare, instance-of, cast, castable, treat, promote).
131+ * Fixed bug #911585 (management of variables during eval)
132+ * Fixed bug #866423 (fn:empty and fn:exists iterators must reset their input in
133+ case of early-out)
134+ * Added index management function to the C++ api's StaticCollectionManager.
135+ * Fixed bug #872288 (reset recursive flag during node rename)
136+ * Fixed bug #905041 (allow for the default element and function namespaces to be
137+ set multiple times via the c++ api).
138+ * Fixed bug #907872 (segfault when returning an input ItemSequence from an external function).
139+ * Fixed bug #905050 (setting and getting the context item type via the c++ api).
140+ * Added createDayTimeDuration, createYearMonthDuration, createDocumentNode, createCommentNode, createPiNode to api's ItemFactory.
141+ * Added split function to the string module that allows for streamable tokenization but doesn't have regular expression
142+ support.
143+ * Fixed bug involving positional var and groupby
144+ * Optimization: preallocate and reuse temp sequence iterator for LetVarITerator
145+ and CtxVarIterator.
146+ * Optimization: enhanced push-down of positional predicate into LetVarITerator
147+ and CtxVarIterator.
148+ * zerr is not predeclared anymore to be http://www.zorba-xquery.com/errors
149+ * Add new XQuery interface for the PHP bindings.
150+ * Added API method Item::getNamespaceBindings().
151+ * Fixed bug #917981 (disallow declaring same module twice).
152+ * Added API method StaticContext::getNamespaceBindings() (see bug #905035)
153+ * Deprecated StaticContext:getNamespaceURIByPrefix()
154+ * Fixed bug 921624 (slow queries with bogus example.com schema URIs)
155+ * Fixed bug #918211 (xqueryx fulltext w3c conformance generation)
156+ * Fixed bug #918157 (Add XQFTTS to validation queue)
157+ * Fixed bug with unversioned modules with C++ external functions
158+
159+version 2.1
160+
161+New Features:
162+ * New node-position module. This module allows to obtain a representation of a node position, which
163+ can be used to assess structural relationships with other nodes.
164+ * New node-reference module. References can be obtained for any node, and
165+ different nodes cannot have the same identifier.
166+ * Custom Full-text thesaurus using Zorba URI resolver mechanism.
167+ * Modified C++ API to add isSequential, getExternalVariables, isBoundContextItem and
168+ isBoundExternalVariable Functions
169+ * Collection allows to retrieve information about the type
170+ and the annotations of a static collection.
171+ * Implemented the probe-index-range-value for general indexes
172+ * Added ExternalFunctionParameter class to be registered in the DynamicContext
173+ * New module for compiling and executing XQueries from XQuery (xqxq)
174+ * External functions are allowed to be updating (i.e. return a pending update list)
175+
176+Optimization:
177 * Optimization for positioned sequence access (e.g. $x[$x[1]] where $x is a
178 sequence of integers)
179- * documentation improvements
180- * installer improvements
181+ * Optimization for count(collection()) expressions
182+ * Optimization of the fn:substring function in the case when its $start and $length arguments
183+ are integers
184+
185+Bug Fixes/Other Changes:
186 * Fixed bug #3403291 (build for Fedora 15)
187 * Fixed bug #3397293 (Incorrect XQueryX error message)
188 * Fixed bug #3398637 (Nested element constructors cause loss of namespace bindings)
189@@ -15,20 +74,19 @@
190 * Fixed bug #3404689 (assignment problem in flwor)
191 * Fix for bug #3404450 (testdriver_mt problem: caching and validation of docs)
192 * Fixed installation bug to not install the .so for test modules
193- * Fix for running ctest on Windows
194 * Fixed bug #3390410 (Adding a node to a collection causes out of bound in vector)
195 * Fixed bug #3406200 (node types were not being moved to new tree during node detach)
196 * Fixed bug #3406191 (Namespace bindings lost after update due to bug in node detach)
197 * Fixed bug #3290122 (ZDST0003 needs collection name)
198- * Collection allows to retrieve information about the type
199- and the annotations of a static collection.
200 * Fixed bug #3406272 (merging of adjacent text nodes must be done after all
201 updates have been applied).
202+ * Don't raise warnings for unknown annotations.
203 * Fixed bug #3409344 (during detach, if the node being detached is the root of
204 its tree, it should be detached from the tree as well; otherwise memory
205 corruption will occur)
206 * Fixed bug # (Should not destroy the parent of a node that is being detached
207 before the detach is done).
208+ * Added const qualifier to StaticContext::getAuditEvent()
209 * Fixed bug #3408181 (available-collection() returns undeclared collections)
210 * Fixed bug #859465 (Fatal error if a PUL contains two deactivate IC primitives)
211 * Fixed bug #859467 (Fatal error if a PUL contains two activate Foreign Key primitives)
212@@ -36,11 +94,10 @@
213 * Fixed bug #859522 (Fatal error if a PUL contains two delete document primitives)
214 * Fixed bug #859968 (Using put on an attribute produces an invalid XDM instance and may cause segmentation faults)
215 * Fixed bug #855314 (should not fold a constant expr that returns an error item)
216- * Added ExternalFunctionParameter class to be registered in the DynamicContext
217+ * Fixed bug when parsing a document with a base-uri attribute.
218 * Fixed bug #863320 (Sentence is incorrectly incremented when token characters end without sentence terminator)
219 * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)
220- * Implemented the probe-index-range-value for general indexes
221- * Fixed bug #867662 ("nullptr" warning)
222+ * Removed ZSTR0005 and ZSTR0006 error codes
223 * Fixed bug #868258 (Assertion failure with two delete collection)
224 * Fixed bug #871623 and #871629 (assertion failures with insertions in dynamic collections)
225 * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)
226@@ -54,6 +111,36 @@
227 * Fixed bug #872796 (validate-in-place can interfere with other update primitives)
228 * Fixed bug #872799 (validate-in-place can set incorrect types)
229 * Fixed bug #855715 (Invalid escaped characters in regex not caught)
230+ * Fixed bug #868325 (fn:analyze-string fails with some recursive subgroups)
231+ * Fixed bug #872697 (segmentation fault with validation of NMTOKENS)
232+ * General index cannot be declared as unique if the type of its key is
233+ xs:anyAtomicType or xs:untypedAtomic.
234+ * Added undo for node revalidation
235+ * Optimization for count(collection()) expressions
236+ * Fixed bug #867133 (SWIG PHP build failure on Mac OSX)
237+ * Fixed bug #872796 (validate-in-place can interfere with other update primitives)
238+ * Fixed bug #872799 (validate-in-place can set incorrect types)
239+ * Fixed bug #872850 (Serialization of Tumbling Window For fails)
240+ * Fixed bug #855715 (Invalid escaped characters in regex not caught)
241+ * Fixed bug #862089 (Split binary/xq install directories for modules) by
242+ splitting "module path" into separate URI and Library paths
243+ * Fixed bug #872502 (validation of the JSON module xqdoc fails)
244+ * Fixed bug #897619 (testdriver_mt can not run the XQueryX tests)
245+ * Fixed bug #867107 (xqdoc dependency to zorba is wrong)
246+ * Fixed bug #897616 (Fix the generation of the XQFTTS report results for
247+ W3C)
248+
249+version 2.0.3
250+ * Fixed bug #867662 ("nullptr" warning)
251+ * documentation improvements
252+
253+version 2.0.2
254+ * Fixed bug #3401971 (node-by-reference on dynamic collections)
255+ * documentation improvements
256+ * installer improvements
257+ * Fixed bug #3403291 (build for Fedora 15)
258+ * Don't install the .so for test modules
259+ * Fix for running ctest on Windows
260
261 version 2.0.1
262
263
264=== modified file 'NOTICE.txt'
265--- NOTICE.txt 2011-10-19 15:28:51 +0000
266+++ NOTICE.txt 2012-02-22 17:11:27 +0000
267@@ -1,5 +1,5 @@
268 -----------
269-Zorba 2.0.1
270+Zorba 2.1.0
271 -----------
272
273 (Note: This file is generated automatically from NOTICE.xml.
274
275=== modified file 'bin/CMakeLists.txt'
276--- bin/CMakeLists.txt 2011-08-05 02:21:55 +0000
277+++ bin/CMakeLists.txt 2012-02-22 17:11:27 +0000
278@@ -15,33 +15,38 @@
279 INCLUDE_DIRECTORIES(AFTER ${CMAKE_SOURCE_DIR}/src/)
280 INCLUDE_DIRECTORIES(AFTER ${CMAKE_CURRENT_SOURCE_DIR})
281
282-IF(ZORBA_WITH_DEBUGGER_CLIENT)
283- CONFIGURE_FILE (debug_client/event_handler_init.cpp.in debug_client/event_handler_init.cpp)
284-
285- SET(DEBUG_CLIENT_SRCS
286- debug_client/tuple.h
287- debug_client/main.cpp
288- debug_client/debug_command.h
289- debug_client/debug_command.cpp
290- debug_client/command_line_handler.h
291- debug_client/command_line_handler.cpp
292- debug_client/lock_free_queue.h
293- debug_client/event_handler.h
294- debug_client/event_handler.cpp
295- ${CMAKE_CURRENT_BINARY_DIR}/debug_client/event_handler_init.cpp
296+IF (ZORBA_WITH_DEBUGGER)
297+ IF (NOT WIN32)
298+ FIND_PACKAGE (Libedit)
299+ IF (LIBEDIT_FOUND)
300+ INCLUDE_DIRECTORIES (${LIBEDIT_INCLUDE_DIRS})
301+ SET (LIBEDIT_LIBS ${LIBEDIT_LIBRARIES})
302+ SET (ZORBA_HAVE_LIBEDIT_H ${LIBEDIT_FOUND})
303+ ENDIF (LIBEDIT_FOUND)
304+ ENDIF (NOT WIN32)
305+
306+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/debugger/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/debugger/config.h)
307+ MESSAGE(STATUS "configured ${CMAKE_CURRENT_SOURCE_DIR}/debugger/config.h.cmake --> ${CMAKE_CURRENT_BINARY_DIR}/debugger/config.h")
308+ INCLUDE_DIRECTORIES (BEFORE ${CMAKE_CURRENT_BINARY_DIR}/debugger)
309+
310+ SET (DEBUG_CLIENT_SRCS
311+ debugger/main.cpp
312+ debugger/xqdb_client.cpp
313+ debugger/process_listener.cpp
314+ debugger/command_prompt.cpp
315+ debugger/command_line_handler.cpp
316+ debugger/event_handler.cpp
317 )
318
319- CONFIGURE_FILE (debug_client/message-handler.xq message-handler.xq)
320-
321- ZORBA_GENERATE_EXE("debuggercmd" "${DEBUG_CLIENT_SRCS}" "" "debugger" "bin")
322-ENDIF(ZORBA_WITH_DEBUGGER_CLIENT)
323+ ZORBA_GENERATE_EXE ("xqdb" "${DEBUG_CLIENT_SRCS}" "${LIBEDIT_LIBS}" "xqdb" "bin")
324+ENDIF (ZORBA_WITH_DEBUGGER)
325
326 SET(SRCS
327 zorbacmd.cpp
328 zorbacmdproperties.cpp
329 error_printer.cpp
330 util.cpp
331- module_path.cpp
332+ path_util.cpp
333 )
334
335 INCLUDE("${CMAKE_SOURCE_DIR}/cmake_modules/ZorbaGenerateExe.cmake")
336@@ -84,3 +89,37 @@
337 # test the --option option to set an option in the static context
338 ZORBA_ADD_TEST(bin/zorba_option zorbacmd -q "${CMAKE_CURRENT_SOURCE_DIR}/test/option.xq" -f --option "{http://www.zorba-xquery.com}option=value")
339 ZORBA_SET_TEST_PROPERTY(bin/zorba_option PASS_REGULAR_EXPRESSION "value")
340+
341+# test the --uri-path, --lib-path, and --module-path args.
342+# Use the versioning tests as they utilize test modules already.
343+SET (_testdir
344+ "${CMAKE_CURRENT_SOURCE_DIR}/../test/rbkt/Queries/zorba/versioning")
345+SET (_uridir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")
346+SET (_libdir "${CMAKE_BINARY_DIR}/TEST_LIB_PATH")
347+ZORBA_ADD_TEST(bin/zorba_uri_path_1 zorbacmd -f -q "${_testdir}/import1.xq"
348+ --uri-path "${_uridir}")
349+ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_1
350+ PASS_REGULAR_EXPRESSION "hello, v2")
351+
352+ZORBA_ADD_TEST(bin/zorba_uri_path_2 zorbacmd -f -q "${_testdir}/external1.xq"
353+ --uri-path "${_uridir}")
354+ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_2
355+ PASS_REGULAR_EXPRESSION "ZXQP0008")
356+
357+ZORBA_ADD_TEST(bin/zorba_uri_path_3 zorbacmd -f -q "${_testdir}/external1.xq"
358+ --uri-path "${_uridir}" --lib-path "${_libdir}")
359+ZORBA_SET_TEST_PROPERTY(bin/zorba_uri_path_3
360+ PASS_REGULAR_EXPRESSION "hello, v2")
361+
362+IF(WIN32)
363+ SET(PATH_SEP ";")
364+ELSE(WIN32)
365+ SET(PATH_SEP ":")
366+ENDIF(WIN32)
367+ZORBA_ADD_TEST(bin/zorba_module_path_1 zorbacmd -f -q "${_testdir}/external1.xq"
368+ --module-path "${_libdir}${PATH_SEP}${_uridir}")
369+ZORBA_SET_TEST_PROPERTY(bin/zorba_module_path_1
370+ PASS_REGULAR_EXPRESSION "hello, v2")
371+
372+# test compilation of the perf script
373+ZORBA_ADD_TEST(bin/zorba_compilechk4 zorbacmd -q "${CMAKE_CURRENT_SOURCE_DIR}/../test/zperf/src/start.xq" -f --compile-only)
374
375=== removed file 'bin/debug_client/debug_command.cpp'
376--- bin/debug_client/debug_command.cpp 2011-07-01 01:53:24 +0000
377+++ bin/debug_client/debug_command.cpp 1970-01-01 00:00:00 +0000
378@@ -1,99 +0,0 @@
379-/*
380- * Copyright 2006-2008 The FLWOR Foundation.
381- *
382- * Licensed under the Apache License, Version 2.0 (the "License");
383- * you may not use this file except in compliance with the License.
384- * You may obtain a copy of the License at
385- *
386- * http://www.apache.org/licenses/LICENSE-2.0
387- *
388- * Unless required by applicable law or agreed to in writing, software
389- * distributed under the License is distributed on an "AS IS" BASIS,
390- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
391- * See the License for the specific language governing permissions and
392- * limitations under the License.
393- */
394-#include <iostream>
395-#include "debug_client/debug_command.h"
396-
397-namespace zorba { namespace debugclient {
398-
399-
400- void CommandLine::execute()
401- {
402- for (;;) {
403- std::cout << "zdb>> ";
404- std::string command;
405- std::getline(std::cin, command);
406- std::vector<std::string> args;
407- args << command;
408- std::map<std::string, UntypedCommand*>::iterator lIter = theCommands.find(args[0]);
409- if (lIter == theCommands.end()) {
410- std::cout << args[0] << ": Command not found" << std::endl;
411- continue;
412- }
413- if (!lIter->second->execute(args))
414- continue;
415- return;
416- }
417- }
418-
419-
420- CommandLine::~CommandLine()
421- {
422- for (std::map<std::string, UntypedCommand*>::iterator i = theCommands.begin();
423- i != theCommands.end(); ++i)
424- {
425- delete i->second;
426- }
427- }
428-
429- CommandLine& CommandLine::operator<<(UntypedCommand *aCommand)
430- {
431- theCommands.insert(std::make_pair(aCommand->get_name(), aCommand));
432- return *this;
433- }
434-}}
435-
436-namespace std {
437- vector<string>& operator<< (vector<string>& vec, const string& str)
438- {
439- string::size_type before = 0;
440- string::size_type pos = str.find(" ", 0);
441- while (pos != str.npos) {
442- std::string lSub = str.substr(before, pos - before);
443- if (lSub[0] == '"') {
444- std::string::size_type lBeforeCopy = before;
445- do {
446- lBeforeCopy = str.find("\"", lBeforeCopy + 1);
447- } while (pos != str.npos && str.size() > pos + 1 && str[pos + 1] == '\\');
448- pos = lBeforeCopy;
449- lSub = str.substr(before + 1, pos - before - 1);
450- }
451- vec.push_back(lSub);
452- before = pos + 1;
453- pos = str.find(" ", before);
454- }
455- std::string lSub = str.substr(before);
456- if (lSub[0] == '"') {
457- pos = str.find("\"", before + 1);
458- lSub = str.substr(before + 1, pos - before - 1);
459- }
460- vec.push_back(lSub);
461- return vec;
462- }
463-
464- set<string>& operator<< (set<string>& vec, const string& str)
465- {
466- string::size_type before = 0;
467- string::size_type pos = str.find(" ", 0);
468- while (pos != str.npos) {
469- vec.insert(str.substr(before, pos));
470- before = pos + 1;
471- pos = str.find(" ", before);
472- }
473- vec.insert(str.substr(before));
474- return vec;
475- }
476-
477-}
478
479=== removed file 'bin/debug_client/event_handler_init.cpp.in'
480--- bin/debug_client/event_handler_init.cpp.in 2011-07-01 01:53:24 +0000
481+++ bin/debug_client/event_handler_init.cpp.in 1970-01-01 00:00:00 +0000
482@@ -1,41 +0,0 @@
483-/*
484- * Copyright 2006-2008 The FLWOR Foundation.
485- *
486- * Licensed under the Apache License, Version 2.0 (the "License");
487- * you may not use this file except in compliance with the License.
488- * You may obtain a copy of the License at
489- *
490- * http://www.apache.org/licenses/LICENSE-2.0
491- *
492- * Unless required by applicable law or agreed to in writing, software
493- * distributed under the License is distributed on an "AS IS" BASIS,
494- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
495- * See the License for the specific language governing permissions and
496- * limitations under the License.
497- */
498-#include <fstream>
499-#include "debug_client/event_handler.h"
500-
501-namespace zorba { namespace debugclient {
502-
503- std::istream* EventHandler::getCurrentDirectory() {
504- const char* build_dir = "@CMAKE_BINARY_DIR@/bin/message-handler.xq";
505- const char* install_dir =
506-#ifndef WIN32
507- "@CMAKE_INSTALL_PREFIX@/bin/";
508-#else
509- "C:/Program Files/Zorba XQuery Processor @ZORBA_MAJOR_NUMBER@.@ZORBA_MINOR_NUMBER@.@ZORBA_PATCH_NUMBER@/bin/";
510-#endif
511- std::auto_ptr<std::ifstream> stream(new std::ifstream(build_dir));
512- if (stream->good()) {
513- return stream.release();
514- }
515- stream.reset(new std::ifstream(install_dir));
516- if (stream->good()) {
517- return stream.release();
518- }
519- return 0;
520- }
521-
522-}} // end of namespace zorba::debugclient
523-
524
525=== removed file 'bin/debug_client/lock_free_queue.cpp'
526--- bin/debug_client/lock_free_queue.cpp 2011-07-01 01:53:24 +0000
527+++ bin/debug_client/lock_free_queue.cpp 1970-01-01 00:00:00 +0000
528@@ -1,16 +0,0 @@
529-/*
530- * Copyright 2006-2008 The FLWOR Foundation.
531- *
532- * Licensed under the Apache License, Version 2.0 (the "License");
533- * you may not use this file except in compliance with the License.
534- * You may obtain a copy of the License at
535- *
536- * http://www.apache.org/licenses/LICENSE-2.0
537- *
538- * Unless required by applicable law or agreed to in writing, software
539- * distributed under the License is distributed on an "AS IS" BASIS,
540- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
541- * See the License for the specific language governing permissions and
542- * limitations under the License.
543- */
544-#include "lock_free_queue.h"
545
546=== removed file 'bin/debug_client/message-handler.xq'
547--- bin/debug_client/message-handler.xq 2011-08-26 23:36:24 +0000
548+++ bin/debug_client/message-handler.xq 1970-01-01 00:00:00 +0000
549@@ -1,165 +0,0 @@
550-(:
551- : Copyright 2006-2009 The FLWOR Foundation.
552- :
553- : Licensed under the Apache License, Version 2.0 (the "License");
554- : you may not use this file except in compliance with the License.
555- : You may obtain a copy of the License at
556- :
557- : http://www.apache.org/licenses/LICENSE-2.0
558- :
559- : Unless required by applicable law or agreed to in writing, software
560- : distributed under the License is distributed on an "AS IS" BASIS,
561- : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
562- : See the License for the specific language governing permissions and
563- : limitations under the License.
564-:)
565-
566-import module namespace refl = 'http://www.zorba-xquery.com/modules/reflection';
567-import module namespace sctx = "http://www.zorba-xquery.com/modules/introspection/sctx";
568-import module namespace base64 = "http://www.zorba-xquery.com/modules/converters/base64";
569-
570-
571-declare variable $local:localns as xs:string := 'http://www.w3.org/2005/xquery-local-functions';
572-
573-
574-declare variable $local:endl as xs:string := '
575-';
576-
577-declare function local:has-to-stop($resp as element())
578-{
579- fn:not(($resp/@command/data(.) eq "stop" and $resp/@reason/data(.) eq "ok")
580- or ($resp/@status/data(.) eq "stopped")
581- or ($resp/@status/data(.) eq "stopping"))
582-};
583-
584-declare function local:status($resp as element())
585-{
586- fn:concat(
587- "Status: ", $resp/@status/data(.), $local:endl,
588- "Reason: ", $resp/@reason/data(.), $local:endl,
589- let $msg := $resp/text()
590- return
591- if (fn:empty($msg) or $msg eq "") then
592- ""
593- else
594- fn:concat($msg, $local:endl)
595- )
596-};
597-
598-
599-declare function local:run($resp as element()) {
600- if ($resp/@status/data(.) eq "starting") then
601- "Starting query"
602- else
603- local:status($resp)
604-};
605-
606-declare function local:stop($resp as element())
607-{
608- local:status($resp)
609-};
610-
611-declare function local:breakpoint_set($resp as element())
612-{
613- if ($resp/error) then
614- fn:concat("Error when setting a breakpoint: ", if ($resp/error/message) then $resp/error/message/text() else concat(" errcode: ", data($resp/error/@code)))
615- else
616- fn:concat("set breakpoint with id ", data($resp/@id), " and state ", data($resp/@state))
617-};
618-
619-declare function local:breakpoint_list($resp as element())
620-{
621- string-join(
622- for $b in $resp/breakpoint
623- return concat("Breakpoint ", data($b/@id), " at ", data($b/@filename), ":", data($b/@lineno), " ", data($b/@state)),
624- $local:endl
625- )
626-};
627-
628-declare function local:breakpoint_remove($resp as element())
629-{
630- "Breakpoint removed"
631-};
632-
633-declare function local:stack_depth($resp as element())
634-{
635- concat("Depth: ", data($resp/@depth))
636-};
637-
638-declare function local:stack_get($resp as element())
639-{
640- string-join(
641- for $s in $resp/stack
642- return concat("Level ", data($s/@level), " at ", data($s/@filename), ":", data($s/@lineno)),
643- $local:endl
644- )
645-};
646-
647-
648-declare function local:context_names($resp as element())
649-{
650- string-join(
651- for $c in $resp/context
652- return concat("Context: ", data($c/@name), " id: ", data($c/@id)),
653- $local:endl
654- )
655-};
656-
657-declare function local:context_get($resp as element())
658-{
659- string-join(
660- for $p in $resp/property
661- return concat(data($p/@fullname), ": [", data($p/@type), "]",
662- if ($p/text() ne "") then concat(": ", base64:decode($p/text())) else ""),
663- $local:endl
664- )
665-};
666-
667-declare function local:eval($resp as element())
668-{
669- if (data($resp/@success) eq "1") then
670- local:context_get($resp)
671- else
672- concat("Eval failed", ":", $resp/error/message/text())
673-};
674-
675-declare function local:process-response($resp as element())
676-{
677- if (data($resp/@command) eq "") then
678- (fn:true(), $resp/@transaction_id/data(.), local:status($resp))
679- else
680- let $fun-cont-name := fn:QName($local:localns, concat("local:", $resp/@command/data(.), "-cont"))
681- let $fun-msg-name := fn:QName($local:localns, concat("local:", $resp/@command/data(.)))
682- return (
683- if (sctx:function-arguments-count($fun-cont-name) = 1) then
684- refl:invoke($fun-cont-name, $resp)
685- else
686- local:has-to-stop($resp),
687- $resp/@transaction_id/data(.),
688- if (sctx:function-arguments-count($fun-msg-name) = 1) then
689- refl:invoke($fun-msg-name, $resp)
690- else
691- "Recieved a message - command not implemented"
692- )
693-};
694-
695-declare function local:process-init($init as element())
696-{
697- fn:true(),
698- 0,
699- fn:concat(fn:string-join(
700- ('Established connection with', $init/@language/data(.), 'client', $init/@appid/data(.)), ' '), '
701-')
702-};
703-
704-declare function local:main($response as element()) {
705- let $process-fun as xs:QName := fn:QName($local:localns, concat("local:process-", node-name($response)))
706- return
707- if (sctx:function-arguments-count($process-fun) = 1) then
708- refl:invoke($process-fun, $response)
709- else (
710- true(),
711- ($response/@transaction_id, 0)[1]/data(.),
712- "ERROR: Recieved unknown node from client"
713- )
714-};
715
716=== renamed directory 'bin/debug_client' => 'bin/debugger'
717=== renamed file 'bin/debug_client/debug_command.h' => 'bin/debugger/command.h'
718--- bin/debug_client/debug_command.h 2011-07-04 08:05:46 +0000
719+++ bin/debugger/command.h 2012-02-22 17:11:27 +0000
720@@ -14,7 +14,9 @@
721 * limitations under the License.
722 */
723 #pragma once
724-#include <zorba/config.h>
725+#ifndef ZORBA_DEBUGGER_COMMAND_H
726+#define ZORBA_DEBUGGER_COMMAND_H
727+
728 #include <string>
729 #include <vector>
730 #include <iostream>
731@@ -23,151 +25,18 @@
732 #include <sstream>
733 #include <memory>
734 #include <typeinfo>
735-#include "debug_client/tuple.h"
736-
737-namespace zorba { namespace debugclient {
738+
739+#include <zorba/config.h>
740+
741+#include "command_arg.h"
742+#include "tuple.h"
743+
744+
745+namespace zorba { namespace debugger {
746
747 class DebugClientParseException : public std::exception {
748 };
749
750- template<typename Tuple>
751- class CommandArg;
752-
753- template<typename Tuple>
754- class CommandArgInstance {
755- public:
756- virtual int get_index() const = 0;
757- virtual const CommandArg<Tuple>* get_arg() const = 0;
758- virtual void insertValue(Tuple& t) = 0;
759- virtual bool isSet(Tuple& t) const = 0;
760- };
761-
762- template<typename T, int Idx, typename Tuple>
763- class TypedCommandArgInstance : public CommandArgInstance<Tuple>
764- {
765- public:
766- TypedCommandArgInstance(T aValue, const CommandArg<Tuple>* aArg)
767- : theValue(aValue), theArg(aArg) {}
768- virtual int get_index() const { return Idx; }
769- virtual const CommandArg<Tuple>* get_arg() const { return theArg; }
770- virtual void insertValue(Tuple& t)
771- {
772- ZORBA_TR1_NS::get<Idx>(t).first = true;
773- ZORBA_TR1_NS::get<Idx>(t).second = theValue;
774- }
775- virtual bool isSet(Tuple& t) const
776- {
777- return ZORBA_TR1_NS::get<Idx>(t).first;
778- }
779- private:
780- T theValue;
781- const CommandArg<Tuple>* theArg;
782- };
783-
784- template<typename Tuple>
785- class CommandArgType {
786- public:
787- virtual CommandArgInstance<Tuple>* parse(const std::string& str,
788- const CommandArg<Tuple>* arg) = 0;
789- virtual bool isVoid() const = 0;
790- virtual bool isSet(Tuple& t) const = 0;
791- virtual ~CommandArgType() {}
792- };
793-
794- template<typename T, int Idx, typename Tuple>
795- class TypedCommandArgType : public CommandArgType<Tuple> {
796- public:
797- typedef T Type;
798- public: // implementation
799- TypedCommandArgType(bool aIsVoid) : theIsVoid(aIsVoid) {}
800- TypedCommandArgType(const T& aValue,
801- bool aIsVoid)
802- : theDefault(aValue), theIsVoid(aIsVoid) {}
803- virtual CommandArgInstance<Tuple>* parse(const std::string& str,
804- const CommandArg<Tuple>* arg)
805- {
806- T aValue;
807- std::stringstream stream(str);
808- stream >> aValue;
809- if (stream.fail()) {
810- std::cerr << "Could not parse argument of type "
811- << typeid(T).name()
812- << std::endl;
813- return 0;
814- }
815- return new TypedCommandArgInstance<T, Idx, Tuple>(aValue, arg);
816- }
817- virtual bool isVoid() const { return theIsVoid; }
818- virtual bool isSet(Tuple& t) const
819- {
820- return ZORBA_TR1_NS::get<Idx>(t).first;
821- }
822- private:
823- TypedCommandArgType<T, Idx, Tuple>() {}
824- T theDefault;
825- bool theIsVoid;
826- };
827-
828- template<typename Tuple>
829- class CommandArg {
830- public:
831- CommandArg(unsigned aId,
832- CommandArgType<Tuple>* aType,
833- const std::set<std::string>& aFlags,
834- const std::string& aDescription,
835- bool aIsRequired)
836- : theId(aId),
837- theType(aType),
838- theFlags(aFlags),
839- theDescription(aDescription),
840- theIsRequired(aIsRequired)
841- {
842- }
843- ~CommandArg() { delete theType; }
844- unsigned get_id() const { return theId; }
845- bool canHandle(const std::string& arg) const
846- {
847- if (theFlags.find(arg) != theFlags.end()) {
848- return true;
849- }
850- return false;
851- }
852- CommandArgInstance<Tuple>* parse(const std::string& str) const
853- {
854- return theType->parse(str, this);
855- }
856- bool isVoid() const {
857- return theType->isVoid();
858- }
859- bool isRequired() const { return theIsRequired; }
860- std::string get_name() const {
861- return *(theFlags.begin());
862- }
863- bool isSet(Tuple& t) const
864- {
865- return theType->isSet(t);
866- }
867- private:
868- unsigned theId;
869- CommandArgType<Tuple>* theType;
870- std::set<std::string> theFlags;
871- std::string theDescription;
872- bool theIsRequired;
873- };
874-}} // end namespace zorba
875-
876-namespace std {
877-
878- /**
879- * This is a helper split function
880- */
881- vector<string>& operator<< (vector<string>& vec, const string& str);
882-
883- set<string>& operator<< (set<string>& vec, const string& str);
884-} //end namespace std
885-
886-namespace zorba { namespace debugclient {
887-
888 template<typename Func, typename Tuple, int CommandIdx>
889 class CommandInstance
890 {
891@@ -188,8 +57,10 @@
892
893 class UntypedCommand {
894 public:
895- virtual std::string get_name() const = 0;
896- virtual std::string get_description() const = 0;
897+ virtual std::string getName() const = 0;
898+ virtual std::set<std::string> getAliases() const = 0;
899+ virtual std::string getDescription() const = 0;
900+ virtual void printHelp() const = 0;
901 virtual bool execute(const std::vector<std::string>& args) = 0;
902 };
903
904@@ -197,77 +68,141 @@
905 class Command : public UntypedCommand {
906 public:
907 Command(const std::string& aName, Func& aFunction, const std::string& aDescription)
908- : theName(aName), theFunction(aFunction), theDescription(aDescription) {}
909+ : theName(aName), theFunction(aFunction), theDescription(aDescription)
910+ {}
911+
912+ Command(const std::string& aName, const std::set<std::string> aAliases, Func& aFunction, const std::string& aDescription)
913+ : theName(aName), theAliases(aAliases), theFunction(aFunction), theDescription(aDescription)
914+ {}
915+
916 ~Command();
917+
918 public:
919- Command& operator() (unsigned aId,
920- const std::string& aFlags,
921- CommandArgType<Tuple>* aType,
922- const std::string& aDescription = "",
923- bool isRequired = false);
924- virtual std::string get_name() const { return theName; }
925- virtual std::string get_description() const { return theDescription; }
926+
927+ void
928+ addArgument(
929+ unsigned aId,
930+ const std::string& aFlags,
931+ CommandArgType<Tuple>* aType,
932+ const std::string& aDescription = "",
933+ bool isRequired = false);
934+
935+ static void
936+ splitNames(
937+ const std::string& names,
938+ std::set<std::string>& set);
939+
940+ virtual std::string
941+ getName() const
942+ {
943+ return theName;
944+ }
945+
946+ virtual std::set<std::string> getAliases() const
947+ {
948+ return theAliases;
949+ }
950+
951+ virtual std::string
952+ getDescription() const
953+ {
954+ return theDescription;
955+ }
956+
957+ virtual void
958+ printHelp() const;
959+
960 virtual bool execute(const std::vector<std::string>& args)
961 {
962 CommandInstance<Func, Tuple, CommandIdx> instance(theFunction, theTuple);
963- if (instance.parseArguments(args, theArgs))
964+ if (instance.parseArguments(args, theArgs)) {
965 instance.execute();
966- else
967- return false;
968- return true;
969+ return true;
970+ }
971+ return false;
972 }
973 private:
974 std::string theName;
975+ std::set<std::string> theAliases;
976 Func& theFunction;
977 Tuple theTuple;
978 std::string theDescription;
979- std::map<std::string, CommandArg<Tuple>* > theArgs;
980- };
981-
982- class CommandLine {
983- public:
984- ~CommandLine();
985- public:
986- void execute();
987- CommandLine& operator<< (UntypedCommand* aCommand);
988- private:
989- std::map<std::string, UntypedCommand*> theCommands;
990- };
991-
992- template<typename Func, typename Tuple, int CommandIdx>
993- Command<Func, Tuple, CommandIdx>::~Command()
994- {
995- typedef std::map<std::string, CommandArg<Tuple>* > ArgType;
996- for (typename ArgType::iterator i = theArgs.begin(); i != theArgs.end(); ++i) {
997- delete i->second;
998- }
999- }
1000-
1001-
1002- template<typename Func, typename Tuple, int CommandIdx>
1003- Command<Func, Tuple, CommandIdx>&
1004- Command<Func, Tuple, CommandIdx>::operator() (unsigned aId,
1005- const std::string& aFlags,
1006- CommandArgType<Tuple>* aType,
1007- const std::string& aDescription,
1008- bool isRequired)
1009- {
1010- std::set<std::string> args;
1011- args << aFlags;
1012- for (std::set<std::string>::iterator i = args.begin(); i != args.end(); ++i) {
1013- std::string toAdd = (i->size() == 1) ? "-" + *i : "--" + *i;
1014- theArgs.insert(std::make_pair(toAdd,
1015- new CommandArg<Tuple>(aId,
1016- aType,
1017- args,
1018- aDescription,
1019- isRequired)
1020- )
1021- );
1022- }
1023- return *this;
1024- }
1025-
1026+ std::map<std::string, CommandArg<Tuple>*> theArgs;
1027+ };
1028+
1029+/*****************************************************************************/
1030+/*****************************************************************************/
1031+
1032+template<typename Func, typename Tuple, int CommandIdx>
1033+Command<Func, Tuple, CommandIdx>::~Command()
1034+{
1035+ typedef std::map<std::string, CommandArg<Tuple>*> ArgType;
1036+ for (typename ArgType::iterator i = theArgs.begin(); i != theArgs.end(); ++i) {
1037+ delete i->second;
1038+ }
1039+}
1040+
1041+template<typename Func, typename Tuple, int CommandIdx>
1042+void
1043+Command<Func, Tuple, CommandIdx>::printHelp() const
1044+{
1045+ std::cout << "Purpose: " << getDescription() << std::endl;
1046+
1047+ typename std::map<std::string, CommandArg<Tuple>*>::const_iterator lIter = theArgs.begin();
1048+ if (lIter == theArgs.end()) {
1049+ std::cout << "This command has no arguments." << std::endl;
1050+ std::cout << std::endl;
1051+ return;
1052+ }
1053+
1054+ std::cout << "Arguments:" << std::endl << std::endl;
1055+ for (; lIter != theArgs.end(); ++lIter) {
1056+ std::cout << " " << lIter->first << "\t" << lIter->second->getDescription() << std::endl;
1057+ }
1058+ std::cout << std::endl;
1059+}
1060+
1061+template<typename Func, typename Tuple, int CommandIdx>
1062+void
1063+Command<Func, Tuple, CommandIdx>::splitNames(const std::string& aNames, std::set<std::string>& aSet)
1064+{
1065+ std::string::size_type before = 0;
1066+ std::string::size_type pos = aNames.find(" ", 0);
1067+ while (pos != aNames.npos) {
1068+ std::string lName = aNames.substr(before, pos);
1069+ if (lName != "") {
1070+ aSet.insert(lName);
1071+ }
1072+ before = pos + 1;
1073+ pos = aNames.find(" ", before);
1074+ }
1075+ std::string lName = aNames.substr(before);
1076+ if (lName != "") {
1077+ aSet.insert(lName);
1078+ }
1079+}
1080+
1081+template<typename Func, typename Tuple, int CommandIdx>
1082+void
1083+Command<Func, Tuple, CommandIdx>::addArgument(
1084+ unsigned aId,
1085+ const std::string& aFlags,
1086+ CommandArgType<Tuple>* aType,
1087+ const std::string& aDescription,
1088+ bool isRequired)
1089+{
1090+ std::set<std::string> lNames;
1091+ splitNames(aFlags, lNames);
1092+
1093+ for (std::set<std::string>::iterator i = lNames.begin(); i != lNames.end(); ++i) {
1094+ std::string toAdd = (i->size() == 1) ? "-" + *i : "--" + *i;
1095+ CommandArg<Tuple>* lArg = new CommandArg<Tuple>(aId, aType, lNames, aDescription, isRequired);
1096+ theArgs.insert(std::make_pair(toAdd, lArg));
1097+ }
1098+}
1099+
1100+/*****************************************************************************/
1101+
1102 template<typename Tuple, typename T, int Idx>
1103 CommandArgType<Tuple>* createArgType(Tuple t)
1104 {
1105@@ -290,6 +225,16 @@
1106 return new Command<Func, Tuple, CommandIdx>(aName, aFunction, aDescription);
1107 }
1108
1109+ template<int CommandIdx, typename Tuple, typename Func>
1110+ Command<Func, Tuple, CommandIdx>* createCommand(Tuple t,
1111+ const std::string& aName,
1112+ const std::set<std::string>& aAliases,
1113+ Func& aFunction,
1114+ const std::string& aDescription)
1115+ {
1116+ return new Command<Func, Tuple, CommandIdx>(aName, aAliases, aFunction, aDescription);
1117+ }
1118+
1119 template<typename Func, typename Tuple, int CommandIdx>
1120 bool CommandInstance<Func, Tuple, CommandIdx>::
1121 parseArguments(const std::vector<std::string>& args,
1122@@ -301,29 +246,34 @@
1123 for (ArgType::size_type i = 1; i < size; ++i) {
1124 typename CArgType::const_iterator pos = aCommandArgs.find(args[i]);
1125 if (pos == aCommandArgs.end()) {
1126- std::cerr << "Error: Unknown Argument " << args[i] << std::endl;
1127+ std::cerr << "Error: Unknown option " << args[i] << std::endl;
1128 parseError = true;
1129 return false;
1130 }
1131 const CommandArg<Tuple>& arg = *(pos->second);
1132- if (!arg.isVoid() && args[++i][0] == '-') {
1133- std::cerr << "Did not expect parameter for option " << args[i] << std::endl;
1134- return false;
1135- }
1136 std::auto_ptr<CommandArgInstance<Tuple> > instance;
1137 if (arg.isVoid()) {
1138 instance.reset(arg.parse("1"));
1139 } else {
1140+ ++i;
1141+ if (i >= size) {
1142+ std::cerr << "Error: Missing value for argument " << args[i - 1] << std::endl;
1143+ parseError = true;
1144+ allSet = false;
1145+ return false;
1146+ }
1147 instance.reset(arg.parse(args[i]));
1148 }
1149- instance->insertValue(theTuple);
1150+ if (instance.get()) {
1151+ instance->insertValue(theTuple);
1152+ }
1153 }
1154 bool allSet = true;
1155 for (typename CArgType::const_iterator i = aCommandArgs.begin();
1156 i != aCommandArgs.end(); ++i)
1157 {
1158 if (i->second->isRequired() && !i->second->isSet(theTuple)) {
1159- std::cerr << "Error: Argument " << i->second->get_name() << " not set" << std::endl;
1160+ std::cerr << "Error: Argument -" << i->second->getName() << " not set" << std::endl;
1161 allSet = false;
1162 }
1163 }
1164@@ -336,4 +286,7 @@
1165 theFunction.template handle<CommandIdx>(this->theTuple);
1166 }
1167
1168-}} // end of namespace zorba::debugclient
1169+} // namespace zorba
1170+} // namespace debugger
1171+
1172+#endif // ZORBA_DEBUGGER_COMMAND_H
1173
1174=== added file 'bin/debugger/command_arg.h'
1175--- bin/debugger/command_arg.h 1970-01-01 00:00:00 +0000
1176+++ bin/debugger/command_arg.h 2012-02-22 17:11:27 +0000
1177@@ -0,0 +1,237 @@
1178+/*
1179+ * Copyright 2006-2008 The FLWOR Foundation.
1180+ *
1181+ * Licensed under the Apache License, Version 2.0 (the "License");
1182+ * you may not use this file except in compliance with the License.
1183+ * You may obtain a copy of the License at
1184+ *
1185+ * http://www.apache.org/licenses/LICENSE-2.0
1186+ *
1187+ * Unless required by applicable law or agreed to in writing, software
1188+ * distributed under the License is distributed on an "AS IS" BASIS,
1189+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1190+ * See the License for the specific language governing permissions and
1191+ * limitations under the License.
1192+ */
1193+#pragma once
1194+#ifndef ZORBA_DEBUGGER_COMMAND_ARG_H
1195+#define ZORBA_DEBUGGER_COMMAND_ARG_H
1196+
1197+#include <string>
1198+#include <iostream>
1199+#include <set>
1200+#include <sstream>
1201+
1202+#include "tuple.h"
1203+
1204+
1205+namespace zorba { namespace debugger {
1206+
1207+template<typename Tuple>
1208+class CommandArg;
1209+
1210+template<typename Tuple>
1211+class CommandArgInstance {
1212+ public:
1213+ virtual int get_index() const = 0;
1214+ virtual const CommandArg<Tuple>* get_arg() const = 0;
1215+ virtual void insertValue(Tuple& t) = 0;
1216+ virtual bool isSet(Tuple& t) const = 0;
1217+};
1218+
1219+template<typename T, int Idx, typename Tuple>
1220+class TypedCommandArgInstance : public CommandArgInstance<Tuple>
1221+{
1222+ public:
1223+ TypedCommandArgInstance(T aValue, const CommandArg<Tuple>* aArg)
1224+ : theValue(aValue), theArg(aArg)
1225+ {
1226+ }
1227+
1228+ virtual int
1229+ get_index() const
1230+ {
1231+ return Idx;
1232+ }
1233+
1234+ virtual const CommandArg<Tuple>*
1235+ get_arg() const
1236+ {
1237+ return theArg;
1238+ }
1239+
1240+ virtual void
1241+ insertValue(Tuple& t)
1242+ {
1243+ ZORBA_TR1_NS::get<Idx>(t).first = true;
1244+ ZORBA_TR1_NS::get<Idx>(t).second = theValue;
1245+ }
1246+
1247+ virtual bool isSet(Tuple& t) const
1248+ {
1249+ return ZORBA_TR1_NS::get<Idx>(t).first;
1250+ }
1251+
1252+ private:
1253+
1254+ T theValue;
1255+ const CommandArg<Tuple>* theArg;
1256+};
1257+
1258+template<typename Tuple>
1259+class CommandArgType
1260+{
1261+ public:
1262+ virtual CommandArgInstance<Tuple>*
1263+ parse(
1264+ const std::string& str,
1265+ const CommandArg<Tuple>* arg) = 0;
1266+
1267+ virtual bool
1268+ isVoid() const = 0;
1269+
1270+ virtual bool
1271+ isSet(Tuple& t) const = 0;
1272+
1273+ virtual ~CommandArgType() {}
1274+};
1275+
1276+ template<typename T, int Idx, typename Tuple>
1277+ class TypedCommandArgType : public CommandArgType<Tuple> {
1278+ public:
1279+ typedef T Type;
1280+ public: // implementation
1281+ TypedCommandArgType(bool aIsVoid) : theIsVoid(aIsVoid) {}
1282+ TypedCommandArgType(const T& aValue,
1283+ bool aIsVoid)
1284+ : theDefault(aValue), theIsVoid(aIsVoid) {}
1285+ virtual CommandArgInstance<Tuple>* parse(const std::string& str,
1286+ const CommandArg<Tuple>* arg)
1287+ {
1288+ T aValue;
1289+
1290+ // special treatment for strings
1291+ // this is a double hack:
1292+ // - we check the type name if this starts with: class std::basic_string
1293+ // - we use void* in readEntireString to workaround the template type T
1294+ // which would otherwise complain during compilation if types and
1295+ // operators do not match
1296+ // TOSO: probably someone can find a more elegant solution
1297+ std::string lTypeName(typeid(T).name());
1298+ if (lTypeName.find("class std::basic_string") == 0) {
1299+ readEntireString(str, &aValue);
1300+ } else {
1301+ std::stringstream stream(str);
1302+ std::stringstream out;
1303+ stream >> aValue;
1304+ if (stream.fail()) {
1305+ std::cerr << "Error: Could not parse value \"" << str << "\" as type "
1306+ << typeid(T).name()
1307+ << std::endl;
1308+ return 0;
1309+ }
1310+ }
1311+
1312+ return new TypedCommandArgInstance<T, Idx, Tuple>(aValue, arg);
1313+ }
1314+ virtual bool isVoid() const { return theIsVoid; }
1315+ virtual bool isSet(Tuple& t) const
1316+ {
1317+ return ZORBA_TR1_NS::get<Idx>(t).first;
1318+ }
1319+ private:
1320+ void readEntireString(std::string aIn, void* aValue)
1321+ {
1322+ *((std::string*)aValue) = aIn;
1323+ }
1324+
1325+ TypedCommandArgType<T, Idx, Tuple>() {}
1326+ T theDefault;
1327+ bool theIsVoid;
1328+ };
1329+
1330+ template<typename Tuple>
1331+ class CommandArg {
1332+ public:
1333+ CommandArg(unsigned aId,
1334+ CommandArgType<Tuple>* aType,
1335+ const std::set<std::string>& aNames,
1336+ const std::string& aDescription,
1337+ bool aIsRequired)
1338+ : theId(aId),
1339+ theType(aType),
1340+ theNames(aNames),
1341+ theDescription(aDescription),
1342+ theIsRequired(aIsRequired)
1343+ {
1344+ }
1345+
1346+ ~CommandArg()
1347+ {
1348+ delete theType;
1349+ }
1350+
1351+ unsigned
1352+ get_id() const
1353+ {
1354+ return theId;
1355+ }
1356+
1357+ bool
1358+ canHandle(const std::string& arg) const
1359+ {
1360+ if (theNames.find(arg) != theNames.end()) {
1361+ return true;
1362+ }
1363+ return false;
1364+ }
1365+
1366+ CommandArgInstance<Tuple>*
1367+ parse(const std::string& str) const
1368+ {
1369+ return theType->parse(str, this);
1370+ }
1371+
1372+ bool
1373+ isVoid() const
1374+ {
1375+ return theType->isVoid();
1376+ }
1377+
1378+ bool
1379+ isRequired() const
1380+ {
1381+ return theIsRequired;
1382+ }
1383+
1384+ std::string
1385+ getName() const
1386+ {
1387+ return *(theNames.begin());
1388+ }
1389+
1390+ std::string
1391+ getDescription() const
1392+ {
1393+ return theDescription;
1394+ }
1395+
1396+ bool
1397+ isSet(Tuple& t) const
1398+ {
1399+ return theType->isSet(t);
1400+ }
1401+
1402+ private:
1403+
1404+ unsigned theId;
1405+ CommandArgType<Tuple>* theType;
1406+ std::set<std::string> theNames;
1407+ std::string theDescription;
1408+ bool theIsRequired;
1409+ };
1410+
1411+} // namespace zorba
1412+} // namespace debugger
1413+
1414+#endif // ZORBA_DEBUGGER_COMMAND_ARG_H
1415
1416=== modified file 'bin/debugger/command_line_handler.cpp'
1417--- bin/debug_client/command_line_handler.cpp 2011-07-01 01:53:24 +0000
1418+++ bin/debugger/command_line_handler.cpp 2012-02-22 17:11:27 +0000
1419@@ -1,4 +1,4 @@
1420-/*
1421+ /*
1422 * Copyright 2006-2008 The FLWOR Foundation.
1423 *
1424 * Licensed under the Apache License, Version 2.0 (the "License");
1425@@ -23,225 +23,385 @@
1426 # define msleep Sleep
1427 #endif
1428
1429-namespace zorba { namespace debugclient {
1430+#include "command_prompt.h"
1431+
1432+
1433+namespace zorba { namespace debugger {
1434
1435- using namespace ::std;
1436 using namespace ::ZORBA_TR1_NS;
1437
1438- CommandLineHandler::CommandLineHandler(unsigned short port,
1439- LockFreeConsumer<std::size_t>& aConsumer,
1440- LockFreeConsumer<bool>& aContinueQueue,
1441- EventHandler& aHandler,
1442- CommandLine& aCommandLine)
1443+CommandLineHandler::CommandLineHandler(
1444+ unsigned short port,
1445+ LockFreeConsumer<std::size_t>& aConsumer,
1446+ LockFreeConsumer<bool>& aContinueQueue,
1447+ EventHandler* aHandler,
1448+ CommandPrompt* aCommandPrompt)
1449 : theConsumer(aConsumer),
1450 theContinueQueue(aContinueQueue),
1451- theClient(DebuggerClient::createDebuggerClient(&aHandler, port, "localhost")),
1452- theCommandLine(aCommandLine),
1453- theQuit(false), theContinue(false), theWaitFor(0)
1454+ theClient(DebuggerClient::createDebuggerClient(aHandler, port, "localhost")),
1455+ theCommandLine(aCommandPrompt),
1456+ theQuit(false), theTerminated(true), theContinue(false), theWaitFor(0)
1457 {
1458 addCommands();
1459 }
1460
1461- CommandLineHandler::~CommandLineHandler()
1462- {
1463- }
1464+CommandLineHandler::~CommandLineHandler()
1465+{
1466+}
1467
1468- void CommandLineHandler::execute()
1469- {
1470- theClient->accept();
1471- std::set<std::size_t> lIdList;
1472- do {
1473+void
1474+CommandLineHandler::execute()
1475+{
1476+ theClient->accept();
1477+ std::set<std::size_t> lIdList;
1478+ do {
1479+ getNextId(lIdList);
1480+ while (lIdList.find(theWaitFor) == lIdList.end()) {
1481 getNextId(lIdList);
1482- while (!theQuit && lIdList.find(theWaitFor) == lIdList.end()) {
1483- getNextId(lIdList);
1484- msleep(20);
1485- }
1486- while (!theContinueQueue.consume(theQuit)) {
1487- msleep(20);
1488- }
1489- theQuit = !theQuit;
1490- if (!theQuit) {
1491- theCommandLine.execute();
1492- while (theContinue) {
1493- theContinue = false;
1494- theCommandLine.execute();
1495- }
1496- }
1497- } while (!theQuit);
1498- }
1499-
1500- void CommandLineHandler::getNextId(std::set<std::size_t>& aIdList)
1501- {
1502- std::size_t result;
1503- if (theConsumer.consume(result)) {
1504- aIdList.insert(result);
1505- }
1506- }
1507-
1508- template<>
1509- void CommandLineHandler::handle<Status>(ZORBA_TR1_NS::tuple<> &t)
1510- {
1511- theWaitFor = theClient->status();
1512- }
1513-
1514- template<>
1515- void CommandLineHandler::handle<Quit>(ZORBA_TR1_NS::tuple<> &t)
1516- {
1517+ msleep(20);
1518+ }
1519+ bool lCanQuit;
1520+ while (!theContinueQueue.consume(lCanQuit)) {
1521+ msleep(20);
1522+ }
1523+ if (lCanQuit) {
1524+ theTerminated = true;
1525+ }
1526+ theCommandLine->execute();
1527+ while (theContinue) {
1528+ theContinue = false;
1529+ theCommandLine->execute();
1530+ }
1531+ } while (!theQuit);
1532+}
1533+
1534+void
1535+CommandLineHandler::getNextId(std::set<std::size_t>& aIdList)
1536+{
1537+ std::size_t result;
1538+ if (theConsumer.consume(result)) {
1539+ aIdList.insert(result);
1540+ }
1541+}
1542+
1543+template<>
1544+void
1545+CommandLineHandler::handle<Status>(ZORBA_TR1_NS::tuple<> &t)
1546+{
1547+ theWaitFor = theClient->status();
1548+}
1549+
1550+template<>
1551+void
1552+CommandLineHandler::handle<Variables>(ZORBA_TR1_NS::tuple<> &t)
1553+{
1554+ theWaitFor = theClient->variables();
1555+}
1556+
1557+template<>
1558+void
1559+CommandLineHandler::handle<Quit>(ZORBA_TR1_NS::tuple<> &t)
1560+{
1561+ if (!theTerminated) {
1562 bool answered = false;
1563 while (!answered) {
1564 std::cout << "Do you really want to stop debugging and exit? (y/n) ";
1565- char answer;
1566- std::cin >> answer;
1567- std::cout << std::endl;
1568- if (answer == 'y') {
1569+ std::string lAnswer;
1570+ std::getline(std::cin, lAnswer);
1571+ if (lAnswer == "y" || lAnswer == "yes") {
1572 answered = true;
1573- } else if (answered == 'n') {
1574+ } else if (lAnswer == "n" || lAnswer == "no") {
1575 theContinue = true;
1576 return;
1577 }
1578 }
1579- theWaitFor = theClient->stop();
1580- theClient->quit();
1581- }
1582-
1583- template<>
1584- void CommandLineHandler::handle<Run>(ZORBA_TR1_NS::tuple<> &t)
1585- {
1586- theWaitFor = theClient->run();
1587- }
1588-
1589- template<>
1590- void CommandLineHandler::handle<BreakpointSet>(std::tr1::tuple<bstring, bstring, bint> &t)
1591- {
1592- DebuggerClient::BreakpointType lType = DebuggerClient::Line;
1593- bool lEnabled = true;
1594- if (get<0>(t).first) {
1595- if (get<0>(t).second == "disabled") {
1596- lEnabled = false;
1597- }
1598- }
1599- theWaitFor = theClient->breakpoint_set(lType,
1600- lEnabled,
1601- get<1>(t).second,
1602- get<2>(t).second);
1603- }
1604-
1605- template<>
1606- void CommandLineHandler::handle<BreakpointGet>(tuple<bint> &aTuple)
1607- {
1608- theWaitFor = theClient->breakpoint_get(get<0>(aTuple).second);
1609- }
1610-
1611- template<>
1612- void CommandLineHandler::handle<BreakpointDel>(tuple<bint> &aTuple)
1613- {
1614- theWaitFor = theClient->breakpoint_remove(get<0>(aTuple).second);
1615- }
1616-
1617- template<>
1618- void CommandLineHandler::handle<BreakpointList>(tuple<> &t)
1619- {
1620- theWaitFor = theClient->breakpoint_list();
1621- }
1622-
1623- template<>
1624- void CommandLineHandler::handle<StackDepth>(tuple<> &t)
1625- {
1626- theWaitFor = theClient->stack_depth();
1627- }
1628-
1629- template<>
1630- void CommandLineHandler::handle<StackGet>(tuple<bint> &aTuple)
1631- {
1632- if (get<0>(aTuple).first) {
1633- theWaitFor = theClient->stack_get(get<0>(aTuple).second);
1634- } else {
1635- theWaitFor = theClient->stack_get();
1636- }
1637- }
1638-
1639- template<>
1640- void CommandLineHandler::handle<ContextNames>(tuple<>& aTuple)
1641- {
1642- theWaitFor = theClient->context_names();
1643- }
1644-
1645- template<>
1646- void CommandLineHandler::handle<ContextGet>(tuple<bint> &aTuple)
1647- {
1648- if (get<0>(aTuple).first)
1649- theWaitFor = theClient->context_get(get<0>(aTuple).second);
1650- else
1651- theWaitFor = theClient->context_get();
1652- }
1653-
1654- template<>
1655- void CommandLineHandler::handle<Eval>(tuple<bstring>& aTuple)
1656- {
1657- theWaitFor = theClient->eval(get<0>(aTuple).second);
1658- }
1659-
1660- void CommandLineHandler::addCommands()
1661- {
1662- theCommandLine << createCommand<Status>(tuple<>(), "status", *this,
1663- "Gets the status of the server");
1664- theCommandLine << createCommand<Quit>(tuple<>(), "quit", *this,
1665- "Stops debugging and quits the client");
1666- theCommandLine << createCommand<Run>(tuple<>(), "run", *this, "Run the Query");
1667- {
1668- Command<CommandLineHandler, tuple<bstring, bstring, bint>, BreakpointSet>* lCommand =
1669- createCommand<BreakpointSet>(tuple<bstring, bstring, bint>(), "break", *this, "Set a breakpoint");
1670- (*lCommand)(0, "s", createArgType<tuple<bstring, bstring, bint>, std::string, 0>(tuple<bstring, bstring, bint>()),
1671- "breakpoint state (enabled or disabled - default: enabled)", false);
1672- (*lCommand)(1, "f", createArgType<tuple<bstring, bstring, bint>, std::string, 1>(tuple<bstring, bstring, bint>()),
1673- "The name of the file where to stop", true);
1674- (*lCommand)(2, "l", createArgType<tuple<bstring, bstring, bint>, int, 2>(tuple<bstring, bstring, bint>()),
1675- "The line number", true);
1676-
1677- theCommandLine << lCommand;
1678- }
1679- {
1680- Command<CommandLineHandler, tuple<bint>, BreakpointGet>* lCommand
1681- = createCommand<BreakpointGet>(tuple<bint>(), "binfo", *this,
1682- "Get information about a given breakpoint");
1683- (*lCommand)(0, "i", createArgType<tuple<bint>, int, 0>(tuple<bint>()),
1684- "The id of the breakpoint", true);
1685-
1686- theCommandLine << lCommand;
1687- }
1688- {
1689- Command<CommandLineHandler, tuple<bint>, BreakpointDel>* lCommand
1690- = createCommand<BreakpointDel>(tuple<bint>(), "bdel", *this, "Delete a breakpoint with a given id");
1691- (*lCommand)(0, "i", createArgType<tuple<bint>, int, 0>(tuple<bint>()), "The id of the breakpoint", true);
1692-
1693- theCommandLine << lCommand;
1694- }
1695- theCommandLine << createCommand<BreakpointList>(tuple<>(), "blist", *this, "List all set breakpoints");
1696- theCommandLine << createCommand<StackDepth>(tuple<>(), "sdepth", *this, "Get the depth of the stack");
1697- {
1698- Command<CommandLineHandler, tuple<bint>, StackGet>* lCommand
1699- = createCommand<StackGet>(tuple<bint>(), "sget", *this, "Get information about one or all stack frames");
1700- (*lCommand)(0, "d", createArgType<tuple<bint>, int, 0>(tuple<bint>()), "The stack entry two show (show all if not provided)", false);
1701- theCommandLine << lCommand;
1702- }
1703- theCommandLine << createCommand<ContextNames>(tuple<>(), "cnames", *this, "Get the names of the avilable contexts");
1704- {
1705- Command<CommandLineHandler, tuple<bint>, ContextGet>* lCommand
1706- = createCommand<ContextGet>(tuple<bint>(), "cget", *this, "Get a context");
1707-
1708- (*lCommand)(0, "c", createArgType<tuple<bint>, int, 0>(tuple<bint>()), "The id of the context", false);
1709-
1710- theCommandLine << lCommand;
1711- }
1712- {
1713- Command<CommandLineHandler, tuple<bstring>, Eval>* lCommand
1714- = createCommand<Eval>(tuple<bstring>(), "eval", *this, "Evaluate a function");
1715-
1716- (*lCommand)(0, "c", createArgType<tuple<bstring>, std::string, 0>(tuple<bstring>()), "The command to evaluate", true);
1717-
1718- theCommandLine << lCommand;
1719- }
1720- }
1721-
1722-}} // namespace zorba::debugclient
1723-
1724+ }
1725+ theWaitFor = theClient->stop(true);
1726+ theClient->quit();
1727+ theQuit = true;
1728+}
1729+
1730+template<>
1731+void
1732+CommandLineHandler::handle<Run>(ZORBA_TR1_NS::tuple<> &t)
1733+{
1734+ theTerminated = false;
1735+ theWaitFor = theClient->run();
1736+}
1737+
1738+template<>
1739+void
1740+CommandLineHandler::handle<Stop>(ZORBA_TR1_NS::tuple<> &t)
1741+{
1742+ theWaitFor = theClient->stop(false);
1743+}
1744+
1745+template<>
1746+void
1747+CommandLineHandler::handle<BreakpointSet>(std::tr1::tuple<bstring, bstring, bint> &aTuple)
1748+{
1749+ DebuggerClient::BreakpointType lType = DebuggerClient::Line;
1750+ bool lEnabled = true;
1751+ if (get<0>(aTuple).first) {
1752+ if (get<0>(aTuple).second == "disabled") {
1753+ lEnabled = false;
1754+ }
1755+ }
1756+ theWaitFor = theClient->breakpoint_set(lType,
1757+ lEnabled,
1758+ get<1>(aTuple).second,
1759+ get<2>(aTuple).second);
1760+}
1761+
1762+template<>
1763+void
1764+CommandLineHandler::handle<BreakpointGet>(tuple<bint> &aTuple)
1765+{
1766+ theWaitFor = theClient->breakpoint_get(get<0>(aTuple).second);
1767+}
1768+
1769+template<>
1770+void
1771+CommandLineHandler::handle<BreakpointRemove>(tuple<bint> &aTuple)
1772+{
1773+ theWaitFor = theClient->breakpoint_remove(get<0>(aTuple).second);
1774+}
1775+
1776+template<>
1777+void
1778+CommandLineHandler::handle<BreakpointList>(tuple<> &aTuple)
1779+{
1780+ theWaitFor = theClient->breakpoint_list();
1781+}
1782+
1783+template<>
1784+void
1785+CommandLineHandler::handle<StackDepth>(tuple<> &aTuple)
1786+{
1787+ theWaitFor = theClient->stack_depth();
1788+}
1789+
1790+template<>
1791+void
1792+CommandLineHandler::handle<StackGet>(tuple<bint> &aTuple)
1793+{
1794+ if (get<0>(aTuple).first) {
1795+ theWaitFor = theClient->stack_get(get<0>(aTuple).second);
1796+ } else {
1797+ theWaitFor = theClient->stack_get();
1798+ }
1799+}
1800+
1801+template<>
1802+void
1803+CommandLineHandler::handle<ContextNames>(tuple<>& aTuple)
1804+{
1805+ theWaitFor = theClient->context_names();
1806+}
1807+
1808+template<>
1809+void CommandLineHandler::handle<ContextGet>(tuple<bint, bint> &aTuple)
1810+{
1811+ int lDepth = -1;
1812+ int lContext = -1;
1813+
1814+ if (get<0>(aTuple).first) {
1815+ lDepth = get<0>(aTuple).second;
1816+ }
1817+ if (get<1>(aTuple).first) {
1818+ lContext = get<1>(aTuple).second;
1819+ }
1820+ theWaitFor = theClient->context_get(lDepth, lContext);
1821+}
1822+
1823+template<>
1824+void CommandLineHandler::handle<Source>(tuple<bint, bint, bstring> &aTuple)
1825+{
1826+ theWaitFor = theClient->source(
1827+ get<2>(aTuple).second,
1828+ get<0>(aTuple).second,
1829+ get<1>(aTuple).second);
1830+}
1831+
1832+template<>
1833+void CommandLineHandler::handle<Eval>(tuple<bstring>& aTuple)
1834+{
1835+ theWaitFor = theClient->eval(get<0>(aTuple).second);
1836+}
1837+
1838+template<>
1839+void
1840+CommandLineHandler::handle<StepIn>(ZORBA_TR1_NS::tuple<> &t)
1841+{
1842+ theTerminated = false;
1843+ theWaitFor = theClient->step_into();
1844+}
1845+
1846+template<>
1847+void
1848+CommandLineHandler::handle<StepOut>(ZORBA_TR1_NS::tuple<> &t)
1849+{
1850+ theWaitFor = theClient->step_out();
1851+}
1852+
1853+template<>
1854+void
1855+CommandLineHandler::handle<StepOver>(ZORBA_TR1_NS::tuple<> &t)
1856+{
1857+ theTerminated = false;
1858+ theWaitFor = theClient->step_over();
1859+}
1860+
1861+void
1862+CommandLineHandler::addCommands()
1863+{
1864+ typedef tuple<> TUPLE;
1865+ typedef tuple<bint> TUPLE_INT;
1866+ typedef tuple<bstring> TUPLE_STR;
1867+ typedef tuple<bint, bint> TUPLE_INT_INT;
1868+ typedef tuple<bstring, bstring, bint> TUPLE_STR_STR_INT;
1869+ typedef tuple<bint, bint, bstring> TUPLE_INT_INT_STR;
1870+
1871+ // DBGP: status
1872+ *theCommandLine << createCommand<Status>(TUPLE(), "status", *this, "Gets the status of the server");
1873+
1874+ // ALIAS: variables (context_get -c -1)
1875+ {
1876+ std::set<std::string> lAliases;
1877+ lAliases.insert("vars");
1878+ *theCommandLine << createCommand<Variables>(TUPLE(), "variables", lAliases, *this, "Gets the variables visible in the current scope");
1879+ }
1880+
1881+ // META: quit
1882+ *theCommandLine << createCommand<Quit>(TUPLE(), "quit", *this, "Stops debugging and quits the client");
1883+
1884+ // DBGP: run
1885+ *theCommandLine << createCommand<Run>(TUPLE(), "run", *this, "Run the query");
1886+
1887+ // DBGP: stop
1888+ *theCommandLine << createCommand<Stop>(TUPLE(), "stop", *this, "Stop the query");
1889+
1890+ // DBGP: breakpoint_set
1891+ {
1892+ std::set<std::string> lAliases;
1893+ lAliases.insert("break");
1894+ Command<CommandLineHandler, TUPLE_STR_STR_INT, BreakpointSet>* lCommand =
1895+ createCommand<BreakpointSet>(TUPLE_STR_STR_INT(), "bset", lAliases, *this, "Set a breakpoint");
1896+
1897+ 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);
1898+ lCommand->addArgument(1, "f", createArgType<TUPLE_STR_STR_INT, std::string, 1>(TUPLE_STR_STR_INT()), "name of the file where to stop", true);
1899+ lCommand->addArgument(2, "l", createArgType<TUPLE_STR_STR_INT, int, 2>(TUPLE_STR_STR_INT()), "line number", true);
1900+
1901+ *theCommandLine << lCommand;
1902+ }
1903+
1904+ // DBGP: breakpoint_get
1905+ {
1906+ Command<CommandLineHandler, TUPLE_INT, BreakpointGet>* lCommand =
1907+ createCommand<BreakpointGet>(TUPLE_INT(), "bget", *this, "Get information about a given breakpoint");
1908+
1909+ lCommand->addArgument(0, "d", createArgType<TUPLE_INT, int, 0>(TUPLE_INT()), "breakpoint ID", true);
1910+
1911+ *theCommandLine << lCommand;
1912+ }
1913+
1914+ // DBGP: breakpoint_remove
1915+ {
1916+ std::set<std::string> lAliases;
1917+ lAliases.insert("clear");
1918+ lAliases.insert("delete");
1919+ Command<CommandLineHandler, TUPLE_INT, BreakpointRemove>* lCommand =
1920+ createCommand<BreakpointRemove>(TUPLE_INT(), "bremove", lAliases, *this, "Delete a breakpoint");
1921+
1922+ lCommand->addArgument(0, "d", createArgType<TUPLE_INT, int, 0>(TUPLE_INT()), "breakpoint ID", true);
1923+
1924+ *theCommandLine << lCommand;
1925+ }
1926+
1927+ // DBGP: breakpoint_list
1928+ *theCommandLine << createCommand<BreakpointList>(TUPLE(), "blist", *this, "List all set breakpoints");
1929+
1930+ // DBGP: stack_depth
1931+ *theCommandLine << createCommand<StackDepth>(TUPLE(), "sdepth", *this, "Get the depth of the stack");
1932+
1933+ // DBGP: stack_get
1934+ {
1935+ Command<CommandLineHandler, TUPLE_INT, StackGet>* lCommand =
1936+ createCommand<StackGet>(TUPLE_INT(), "sget", *this, "Get information about one or all stack frames");
1937+
1938+ 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);
1939+
1940+ *theCommandLine << lCommand;
1941+ }
1942+
1943+ // DBGP: context_names
1944+ *theCommandLine << createCommand<ContextNames>(tuple<>(), "cnames", *this, "Get the names of the avilable contexts");
1945+ // the DBGP -d arguments for this command is omitted since we always have/return: 0 - Local, 1 - Global
1946+
1947+ // DBGP: context_get
1948+ {
1949+ Command<CommandLineHandler, TUPLE_INT_INT, ContextGet>* lCommand =
1950+ createCommand<ContextGet>(TUPLE_INT_INT(), "cget", *this, "Get a context (list variables in this context)");
1951+
1952+ lCommand->addArgument(0, "d", createArgType<TUPLE_INT_INT, int, 0>(TUPLE_INT_INT()), "stack depth (optional, default: 0)", false);
1953+ 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);
1954+
1955+ *theCommandLine << lCommand;
1956+ }
1957+
1958+ // DBGP: source
1959+ {
1960+ std::set<std::string> lAliases;
1961+ lAliases.insert("list");
1962+ Command<CommandLineHandler, TUPLE_INT_INT_STR, Source>* lCommand =
1963+ createCommand<Source>(TUPLE_INT_INT_STR(), "source", lAliases, *this, "List source code");
1964+
1965+ lCommand->addArgument(0, "b", createArgType<TUPLE_INT_INT_STR, int, 0>(TUPLE_INT_INT_STR()), "begin line (optional, default: first line)", false);
1966+ lCommand->addArgument(1, "e", createArgType<TUPLE_INT_INT_STR, int, 1>(TUPLE_INT_INT_STR()), "end line (optional, default: last line)", false);
1967+ 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);
1968+
1969+ *theCommandLine << lCommand;
1970+ }
1971+
1972+ // DBGP: eval
1973+ {
1974+ std::set<std::string> lAliases;
1975+ lAliases.insert("print");
1976+ Command<CommandLineHandler, TUPLE_STR, Eval>* lCommand =
1977+ createCommand<Eval>(TUPLE_STR(), "eval", lAliases, *this, "Evaluate an expression");
1978+
1979+ // TODO: this argument should not be here at all. Eval has the form: eval -i transaction_id -- {DATA}
1980+ // Eval should be called with a command like: eval 1 + 3
1981+ // - no need for an argument name
1982+ // - everything following the fist contiguous set of whitespaces are sent as string
1983+ lCommand->addArgument(0, "c", createArgType<TUPLE_STR, std::string, 0>(TUPLE_STR()), "expression to evaluate", true);
1984+
1985+ *theCommandLine << lCommand;
1986+ }
1987+
1988+ // DBGP: step_in
1989+ {
1990+ std::set<std::string> lAliases;
1991+ lAliases.insert("step");
1992+ lAliases.insert("s");
1993+ *theCommandLine << createCommand<StepIn>(TUPLE(), "in", lAliases, *this, "Step in");
1994+ }
1995+
1996+ // DBGP: step_out
1997+ {
1998+ std::set<std::string> lAliases;
1999+ lAliases.insert("finish");
2000+ *theCommandLine << createCommand<StepOut>(TUPLE(), "out", lAliases, *this, "Step out");
2001+ }
2002+
2003+ // DBGP: step_over
2004+ {
2005+ std::set<std::string> lAliases;
2006+ lAliases.insert("next");
2007+ lAliases.insert("n");
2008+ *theCommandLine << createCommand<StepOver>(TUPLE(), "over", lAliases, *this, "Step over");
2009+ }
2010+}
2011+
2012+} // namespace zorba
2013+} // namespace debugger
2014
2015=== modified file 'bin/debugger/command_line_handler.h'
2016--- bin/debug_client/command_line_handler.h 2011-07-01 01:53:24 +0000
2017+++ bin/debugger/command_line_handler.h 2012-02-22 17:11:27 +0000
2018@@ -14,46 +14,71 @@
2019 * limitations under the License.
2020 */
2021 #pragma once
2022+#ifndef ZORBA_DEBUGGER_COMMAND_LINE_HANDLER_H
2023+#define ZORBA_DEBUGGER_COMMAND_LINE_HANDLER_H
2024
2025 #include <set>
2026 #include <cassert>
2027+
2028 #include <zorba/debugger_client.h>
2029-#include "debug_command.h"
2030+
2031+#include "command.h"
2032 #include "event_handler.h"
2033
2034-namespace zorba { namespace debugclient {
2035-
2036+
2037+namespace zorba { namespace debugger {
2038+
2039+ class CommandPrompt;
2040+
2041 enum Commands {
2042 Status,
2043+ Variables,
2044+ Quit,
2045 Run,
2046+ Stop,
2047 BreakpointSet,
2048 BreakpointGet,
2049- BreakpointDel,
2050+ BreakpointRemove,
2051 BreakpointList,
2052 StackDepth,
2053 StackGet,
2054 ContextNames,
2055 ContextGet,
2056+ Source,
2057 Eval,
2058- Quit
2059+ StepIn,
2060+ StepOut,
2061+ StepOver
2062 };
2063
2064- class CommandLineHandler {
2065+class CommandLineHandler
2066+{
2067 private:
2068+
2069 typedef std::pair<bool, std::string> bstring;
2070 typedef std::pair<bool, int> bint;
2071+
2072 public:
2073- CommandLineHandler(unsigned short port,
2074- LockFreeConsumer<std::size_t>& aConsumer,
2075- LockFreeConsumer<bool>& aContinueQueue,
2076- EventHandler& aHandler,
2077- CommandLine& aCommandLine);
2078+
2079+ CommandLineHandler(
2080+ unsigned short port,
2081+ LockFreeConsumer<std::size_t>& aConsumer,
2082+ LockFreeConsumer<bool>& aContinueQueue,
2083+ EventHandler* aHandler,
2084+ CommandPrompt* aCommandPrompt);
2085+
2086 ~CommandLineHandler();
2087+
2088 public:
2089 void execute();
2090+
2091 public: // Handlers
2092+
2093 template<int>
2094- void handle(ZORBA_TR1_NS::tuple<>& aTuple) { assert(false); }
2095+ void handle(ZORBA_TR1_NS::tuple<>& aTuple)
2096+ {
2097+ assert(false);
2098+ }
2099
2100 template<int>
2101 void handle(ZORBA_TR1_NS::tuple<bstring, bstring, bint>& t)
2102@@ -62,63 +87,96 @@
2103 }
2104
2105 template<int>
2106+ void handle(ZORBA_TR1_NS::tuple<bint, bint, bstring>& t)
2107+ {
2108+ assert(false);
2109+ }
2110+
2111+ template<int>
2112 void handle(ZORBA_TR1_NS::tuple<bint>& aTuple)
2113 {
2114 assert(false);
2115 }
2116
2117 template<int>
2118+ void handle(ZORBA_TR1_NS::tuple<bint, bint>& aTuple)
2119+ {
2120+ assert(false);
2121+ }
2122+
2123+ template<int>
2124 void handle(ZORBA_TR1_NS::tuple<bstring>& aTuple)
2125 {
2126 assert(false);
2127 }
2128+
2129 private:
2130- LockFreeConsumer<std::size_t>& theConsumer;
2131- LockFreeConsumer<bool>& theContinueQueue;
2132- DebuggerClient* theClient;
2133- CommandLine& theCommandLine;
2134- bool theQuit;
2135- bool theContinue;
2136- std::size_t theWaitFor;
2137+ LockFreeConsumer<std::size_t>& theConsumer;
2138+ LockFreeConsumer<bool>& theContinueQueue;
2139+ DebuggerClient* theClient;
2140+ CommandPrompt* theCommandLine;
2141+ bool theQuit;
2142+ bool theTerminated;
2143+ bool theContinue;
2144+ std::size_t theWaitFor;
2145+
2146 private:
2147 void getNextId(std::set<std::size_t>& aIdList);
2148 void addCommands();
2149- };
2150-
2151- template<>
2152- void CommandLineHandler::handle<Status> (ZORBA_TR1_NS::tuple<>& t);
2153-
2154- template<>
2155- void CommandLineHandler::handle<Quit> (ZORBA_TR1_NS::tuple<>& t);
2156-
2157- template<>
2158- void CommandLineHandler::handle<Run> (ZORBA_TR1_NS::tuple<> &t);
2159-
2160- template<>
2161- void CommandLineHandler::handle<StackDepth> (ZORBA_TR1_NS::tuple<>& t);
2162-
2163- template<>
2164- void CommandLineHandler::handle<BreakpointList> (ZORBA_TR1_NS::tuple<>& aTuple);
2165-
2166- template<>
2167- void CommandLineHandler::handle<BreakpointSet> (ZORBA_TR1_NS::tuple<bstring, bstring, bint> &t);
2168-
2169- template<>
2170- void CommandLineHandler::handle<BreakpointGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);
2171-
2172- template<>
2173- void CommandLineHandler::handle<BreakpointDel>(ZORBA_TR1_NS::tuple<bint> &aTuple);
2174-
2175- template<>
2176- void CommandLineHandler::handle<StackGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);
2177-
2178- template<>
2179- void CommandLineHandler::handle<ContextNames>(ZORBA_TR1_NS::tuple<> &aTuple);
2180-
2181- template<>
2182- void CommandLineHandler::handle<ContextGet>(ZORBA_TR1_NS::tuple<bint> &aTuple);
2183-
2184- template<>
2185- void CommandLineHandler::handle<Eval>(ZORBA_TR1_NS::tuple<bstring>& aTuple);
2186-
2187-}} // close namespaces zorba::debugclient
2188+};
2189+
2190+template<>
2191+void CommandLineHandler::handle<Status> (ZORBA_TR1_NS::tuple<>& t);
2192+
2193+template<>
2194+void CommandLineHandler::handle<Quit> (ZORBA_TR1_NS::tuple<>& t);
2195+
2196+template<>
2197+void CommandLineHandler::handle<Run> (ZORBA_TR1_NS::tuple<> &t);
2198+
2199+template<>
2200+void CommandLineHandler::handle<Stop> (ZORBA_TR1_NS::tuple<> &t);
2201+
2202+template<>
2203+void CommandLineHandler::handle<StackDepth> (ZORBA_TR1_NS::tuple<>& t);
2204+
2205+template<>
2206+void CommandLineHandler::handle<BreakpointList> (ZORBA_TR1_NS::tuple<>& aTuple);
2207+
2208+template<>
2209+void CommandLineHandler::handle<BreakpointSet> (ZORBA_TR1_NS::tuple<bstring, bstring, bint> &t);
2210+
2211+template<>
2212+void CommandLineHandler::handle<BreakpointGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);
2213+
2214+template<>
2215+void CommandLineHandler::handle<BreakpointRemove>(ZORBA_TR1_NS::tuple<bint> &aTuple);
2216+
2217+template<>
2218+void CommandLineHandler::handle<StackGet> (ZORBA_TR1_NS::tuple<bint>& aTuple);
2219+
2220+template<>
2221+void CommandLineHandler::handle<ContextNames>(ZORBA_TR1_NS::tuple<> &aTuple);
2222+
2223+template<>
2224+void CommandLineHandler::handle<ContextGet>(ZORBA_TR1_NS::tuple<bint, bint> &aTuple);
2225+
2226+template<>
2227+void CommandLineHandler::handle<Source>(ZORBA_TR1_NS::tuple<bint, bint, bstring> &aTuple);
2228+
2229+template<>
2230+void CommandLineHandler::handle<Eval>(ZORBA_TR1_NS::tuple<bstring>& aTuple);
2231+
2232+template<>
2233+void CommandLineHandler::handle<StepIn> (ZORBA_TR1_NS::tuple<> &t);
2234+
2235+template<>
2236+void CommandLineHandler::handle<StepOut> (ZORBA_TR1_NS::tuple<> &t);
2237+
2238+template<>
2239+void CommandLineHandler::handle<StepOver> (ZORBA_TR1_NS::tuple<> &t);
2240+
2241+} // namespace zorba
2242+} // namespace debugger
2243+
2244+#endif // ZORBA_DEBUGGER_COMMAND_LINE_HANDLER_H
2245
2246=== added file 'bin/debugger/command_prompt.cpp'
2247--- bin/debugger/command_prompt.cpp 1970-01-01 00:00:00 +0000
2248+++ bin/debugger/command_prompt.cpp 2012-02-22 17:11:27 +0000
2249@@ -0,0 +1,287 @@
2250+/*
2251+ * Copyright 2006-2008 The FLWOR Foundation.
2252+ *
2253+ * Licensed under the Apache License, Version 2.0 (the "License");
2254+ * you may not use this file except in compliance with the License.
2255+ * You may obtain a copy of the License at
2256+ *
2257+ * http://www.apache.org/licenses/LICENSE-2.0
2258+ *
2259+ * Unless required by applicable law or agreed to in writing, software
2260+ * distributed under the License is distributed on an "AS IS" BASIS,
2261+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2262+ * See the License for the specific language governing permissions and
2263+ * limitations under the License.
2264+ */
2265+#include "command_prompt.h"
2266+
2267+#include <string>
2268+#include <vector>
2269+#include <map>
2270+#include <iostream>
2271+
2272+#include "command.h"
2273+
2274+
2275+namespace zorba { namespace debugger {
2276+
2277+#ifdef ZORBA_HAVE_LIBEDIT_H
2278+const char*
2279+prompt(EditLine* aEl) {
2280+ return "(xqdb) ";
2281+}
2282+#endif
2283+
2284+CommandPrompt::CommandPrompt()
2285+{
2286+#ifdef ZORBA_HAVE_LIBEDIT_H
2287+ theEditLine = el_init("xqdb", stdin, stdout, stderr);
2288+ theHistory = history_init();
2289+ HistEvent lHistoryEvent;
2290+ history(theHistory, &lHistoryEvent, H_SETSIZE, 100);
2291+
2292+ el_set(theEditLine, EL_PROMPT, prompt);
2293+
2294+ el_set(theEditLine, EL_HIST, history, theHistory);
2295+ el_set(theEditLine, EL_EDITOR, "emacs");
2296+#endif
2297+}
2298+
2299+CommandPrompt::~CommandPrompt()
2300+{
2301+#ifdef ZORBA_HAVE_LIBEDIT_H
2302+ history_end(theHistory);
2303+ el_end(theEditLine);
2304+#endif
2305+
2306+ std::map<std::string, UntypedCommand*>::iterator lIter;
2307+ for (lIter = theCommands.begin(); lIter != theCommands.end(); ++lIter) {
2308+ delete lIter->second;
2309+ }
2310+}
2311+
2312+void
2313+CommandPrompt::printHelp(UntypedCommand* aCommand)
2314+{
2315+ // if no command is provided, print all the available commands
2316+ if (!aCommand) {
2317+ std::cout << "Available commands:" << std::endl;
2318+
2319+ // print the names of all commands
2320+ std::map<std::string, UntypedCommand*>::iterator lIter = theCommands.begin();
2321+ while (lIter != theCommands.end()) {
2322+ std::cout << " " << (*lIter).first;
2323+ std::set<std::string> lAliases = (*lIter).second->getAliases();
2324+ std::set<std::string>::const_iterator lAliasIter = lAliases.begin();
2325+ while (lAliasIter != lAliases.end()) {
2326+ std::cout << ", " << *lAliasIter;
2327+ lAliasIter++;
2328+ }
2329+ std::cout << std::endl;
2330+ lIter++;
2331+ }
2332+
2333+ // some hints for detailed help
2334+ std::cout << std::endl;
2335+ std::cout << "Type help <command> to get more information about one command." << std::endl;
2336+ std::cout << std::endl;
2337+ } else {
2338+ // ok, so we have a command; then print the help
2339+ aCommand->printHelp();
2340+ }
2341+}
2342+
2343+void
2344+CommandPrompt::execute()
2345+{
2346+ bool lWithOutput = true;
2347+
2348+ for (;;) {
2349+#ifdef ZORBA_HAVE_LIBEDIT_H
2350+ const char* lBuf;
2351+ int lCharsRead = -1;
2352+ lBuf = el_gets(theEditLine, &lCharsRead);
2353+ std::string lCommandLine(lBuf, lCharsRead - 1);
2354+#else
2355+ if (lWithOutput) {
2356+ std::cout << "(xqdb) ";
2357+ }
2358+ lWithOutput = true;
2359+ std::string lCommandLine;
2360+ std::getline(std::cin, lCommandLine);
2361+ if (std::cin.fail()) {
2362+ lWithOutput = false;
2363+ std::cin.clear();
2364+ continue;
2365+ }
2366+#endif
2367+
2368+ std::vector<std::string> lArgs;
2369+
2370+ // split the command into arguments
2371+ parseLine(lCommandLine, lArgs);
2372+ std::string::size_type lSize = lArgs.size();
2373+
2374+ // empty command? do nothing!
2375+ if (lSize == 0) {
2376+ lArgs = theLastArgs;
2377+ if (lArgs.size() == 0) {
2378+ continue;
2379+ }
2380+ }
2381+#ifdef ZORBA_HAVE_LIBEDIT_H
2382+ else {
2383+ HistEvent lHistoryEvent;
2384+ history(theHistory, &lHistoryEvent, H_ENTER, lCommandLine.c_str());
2385+ }
2386+#endif
2387+ theLastArgs = lArgs;
2388+
2389+ UntypedCommand* lCommand = NULL;
2390+
2391+ // help is not a command but a hook here
2392+ if (lArgs.at(0) == "h" || lArgs.at(0) == "help") {
2393+ std::string lCmd = "";
2394+
2395+ // if the user needs the help for a specific command
2396+ if (lSize > 1) {
2397+ // do nothing if we don't have a command starting with this prefix?
2398+ // findCommand will print the appropriate errors
2399+ if (!findCommand(lArgs[1], lCommand)) {
2400+ continue;
2401+ }
2402+ }
2403+ printHelp(lCommand);
2404+ continue;
2405+ }
2406+ if (findCommand(lArgs[0], lCommand) && lCommand->execute(lArgs)) {
2407+ return;
2408+ }
2409+ continue;
2410+ }
2411+}
2412+
2413+CommandPrompt&
2414+CommandPrompt::operator<<(UntypedCommand *aCommand)
2415+{
2416+ theCommands.insert(std::make_pair(aCommand->getName(), aCommand));
2417+ return *this;
2418+}
2419+
2420+bool
2421+CommandPrompt::findCommand(const std::string& aPrefix, UntypedCommand*& aCommand)
2422+{
2423+ std::vector<UntypedCommand*> lFoundCommands;
2424+
2425+ std::map<std::string, UntypedCommand*>::iterator lIter = theCommands.begin();
2426+ while (lIter != theCommands.end()) {
2427+ // if a command name is equal with the prefix, this is the command we want
2428+ if ((*lIter).first == aPrefix) {
2429+ aCommand = (*lIter).second;
2430+ return true;
2431+ }
2432+
2433+ bool lIsCandidate = false;
2434+
2435+ // add this command to candidate commands if the prefix matches
2436+ if ((*lIter).first.find(aPrefix) == 0) {
2437+ lFoundCommands.push_back((*lIter).second);
2438+ lIsCandidate = true;
2439+ }
2440+
2441+ // now process the aliases
2442+ std::set<std::string> lAliases = (*lIter).second->getAliases();
2443+ std::set<std::string>::const_iterator lAliasIter = lAliases.begin();
2444+ while (lAliasIter != lAliases.end()) {
2445+ // if a command alias is equal with the prefix, this is the command we want
2446+ if (*lAliasIter == aPrefix) {
2447+ aCommand = (*lIter).second;
2448+ return true;
2449+ }
2450+
2451+ // add this command to candidate commands if the prefix matches one alias
2452+ // and if the command is not already added
2453+ if (!lIsCandidate && (*lAliasIter).find(aPrefix) == 0) {
2454+ lFoundCommands.push_back((*lIter).second);
2455+ break;
2456+ }
2457+ lAliasIter++;
2458+ }
2459+
2460+ lIter++;
2461+ }
2462+
2463+ if (lFoundCommands.empty()) {
2464+ std::cout << "Command not found: " << aPrefix << std::endl;
2465+ return false;
2466+ }
2467+
2468+ if (lFoundCommands.size() > 1) {
2469+ std::cout << "Ambigous command: " << aPrefix << std::endl;
2470+ // show all possible commands that start with this prefix
2471+ for (std::string::size_type i = 0; i < lFoundCommands.size(); i++) {
2472+ UntypedCommand* lCommand = lFoundCommands.at(i);
2473+
2474+ // commands
2475+ if (lCommand->getName().find(aPrefix) == 0) {
2476+ std::cout << " " << lCommand->getName() << std::endl;
2477+ }
2478+
2479+ // and aliases
2480+ std::set<std::string> lAliases = lCommand->getAliases();
2481+ std::set<std::string>::const_iterator lAliasIter = lAliases.begin();
2482+ while (lAliasIter != lAliases.end()) {
2483+ if ((*lAliasIter).find(aPrefix) == 0) {
2484+ std::cout << " " << *lAliasIter << std::endl;
2485+ }
2486+ lAliasIter++;
2487+ }
2488+ }
2489+ return false;
2490+ }
2491+
2492+ aCommand = lFoundCommands[0];
2493+ return true;
2494+}
2495+
2496+void
2497+CommandPrompt::parseLine(const std::string& aLine, std::vector<std::string>& aVector)
2498+{
2499+ std::string::size_type lBefore = 0;
2500+ std::string::size_type lPos = aLine.find_first_of(" \t", 0);
2501+
2502+ while (lPos != aLine.npos) {
2503+ std::string lSub = aLine.substr(lBefore, lPos - lBefore);
2504+
2505+ // if two consecutive spaces, you get an empty string here
2506+ if (lSub != "") {
2507+ if (lSub[0] == '"') {
2508+ std::string::size_type lBeforeCopy = lBefore;
2509+ do {
2510+ lBeforeCopy = aLine.find("\"", lBeforeCopy + 1);
2511+ } while (lPos != aLine.npos && aLine.size() > lPos + 1 && aLine[lPos + 1] == '\\');
2512+ lPos = lBeforeCopy;
2513+ lSub = aLine.substr(lBefore + 1, lPos - lBefore - 1);
2514+ }
2515+ aVector.push_back(lSub);
2516+ }
2517+
2518+ lBefore = lPos + 1;
2519+ lPos = aLine.find_first_of(" \t", lBefore);
2520+ }
2521+ std::string lSub = aLine.substr(lBefore);
2522+
2523+ // catching the case when the command ends with a space
2524+ if (lSub == "") {
2525+ return;
2526+ }
2527+
2528+ if (lSub[0] == '"') {
2529+ lPos = aLine.find("\"", lBefore + 1);
2530+ lSub = aLine.substr(lBefore + 1, lPos - lBefore - 1);
2531+ }
2532+ aVector.push_back(lSub);
2533+}
2534+
2535+} // namespace zorba
2536+} // namespace debugger
2537
2538=== added file 'bin/debugger/command_prompt.h'
2539--- bin/debugger/command_prompt.h 1970-01-01 00:00:00 +0000
2540+++ bin/debugger/command_prompt.h 2012-02-22 17:11:27 +0000
2541@@ -0,0 +1,72 @@
2542+/*
2543+ * Copyright 2006-2008 The FLWOR Foundation.
2544+ *
2545+ * Licensed under the Apache License, Version 2.0 (the "License");
2546+ * you may not use this file except in compliance with the License.
2547+ * You may obtain a copy of the License at
2548+ *
2549+ * http://www.apache.org/licenses/LICENSE-2.0
2550+ *
2551+ * Unless required by applicable law or agreed to in writing, software
2552+ * distributed under the License is distributed on an "AS IS" BASIS,
2553+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2554+ * See the License for the specific language governing permissions and
2555+ * limitations under the License.
2556+ */
2557+#pragma once
2558+#ifndef ZORBA_DEBUGGER_COMMAND_PROMPT_H
2559+#define ZORBA_DEBUGGER_COMMAND_PROMPT_H
2560+
2561+#include <string>
2562+#include <map>
2563+#include <vector>
2564+
2565+#include "config.h"
2566+
2567+#ifdef ZORBA_HAVE_LIBEDIT_H
2568+# include <histedit.h>
2569+#endif
2570+
2571+
2572+namespace zorba { namespace debugger {
2573+
2574+class UntypedCommand;
2575+
2576+class CommandPrompt
2577+{
2578+ public:
2579+ CommandPrompt();
2580+ ~CommandPrompt();
2581+
2582+ public:
2583+
2584+ void execute();
2585+
2586+ CommandPrompt& operator<< (UntypedCommand* command);
2587+
2588+ private:
2589+
2590+ void
2591+ printHelp(UntypedCommand* command);
2592+
2593+ bool
2594+ findCommand(const std::string& prefix, UntypedCommand*& command);
2595+
2596+ void
2597+ parseLine(const std::string& line, std::vector<std::string>& vector);
2598+
2599+ private:
2600+ std::map<std::string, UntypedCommand*> theCommands;
2601+ std::vector<std::string> theLastArgs;
2602+
2603+#ifdef ZORBA_HAVE_LIBEDIT_H
2604+ EditLine* theEditLine;
2605+ History* theHistory;
2606+#endif
2607+};
2608+
2609+
2610+} // namespace zorba
2611+} // namespace debugger
2612+
2613+#endif // ZORBA_DEBUGGER_COMMAND_PROMPT_H
2614
2615=== added file 'bin/debugger/config.h.cmake'
2616--- bin/debugger/config.h.cmake 1970-01-01 00:00:00 +0000
2617+++ bin/debugger/config.h.cmake 2012-02-22 17:11:27 +0000
2618@@ -0,0 +1,24 @@
2619+/*
2620+ * Copyright 2006-2008 The FLWOR Foundation.
2621+ *
2622+ * Licensed under the Apache License, Version 2.0 (the "License");
2623+ * you may not use this file except in compliance with the License.
2624+ * You may obtain a copy of the License at
2625+ *
2626+ * http://www.apache.org/licenses/LICENSE-2.0
2627+ *
2628+ * Unless required by applicable law or agreed to in writing, software
2629+ * distributed under the License is distributed on an "AS IS" BASIS,
2630+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631+ * See the License for the specific language governing permissions and
2632+ * limitations under the License.
2633+ */
2634+
2635+// This header is configured by Zorba's build process -- DO NOT EDIT!
2636+
2637+#ifndef ZORBA_DEBUGGER_CONFIG_H
2638+#define ZORBA_DEBUGGER_CONFIG_H
2639+
2640+#cmakedefine ZORBA_HAVE_LIBEDIT_H
2641+
2642+#endif /* ZORBA_DEBUGGER_CONFIG_H */
2643
2644=== modified file 'bin/debugger/event_handler.cpp'
2645--- bin/debug_client/event_handler.cpp 2011-07-01 01:53:24 +0000
2646+++ bin/debugger/event_handler.cpp 2012-02-22 17:11:27 +0000
2647@@ -13,88 +13,93 @@
2648 * See the License for the specific language governing permissions and
2649 * limitations under the License.
2650 */
2651+
2652+#include "event_handler.h"
2653+
2654+#include <sstream>
2655+
2656 #include <zorba/zorba.h>
2657 #include <zorba/store_manager.h>
2658 #include <zorba/iterator.h>
2659-#include <sstream>
2660-#include "debug_client/event_handler.h"
2661
2662-namespace zorba { namespace debugclient {
2663+namespace zorba { namespace debugger {
2664
2665- EventHandler::EventHandler(LockFreeProducer<std::size_t>& aQueue, LockFreeProducer<bool>& aContProducer)
2666+EventHandler::EventHandler(LockFreeProducer<std::size_t>& aQueue, LockFreeProducer<bool>& aContProducer)
2667 : theIdQueue(aQueue), theContinueProducer(aContProducer),
2668 theStore(StoreManager::getStore()),
2669 theZorbaInstance(Zorba::getInstance(theStore)),
2670 theStaticContext(theZorbaInstance->createStaticContext())
2671-
2672- {
2673- try {
2674- Zorba_CompilerHints_t lHints;
2675- lHints.opt_level = ZORBA_OPT_LEVEL_O1;
2676- std::auto_ptr<std::istream> stream(getCurrentDirectory());
2677- zorba::String query;
2678- char buffer[1024];
2679- std::string::size_type s;
2680- while ((s = stream->readsome(buffer, 1024))) {
2681- query.append(std::string(buffer, s));
2682- }
2683- theStaticContext->loadProlog(query, lHints);
2684- } catch (zorba::ZorbaException& e) {
2685- std::cerr << "Exception: I was not able to load the query file:" << std::endl;
2686- std::cerr << e.what() << std::endl;
2687- throw;
2688- }
2689- }
2690-
2691- EventHandler::~EventHandler()
2692- {
2693- theStaticContext = 0;
2694- theZorbaInstance->shutdown();
2695- StoreManager::shutdownStore(theStore);
2696- }
2697-
2698- void EventHandler::parseMessage(const std::string &aMessage)
2699- {
2700- try {
2701- zorba::String queryString = "local:main(";
2702- queryString += aMessage + ")";
2703- XQuery_t query = theZorbaInstance->compileQuery(queryString, theStaticContext);
2704- Iterator_t lIter = query->iterator();
2705- Item item;
2706- lIter->open();
2707- bool doContinue = false;
2708- lIter->next(item);
2709- {
2710- const std::string& continueString = item.getStringValue().str();
2711- if (continueString == "true") {
2712- doContinue = true;
2713- } else if (continueString == "false") {
2714- doContinue = false;
2715- } else {
2716- std::stringstream stream(continueString);
2717- stream >> doContinue;
2718- }
2719- }
2720- lIter->next(item);
2721- std::size_t lId;
2722- {
2723- std::stringstream stream(item.getStringValue().c_str());
2724- stream >> lId;
2725- }
2726- lIter->next(item);
2727- std::cout << item.getStringValue() << std::endl;
2728- theContinueProducer.produce(doContinue);
2729- theIdQueue.produce(lId);
2730- } catch (ZorbaException& e) {
2731- std::cerr << "FATAL: could not execute query: " << std::endl;
2732- std::cerr << e << std::endl;
2733- std::cerr << "This is a bug, please report to zorba-users@lists.sourceforge.net" << std::endl;
2734- theContinueProducer.produce(false);
2735- }
2736- }
2737-
2738- void EventHandler::error(unsigned int errcode, const std::string &msg)
2739- {
2740- std::cerr << "Error " << errcode << ": " << msg << std::endl;
2741- }
2742-}}
2743+{
2744+}
2745+
2746+EventHandler::~EventHandler()
2747+{
2748+ theStaticContext = 0;
2749+ theZorbaInstance->shutdown();
2750+ StoreManager::shutdownStore(theStore);
2751+}
2752+
2753+void
2754+EventHandler::init()
2755+{
2756+ try {
2757+ Zorba_CompilerHints_t lHints;
2758+ lHints.opt_level = ZORBA_OPT_LEVEL_O1;
2759+ zorba::String lProlog("import module namespace dmh = 'http://www.zorba-xquery.com/modules/debugger/dbgp-message-handler';");
2760+ theStaticContext->loadProlog(lProlog, lHints);
2761+ } catch (zorba::ZorbaException& e) {
2762+ std::cerr << "Exception: I was not able to load the query file:" << std::endl;
2763+ std::cerr << e.what() << std::endl;
2764+ throw;
2765+ }
2766+}
2767+
2768+void
2769+EventHandler::parseMessage(const std::string &aMessage)
2770+{
2771+ try {
2772+#ifndef NDEBUG
2773+ // uncomment this to see the raw messages received by the event handler
2774+ //std::cout << "Processing response: " << aMessage << std::endl;
2775+#endif
2776+ // the query to process the response
2777+ std::stringstream lQueryStream;
2778+ lQueryStream << "dmh:process(" << aMessage << ")";
2779+ XQuery_t lQuery = theZorbaInstance->compileQuery(lQueryStream.str(), theStaticContext);
2780+
2781+ // get the query result sequrence:
2782+ // 1. a message
2783+ Iterator_t lIter = lQuery->iterator();
2784+ Item lItem;
2785+ lIter->open();
2786+ lIter->next(lItem);
2787+ std::size_t lId;
2788+ std::stringstream lStream(lItem.getStringValue().c_str());
2789+ lStream >> lId;
2790+
2791+ // 2. an "idle" flag (to disable quit confirmation)
2792+ bool lCanQuit = false;
2793+ if (lIter->next(lItem)) {
2794+ String lMessage = lItem.getStringValue();
2795+ lCanQuit = lMessage == "idle";
2796+ std::cout << std::endl << lItem.getStringValue() << std::endl;
2797+ }
2798+ theContinueProducer.produce(lCanQuit);
2799+
2800+ // go and solve the event with this id
2801+ theIdQueue.produce(lId);
2802+ } catch (ZorbaException& e) {
2803+ std::cerr << "FATAL: could not execute query: " << std::endl;
2804+ std::cerr << e << std::endl;
2805+ std::cerr << "This is a bug, please report it at http://bugs.launchpad.net/zorba" << std::endl;
2806+ }
2807+}
2808+
2809+void
2810+EventHandler::error(unsigned int errcode, const std::string &msg)
2811+{
2812+ std::cerr << "Error " << errcode << ": " << msg << std::endl;
2813+}
2814+
2815+} // namespace zorba
2816+} // namespace debugger
2817
2818=== modified file 'bin/debugger/event_handler.h'
2819--- bin/debug_client/event_handler.h 2011-07-01 01:53:24 +0000
2820+++ bin/debugger/event_handler.h 2012-02-22 17:11:27 +0000
2821@@ -14,33 +14,46 @@
2822 * limitations under the License.
2823 */
2824 #pragma once
2825+#ifndef ZORBA_DEBUGGER_EVENT_HANDLER_H
2826+#define ZORBA_DEBUGGER_EVENT_HANDLER_H
2827+
2828 #include <string>
2829 #include <iostream>
2830+
2831 #include <zorba/debugger_event_handler.h>
2832 #include <zorba/static_context.h>
2833+
2834 #include "lock_free_queue.h"
2835
2836-namespace zorba {
2837- class Zorba;
2838-}
2839-
2840-namespace zorba { namespace debugclient {
2841-
2842- class EventHandler : public zorba::DebuggerEventHandler
2843- {
2844+
2845+namespace zorba { namespace debugger {
2846+
2847+class EventHandler : public zorba::DebuggerEventHandler
2848+{
2849 public:
2850- EventHandler(LockFreeProducer<std::size_t>& aQueue, LockFreeProducer<bool>& aContQueue);
2851+ EventHandler(
2852+ LockFreeProducer<std::size_t>& aQueue,
2853+ LockFreeProducer<bool>& aContQueue);
2854+
2855 ~EventHandler();
2856+
2857 public:
2858 virtual void parseMessage(const std::string& aMessage);
2859+
2860 virtual void error(unsigned int errcode, const std::string& msg);
2861+
2862+ virtual void init();
2863+
2864 private:
2865- static std::istream* getCurrentDirectory();
2866 LockFreeProducer<std::size_t>& theIdQueue;
2867 LockFreeProducer<bool>& theContinueProducer;
2868 void* theStore;
2869 Zorba* theZorbaInstance;
2870 StaticContext_t theStaticContext;
2871- };
2872+
2873+};
2874
2875-}} // end of namespace zorba::debugclient
2876+} // namespace zorba
2877+} // namespace debugger
2878+
2879+#endif // ZORBA_DEBUGGER_EVENT_HANDLER_H
2880
2881=== modified file 'bin/debugger/lock_free_queue.h'
2882--- bin/debug_client/lock_free_queue.h 2011-07-01 01:53:24 +0000
2883+++ bin/debugger/lock_free_queue.h 2012-02-22 17:11:27 +0000
2884@@ -14,10 +14,14 @@
2885 * limitations under the License.
2886 */
2887 #pragma once
2888+#ifndef ZORBA_DEBUGGER_LOCK_FREE_QUEUE_H
2889+#define ZORBA_DEBUGGER_LOCK_FREE_QUEUE_H
2890+
2891 #include <iostream>
2892 #include <list>
2893
2894-namespace zorba { namespace debugclient {
2895+
2896+namespace zorba { namespace debugger {
2897
2898 template<typename T>
2899 class LockFreeProducer
2900@@ -80,4 +84,8 @@
2901 }
2902 return false;
2903 }
2904-}} // namespace zorba::debugclient
2905+
2906+} // namespace zorba
2907+} // namespace debugger
2908+
2909+#endif // ZORBA_DEBUGGER_LOCK_FREE_QUEUE_H
2910
2911=== modified file 'bin/debugger/main.cpp'
2912--- bin/debug_client/main.cpp 2011-07-01 01:53:24 +0000
2913+++ bin/debugger/main.cpp 2012-02-22 17:11:27 +0000
2914@@ -13,12 +13,286 @@
2915 * See the License for the specific language governing permissions and
2916 * limitations under the License.
2917 */
2918+
2919+#ifdef WIN32
2920+# include <windows.h>
2921+# include <string.h>
2922+# include <strsafe.h>
2923+#endif
2924+
2925+#include <vector>
2926+
2927 #include <zorba/config.h>
2928-#include "debug_command.h"
2929-#include "command_line_handler.h"
2930+
2931+#include "xqdb_client.h"
2932+#include "process_listener.h"
2933+
2934
2935 using namespace zorba;
2936-using namespace zorba::debugclient;
2937+using namespace zorba::debugger;
2938+
2939+
2940+std::auto_ptr<XqdbClient> theClient;
2941+
2942+// this will make sure the xqdb process will not quit when Ctrl-C is pressed
2943+#ifdef WIN32
2944+BOOL WINAPI
2945+ctrlC_Handler(DWORD aCtrlType)
2946+{
2947+ if (CTRL_C_EVENT == aCtrlType) {
2948+ return true;
2949+ }
2950+ return false;
2951+}
2952+#else
2953+void
2954+ctrlC_Handler(int lParam)
2955+{
2956+ // an empty sugnal handler on Linux should do the job
2957+}
2958+#endif
2959+
2960+
2961+// this handler function is passed the the zorba process listener and will
2962+// the client if the zorba process terminates
2963+void
2964+onExitProcess(ExitCode aExitCode) {
2965+ std::cout << std::endl << "Terminating debugger client." << std::endl;
2966+
2967+#ifndef WIN32
2968+ XqdbClient* lClient = theClient.release();
2969+ if (lClient) {
2970+ delete lClient;
2971+ }
2972+#endif
2973+
2974+ exit(aExitCode);
2975+}
2976+
2977+
2978+int
2979+startZorba(std::string& aExec, std::vector<std::string>& aArgs, std::auto_ptr<ProcessListener>& aProcessListener)
2980+{
2981+#ifdef WIN32
2982+ // **************************
2983+ // start a process on Windows
2984+
2985+ DWORD iReturnVal = 0;
2986+
2987+ std::wstring lExec;
2988+ std::wstring lArgs;
2989+
2990+ lExec.assign(aExec.begin(), aExec.end());
2991+
2992+ // the executable must be the first in the list of arguments
2993+ lArgs.append(L"\"");
2994+ lArgs.append(lExec);
2995+ lArgs.append(L"\"");
2996+
2997+ for (std::vector<std::string>::size_type j = 0; j < aArgs.size(); j++) {
2998+ std::string lArg(aArgs.at(j));
2999+ std::wstring lArgW;
3000+ lArgW.assign(lArg.begin(), lArg.end());
3001+ lArgs.append(L" ");
3002+ lArgs.append(lArgW);
3003+ }
3004+
3005+ // CreateProcessW can modify Parameters thus we allocate needed memory
3006+ wchar_t * pwszParam = new wchar_t[lArgs.size() + 1];
3007+ if (pwszParam == 0) {
3008+ return 1;
3009+ }
3010+ const wchar_t* pchrTemp = lArgs.c_str();
3011+ wcscpy_s(pwszParam, lArgs.size() + 1, pchrTemp);
3012+
3013+ // CreateProcess API initialization
3014+ STARTUPINFOW siStartupInfo;
3015+ PROCESS_INFORMATION piProcessInfo;
3016+ memset(&siStartupInfo, 0, sizeof(siStartupInfo));
3017+ memset(&piProcessInfo, 0, sizeof(piProcessInfo));
3018+ siStartupInfo.cb = sizeof(siStartupInfo);
3019+
3020+ BOOL lResult = CreateProcessW(
3021+ const_cast<LPCWSTR>(lExec.c_str()),
3022+ pwszParam, 0, 0, false,
3023+ CREATE_DEFAULT_ERROR_MODE, 0, 0,
3024+ &siStartupInfo, &piProcessInfo);
3025+
3026+ if (lResult) {
3027+ // Watch the process
3028+ aProcessListener.reset(new ProcessListener(piProcessInfo.dwProcessId, &onExitProcess));
3029+ }
3030+ else {
3031+ // CreateProcess failed
3032+ iReturnVal = GetLastError();
3033+ LPVOID lpMsgBuf;
3034+ LPVOID lpDisplayBuf;
3035+
3036+ FormatMessage(
3037+ FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
3038+ NULL,
3039+ iReturnVal,
3040+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
3041+ (LPTSTR) &lpMsgBuf,
3042+ 0, NULL);
3043+
3044+ // Display the error message and exit the process
3045+
3046+ lpDisplayBuf = (LPVOID)LocalAlloc(
3047+ LMEM_ZEROINIT,
3048+ (lstrlen((LPCTSTR)lpMsgBuf) + 40) * sizeof(TCHAR));
3049+
3050+ StringCchPrintf(
3051+ (LPTSTR)lpDisplayBuf,
3052+ LocalSize(lpDisplayBuf) / sizeof(TCHAR),
3053+ TEXT("Error (%d) when starting zorba: %s"),
3054+ iReturnVal,
3055+ lpMsgBuf);
3056+
3057+ std::wstring lErrorW((wchar_t*)lpDisplayBuf);
3058+ std::string lError;
3059+ lError.assign(lErrorW.begin(), lErrorW.end());
3060+ std::cout << lError << std::endl;
3061+
3062+ LocalFree(lpMsgBuf);
3063+ LocalFree(lpDisplayBuf);
3064+ }
3065+
3066+ // Free memory
3067+ delete[]pwszParam;
3068+ pwszParam = 0;
3069+
3070+ // Release handles
3071+ CloseHandle(piProcessInfo.hProcess);
3072+ CloseHandle(piProcessInfo.hThread);
3073+
3074+ return iReturnVal;
3075+
3076+#else
3077+ // ************************
3078+ // start a process on Linux
3079+
3080+ pid_t pID = fork();
3081+ if (pID == 0) {
3082+ // Code only executed by child process
3083+ std::stringstream lCommand;
3084+ lCommand << aExec;
3085+ for (std::vector<std::string>::size_type j = 0; j < aArgs.size(); j++) {
3086+ lCommand << " " << aArgs.at(j);
3087+ }
3088+
3089+ int lRes = system(lCommand.str().c_str());
3090+ exit(lRes);
3091+ }
3092+ else {
3093+ // Code only executed by parent process
3094+ if (pID < 0) {
3095+ std::cerr << "Failed to fork Zorba" << std::endl;
3096+ return pID;
3097+ }
3098+
3099+ // Watch the process
3100+ aProcessListener.reset(new ProcessListener(pID, &onExitProcess));
3101+
3102+ return 0;
3103+ }
3104+#endif
3105+}
3106+
3107+void printUsage(std::string& aProgram)
3108+{
3109+ std::cerr << "Usage:" << std::endl
3110+ << " " << aProgram << " <zorba_arguments>" << std::endl
3111+ << " this will start a debugger command line and a zorba process with the given arguments" << std::endl;
3112+}
3113+
3114+bool
3115+processArguments(
3116+ int argc,
3117+ char* argv[],
3118+ std::string& aProgram,
3119+ bool& aStandalone,
3120+ std::string& aZorba,
3121+ unsigned int& aPort,
3122+ std::vector<std::string>& aZorbaArgs)
3123+{
3124+ aPort = 28028;
3125+
3126+ // find the path to Zorba and this executable name
3127+ aProgram = argv[0];
3128+
3129+#ifdef WIN32
3130+ char lSep = '\\';
3131+#else
3132+ char lSep = '/';
3133+#endif
3134+ std::string::size_type lPos = aProgram.find_last_of(lSep);
3135+
3136+ std::stringstream lZs;
3137+
3138+ if (lPos == aProgram.npos) {
3139+ lZs << "." << lSep;
3140+ } else {
3141+ lZs << aProgram.substr(0, lPos + 1);
3142+ aProgram = aProgram.substr(lPos + 1);
3143+ }
3144+ lZs << "zorba";
3145+#ifdef WIN32
3146+ lZs << ".exe";
3147+#endif
3148+ aZorba = lZs.str();
3149+
3150+
3151+ bool lHasFileArg = false;
3152+ bool lHasQueryArg = false;
3153+ bool lHasQueryVal = false;
3154+
3155+ // find if the user asked for help or specified a specific port
3156+ for (int i = 1; i < argc; i++) {
3157+ std::string lArg = argv[i];
3158+ if (lArg == "-h" || lArg == "--help") {
3159+ return false;
3160+ }
3161+ else if (lArg == "-p" || lArg == "--debug-port") {
3162+ // if there is one more argument
3163+ if (i < argc - 1) {
3164+ // get the port value
3165+ int lPort;
3166+ std::stringstream lStream(argv[i + 1]);
3167+ lStream >> lPort;
3168+ if (!lStream.fail()) {
3169+ aPort = lPort;
3170+ }
3171+ }
3172+ }
3173+ else if (lArg == "-f") {
3174+ lHasFileArg = true;
3175+ }
3176+ else if (lArg == "-q") {
3177+ lHasQueryArg = true;
3178+ if (++i < argc) {
3179+ lHasQueryVal = true;
3180+ }
3181+ }
3182+ }
3183+
3184+ if (!lHasFileArg || !lHasQueryArg || !lHasQueryVal) {
3185+ std::cout << "Not enough arguments to start Zorba." << std::endl;
3186+ std::cout << "Running the standalone XQuery debugger client on port: " << aPort << std::endl;
3187+ return true;
3188+ }
3189+
3190+ // zorba will need the -d flag
3191+ aZorbaArgs.push_back("-d");
3192+
3193+ // gather all arguments (excepting the program name)
3194+ for (int i = 1; i < argc; i++) {
3195+ aZorbaArgs.push_back(argv[i]);
3196+ }
3197+
3198+ aStandalone = false;
3199+ return true;
3200+}
3201
3202 #ifndef _WIN32_WCE
3203 int
3204@@ -28,24 +302,72 @@
3205 _tmain(int argc, _TCHAR* argv[])
3206 #endif
3207 {
3208- int port = 28028;
3209- if (argv[1]) {
3210- std::stringstream stream(argv[1]);
3211- stream >> port;
3212- if (stream.fail() || argv[2]) {
3213- std::cerr << "Unknown argument. USAGE: " << argv[0] << " [PORT]" << std::endl;
3214- return 2;
3215+#ifdef WIN32
3216+ SetConsoleCtrlHandler(ctrlC_Handler, TRUE);
3217+#else
3218+ signal(SIGINT, ctrlC_Handler);
3219+#endif
3220+
3221+ // **************************************************************************
3222+ // processing arguments
3223+
3224+ std::string lProgram, lZorbaExec;
3225+ unsigned int lPort = 28028;
3226+ std::vector<std::string> lZorbaArgs;
3227+
3228+ bool lStandalone = true;
3229+ if (!processArguments(argc, argv, lProgram, lStandalone, lZorbaExec, lPort, lZorbaArgs)) {
3230+ printUsage(lProgram);
3231+ return 1;
3232+ }
3233+
3234+#ifndef NDEBUG
3235+ // **************************************************************************
3236+ // debug reporting
3237+
3238+ if (!lStandalone) {
3239+ std::cout << "Communication port: " << lPort << std::endl;
3240+ std::cout << "Zorba executable: " << lZorbaExec << std::endl;
3241+ std::cout << "Zorba arguments: ";
3242+ for (std::vector<std::string>::size_type j = 0; j < lZorbaArgs.size(); j++) {
3243+ std::cout << lZorbaArgs.at(j) << " ";
3244 }
3245+ std::cout << std::endl;
3246 }
3247+#endif
3248+
3249 try {
3250- LockFreeQueue<std::size_t> lQueue;
3251- LockFreeQueue<bool> lContEvent;
3252- EventHandler lHandler(lQueue, lContEvent);
3253- CommandLine cli;
3254- CommandLineHandler handler(port, lQueue, lContEvent, lHandler, cli);
3255- handler.execute();
3256+ // **************************************************************************
3257+ // start a zorba
3258+
3259+ // This is a process listener used to watch the Zorba process termination.
3260+ std::auto_ptr<ProcessListener> lProcessListener;
3261+
3262+ if (!lStandalone) {
3263+ int lResult = startZorba(lZorbaExec, lZorbaArgs, lProcessListener);
3264+ if (lResult) {
3265+ return lResult;
3266+ }
3267+ } else {
3268+ std::cout << "Listening for an incomming Zorba connection on port " << lPort << "..." << std::endl;
3269+ }
3270+
3271+ // **************************************************************************
3272+ // start the debugger command line
3273+
3274+ theClient.reset(new XqdbClient(lPort));
3275+ theClient->start();
3276+
3277 } catch (...) {
3278- return 4;
3279- }
3280+ return -1;
3281+ }
3282+
3283+#ifndef WIN32
3284+ XqdbClient* lClient = theClient.release();
3285+ if (lClient) {
3286+ delete lClient;
3287+ }
3288+#endif
3289+
3290 return 0;
3291 }
3292
3293=== added file 'bin/debugger/process_listener.cpp'
3294--- bin/debugger/process_listener.cpp 1970-01-01 00:00:00 +0000
3295+++ bin/debugger/process_listener.cpp 2012-02-22 17:11:27 +0000
3296@@ -0,0 +1,105 @@
3297+/*
3298+ * Copyright 2006-2008 The FLWOR Foundation.
3299+ *
3300+ * Licensed under the Apache License, Version 2.0 (the "License");
3301+ * you may not use this file except in compliance with the License.
3302+ * You may obtain a copy of the License at
3303+ *
3304+ * http://www.apache.org/licenses/LICENSE-2.0
3305+ *
3306+ * Unless required by applicable law or agreed to in writing, software
3307+ * distributed under the License is distributed on an "AS IS" BASIS,
3308+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3309+ * See the License for the specific language governing permissions and
3310+ * limitations under the License.
3311+ */
3312+
3313+#include "process_listener.h"
3314+
3315+#include <iostream>
3316+
3317+#ifdef ZORBA_HAVE_PTHREAD_H
3318+# include <cassert>
3319+#endif
3320+
3321+
3322+namespace zorba { namespace debugger {
3323+
3324+ProcessListener::ProcessListener(ProcessId aProcessID, ExitCallbackType aCallback)
3325+ : theProcessID(aProcessID), theCallback(aCallback)
3326+{
3327+#ifdef WIN32
3328+ theThread = CreateThread(NULL, 0, &run, (void*) this, 0, &theThreadId);
3329+#else
3330+ if (pthread_create(&theThread, NULL, &run, (void*) this)) {
3331+ assert(false);
3332+ }
3333+#endif
3334+}
3335+
3336+ProcessListener::~ProcessListener()
3337+{
3338+}
3339+
3340+ProcessId
3341+ProcessListener::getProcessID()
3342+{
3343+ return theProcessID;
3344+}
3345+
3346+ExitCallbackType
3347+ProcessListener::getCallback()
3348+{
3349+ return theCallback;
3350+}
3351+
3352+
3353+ZORBA_THREAD_RETURN
3354+ProcessListener::run(void* params)
3355+{
3356+ ProcessListener* lThis = static_cast<ProcessListener*>(params);
3357+ ExitCode lExitCode = -1;
3358+ ProcessId lPid = lThis->getProcessID();
3359+
3360+#ifdef WIN32
3361+ HANDLE lProcessHandle = OpenProcess(SYNCHRONIZE, false, lPid);
3362+ if (lProcessHandle != NULL) {
3363+ // wait for the process to exit
3364+ DWORD lResult = WaitForSingleObject(lProcessHandle, INFINITE);
3365+
3366+ // find out the process exit code if possible
3367+ if (!GetExitCodeProcess(lProcessHandle, &lExitCode)) {
3368+ lExitCode = -1;
3369+ }
3370+ DWORD dw = GetLastError();
3371+
3372+ // wait a little for zorba to dump the garbage
3373+ Sleep(1000);
3374+ }
3375+#else
3376+ int lChildExitStatus;
3377+
3378+ // wait for the process to exit
3379+ waitpid(lPid, &lChildExitStatus, 0);
3380+
3381+ // find out the process exit code if possible
3382+ if (WIFEXITED(lChildExitStatus)) {
3383+ lExitCode = WEXITSTATUS(lChildExitStatus);
3384+ }
3385+
3386+ // wait a little for zorba to dump the garbage
3387+ sleep(1);
3388+#endif
3389+
3390+ // and call the callback when this happened
3391+ ExitCallbackType lCallback = lThis->getCallback();
3392+ lCallback(lExitCode);
3393+
3394+ for (int i = 0; i < 10; i++) {
3395+ std::cout << i << std::endl;
3396+ }
3397+ return NULL;
3398+}
3399+
3400+} // namespace zorba
3401+} // namespace debugger
3402
3403=== added file 'bin/debugger/process_listener.h'
3404--- bin/debugger/process_listener.h 1970-01-01 00:00:00 +0000
3405+++ bin/debugger/process_listener.h 2012-02-22 17:11:27 +0000
3406@@ -0,0 +1,75 @@
3407+/*
3408+ * Copyright 2006-2008 The FLWOR Foundation.
3409+ *
3410+ * Licensed under the Apache License, Version 2.0 (the "License");
3411+ * you may not use this file except in compliance with the License.
3412+ * You may obtain a copy of the License at
3413+ *
3414+ * http://www.apache.org/licenses/LICENSE-2.0
3415+ *
3416+ * Unless required by applicable law or agreed to in writing, software
3417+ * distributed under the License is distributed on an "AS IS" BASIS,
3418+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3419+ * See the License for the specific language governing permissions and
3420+ * limitations under the License.
3421+ */
3422+#pragma once
3423+#ifndef ZORBA_DEBUGGER_PROCESS_LISTENER_H
3424+#define ZORBA_DEBUGGER_PROCESS_LISTENER_H
3425+
3426+#include <zorba/config.h>
3427+
3428+#ifdef ZORBA_HAVE_PTHREAD_H
3429+# include <pthread.h>
3430+# include <sys/wait.h>
3431+ typedef pthread_t ThreadId;
3432+ typedef pid_t ProcessId;
3433+ typedef int ExitCode;
3434+# define ZORBA_THREAD_RETURN void *
3435+#else
3436+# include <windows.h>
3437+ typedef DWORD ThreadId;
3438+ typedef DWORD ProcessId;
3439+ typedef DWORD ExitCode;
3440+# define ZORBA_THREAD_RETURN DWORD WINAPI
3441+#endif
3442+
3443+typedef void (*ExitCallbackType)(ExitCode);
3444+
3445+
3446+namespace zorba { namespace debugger {
3447+
3448+class ProcessListener
3449+{
3450+ public:
3451+ ProcessListener(ProcessId processID, ExitCallbackType callback);
3452+
3453+ ~ProcessListener();
3454+
3455+ ProcessId
3456+ getProcessID();
3457+
3458+ ExitCallbackType
3459+ getCallback();
3460+
3461+ private:
3462+
3463+ static ZORBA_THREAD_RETURN run(void* params);
3464+
3465+ private:
3466+
3467+#ifdef ZORBA_HAVE_PTHREAD_H
3468+ pthread_t theThread;
3469+#else
3470+ ThreadId theThreadId;
3471+ HANDLE theThread;
3472+#endif
3473+
3474+ ProcessId theProcessID;
3475+ ExitCallbackType theCallback;
3476+};
3477+
3478+} // namespace zorba
3479+} // namespace debugger
3480+
3481+#endif // ZORBA_DEBUGGER_PROCESS_LISTENER_H
3482
3483=== modified file 'bin/debugger/tuple.h'
3484--- bin/debug_client/tuple.h 2011-07-04 08:05:46 +0000
3485+++ bin/debugger/tuple.h 2012-02-22 17:11:27 +0000
3486@@ -14,9 +14,15 @@
3487 * limitations under the License.
3488 */
3489 #pragma once
3490+#ifndef ZORBA_DEBUGGER_TUPLE_H
3491+#define ZORBA_DEBUGGER_TUPLE_H
3492+
3493 #include <zorba/config.h>
3494+
3495 #if ZORBA_TR1_IN_TR1_SUBDIRECTORY
3496 # include <tr1/tuple>
3497 #else
3498 # include <tuple>
3499 #endif
3500+
3501+#endif // ZORBA_DEBUGGER_TUPLE_H
3502
3503=== added file 'bin/debugger/xqdb_client.cpp'
3504--- bin/debugger/xqdb_client.cpp 1970-01-01 00:00:00 +0000
3505+++ bin/debugger/xqdb_client.cpp 2012-02-22 17:11:27 +0000
3506@@ -0,0 +1,63 @@
3507+/*
3508+ * Copyright 2006-2008 The FLWOR Foundation.
3509+ *
3510+ * Licensed under the Apache License, Version 2.0 (the "License");
3511+ * you may not use this file except in compliance with the License.
3512+ * You may obtain a copy of the License at
3513+ *
3514+ * http://www.apache.org/licenses/LICENSE-2.0
3515+ *
3516+ * Unless required by applicable law or agreed to in writing, software
3517+ * distributed under the License is distributed on an "AS IS" BASIS,
3518+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3519+ * See the License for the specific language governing permissions and
3520+ * limitations under the License.
3521+ */
3522+
3523+#include "xqdb_client.h"
3524+
3525+#include <iostream>
3526+
3527+#ifdef ZORBA_HAVE_PTHREAD_H
3528+# include <cassert>
3529+#endif
3530+
3531+
3532+namespace zorba { namespace debugger {
3533+
3534+XqdbClient::XqdbClient(unsigned int aPort)
3535+{
3536+ theIdQueue = new LockFreeQueue<std::size_t>();
3537+ theQuitQueue = new LockFreeQueue<bool>();
3538+ theEventHandler = new EventHandler(*theIdQueue, *theQuitQueue);
3539+ theEventHandler->init();
3540+
3541+ theCommandPrompt = new CommandPrompt();
3542+ theCommandLineHandler = new CommandLineHandler(aPort, *theIdQueue, *theQuitQueue, theEventHandler, theCommandPrompt);
3543+}
3544+
3545+XqdbClient::~XqdbClient()
3546+{
3547+ if (theCommandLineHandler) {
3548+ delete theCommandLineHandler;
3549+ }
3550+ if (theCommandPrompt) {
3551+ delete theCommandPrompt;
3552+ }
3553+ if (theEventHandler) {
3554+ delete theEventHandler;
3555+ }
3556+
3557+ delete theIdQueue;
3558+ delete theQuitQueue;
3559+}
3560+
3561+void
3562+XqdbClient::start()
3563+{
3564+ theCommandLineHandler->execute();
3565+}
3566+
3567+
3568+} // namespace zorba
3569+} // namespace debugger
3570
3571=== added file 'bin/debugger/xqdb_client.h'
3572--- bin/debugger/xqdb_client.h 1970-01-01 00:00:00 +0000
3573+++ bin/debugger/xqdb_client.h 2012-02-22 17:11:27 +0000
3574@@ -0,0 +1,51 @@
3575+/*
3576+ * Copyright 2006-2008 The FLWOR Foundation.
3577+ *
3578+ * Licensed under the Apache License, Version 2.0 (the "License");
3579+ * you may not use this file except in compliance with the License.
3580+ * You may obtain a copy of the License at
3581+ *
3582+ * http://www.apache.org/licenses/LICENSE-2.0
3583+ *
3584+ * Unless required by applicable law or agreed to in writing, software
3585+ * distributed under the License is distributed on an "AS IS" BASIS,
3586+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3587+ * See the License for the specific language governing permissions and
3588+ * limitations under the License.
3589+ */
3590+#pragma once
3591+#ifndef ZORBA_DEBUGGER_XQDB_CLIENT_H
3592+#define ZORBA_DEBUGGER_XQDB_CLIENT_H
3593+
3594+#include "command_prompt.h"
3595+#include "command_line_handler.h"
3596+
3597+
3598+namespace zorba { namespace debugger {
3599+
3600+class XqdbClient {
3601+
3602+ public:
3603+
3604+ XqdbClient(unsigned int aPort);
3605+
3606+ ~XqdbClient();
3607+
3608+ void
3609+ start();
3610+
3611+ private:
3612+
3613+ LockFreeQueue<std::size_t>* theIdQueue;
3614+ LockFreeQueue<bool>* theQuitQueue;
3615+
3616+ EventHandler* theEventHandler;
3617+ CommandPrompt* theCommandPrompt;
3618+ CommandLineHandler* theCommandLineHandler;
3619+};
3620+
3621+
3622+} // namespace zorba
3623+} // namespace debugger
3624+
3625+#endif // ZORBA_DEBUGGER_XQDB_CLIENT_H
3626
3627=== renamed file 'bin/module_path.cpp' => 'bin/path_util.cpp'
3628--- bin/module_path.cpp 2011-05-25 16:40:26 +0000
3629+++ bin/path_util.cpp 2012-02-22 17:11:27 +0000
3630@@ -14,85 +14,117 @@
3631 * limitations under the License.
3632 */
3633
3634-#include "module_path.h"
3635+#include "path_util.h"
3636
3637 #include <stdlib.h>
3638-#include "zorba/zorba_string.h"
3639+//#include "zorba/zorba_string.h"
3640 #include "zorba/util/path.h"
3641
3642 #include "util.h"
3643 #include "zorbacmdproperties.h"
3644+#include <zorba/static_context.h>
3645
3646 namespace zorba {
3647
3648-std::string
3649-ModulePath::getEnvironmentModulePath()
3650+namespace PathUtil {
3651+
3652+static std::string
3653+getPathFromEnvironment(std::string const& aEnvVar)
3654 {
3655- std::string lEnvName("ZORBA_MODULE_PATH");
3656 #ifdef WIN32
3657 char* lBuffer;
3658 size_t lLen=0;
3659- errno_t lErr = getenv_s(&lLen, NULL, 0, lEnvName.c_str());
3660+ errno_t lErr = getenv_s(&lLen, NULL, 0, aEnvVar.c_str());
3661 if (lErr || !lLen) return "";
3662 lBuffer = (char*)malloc(lLen * sizeof(char));
3663 if (!lBuffer) return "";
3664- getenv_s(&lLen, lBuffer, lLen, lEnvName.c_str());
3665+ getenv_s(&lLen, lBuffer, lLen, aEnvVar.c_str());
3666 std::string lRes(lBuffer);
3667 free(lBuffer);
3668 return lRes;
3669 #else
3670- const char* lEnvValue = getenv(lEnvName.c_str());
3671- return lEnvValue!=0?lEnvValue:"";
3672+ const char* lEnvValue = getenv(aEnvVar.c_str());
3673+ return lEnvValue != 0 ? lEnvValue : "";
3674 #endif
3675 }
3676
3677-void
3678-ModulePath::convertVector(
3679- const std::vector<std::string>& aSource,
3680- std::vector<String>& aDest)
3681-{
3682- for (std::vector<std::string>::const_iterator lIter = aSource.begin();
3683- lIter != aSource.end(); ++lIter) {
3684- aDest.push_back(*lIter);
3685- }
3686-}
3687
3688 void
3689-ModulePath::tokenizeModulePath(
3690- const std::string& aModulePath,
3691- std::vector<std::string>& aResult)
3692+tokenizePath(
3693+ const std::string& aPathStr,
3694+ std::vector<String>& aResult)
3695 {
3696+ std::vector<std::string> lPath;
3697 #ifdef WIN32
3698- Util::tokenize(aModulePath, ";", aResult);
3699+ Util::tokenize(aPathStr, ";", lPath);
3700 #else
3701- Util::tokenize(aModulePath, ":", aResult);
3702+ Util::tokenize(aPathStr, ":", lPath);
3703 #endif
3704-}
3705+ for (std::vector<std::string>::iterator lIter = lPath.begin();
3706+ lIter != lPath.end(); ++lIter) {
3707+ aResult.push_back(*lIter);
3708+ }
3709+}
3710+
3711+
3712+String
3713+concatenatePaths( const std::vector<String>& aPathList)
3714+{
3715+ String delimiter(filesystem_path::get_path_separator());
3716+
3717+ String lResult;
3718+ for (std::vector<String>::const_iterator lIter = aPathList.begin();
3719+ lIter != aPathList.end(); ++lIter)
3720+ {
3721+ lResult += delimiter + *lIter;
3722+ }
3723+
3724+ return lResult;
3725+}
3726+
3727
3728 void
3729-ModulePath::getModulePaths(
3730+setPathsOnContext(
3731 const ZorbaCMDProperties& aProperties,
3732- std::vector<String>& aModulePaths)
3733+ StaticContext_t& aStaticCtx)
3734 {
3735- std::vector<std::string> lModulePaths; // result vector
3736- std::string lModulePath; // temporary variable for collections paths
3737-
3738- // 1. add the module paths from the command line properties
3739- aProperties.getModulePaths(lModulePath);
3740-
3741- tokenizeModulePath(lModulePath, lModulePaths);
3742-
3743- // 2. add the module paths from the environment
3744- lModulePath = ModulePath::getEnvironmentModulePath();
3745-
3746- tokenizeModulePath(lModulePath, lModulePaths);
3747-
3748- // 3. add the current working directory as module path
3749+ std::vector<String> lPath;
3750+ std::string lPathStr, lEnvStr;
3751+
3752+ // Compute the current working directory to append to all paths.
3753 filesystem_path lCWD;
3754- lModulePaths.push_back(lCWD.get_path());
3755-
3756- // convert std::string to zorba::String
3757- convertVector(lModulePaths, aModulePaths);
3758+
3759+ // setModulePaths() *overwrites* the URI path and lib path, so there's no
3760+ // sense in calling both. So if either --module-path or ZORBA_MODULE_PATH
3761+ // exists, just use those.
3762+ aProperties.getModulePath(lPathStr);
3763+ lEnvStr = getPathFromEnvironment("ZORBA_MODULE_PATH");
3764+ if (lPathStr.length() > 0 || lEnvStr.length() > 0) {
3765+ tokenizePath(lPathStr, lPath);
3766+ tokenizePath(lEnvStr, lPath);
3767+ lPath.push_back(lCWD.get_path());
3768+ aStaticCtx->setModulePaths(lPath);
3769+ }
3770+ else {
3771+ // Compute and set URI path
3772+ aProperties.getURIPath(lPathStr);
3773+ tokenizePath(lPathStr, lPath);
3774+ lEnvStr = getPathFromEnvironment("ZORBA_URI_PATH");
3775+ tokenizePath(lEnvStr, lPath);
3776+ lPath.push_back(lCWD.get_path());
3777+ aStaticCtx->setURIPath(lPath);
3778+ lPath.clear();
3779+
3780+ // Compute and set lib path
3781+ aProperties.getLibPath(lPathStr);
3782+ tokenizePath(lPathStr, lPath);
3783+ lPath.push_back(lCWD.get_path());
3784+ lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH");
3785+ tokenizePath(lEnvStr, lPath);
3786+ aStaticCtx->setLibPath(lPath);
3787+ }
3788 }
3789
3790+} /* namespace ModulePath */
3791+
3792 } /* namespace zorba */
3793
3794=== renamed file 'bin/module_path.h' => 'bin/path_util.h'
3795--- bin/module_path.h 2010-02-12 08:57:04 +0000
3796+++ bin/path_util.h 2012-02-22 17:11:27 +0000
3797@@ -18,6 +18,7 @@
3798
3799 #include <vector>
3800 #include <string>
3801+#include <zorba/api_shared_types.h>
3802
3803 class ZorbaCMDProperties;
3804
3805@@ -25,30 +26,20 @@
3806
3807 class String;
3808
3809- class ModulePath {
3810- protected:
3811- static std::string
3812- getEnvironmentModulePath();
3813-
3814- static void
3815- convertVector(const std::vector<std::string>& aSource,
3816- std::vector<String>& aDest);
3817-
3818- static void
3819- tokenizeModulePath(const std::string& aModulePath,
3820- std::vector<std::string>& aResult);
3821-
3822- static void
3823- getInstalledModulePath(const std::string& aModulePath,
3824- std::vector<std::string>& aResult);
3825-
3826- public:
3827- static void
3828- getModulePaths(const ZorbaCMDProperties& aProperties,
3829- std::vector<String>& aModulePaths);
3830-
3831-
3832- };
3833+ namespace PathUtil {
3834+
3835+ void
3836+ setPathsOnContext(const ZorbaCMDProperties& aProperties,
3837+ zorba::StaticContext_t& aStaticCtx);
3838+
3839+ void
3840+ tokenizePath(const std::string& aPathStr, std::vector<String>& aResult);
3841+
3842+
3843+ String
3844+ concatenatePaths( const std::vector<String>& aPathList);
3845+
3846+ }
3847 } /* namespace zorba */
3848
3849 #endif
3850
3851=== modified file 'bin/zorbacmd.cpp'
3852--- bin/zorbacmd.cpp 2011-07-11 11:12:23 +0000
3853+++ bin/zorbacmd.cpp 2012-02-22 17:11:27 +0000
3854@@ -43,7 +43,7 @@
3855
3856 #include "error_printer.h"
3857 #include "util.h"
3858-#include "module_path.h"
3859+#include "path_util.h"
3860
3861 // For setting the base URI from the current directory
3862 #include <zorba/util/path.h>
3863@@ -70,7 +70,7 @@
3864
3865 #ifndef ZORBA_NO_FULL_TEXT
3866 OneToOneURIMapper theStopWordsMapper(EntityData::STOP_WORDS);
3867-OneToOneURIMapper theThesaurusMapper(EntityData::THESAURUS, URIMapper::COMPONENT);
3868+OneToOneURIMapper theThesaurusMapper(EntityData::THESAURUS);
3869 #endif
3870
3871 bool
3872@@ -85,10 +85,8 @@
3873 // 2. environment ZORBA_MODULE_PATH
3874 // 3. current working directory
3875 {
3876- std::vector<String> lModulePaths;
3877- ModulePath::getModulePaths(aProperties, lModulePaths);
3878-
3879- aStaticContext->setModulePaths(lModulePaths);
3880+ std::vector<String> lModulePath;
3881+ PathUtil::setPathsOnContext(aProperties, aStaticContext);
3882 }
3883
3884 if (aProperties.boundarySpace().size() != 0 )
3885@@ -509,12 +507,24 @@
3886 Zorba_CompilerHints lHints;
3887
3888 // default is O1 in the Zorba_CompilerHints constructor
3889- if (properties.optimizationLevel() == "O0") {
3890+ if (properties.optimizationLevel() == "O0")
3891+ {
3892 lHints.opt_level = ZORBA_OPT_LEVEL_O0;
3893- } else if (properties.optimizationLevel() == "O2") {
3894+ }
3895+ else if (properties.optimizationLevel() == "O2")
3896+ {
3897 lHints.opt_level = ZORBA_OPT_LEVEL_O2;
3898 }
3899
3900+ lHints.for_serialization_only = true;
3901+
3902+#if ZORBACMD_LOAD_SYSTEM_PROPERTIES
3903+ if (Properties::instance()->serializeOnlyQuery() == 0)
3904+ {
3905+ lHints.for_serialization_only = false;
3906+ }
3907+#endif
3908+
3909 // default is false
3910 if (properties.libModule())
3911 {
3912@@ -577,8 +587,6 @@
3913 return 12;
3914 }
3915
3916- // if (diagnosticHandler.
3917-
3918 //
3919 // Create and populate the dynamic context
3920 //
3921@@ -661,19 +669,22 @@
3922 XmlDataManager* store = zorbaInstance->getXmlDataManager();
3923
3924 timing.startTimer(TimingInfo::UNLOAD_TIMER, i);
3925+
3926 DocumentManager* lMgr = store->getDocumentManager();
3927 ItemSequence_t lSeq = lMgr->availableDocuments();
3928 Iterator_t lIter = lSeq->getIterator();
3929 lIter->open();
3930 Item lURI;
3931- while (lIter->next(lURI)) {
3932+ while (lIter->next(lURI))
3933+ {
3934 lMgr->remove(lURI.getStringValue());
3935 }
3936+
3937 timing.stopTimer(TimingInfo::UNLOAD_TIMER, i);
3938
3939 timing.stopTimer(TimingInfo::TOTAL_TIMER, i);
3940 }
3941- }
3942+ } // for each execution
3943
3944 return 0;
3945 }
3946@@ -704,7 +715,7 @@
3947 return 1;
3948 }
3949
3950- TimingInfo timing(lProperties.multiple());
3951+ TimingInfo engineTiming(lProperties.multiple());
3952
3953 bool doTiming = lProperties.timing();
3954 bool debug = false;
3955@@ -738,17 +749,25 @@
3956 return 3;
3957 }
3958
3959+ // Add command line --classpath option in front of config/env CLASSPATH
3960+ Properties* globalProperties = Properties::instance();
3961+ std::string cmdJvmClassPath;
3962+ lProperties.getJVMClassPath(cmdJvmClassPath);
3963+ std::string configJvmClassPath;
3964+ globalProperties->getJVMClassPath(configJvmClassPath);
3965+ globalProperties->setJVMClassPath(cmdJvmClassPath +
3966+ filesystem_path::get_path_separator() + configJvmClassPath);
3967
3968 // Start the engine
3969
3970- timing.startTimer(TimingInfo::INIT_TIMER, 2);
3971+ engineTiming.startTimer(TimingInfo::INIT_TIMER, 2);
3972
3973 void* store = zorba::StoreManager::getStore();
3974
3975 zorba::Zorba* lZorbaInstance = zorba::Zorba::getInstance(store);
3976
3977 {
3978- timing.stopTimer(TimingInfo::INIT_TIMER, 2);
3979+ engineTiming.stopTimer(TimingInfo::INIT_TIMER, 2);
3980
3981 // For each query ...
3982
3983@@ -770,14 +789,14 @@
3984 if (asFile)
3985 {
3986 path.resolve_relative ();
3987- qfile.reset (new std::ifstream (path.c_str ()));
3988+ qfile.reset(new std::ifstream (path.c_str ()));
3989 }
3990 else
3991 {
3992- qfile.reset (new std::istringstream(fURI));
3993+ qfile.reset(new std::istringstream(fURI));
3994 }
3995
3996- if ( asFile && (!qfile->good() || qfile->eof()) )
3997+ if (asFile && (!qfile->good() || qfile->eof()))
3998 {
3999 std::cerr << "file {" << fname << "} not found or not readable." << std::endl;
4000 lProperties.printHelp(std::cout);
4001@@ -793,7 +812,8 @@
4002 //
4003 // Print the query if requested
4004 //
4005- if (lProperties.printQuery()) {
4006+ if (lProperties.printQuery())
4007+ {
4008 *lOutputStream << "\nQuery number " << queryNo << " :\n";
4009 std::copy (std::istreambuf_iterator<char> (*qfile),
4010 std::istreambuf_iterator<char> (),
4011@@ -836,8 +856,10 @@
4012 }
4013
4014 // Parse the query
4015- if (lProperties.parseOnly()) {
4016- try {
4017+ if (lProperties.parseOnly())
4018+ {
4019+ try
4020+ {
4021 zorba::XQuery_t lQuery = lZorbaInstance->createQuery();
4022 if (asFile) {
4023 lQuery->setFileName(path.get_path());
4024@@ -845,7 +867,8 @@
4025
4026 lQuery->parse (*qfile);
4027 }
4028- catch (zorba::ZorbaException const& ze) {
4029+ catch (zorba::ZorbaException const& ze)
4030+ {
4031 std::cerr << ze << std::endl;
4032 return 6;
4033 }
4034@@ -853,30 +876,44 @@
4035
4036 // Compile and run it if necessary.
4037 // Print timing information if requested.
4038- else if (!debug) {
4039- if (compileOnly) {
4040- try {
4041+ else if (!debug)
4042+ {
4043+ if (compileOnly)
4044+ {
4045+ try
4046+ {
4047 zorba::XQuery_t aQuery = lZorbaInstance->createQuery();
4048- if (asFile) {
4049+ if (asFile)
4050+ {
4051 aQuery->setFileName(path.get_path());
4052 }
4053+
4054 aQuery->parse(*qfile);
4055+
4056 qfile->clear();
4057 qfile->seekg(0); // go back to the beginning
4058- } catch (zorba::XQueryException const& qe) {
4059- ErrorPrinter::print(qe, std::cerr, lProperties.printErrorsAsXml(), lProperties.indent());
4060+ }
4061+ catch (zorba::XQueryException const& qe)
4062+ {
4063+ ErrorPrinter::print(qe,
4064+ std::cerr,
4065+ lProperties.printErrorsAsXml(),
4066+ lProperties.indent());
4067 return 6;
4068 }
4069 }
4070
4071+ TimingInfo queryTiming(lProperties.multiple());
4072+
4073 int status = compileAndExecute(lZorbaInstance,
4074 lProperties,
4075 lStaticContext,
4076 path.get_path(),
4077 *qfile,
4078 *lOutputStream,
4079- timing);
4080- if (status != 0) {
4081+ queryTiming);
4082+ if (status != 0)
4083+ {
4084 // reset the file handler (in case output option was provided)
4085 // in order to delete the created output file
4086 lFileStream.reset();
4087@@ -884,21 +921,25 @@
4088 return status;
4089 }
4090
4091- if (doTiming) {
4092- timing.print(std::cout);
4093+ if (doTiming)
4094+ {
4095+ queryTiming.print(std::cout);
4096 }
4097 }
4098
4099 #ifdef ZORBA_WITH_DEBUGGER
4100 // Debug the query. Do not allow "compileOnly" flags and inline queries
4101- else if (debug) {
4102- if (compileOnly) {
4103+ else if (debug)
4104+ {
4105+ if (compileOnly)
4106+ {
4107 std::cerr << "cannot debug a query if the compileOnly option is specified"
4108 << std::endl;
4109 return 7;
4110 }
4111
4112- if (!asFile) {
4113+ if (!asFile)
4114+ {
4115 std::cerr << "Cannot debug inline queries." << std::endl;
4116 return 8;
4117 }
4118@@ -908,7 +949,8 @@
4119
4120 zorba::XQuery_t lQuery;
4121
4122- try {
4123+ try
4124+ {
4125 lQuery = lZorbaInstance->createQuery();
4126 lQuery->setFileName(lFileName);
4127 lQuery->setDebugMode(true);
4128@@ -927,21 +969,24 @@
4129 lHost = "127.0.0.1";
4130 }
4131
4132- if (lProperties.debug()) {
4133- Zorba_SerializerOptions lSerOptions =
4134- Zorba_SerializerOptions::SerializerOptionsFromStringParams(
4135- lProperties.getSerializerParameters());
4136- createSerializerOptions(lSerOptions, lProperties);
4137+ Zorba_SerializerOptions lSerOptions =
4138+ Zorba_SerializerOptions::SerializerOptionsFromStringParams(
4139+ lProperties.getSerializerParameters());
4140+ createSerializerOptions(lSerOptions, lProperties);
4141
4142- if (!lProperties.hasNoLogo() && !lProperties.debug()) {
4143- std::cout << "Zorba XQuery Debugger Server\n" << copyright_str << std::endl;
4144- }
4145- lQuery->debug(*lOutputStream, lSerOptions, lHost, lProperties.getDebugPort());
4146+ if (!lProperties.hasNoLogo())
4147+ {
4148+ std::cout << "Zorba XQuery Debugger Server\n" << copyright_str << std::endl;
4149 }
4150+
4151+ lQuery->debug(*lOutputStream, lSerOptions, lHost, lProperties.getDebugPort());
4152 }
4153 catch (zorba::XQueryException const& qe)
4154 {
4155- ErrorPrinter::print(qe, std::cerr, lProperties.printErrorsAsXml(), lProperties.indent());
4156+ ErrorPrinter::print(qe,
4157+ std::cerr,
4158+ lProperties.printErrorsAsXml(),
4159+ lProperties.indent());
4160 return 5;
4161 }
4162 catch (zorba::ZorbaException const& ze)
4163@@ -958,7 +1003,7 @@
4164
4165 if (doTiming)
4166 {
4167- timing.startTimer(TimingInfo::DEINIT_TIMER, 2);
4168+ engineTiming.startTimer(TimingInfo::DEINIT_TIMER, 2);
4169 }
4170
4171 lZorbaInstance->shutdown();
4172@@ -966,11 +1011,11 @@
4173
4174 if (doTiming)
4175 {
4176- timing.stopTimer(TimingInfo::DEINIT_TIMER, 2);
4177+ engineTiming.stopTimer(TimingInfo::DEINIT_TIMER, 2);
4178
4179 std::cout << std::endl << "Engine Shutdown Time : "
4180- << timing.elapsedDeinitWalltime
4181- << " (user: " << timing.elapsedDeinitCputime << ")"
4182+ << engineTiming.elapsedDeinitWalltime
4183+ << " (user: " << engineTiming.elapsedDeinitCputime << ")"
4184 << " milliseconds" << std::endl;
4185 }
4186 return 0;
4187
4188=== modified file 'bin/zorbacmdproperties.cpp'
4189--- bin/zorbacmdproperties.cpp 2011-07-21 19:21:25 +0000
4190+++ bin/zorbacmdproperties.cpp 2012-02-22 17:11:27 +0000
4191@@ -166,11 +166,25 @@
4192 }
4193
4194
4195-void ZorbaCMDProperties::getModulePaths(std::string& aPaths) const
4196-{
4197- aPaths = theModulePath;
4198-}
4199-
4200+void ZorbaCMDProperties::getModulePath(std::string& aPath) const
4201+{
4202+ aPath = theModulePath;
4203+}
4204+
4205+void ZorbaCMDProperties::getURIPath(std::string& aPath) const
4206+{
4207+ aPath = theUriPath;
4208+}
4209+
4210+void ZorbaCMDProperties::getLibPath(std::string& aPath) const
4211+{
4212+ aPath = theLibPath;
4213+}
4214+
4215+void ZorbaCMDProperties::getJVMClassPath(std::string& aPath) const
4216+{
4217+ aPath = theClasspath;
4218+}
4219
4220 std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const
4221 {
4222
4223=== modified file 'bin/zorbacmdproperties.h'
4224--- bin/zorbacmdproperties.h 2011-06-29 17:25:50 +0000
4225+++ bin/zorbacmdproperties.h 2012-02-22 17:11:27 +0000
4226@@ -84,8 +84,17 @@
4227 getSerializerParameters() const;
4228
4229 void
4230- getModulePaths(std::string&) const;
4231+ getModulePath(std::string&) const;
4232
4233+ void
4234+ getURIPath(std::string&) const;
4235+
4236+ void
4237+ getLibPath(std::string&) const;
4238+
4239+ void
4240+ getJVMClassPath(std::string&) const;
4241+
4242 bool isDebug(){ return theDebug; }
4243
4244 bool hasNoLogo(){ return theNoLogo; }
4245
4246=== modified file 'bin/zorbacmdproperties.txt'
4247--- bin/zorbacmdproperties.txt 2011-07-04 08:31:01 +0000
4248+++ bin/zorbacmdproperties.txt 2012-02-22 17:11:27 +0000
4249@@ -28,7 +28,10 @@
4250 ("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")
4251 ("no-logo", "Print no logo when starting.")
4252 ("timeout", po::value<long>()->default_value(-1), "Specify a timeout in seconds. After the specified time, the execution of the query will be aborted.")
4253-("module-path", po::value<std::string>(), "Module paths added to the built-in resolver, i.e. where module imports are looking for modules.")
4254+("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.")
4255+("lib-path", po::value<std::string>(), "Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.")
4256+("module-path", po::value<std::string>(), "Path (list of directories) to add to both the URI and Library paths.")
4257+("classpath", po::value<std::string>(), "JVM classpath to be used by modules using Java implementations")
4258 ("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").
4259 ("trailing-nl", "Output a trailing newline after the result of the query.")
4260 ("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.")
4261
4262=== modified file 'bin/zorbacmdproperties_base.h'
4263--- bin/zorbacmdproperties_base.h 2011-07-04 08:31:01 +0000
4264+++ bin/zorbacmdproperties_base.h 2012-02-22 17:11:27 +0000
4265@@ -34,7 +34,7 @@
4266 class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase {
4267 protected:
4268 const char **get_all_options () const {
4269- 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 };
4270+ static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--uri-path", "--lib-path", "--module-path", "--classpath", "--option", "--trailing-nl", "--stop-words", "--thesaurus", NULL };
4271 return result;
4272 }
4273 bool theTiming;
4274@@ -67,7 +67,10 @@
4275 unsigned int theDebugPort;
4276 bool theNoLogo;
4277 long theTimeout;
4278+ std::string theUriPath;
4279+ std::string theLibPath;
4280 std::string theModulePath;
4281+ std::string theClasspath;
4282 std::vector<std::string> theOption;
4283 bool theTrailingNl;
4284 std::vector<std::string> theStopWords;
4285@@ -127,7 +130,10 @@
4286 const unsigned int &debugPort () const { return theDebugPort; }
4287 const bool &noLogo () const { return theNoLogo; }
4288 const long &timeout () const { return theTimeout; }
4289+ const std::string &uriPath () const { return theUriPath; }
4290+ const std::string &libPath () const { return theLibPath; }
4291 const std::string &modulePath () const { return theModulePath; }
4292+ const std::string &classpath () const { return theClasspath; }
4293 const std::vector<std::string> &option () const { return theOption; }
4294 const bool &trailingNl () const { return theTrailingNl; }
4295 const std::vector<std::string> &stopWords () const { return theStopWords; }
4296@@ -262,11 +268,26 @@
4297 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
4298 if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d);
4299 }
4300+ else if (strcmp (*argv, "--uri-path") == 0) {
4301+ int d = 2;
4302+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
4303+ if (*argv == NULL) { result = "No value given for --uri-path option"; break; } init_val (*argv, theUriPath, d);
4304+ }
4305+ else if (strcmp (*argv, "--lib-path") == 0) {
4306+ int d = 2;
4307+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
4308+ if (*argv == NULL) { result = "No value given for --lib-path option"; break; } init_val (*argv, theLibPath, d);
4309+ }
4310 else if (strcmp (*argv, "--module-path") == 0) {
4311 int d = 2;
4312 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
4313 if (*argv == NULL) { result = "No value given for --module-path option"; break; } init_val (*argv, theModulePath, d);
4314 }
4315+ else if (strcmp (*argv, "--classpath") == 0) {
4316+ int d = 2;
4317+ if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
4318+ if (*argv == NULL) { result = "No value given for --classpath option"; break; } init_val (*argv, theClasspath, d);
4319+ }
4320 else if (strcmp (*argv, "--option") == 0) {
4321 int d = 2;
4322 if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; }
4323@@ -327,11 +348,14 @@
4324 "--compile-only\nOnly compile (don't execute)\n\n"
4325 "--no-serializer\nDo not serialize (discard) result.\n\n"
4326 "--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n"
4327-"--debug-host, -p\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
4328+"--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n"
4329 "--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n"
4330 "--no-logo\nPrint no logo when starting.\n\n"
4331 "--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n"
4332-"--module-path\nModule paths added to the built-in resolver, i.e. where module imports are looking for modules.\n\n"
4333+"--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"
4334+"--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n"
4335+"--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n"
4336+"--classpath\nJVM classpath to be used by modules using Java implementations\n\n"
4337 "--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"
4338 "--trailing-nl\nOutput a trailing newline after the result of the query.\n\n"
4339 "--stop-words\nMapping specifying a stop-words URI to another.\n\n"
4340
4341=== added file 'cmake_modules/FindLibedit.cmake'
4342--- cmake_modules/FindLibedit.cmake 1970-01-01 00:00:00 +0000
4343+++ cmake_modules/FindLibedit.cmake 2012-02-22 17:11:27 +0000
4344@@ -0,0 +1,46 @@
4345+# Copyright 2011 The FLWOR Foundation.
4346+#
4347+# Licensed under the Apache License, Version 2.0 (the "License");
4348+# you may not use this file except in compliance with the License.
4349+# You may obtain a copy of the License at
4350+#
4351+# http://www.apache.org/licenses/LICENSE-2.0
4352+#
4353+# Unless required by applicable law or agreed to in writing, software
4354+# distributed under the License is distributed on an "AS IS" BASIS,
4355+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4356+# See the License for the specific language governing permissions and
4357+# limitations under the License.
4358+#
4359+# - Try to find the libedit library
4360+#
4361+# Once done this will define
4362+#
4363+# LIBEDIT_FOUND - True if libedit library is found
4364+# LIBEDIT_INCLUDE_DIRS - Directory to include to get libedit headers
4365+# LIBEDIT_LIBRARIES - Libraries to link against for the libedit library
4366+#
4367+
4368+FIND_PATH (
4369+ LIBEDIT_INCLUDE
4370+ editline/readline.h
4371+ PATHS ${LIBEDIT_INCLUDE_DIR} /usr/include /usr/local/include
4372+)
4373+MESSAGE(STATUS ${LIBEDIT_INCLUDE})
4374+
4375+FIND_LIBRARY (
4376+ LIBEDIT_LIBRARY
4377+ NAMES edit
4378+ PATHS ${LIBEDIT_LIBRARY_DIR} /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
4379+)
4380+MESSAGE(STATUS ${LIBEDIT_LIBRARY})
4381+
4382+SET (LIBEDIT_INCLUDE_DIRS ${LIBEDIT_INCLUDE})
4383+SET (LIBEDIT_LIBRARIES ${LIBEDIT_LIBRARY})
4384+
4385+FIND_PACKAGE_HANDLE_STANDARD_ARGS (
4386+ Libedit
4387+ DEFAULT_MSG
4388+ LIBEDIT_INCLUDE LIBEDIT_LIBRARY
4389+)
4390+
4391
4392=== modified file 'cmake_modules/FindPHP5.cmake'
4393--- cmake_modules/FindPHP5.cmake 2011-08-19 00:03:31 +0000
4394+++ cmake_modules/FindPHP5.cmake 2012-02-22 17:11:27 +0000
4395@@ -97,6 +97,11 @@
4396 _zend_rsrc_list_get_rsrc_type
4397 _zend_wrong_param_count
4398 _zval_used_for_init
4399+ _zval_is_true
4400+ _zend_lookup_class
4401+ __object_init
4402+ __zend_hash_add_or_update
4403+ _php_strtolower
4404 )
4405 SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
4406 "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}")
4407
4408=== modified file 'cmake_modules/ZorbaModule.cmake'
4409--- cmake_modules/ZorbaModule.cmake 2011-10-10 10:31:20 +0000
4410+++ cmake_modules/ZorbaModule.cmake 2012-02-22 17:11:27 +0000
4411@@ -66,7 +66,8 @@
4412 #
4413 # Parameters:
4414 # URI - URI to mangle
4415-# EXT - extension to ensure URI ends with
4416+# EXT - extension to ensure URI ends with (may be empty; if set, must
4417+# include leading "."
4418 # DIR_VAR - variable to set with the directory part of the mangled path
4419 # FILE_VAR - variable to set with the file part of the mangled path
4420 MACRO (MANGLE_URI URI EXT DIR_VAR FILE_VAR)
4421@@ -89,13 +90,14 @@
4422
4423 # Convert final component into proper filename
4424 IF (NOT final_comp)
4425- SET (${FILE_VAR} "index.${EXT}")
4426+ SET (${FILE_VAR} "index${EXT}")
4427 ELSE (NOT final_comp)
4428- IF ("${final_comp}" MATCHES "\\.${EXT}$")
4429+ # \\ necessary to escape the leading . in EXT
4430+ IF ("${final_comp}" MATCHES "\\${EXT}$")
4431 SET (${FILE_VAR} "${final_comp}")
4432- ELSE ("${final_comp}" MATCHES "\\.${EXT}$")
4433- SET (${FILE_VAR} "${final_comp}.${EXT}")
4434- ENDIF ("${final_comp}" MATCHES "\\.${EXT}$")
4435+ ELSE ("${final_comp}" MATCHES "\\${EXT}$")
4436+ SET (${FILE_VAR} "${final_comp}${EXT}")
4437+ ENDIF ("${final_comp}" MATCHES "\\${EXT}$")
4438 ENDIF (NOT final_comp)
4439
4440 # Stick the reversed authority back on the front of the path: done!
4441@@ -138,8 +140,7 @@
4442 ENDIF (NOT IS_ABSOLUTE "${MODULE_FILE}")
4443 GET_FILENAME_COMPONENT (module_name "${MODULE_FILE}" NAME)
4444
4445-
4446- MANGLE_URI (${MODULE_URI} "xq" module_path module_filename)
4447+ MANGLE_URI (${MODULE_URI} ".xq" module_path module_filename)
4448
4449 # Compute a CMake-symbol-safe version of the target URI, for storing
4450 # things in CMake properties.
4451@@ -159,41 +160,51 @@
4452 MATH (EXPR num_zorba_modules "${num_zorba_modules} + 1")
4453 SET_PROPERTY (GLOBAL PROPERTY ZORBA_MODULE_COUNT ${num_zorba_modules})
4454
4455- # Compute the version numbers, if any provided.
4456- IF (MODULE_VERSION)
4457- STRING (REPLACE "." ";" version "${MODULE_VERSION}")
4458- LIST (LENGTH version version_len)
4459- IF (NOT (version_len EQUAL 2) OR (version_len EQUAL 3))
4460- MESSAGE (FATAL_ERROR
4461- "Version ${MODULE_VERSION} not of form 'major.minor[.patch]'")
4462- ENDIF (NOT (version_len EQUAL 2) OR (version_len EQUAL 3))
4463- LIST (GET version 0 major_ver)
4464- LIST (GET version 1 minor_ver)
4465- IF (version_len EQUAL 3)
4466- LIST (GET version 2 patch_ver)
4467- MATH (EXPR version_int
4468- "${major_ver} * 100000000 + ${minor_ver} * 100000 + ${patch_ver}")
4469- ELSE (version_len EQUAL 3)
4470- SET (patch_ver)
4471- MATH (EXPR version_int "${major_ver} * 100000000 + ${minor_ver} * 100000")
4472- ENDIF (version_len EQUAL 3)
4473-
4474- # We maintain a global CMake property named after the target URI
4475- # which remembers all versions of this URI which have been
4476- # declared. If a *lower* version has already been declared, the
4477- # output file rules will be messed up, so die.
4478- GET_PROPERTY (target_versions GLOBAL PROPERTY "${uri_sym}-versions")
4479- FOREACH (known_ver ${target_versions})
4480- IF (known_ver LESS version_int)
4481- MESSAGE (FATAL_ERROR
4482- "The module ${MODULE_URI} has already been declared with a "
4483- "lower version number than ${MODULE_VERSION}. "
4484- "Please call DECLARE_ZORBA_MODULE() for higher versions of the same "
4485- "module first.")
4486- ENDIF (known_ver LESS version_int)
4487- ENDFOREACH (known_ver)
4488- SET_PROPERTY (GLOBAL APPEND PROPERTY "${uri_sym}-versions" ${version_int})
4489- ENDIF (MODULE_VERSION)
4490+ # If no version specified, it is effectively treated as 0.0.0.
4491+ IF (NOT MODULE_VERSION)
4492+ SET (MODULE_VERSION "0.0.0")
4493+ ENDIF (NOT MODULE_VERSION)
4494+
4495+ # Compute a unique integer, version_int, based on the version
4496+ # number, so we can more easily compare with other versions later.
4497+ STRING (REPLACE "." ";" version "${MODULE_VERSION}")
4498+ LIST (LENGTH version version_len)
4499+ IF (NOT ( (version_len EQUAL 2) OR (version_len EQUAL 3) ) )
4500+ MESSAGE (FATAL_ERROR
4501+ "Version ${version_len} ${MODULE_VERSION} not of form 'major.minor[.patch]'")
4502+ ENDIF (NOT ( (version_len EQUAL 2) OR (version_len EQUAL 3) ) )
4503+ LIST (GET version 0 major_ver)
4504+ LIST (GET version 1 minor_ver)
4505+ IF (version_len EQUAL 3)
4506+ LIST (GET version 2 patch_ver)
4507+ MATH (EXPR version_int
4508+ "${major_ver} * 100000000 + ${minor_ver} * 100000 + ${patch_ver}")
4509+ ELSE (version_len EQUAL 3)
4510+ SET (patch_ver)
4511+ MATH (EXPR version_int "${major_ver} * 100000000 + ${minor_ver} * 100000")
4512+ ENDIF (version_len EQUAL 3)
4513+
4514+ # We maintain a global CMake property named after the target URI
4515+ # which remembers all versions of this URI which have been
4516+ # declared. If a *lower* version has already been declared, the
4517+ # output file rules will be messed up, so die. If the *same* version
4518+ # has already been declare, XQdoc will be messed up, so die.
4519+ GET_PROPERTY (target_versions GLOBAL PROPERTY "${uri_sym}-versions")
4520+ FOREACH (known_ver ${target_versions})
4521+ IF (known_ver LESS version_int)
4522+ MESSAGE (FATAL_ERROR
4523+ "The module ${MODULE_URI} has already been declared with a "
4524+ "lower version number than ${MODULE_VERSION}. "
4525+ "Please call DECLARE_ZORBA_MODULE() for higher versions of the same "
4526+ "module first.")
4527+ ElSEIF (known_ver EQUAL version_int)
4528+ MESSAGE (FATAL_ERROR
4529+ "The module ${MODULE_URI} has already been declared with the "
4530+ "version number ${MODULE_VERSION}. You cannot declare the same "
4531+ "module twice.")
4532+ ENDIF (known_ver LESS version_int)
4533+ ENDFOREACH (known_ver)
4534+ SET_PROPERTY (GLOBAL APPEND PROPERTY "${uri_sym}-versions" ${version_int})
4535
4536 # Add to module manifest (except test modules).
4537 IF (NOT MODULE_TEST_ONLY)
4538@@ -250,6 +261,11 @@
4539 SET(module_lib_target "modlib${num_zorba_modules}_${module_name}")
4540 ADD_LIBRARY(${module_lib_target} SHARED ${SRC_FILES})
4541 GET_FILENAME_COMPONENT(module_filewe "${module_filename}" NAME_WE)
4542+ IF (MODULE_VERSION)
4543+ # If there's a version, insert it into the module library name
4544+ SET (module_filewe "${module_filewe}_${MODULE_VERSION}")
4545+ ENDIF (MODULE_VERSION)
4546+
4547 # It seems like it would be nice to set the VERSION and/or
4548 # SOVERSION target properties here. However: On Windows, it
4549 # doesn't seem to do anything (the .rc file configured above
4550@@ -260,7 +276,7 @@
4551 # target property isn't desirable.
4552 # FOLDER is to group IDE projects into folders.
4553 SET_TARGET_PROPERTIES (${module_lib_target} PROPERTIES
4554- OUTPUT_NAME "${module_filewe}_${MODULE_VERSION}${SUFFIX}"
4555+ OUTPUT_NAME "${module_filewe}${SUFFIX}"
4556 ${target_type}_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.src"
4557 FOLDER "Modules"
4558 )
4559@@ -272,12 +288,12 @@
4560 IF(NOT ${PROJECT_NAME} STREQUAL "zorba")
4561 STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
4562 INSTALL(TARGETS ${module_lib_target}
4563- ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path}
4564+ ${target_type} DESTINATION ${ZORBA_NONCORE_LIB_DIR}/${module_path}
4565 COMPONENT ${component_name})
4566
4567 ELSE(NOT ${PROJECT_NAME} STREQUAL "zorba")
4568 INSTALL(TARGETS ${module_lib_target}
4569- ${target_type} DESTINATION ${ZORBA_MODULES_INSTALL_DIR}/${module_path})
4570+ ${target_type} DESTINATION ${ZORBA_CORE_LIB_DIR}/${module_path})
4571 ENDIF(NOT ${PROJECT_NAME} STREQUAL "zorba")
4572 ENDIF (NOT MODULE_TEST_ONLY)
4573
4574@@ -296,16 +312,16 @@
4575 ENDIF (patch_ver)
4576 ENDIF (MODULE_VERSION)
4577 FOREACH (version_infix "" ${version_infixes})
4578- ADD_COPY_RULE ("${SOURCE_FILE}" "${module_path}/${module_filename}"
4579- "${version_infix}" "" "${MODULE_TEST_ONLY}")
4580+ ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}"
4581+ "${version_infix}" "" 1 "${MODULE_TEST_ONLY}")
4582 ENDFOREACH (version_infix)
4583
4584 # Also copy the dynamic library from the location it was built.
4585 IF (module_lib_target)
4586 GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION)
4587 GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME)
4588- ADD_COPY_RULE ("${lib_location}" "${module_path}/${lib_filename}"
4589- "" "${module_lib_target}" "${MODULE_TEST_ONLY}")
4590+ ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}"
4591+ "" "${module_lib_target}" 0 "${MODULE_TEST_ONLY}")
4592 ENDIF (module_lib_target)
4593
4594 # Last but not least, whip up a test case that ensures the module
4595@@ -350,34 +366,152 @@
4596 SET (SOURCE_FILE "${SCHEMA_FILE}")
4597 ENDIF (NOT IS_ABSOLUTE "${SCHEMA_FILE}")
4598 GET_FILENAME_COMPONENT (schema_name "${SCHEMA_FILE}" NAME)
4599- MANGLE_URI (${SCHEMA_URI} "xsd" schema_path schema_filename)
4600+ MANGLE_URI (${SCHEMA_URI} ".xsd" schema_path schema_filename)
4601
4602 # Add to schema manifest (except test schema).
4603 IF (NOT SCHEMA_TEST_ONLY)
4604 ADD_ZORBA_MANIFEST_ENTRY("schema" ${SCHEMA_URI} "")
4605 ENDIF (NOT SCHEMA_TEST_ONLY)
4606
4607- ADD_COPY_RULE ("${SOURCE_FILE}" "${schema_path}/${schema_filename}"
4608- "" "" "${SCHEMA_TEST_ONLY}")
4609+ ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}"
4610+ "" "" 1 "${SCHEMA_TEST_ONLY}")
4611
4612 ENDMACRO (DECLARE_ZORBA_SCHEMA)
4613
4614+# Macro which declares a file to be loaded by URI. This sets up the
4615+# installation of the file into the URI_PATH folder so it will be
4616+# found at runtime.
4617+#
4618+# Args: URI - the URI of the file
4619+# FILE - path to file (if not absolute, will be resolved
4620+# relative to CMAKE_CURRENT_SOURCE_DIR)
4621+# TEST_ONLY - (optional) File is for testcases only and should not
4622+# be installed
4623+MACRO (DECLARE_ZORBA_URI_FILE)
4624+ # QQQ Refactor - this macro is basically identical to DECLARE_ZORBA_SCHEMA
4625+ PARSE_ARGUMENTS(URI_FILE "" "URI;FILE" "TEST_ONLY" ${ARGN})
4626+ IF (NOT URI_FILE_FILE)
4627+ MESSAGE (FATAL_ERROR "'FILE' argument is required for ZORBA_DECLARE_URI_FILE()")
4628+ ENDIF (NOT URI_FILE_FILE)
4629+ IF (NOT URI_FILE_URI)
4630+ MESSAGE (FATAL_ERROR "'URI' argument is required for ZORBA_DECLARE_URI_FILE()")
4631+ ENDIF (NOT URI_FILE_URI)
4632+ IF (NOT IS_ABSOLUTE "${URI_FILE_FILE}")
4633+ SET (SOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${URI_FILE_FILE}")
4634+ ELSE (NOT IS_ABSOLUTE "${URI_FILE_FILE}")
4635+ SET (SOURCE_FILE "${URI_FILE_FILE}")
4636+ ENDIF (NOT IS_ABSOLUTE "${URI_FILE_FILE}")
4637+ GET_FILENAME_COMPONENT (uri_file_name "${URI_FILE_FILE}" NAME)
4638+ # Don't enforce any extension on general files
4639+ MANGLE_URI (${URI_FILE_URI} "" uri_file_path uri_file_filename)
4640+
4641+ ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${uri_file_path}/${uri_file_filename}"
4642+ "" "" 1 "${URI_FILE_TEST_ONLY}")
4643+
4644+ENDMACRO (DECLARE_ZORBA_URI_FILE)
4645+
4646+# Inform Zorba of a .jar file that should be made available on the CLASSPATH
4647+# of the JVM, should the JVM be started. QQQ more doc needed
4648+#
4649+# Args: FILE - path to file (must be absolute)
4650+# EXTERNAL - (optional) FILE specifies a path that should be added
4651+# to CLASSPATH as-is
4652+# TEST_ONLY - (optional) Jar file is for testcases only and should not
4653+# be installed
4654+
4655+MACRO (DECLARE_ZORBA_JAR)
4656+ PARSE_ARGUMENTS (JAR "FILE" "" "TEST_ONLY;EXTERNAL" ${ARGN})
4657+ IF (NOT JAR_FILE)
4658+ MESSAGE (FATAL_ERROR "'FILE' argument is required for DECLARE_ZORBA_JAR")
4659+ ENDIF (NOT JAR_FILE)
4660+
4661+ # Initialize classpath file and set up copy rule (once per project)
4662+ SET (_CP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-classpath.txt")
4663+ GET_PROPERTY (_known_project GLOBAL PROPERTY "${PROJECT_NAME}-jars")
4664+ IF (NOT _known_project)
4665+ FILE (REMOVE "${_CP_FILE}")
4666+ SET_PROPERTY (GLOBAL PROPERTY "${PROJECT_NAME}-jars" 1)
4667+ ADD_COPY_RULE ("LIB" "${_CP_FILE}" "jars/${PROJECT_NAME}-classpath.txt"
4668+ "" "" 1 "${JAR_TEST_ONLY}")
4669+ ENDIF (NOT _known_project)
4670+
4671+ # Iterate over all supplied jar files
4672+ FOREACH (_jar_file ${JAR_FILE})
4673+
4674+ IF (JAR_EXTERNAL)
4675+ # Put absolute path into classpath file
4676+ FILE (APPEND "${_CP_FILE}" "${_jar_file}\n")
4677+ ELSE (JAR_EXTERNAL)
4678+ # Copy jar to jars/ directory and add relative path to classpath file
4679+ GET_FILENAME_COMPONENT (_output_filename "${_jar_file}" NAME)
4680+ ADD_COPY_RULE ("LIB" "${_jar_file}" "jars/${_output_filename}" "" ""
4681+ 1 "${JAR_TEST_ONLY}")
4682+ FILE (APPEND "${_CP_FILE}" "${_output_filename}\n")
4683+ ENDIF (JAR_EXTERNAL)
4684+
4685+ ENDFOREACH (_jar_file)
4686+ENDMACRO (DECLARE_ZORBA_JAR)
4687+
4688+# Inform Zorba of a .jar file that should be made available on the CLASSPATH
4689+# of the JVM, should the JVM be started. QQQ more doc needed
4690+#
4691+# Args: FILE - path to file (must be absolute)
4692+# EXTERNAL - (optional) FILE specifies a path that should be added
4693+# to CLASSPATH as-is
4694+# TEST_ONLY - (optional) Jar file is for testcases only and should not
4695+# be installed
4696+
4697+#MACRO (DECLARE_ZORBA_JAR)
4698+# PARSE_ARGUMENTS (JAR "" "FILE" "TEST_ONLY;EXTERNAL" ${ARGN})
4699+# IF (NOT JAR_FILE)
4700+# MESSAGE (FATAL_ERROR "'JAR' argument is required for DECLARE_ZORBA_JAR")
4701+# ENDIF (NOT JAR_FILE)
4702+# IF (NOT IS_ABSOLUTE "${JAR_FILE}")
4703+# SET (JAR_FILE "${CMAKE_CURRENT_BINARY_DIR}/${JAR_FILE}")
4704+# ENDIF (NOT IS_ABSOLUTE "${JAR_FILE}")
4705+#
4706+# SET (_LIST_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-classpath.txt")
4707+# IF (JAR_EXTERNAL)
4708+# # Remember whether we've seen external jars for this project yet
4709+# GET_PROPERTY (_known_project GLOBAL PROPERTY "${PROJECT_NAME}-ext-jars")
4710+# IF (NOT _known_project)
4711+# FILE (REMOVE "${_LIST_FILE}")
4712+# SET_PROPERTY (GLOBAL PROPERTY "${PROJECT_NAME}-ext-jars" 1)
4713+# ADD_COPY_RULE ("LIB" "${_LIST_FILE}" "jars/${PROJECT_NAME}-classpath.txt"
4714+# "" "" 1 0)
4715+# ENDIF (NOT _known_project)
4716+# FILE (APPEND "${_LIST_FILE}" "${JAR_FILE}\n")
4717+# ELSE (JAR_EXTERNAL)
4718+# GET_FILENAME_COMPONENT (_output_filename "${JAR_FILE}" NAME)
4719+# ADD_COPY_RULE ("LIB" "${JAR_FILE}" "jars/${_output_filename}" "" ""
4720+# 1 "${JAR_TEST_ONLY}")
4721+# ENDIF (JAR_EXTERNAL)
4722+#ENDMACRO (DECLARE_ZORBA_JAR)
4723+
4724+
4725+
4726 # Utility macro for setting up a build rule to copy a file to a
4727-# particular (possible versioned) file in URI_PATH if such a file has
4728-# not already been output.
4729+# particular (possibly versioned) file in a shared directory if such a
4730+# file has not already been output.
4731+#
4732+# FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared
4733+# directory to place output in (URI_PATH or LIB_PATH).
4734 # INPUT_FILE: Absolute path to file to copy.
4735 # OUTPUT_FILE: Relative path to output file (relative to URI_PATH).
4736 # VERSION_ARG: Version; may be "" for non-versioned files.
4737 # DEPEND_TARGET: A CMake target name upon which the copy rule should depend;
4738 # may be "".
4739+# INSTALL: If 1, an INSTALL() directive will be executed to put the
4740+# file into the install image.
4741 # TEST_ONLY: If 1, file is for testcases only; will be copied into
4742-# TEST_URI_PATH and will not be installed
4743-MACRO (ADD_COPY_RULE INPUT_FILE OUTPUT_FILE VERSION_ARG DEPEND_TARGET TEST_ONLY)
4744+# TEST_URI_PATH/TEST_LIB_PATH and will not be installed.
4745+MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG
4746+ DEPEND_TARGET INSTALL TEST_ONLY)
4747 # Choose output base directory
4748 IF (${TEST_ONLY} EQUAL 1)
4749- SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_URI_PATH")
4750+ SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH")
4751 ELSE (${TEST_ONLY} EQUAL 1)
4752- SET (_output_basedir "${CMAKE_BINARY_DIR}/URI_PATH")
4753+ SET (_output_basedir "${CMAKE_BINARY_DIR}/${FILE_TYPE}_PATH")
4754 ENDIF (${TEST_ONLY} EQUAL 1)
4755
4756 # Compute the modified output filename by inserting VERSION_ARG (if
4757@@ -404,46 +538,50 @@
4758 IF (file_found EQUAL -1)
4759 SET_PROPERTY (GLOBAL APPEND PROPERTY "${_dir_sym}-output-files"
4760 "${_output_file}")
4761- # Save the input file, output file, and any library dependency
4762- # target for this rule in a global property
4763+ # Detect whether this is a core URI or not
4764+ IF (PROJECT_NAME STREQUAL "zorba")
4765+ SET (_is_core 1)
4766+ ELSE (PROJECT_NAME STREQUAL "zorba")
4767+ SET (_is_core 0)
4768+ ENDIF (PROJECT_NAME STREQUAL "zorba")
4769+
4770+ # Save the (input file, output file, any library dependency
4771+ # target, and whether this is a core or non-core file) for this
4772+ # rule in a global property
4773 SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES
4774- "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}")
4775+ "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}" "${_is_core}")
4776
4777- # For .xq and .xsd files, also set up an INSTALL rule (if not TEST_ONLY).
4778- IF (NOT ${TEST_ONLY} EQUAL 1)
4779- IF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")
4780+ # Also set up an INSTALL rule (unless TEST_ONLY).
4781+ IF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) )
4782
4783- IF(NOT PROJECT_NAME STREQUAL "zorba")
4784- STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
4785- INSTALL (FILES "${INPUT_FILE}"
4786- DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"
4787- RENAME "${_output_filename}"
4788- COMPONENT "${component_name}")
4789+ IF(NOT _is_core)
4790+ STRING(REPLACE "-" "_" component_name ${PROJECT_NAME})
4791+ INSTALL (FILES "${INPUT_FILE}"
4792+ DESTINATION "${ZORBA_NONCORE_${FILE_TYPE}_DIR}/${_output_path}"
4793+ RENAME "${_output_filename}"
4794+ COMPONENT "${component_name}")
4795
4796- IF (NOT ${component_name}_cpack)
4797- SET (${component_name}_cpack 1)
4798+ IF (NOT ${component_name}_cpack)
4799+ SET (${component_name}_cpack 1)
4800
4801- STRING(TOUPPER ${component_name} component_name2)
4802- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_GROUP \"external_modules\")\n")
4803-
4804- STRING(REPLACE "zorba_" "" component_display_name ${component_name})
4805- STRING(REPLACE "_" " " component_display_name ${component_display_name})
4806- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DISPLAY_NAME \"${component_display_name}\")\n")
4807-
4808- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DESCRIPTION \"Install the functionalities of the ${component_display_name}.\")\n")
4809- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_INSTALL_TYPES Full)\n")
4810- ENDIF (NOT ${component_name}_cpack)
4811-
4812- ELSE(NOT PROJECT_NAME STREQUAL "zorba")
4813- INSTALL (FILES "${INPUT_FILE}"
4814- DESTINATION "${ZORBA_MODULES_INSTALL_DIR}/${_output_path}"
4815+ STRING(TOUPPER ${component_name} component_name2)
4816+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_GROUP \"external_modules\")\n")
4817+
4818+ STRING(REPLACE "zorba_" "" component_display_name ${component_name})
4819+ STRING(REPLACE "_" " " component_display_name ${component_display_name})
4820+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DISPLAY_NAME \"${component_display_name}\")\n")
4821+
4822+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_DESCRIPTION \"Install the functionalities of the ${component_display_name}.\")\n")
4823+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeCPackModules.cmake "SET(CPACK_COMPONENT_${component_name2}_INSTALL_TYPES Full)\n")
4824+ ENDIF (NOT ${component_name}_cpack)
4825+
4826+ ELSE(NOT _is_core)
4827+ INSTALL (FILES "${INPUT_FILE}"
4828+ DESTINATION "${ZORBA_CORE_${FILE_TYPE}_DIR}/${_output_path}"
4829 RENAME "${_output_filename}")
4830- ENDIF(NOT PROJECT_NAME STREQUAL "zorba")
4831-
4832-
4833+ ENDIF(NOT _is_core)
4834
4835- ENDIF (${_output_ext} STREQUAL ".xq" OR ${_output_ext} STREQUAL ".xsd")
4836- ENDIF (NOT ${TEST_ONLY} EQUAL 1)
4837+ ENDIF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) )
4838 ENDIF (file_found EQUAL -1)
4839 ENDMACRO (ADD_COPY_RULE)
4840
4841@@ -485,16 +623,17 @@
4842 IF (POLICY CMP0007)
4843 CMAKE_POLICY (SET CMP0007 NEW)
4844 ENDIF (POLICY CMP0007)
4845- MESSAGE (STATUS "Creating check_uris target")
4846+ MESSAGE (STATUS "Creating check_core_uris and check_uris targets")
4847 GET_PROPERTY (copy_rules GLOBAL PROPERTY ZORBA_URI_FILES)
4848 SET (_output_files)
4849 WHILE (copy_rules)
4850- # Pop three items off the list, and set up the corresponding
4851+ # Pop four items off the list, and set up the corresponding
4852 # rule
4853 LIST (GET copy_rules 0 _input_file)
4854 LIST (GET copy_rules 1 _output_file)
4855 LIST (GET copy_rules 2 _depend_target)
4856- LIST (REMOVE_AT copy_rules 0 1 2)
4857+ LIST (GET copy_rules 3 _is_core)
4858+ LIST (REMOVE_AT copy_rules 0 1 2 3)
4859 SET (_depends "${_input_file}")
4860 IF (_depend_target)
4861 LIST (APPEND _depends "${_depend_target}")
4862@@ -504,12 +643,30 @@
4863 "${_input_file}" "${_output_file}"
4864 DEPENDS ${_depends}
4865 COMMENT "Copying ${_input_file} to URI path" VERBATIM)
4866- LIST (APPEND _output_files "${_output_file}")
4867+ IF (_is_core)
4868+ LIST (APPEND _core_output_files "${_output_file}")
4869+ ELSE (_is_core)
4870+ LIST (APPEND _noncore_output_files "${_output_file}")
4871+ ENDIF (_is_core)
4872 ENDWHILE (copy_rules)
4873- ADD_CUSTOM_TARGET (check_uris ALL DEPENDS ${_output_files} VERBATIM)
4874- SET_TARGET_PROPERTIES(check_uris PROPERTIES
4875- FOLDER "Modules"
4876- )
4877+
4878+ # Targets and dependencies:
4879+ # ALL depends on check_uris; check_uris depends on check_core_uris;
4880+ # zorbacmd depends on check_core_uris.
4881+ ADD_CUSTOM_TARGET (check_uris ALL
4882+ DEPENDS ${_noncore_output_files} VERBATIM)
4883+ SET_TARGET_PROPERTIES(check_uris PROPERTIES FOLDER "Modules")
4884+ # Only create check_core_uris target and associated dependencies if
4885+ # there are any core URIs; there should never be any when building a
4886+ # standalone module project.
4887+ LIST (LENGTH _core_output_files _num_core)
4888+ IF (_num_core GREATER 0)
4889+ ADD_CUSTOM_TARGET (check_core_uris
4890+ DEPENDS ${_core_output_files} VERBATIM)
4891+ ADD_DEPENDENCIES(check_uris check_core_uris)
4892+ ADD_DEPENDENCIES(zorbacmd check_core_uris)
4893+ SET_TARGET_PROPERTIES(check_core_uris PROPERTIES FOLDER "Modules")
4894+ ENDIF (_num_core GREATER 0)
4895 SET_PROPERTY (GLOBAL PROPERTY ZORBA_URI_FILES)
4896
4897 #add 'xqdoc' and 'xqdoc-xml' targets
4898@@ -695,7 +852,7 @@
4899 COMMENT "Building XQDoc XML documentation ..."
4900 )
4901 MESSAGE(STATUS " added target xqdoc-xml")
4902- ADD_DEPENDENCIES(xqdoc-xml zorba_simplestore)
4903+ ADD_DEPENDENCIES(xqdoc-xml zorbacmd check_core_uris)
4904
4905 SET_TARGET_PROPERTIES (xqdoc-xml PROPERTIES
4906 EXCLUDE_FROM_DEFAULT_BUILD 1
4907
4908=== modified file 'config/CMakeLists.txt'
4909--- config/CMakeLists.txt 2011-09-08 19:19:54 +0000
4910+++ config/CMakeLists.txt 2012-02-22 17:11:27 +0000
4911@@ -34,7 +34,8 @@
4912 SET(Zorba_EXE_PATH "${ZORBA_ROOT}/bin/zorba")
4913 SET(Zorba_EXTERNALMODULECONFIG_FILE
4914 "${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}/ExternalModuleConfig.cmake.in")
4915-SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_ROOT}/${ZORBA_MODULES_INSTALL_DIR}")
4916+SET(Zorba_NONCORE_URI_DIR "${ZORBA_ROOT}/${ZORBA_NONCORE_URI_DIR}")
4917+SET(Zorba_NONCORE_LIB_DIR "${ZORBA_ROOT}/${ZORBA_NONCORE_LIB_DIR}")
4918
4919 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
4920 "${CMAKE_CURRENT_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
4921@@ -58,7 +59,7 @@
4922 STRING (REPLACE ".exe" ".bat" Zorba_TESTDRIVER ${Zorba_TESTDRIVER})
4923 ENDIF (WIN32)
4924
4925-SET(Zorba_EXE_PATH "${ZORBA_EXE}")
4926+SET(Zorba_EXE_PATH "${ZORBA_EXE}")
4927 SET(Zorba_EXTERNALMODULECONFIG_FILE
4928 "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in")
4929 # Note: We also set these two into the parent's scope, so that it is
4930@@ -67,10 +68,9 @@
4931 "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in"
4932 PARENT_SCOPE)
4933 SET(Zorba_EXE "${ZORBA_EXE}" PARENT_SCOPE)
4934+SET(Zorba_NONCORE_URI_DIR "${ZORBA_NONCORE_URI_DIR}")
4935+SET(Zorba_NONCORE_LIB_DIR "${ZORBA_NONCORE_LIB_DIR}")
4936
4937-# Note: This value doesn't really make much sense, but neither does any
4938-# other value
4939-SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_MODULES_INSTALL_DIR}")
4940 CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
4941 "${CMAKE_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
4942
4943
4944=== modified file 'config/ZorbaConfig.cmake.in'
4945--- config/ZorbaConfig.cmake.in 2011-08-24 09:09:02 +0000
4946+++ config/ZorbaConfig.cmake.in 2012-02-22 17:11:27 +0000
4947@@ -47,10 +47,13 @@
4948 "Path to Zorba's testdriver" FORCE)
4949 SET_NORMALIZED (Zorba_EXE "@Zorba_EXE_PATH@" CACHE PATH "Path to Zorba executable" FORCE)
4950
4951-# Tell the user project where modules are installed. Note: This variable
4952-# is all-uppercase because it is also used internally by Zorba's build.
4953-SET (ZORBA_MODULES_INSTALL_DIR "@Zorba_MODULES_INSTALL_DIR@"
4954- CACHE STRING "Path to Zorba modules in this Zorba installation" FORCE)
4955+# Tell the user project where (non-core) modules are installed. Note:
4956+# These variables are all-uppercase because they are also used
4957+# internally by Zorba's build.
4958+SET (ZORBA_NONCORE_URI_DIR "@Zorba_NONCORE_URI_DIR@"
4959+ CACHE STRING "Path to Zorba to non-core modules/schemas in this Zorba installation" FORCE)
4960+SET (ZORBA_NONCORE_LIB_DIR "@Zorba_NONCORE_LIB_DIR@"
4961+ CACHE STRING "Path to Zorba to non-core libraries in this Zorba installation" FORCE)
4962
4963 # Tell the user project where to find the "USE" file.
4964 # This file uses the above settings to configure the user project.
4965
4966=== modified file 'doc/cxx/examples/errors.cpp'
4967--- doc/cxx/examples/errors.cpp 2011-08-11 05:11:12 +0000
4968+++ doc/cxx/examples/errors.cpp 2012-02-22 17:11:27 +0000
4969@@ -139,12 +139,12 @@
4970 // make sure that the warning zwarn::ZWST0002 is turned
4971 // into an error
4972 StaticContext_t lCtx = aZorba->createStaticContext();
4973- lCtx->declareOption(lQName, "ZWST0002");
4974+ lCtx->declareOption(lQName, "ZWST0003");
4975
4976 std::ostringstream s;
4977- s << "declare namespace unknown = 'unknown-annotation';" << std::endl
4978- << "declare %unknown:test variable $var := 3;" << std::endl
4979- << "$var" << std::endl;
4980+ s << "declare namespace z = 'http://www.zorba-xquery.com/annotations';" << std::endl
4981+ << "declare %z:sequential function local:foo() { 1 };" << std::endl
4982+ << "local:foo()" << std::endl;
4983 XQuery_t lQuery = aZorba->compileQuery(s.str(), lCtx);
4984
4985 std::cout << lQuery << std::endl;
4986
4987=== modified file 'doc/cxx/examples/simple.cpp'
4988--- doc/cxx/examples/simple.cpp 2011-06-14 14:21:49 +0000
4989+++ doc/cxx/examples/simple.cpp 2012-02-22 17:11:27 +0000
4990@@ -33,14 +33,14 @@
4991
4992 std::cout << lQuery << std::endl;
4993
4994- return true;
4995+ return true;
4996 }
4997
4998
4999 bool
5000 example_2(Zorba* aZorba)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: