Merge lp:~zorba-coders/zorba/module-schema-tools into lp:zorba
- module-schema-tools
- Merge into trunk
Status: | Superseded | ||||||||
---|---|---|---|---|---|---|---|---|---|
Proposed branch: | lp:~zorba-coders/zorba/module-schema-tools | ||||||||
Merge into: | lp:zorba | ||||||||
Diff against target: |
2318 lines (+1282/-160) 35 files modified
NOTICE.txt (+18/-0) NOTICE.xml (+16/-0) bin/path_util.cpp (+19/-2) bin/path_util.h (+6/-0) bin/zorbacmd.cpp (+8/-0) bin/zorbacmdproperties.cpp (+5/-0) bin/zorbacmdproperties.h (+3/-0) bin/zorbacmdproperties.txt (+1/-0) bin/zorbacmdproperties_base.h (+133/-72) cmake_modules/ZorbaModule.cmake (+60/-16) include/zorba/properties_base.h (+37/-1) include/zorba/util/file.h (+2/-0) include/zorba/zorba.h (+15/-5) src/api/staticcontextimpl.h (+1/-0) src/api/zorbaimpl.cpp (+10/-0) src/api/zorbaimpl.h (+2/-0) src/context/dynamic_loader.cpp (+41/-26) src/context/dynamic_loader.h (+10/-5) src/context/static_context.cpp (+37/-0) src/context/static_context.h (+11/-0) src/precompiled/stdafx.h (+5/-6) src/system/properties.h (+21/-0) src/system/zorba_properties.h (+67/-17) src/system/zorba_properties.txt (+1/-0) src/util/file.cpp (+12/-0) src/util/fs_util.cpp (+24/-0) src/util/fs_util.h (+28/-0) src/util/win32/dirent.h (+372/-0) swig/XQuery.i (+75/-8) swig/java/CMakeLists.txt (+2/-1) swig/various.i (+184/-0) swig/zorba_api.i (+8/-1) test/rbkt/modules/CMakeLists.txt (+2/-0) test/rbkt/modules/java/CMakeLists.txt (+39/-0) test/rbkt/modules/java/Test.java (+7/-0) |
||||||||
To merge this branch: | bzr merge lp:~zorba-coders/zorba/module-schema-tools | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Chris Hillery | Needs Fixing | ||
Matthias Brantner | Needs Fixing | ||
Cezar Andrei | Pending | ||
Review via email: mp+97978@code.launchpad.net |
This proposal supersedes a proposal from 2012-03-16.
This proposal has been superseded by a proposal from 2012-03-19.
Commit message
Merge in branch implementing jvm classpath and fix managing dynamic libraries.
Add java classpath to zorbacmd and to Zorba API.
Fix dynamic libraries loading.
Tested it works on Windows with both xsl-fo and xmlbeans modules. All tests are passing.
Description of the change
Add java classpath to zorbacmd and to Zorba API.
Fix dynamic libraries loading.
Tested it works on Windows with both xsl-fo and xmlbeans modules. All tests are passing.
Removed reference to schema-tools module.
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal | # |
- In DynamicLoader:
- Why is DECLARE_ZORBA_JAR in cmake_modules/
- Why did the file src/store/
For example,
88 -"--no-
1089 -"--serialize-
1090 +"--no-
1091 +"--serialize-
causes the unknown option for the serialize-
- commit of src/util/
- I don't really like the name serializeToOutp
- there is a todo left "# todo cezar compile and jar it up"
- I didn't find a test for the new serializeToOutp
Chris Hillery (ceejatec) wrote : Posted in a previous version of this proposal | # |
Agreed with Matthias's comments.
Regarding DECLARE_
Couple more comments:
- Do we also need to mention the addition of swig/various.i in NOTICE.xml? It has a comment saying it's from the SWIG package directly.
- Wasn't the class name "IStream" causing a build conflict on Windows?
- The call to init_val() in zorbacmdpropert
- Why is the method for retrieving the PropertiesGlobal* called "getProperties()"? Shouldn't that be getProperiesGlo
- Similarly, why is the factory method for PropertiesGlobal "Properties:
- Need to fix the conflict in ExternalModules
- Typo: "singelton" in zorba.h.
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal | # |
I fixed all of the comments, execept:
- the ones related to swig:
- the changes are not required, right now but they required for optimizing XQJ, to make swig play nice with streams it's quite a chlange, would be a petty to loose them
- I don't think various.i should be specified in NOTICE.xml since we already have swig and various.i is part of swig.
- about Properties it's not really the most intuitive way of representing it but I do think PropertiesGlobal is a good name, many projects use kind after the base to explain what it is. I call Properties:
Cezar Andrei (cezar-andrei) wrote : Posted in a previous version of this proposal | # |
See my prevoius comment for fixes in this proposal.
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue starting for merge proposal.
Log at: http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job module-
All tests succeeded!
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1. Got: 3 Pending.
Zorba Build Bot (zorba-buildbot) wrote : | # |
There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.
Matthias Brantner (matthias-brantner) wrote : | # |
- I think you reverted the changes that have been made in modules/
- The file src/system/
1058 -"--no-
1059 -"--serialize-
1060 +"--no-
1061 +"--serialize-
Chris Hillery (ceejatec) wrote : | # |
It looks like you didn't fix the indentation of calls to init_val() in zorbacmdpropert
if (*argv == NULL) { result = "No value given for --classpath option"; break; } init_val (*argv, theClasspath, d);
There's no reason to have that call to init_val() hanging out over there. I count 9 places where this is done, most of which were put that way with this change.
You also didn't rename the class "IStream". Rodolfo reported that that class name conflicted with a Windows class, making the code not compile on Windows. It's not clear to me if this is one of the changes for "optimizing XQJ" you mentioned, but if it actually causes a compilation failure it must be changed.
Cezar Andrei (cezar-andrei) wrote : | # |
> It looks like you didn't fix the indentation of calls to init_val() in
> zorbacmdpropert
> other instances of calls to that method onto the ends of earlier lines of code
> in zorba_properties.h. It's just not good readability. To be clear, I'm
> talking about lines like this:
>
> if (*argv == NULL) { result = "No value given for --classpath option";
> break; } init_val (*argv, theClasspath, d);
>
> There's no reason to have that call to init_val() hanging out over there. I
> count 9 places where this is done, most of which were put that way with this
> change.
If you take a look at the file there are many places where this strange indentation occurs. Check out the top of the file: THIS IS A GENERATED FILE. DO NOT EDIT!
>
>
> You also didn't rename the class "IStream". Rodolfo reported that that class
> name conflicted with a Windows class, making the code not compile on Windows.
> It's not clear to me if this is one of the changes for "optimizing XQJ" you
> mentioned, but if it actually causes a compilation failure it must be changed.
Rodolfo, checked out the full build and tests on windows, there is no problem with it. I sent an email to clarify it.
Chris Hillery (ceejatec) wrote : | # |
> If you take a look at the file there are many places where this strange
> indentation occurs. Check out the top of the file: THIS IS A GENERATED FILE.
> DO NOT EDIT!
My understanding is that this isn't true anymore, though. Markos removed the script to generate this file, and said that in future changes should be made directly to it. If that's correct, clearly he should have removed the above comment as well.
Did you run a script to generate these files, Cezar? If so, that would explain Matthias's problem as well (about changes to the property descriptions that seem to have been reverted by you).
- 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_propertie s.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
Preview Diff
1 | === modified file 'NOTICE.txt' | |||
2 | --- NOTICE.txt 2012-03-14 15:28:15 +0000 | |||
3 | +++ NOTICE.txt 2012-03-19 16:17:13 +0000 | |||
4 | @@ -459,6 +459,24 @@ | |||
5 | 459 | suitability of this software for any purpose. It is provided "as is" | 459 | suitability of this software for any purpose. It is provided "as is" |
6 | 460 | without express or implied warranty. | 460 | without express or implied warranty. |
7 | 461 | 461 | ||
8 | 462 | ---------------------------------------------------- | ||
9 | 463 | |||
10 | 464 | src/util/win32/dirent.h | ||
11 | 465 | |||
12 | 466 | Copyright: 2006 Toni Ronkko | ||
13 | 467 | |||
14 | 468 | |||
15 | 469 | Permission is hereby granted, free of charge, to any person obtaining | ||
16 | 470 | a copy of this software and associated documentation files (the | ||
17 | 471 | ``Software''), to deal in the Software without restriction, including | ||
18 | 472 | without limitation the rights to use, copy, modify, merge, publish, | ||
19 | 473 | distribute, sublicense, and/or sell copies of the Software, and to | ||
20 | 474 | permit persons to whom the Software is furnished to do so, subject to | ||
21 | 475 | the following conditions: | ||
22 | 476 | |||
23 | 477 | The above copyright notice and this permission notice shall be included | ||
24 | 478 | in all copies or substantial portions of the Software. | ||
25 | 479 | |||
26 | 462 | 480 | ||
27 | 463 | External libraries used by this project: | 481 | External libraries used by this project: |
28 | 464 | ---------------------------------------------------- | 482 | ---------------------------------------------------- |
29 | 465 | 483 | ||
30 | === modified file 'NOTICE.xml' | |||
31 | --- NOTICE.xml 2012-01-11 15:56:57 +0000 | |||
32 | +++ NOTICE.xml 2012-03-19 16:17:13 +0000 | |||
33 | @@ -423,6 +423,22 @@ | |||
34 | 423 | without express or implied warranty. | 423 | without express or implied warranty. |
35 | 424 | </foreign-notice> | 424 | </foreign-notice> |
36 | 425 | </foreign-files> | 425 | </foreign-files> |
37 | 426 | <foreign-files> | ||
38 | 427 | <file>src/util/win32/dirent.h</file> | ||
39 | 428 | <copyright>2006 Toni Ronkko</copyright> | ||
40 | 429 | <foreign-notice> | ||
41 | 430 | Permission is hereby granted, free of charge, to any person obtaining | ||
42 | 431 | a copy of this software and associated documentation files (the | ||
43 | 432 | ``Software''), to deal in the Software without restriction, including | ||
44 | 433 | without limitation the rights to use, copy, modify, merge, publish, | ||
45 | 434 | distribute, sublicense, and/or sell copies of the Software, and to | ||
46 | 435 | permit persons to whom the Software is furnished to do so, subject to | ||
47 | 436 | the following conditions: | ||
48 | 437 | |||
49 | 438 | The above copyright notice and this permission notice shall be included | ||
50 | 439 | in all copies or substantial portions of the Software. | ||
51 | 440 | </foreign-notice> | ||
52 | 441 | </foreign-files> | ||
53 | 426 | 442 | ||
54 | 427 | <external-lib mandatory="true"> | 443 | <external-lib mandatory="true"> |
55 | 428 | <name>LIBXML2</name> | 444 | <name>LIBXML2</name> |
56 | 429 | 445 | ||
57 | === modified file 'bin/path_util.cpp' | |||
58 | --- bin/path_util.cpp 2012-01-11 15:56:57 +0000 | |||
59 | +++ bin/path_util.cpp 2012-03-19 16:17:13 +0000 | |||
60 | @@ -49,7 +49,7 @@ | |||
61 | 49 | } | 49 | } |
62 | 50 | 50 | ||
63 | 51 | 51 | ||
65 | 52 | static void | 52 | void |
66 | 53 | tokenizePath( | 53 | tokenizePath( |
67 | 54 | const std::string& aPathStr, | 54 | const std::string& aPathStr, |
68 | 55 | std::vector<String>& aResult) | 55 | std::vector<String>& aResult) |
69 | @@ -66,6 +66,23 @@ | |||
70 | 66 | } | 66 | } |
71 | 67 | } | 67 | } |
72 | 68 | 68 | ||
73 | 69 | |||
74 | 70 | String | ||
75 | 71 | concatenatePaths( const std::vector<String>& aPathList) | ||
76 | 72 | { | ||
77 | 73 | String delimiter(filesystem_path::get_path_separator()); | ||
78 | 74 | |||
79 | 75 | String lResult; | ||
80 | 76 | for (std::vector<String>::const_iterator lIter = aPathList.begin(); | ||
81 | 77 | lIter != aPathList.end(); ++lIter) | ||
82 | 78 | { | ||
83 | 79 | lResult += delimiter + *lIter; | ||
84 | 80 | } | ||
85 | 81 | |||
86 | 82 | return lResult; | ||
87 | 83 | } | ||
88 | 84 | |||
89 | 85 | |||
90 | 69 | void | 86 | void |
91 | 70 | setPathsOnContext( | 87 | setPathsOnContext( |
92 | 71 | const ZorbaCMDProperties& aProperties, | 88 | const ZorbaCMDProperties& aProperties, |
93 | @@ -101,8 +118,8 @@ | |||
94 | 101 | // Compute and set lib path | 118 | // Compute and set lib path |
95 | 102 | aProperties.getLibPath(lPathStr); | 119 | aProperties.getLibPath(lPathStr); |
96 | 103 | tokenizePath(lPathStr, lPath); | 120 | tokenizePath(lPathStr, lPath); |
97 | 121 | lPath.push_back(lCWD.get_path()); | ||
98 | 104 | lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH"); | 122 | lEnvStr = getPathFromEnvironment("ZORBA_LIB_PATH"); |
99 | 105 | lPath.push_back(lCWD.get_path()); | ||
100 | 106 | tokenizePath(lEnvStr, lPath); | 123 | tokenizePath(lEnvStr, lPath); |
101 | 107 | aStaticCtx->setLibPath(lPath); | 124 | aStaticCtx->setLibPath(lPath); |
102 | 108 | } | 125 | } |
103 | 109 | 126 | ||
104 | === modified file 'bin/path_util.h' | |||
105 | --- bin/path_util.h 2012-01-11 15:56:57 +0000 | |||
106 | +++ bin/path_util.h 2012-03-19 16:17:13 +0000 | |||
107 | @@ -32,6 +32,12 @@ | |||
108 | 32 | setPathsOnContext(const ZorbaCMDProperties& aProperties, | 32 | setPathsOnContext(const ZorbaCMDProperties& aProperties, |
109 | 33 | zorba::StaticContext_t& aStaticCtx); | 33 | zorba::StaticContext_t& aStaticCtx); |
110 | 34 | 34 | ||
111 | 35 | void | ||
112 | 36 | tokenizePath(const std::string& aPathStr, std::vector<String>& aResult); | ||
113 | 37 | |||
114 | 38 | |||
115 | 39 | String | ||
116 | 40 | concatenatePaths( const std::vector<String>& aPathList); | ||
117 | 35 | 41 | ||
118 | 36 | } | 42 | } |
119 | 37 | } /* namespace zorba */ | 43 | } /* namespace zorba */ |
120 | 38 | 44 | ||
121 | === modified file 'bin/zorbacmd.cpp' | |||
122 | --- bin/zorbacmd.cpp 2012-03-14 15:28:15 +0000 | |||
123 | +++ bin/zorbacmd.cpp 2012-03-19 16:17:13 +0000 | |||
124 | @@ -787,6 +787,14 @@ | |||
125 | 787 | return 3; | 787 | return 3; |
126 | 788 | } | 788 | } |
127 | 789 | 789 | ||
128 | 790 | // Add command line --classpath option in front of config/env CLASSPATH | ||
129 | 791 | Properties* globalProperties = Properties::instance(); | ||
130 | 792 | std::string cmdJvmClassPath; | ||
131 | 793 | lProperties.getJVMClassPath(cmdJvmClassPath); | ||
132 | 794 | std::string configJvmClassPath; | ||
133 | 795 | globalProperties->getJVMClassPath(configJvmClassPath); | ||
134 | 796 | globalProperties->setJVMClassPath(cmdJvmClassPath + | ||
135 | 797 | filesystem_path::get_path_separator() + configJvmClassPath); | ||
136 | 790 | 798 | ||
137 | 791 | // Start the engine | 799 | // Start the engine |
138 | 792 | 800 | ||
139 | 793 | 801 | ||
140 | === modified file 'bin/zorbacmdproperties.cpp' | |||
141 | --- bin/zorbacmdproperties.cpp 2012-01-11 15:56:57 +0000 | |||
142 | +++ bin/zorbacmdproperties.cpp 2012-03-19 16:17:13 +0000 | |||
143 | @@ -181,6 +181,11 @@ | |||
144 | 181 | aPath = theLibPath; | 181 | aPath = theLibPath; |
145 | 182 | } | 182 | } |
146 | 183 | 183 | ||
147 | 184 | void ZorbaCMDProperties::getJVMClassPath(std::string& aPath) const | ||
148 | 185 | { | ||
149 | 186 | aPath = theClasspath; | ||
150 | 187 | } | ||
151 | 188 | |||
152 | 184 | std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const | 189 | std::vector<std::pair<std::string,std::string> > ZorbaCMDProperties::getSerializerParameters() const |
153 | 185 | { | 190 | { |
154 | 186 | std::vector<std::pair<std::string,std::string> > lResult; | 191 | std::vector<std::pair<std::string,std::string> > lResult; |
155 | 187 | 192 | ||
156 | === modified file 'bin/zorbacmdproperties.h' | |||
157 | --- bin/zorbacmdproperties.h 2012-01-11 15:56:57 +0000 | |||
158 | +++ bin/zorbacmdproperties.h 2012-03-19 16:17:13 +0000 | |||
159 | @@ -92,6 +92,9 @@ | |||
160 | 92 | void | 92 | void |
161 | 93 | getLibPath(std::string&) const; | 93 | getLibPath(std::string&) const; |
162 | 94 | 94 | ||
163 | 95 | void | ||
164 | 96 | getJVMClassPath(std::string&) const; | ||
165 | 97 | |||
166 | 95 | bool isDebug(){ return theDebug; } | 98 | bool isDebug(){ return theDebug; } |
167 | 96 | 99 | ||
168 | 97 | bool hasNoLogo(){ return theNoLogo; } | 100 | bool hasNoLogo(){ return theNoLogo; } |
169 | 98 | 101 | ||
170 | === modified file 'bin/zorbacmdproperties.txt' | |||
171 | --- bin/zorbacmdproperties.txt 2012-02-29 11:10:30 +0000 | |||
172 | +++ bin/zorbacmdproperties.txt 2012-03-19 16:17:13 +0000 | |||
173 | @@ -31,6 +31,7 @@ | |||
174 | 31 | ("uri-path", po::value<std::string>(), "URI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.") | 31 | ("uri-path", po::value<std::string>(), "URI path (list of directories) added to the built-in URI resolver, i.e. where to find modules/schemas to import.") |
175 | 32 | ("lib-path", po::value<std::string>(), "Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.") | 32 | ("lib-path", po::value<std::string>(), "Library path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.") |
176 | 33 | ("module-path", po::value<std::string>(), "Path (list of directories) to add to both the URI and Library paths.") | 33 | ("module-path", po::value<std::string>(), "Path (list of directories) to add to both the URI and Library paths.") |
177 | 34 | ("classpath", po::value<std::string>(), "JVM classpath to be used by modules using Java implementations") | ||
178 | 34 | ("option", po::value<std::vector<std::string> >(), "Set an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value"). | 35 | ("option", po::value<std::vector<std::string> >(), "Set an XQuery option in the static context. The QName of the option is passed as a string in the notation by James Clark (i.e. {namespace}localname). For example, --option {http://www.zorba-xquery.com}option=value"). |
179 | 35 | ("trailing-nl", "Output a trailing newline after the result of the query.") | 36 | ("trailing-nl", "Output a trailing newline after the result of the query.") |
180 | 36 | ("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.") | 37 | ("stop-words", po::value<std::vector<std::string> >(), "Mapping specifying a stop-words URI to another.") |
181 | 37 | 38 | ||
182 | === modified file 'bin/zorbacmdproperties_base.h' | |||
183 | --- bin/zorbacmdproperties_base.h 2012-02-29 11:10:30 +0000 | |||
184 | +++ bin/zorbacmdproperties_base.h 2012-03-19 16:17:13 +0000 | |||
185 | @@ -15,13 +15,6 @@ | |||
186 | 15 | */ | 15 | */ |
187 | 16 | /* vim:set et sw=2 ts=2: */ | 16 | /* vim:set et sw=2 ts=2: */ |
188 | 17 | 17 | ||
189 | 18 | // ****************************************** | ||
190 | 19 | // * * | ||
191 | 20 | // * THIS IS A GENERATED FILE. DO NOT EDIT! * | ||
192 | 21 | // * SEE .txt FILE WITH SAME NAME * | ||
193 | 22 | // * * | ||
194 | 23 | // ****************************************** | ||
195 | 24 | |||
196 | 25 | #include <string> | 18 | #include <string> |
197 | 26 | #include <sstream> | 19 | #include <sstream> |
198 | 27 | #include <zorba/config.h> | 20 | #include <zorba/config.h> |
199 | @@ -30,13 +23,29 @@ | |||
200 | 30 | 23 | ||
201 | 31 | #ifndef ZORBACMD_ZORBACMDPROPERTIESBASE | 24 | #ifndef ZORBACMD_ZORBACMDPROPERTIESBASE |
202 | 32 | #define ZORBACMD_ZORBACMDPROPERTIESBASE | 25 | #define ZORBACMD_ZORBACMDPROPERTIESBASE |
205 | 33 | namespace zorbacmd { | 26 | namespace zorbacmd |
206 | 34 | class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase { | 27 | { |
207 | 28 | |||
208 | 29 | class ZorbaCMDPropertiesBase : public ::zorba::PropertiesBase | ||
209 | 30 | { | ||
210 | 35 | protected: | 31 | protected: |
213 | 36 | const char **get_all_options () const { | 32 | const char **get_all_options () const |
214 | 37 | static const char *result [] = { "--timing", "--output-file", "--serialization-parameter", "--serialize-html", "--serialize-text", "--indent", "--print-query", "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", "--base-uri", "--boundary-space", "--default-collation", "--construction-mode", "--ordering-mode", "--multiple", "--query", "--as-files", "--external-variable", "--context-item", "--optimization-level", "--lib-module", "--parse-only", "--compile-only", "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", "--timeout", "--uri-path", "--lib-path", "--module-path", "--option", "--trailing-nl", "--stop-words", "--thesaurus", "--compile-plan", "--execute-plan", NULL }; | 33 | { |
215 | 34 | static const char *result [] = { | ||
216 | 35 | "--timing", "--output-file", "--serialization-parameter", | ||
217 | 36 | "--serialize-html", "--serialize-text", "--indent", "--print-query", | ||
218 | 37 | "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration", | ||
219 | 38 | "--base-uri", "--boundary-space", "--default-collation", | ||
220 | 39 | "--construction-mode", "--ordering-mode", "--multiple", "--query", | ||
221 | 40 | "--as-files", "--external-variable", "--context-item", | ||
222 | 41 | "--optimization-level", "--lib-module", "--parse-only", "--compile-only", | ||
223 | 42 | "--no-serializer", "--debug", "--debug-host", "--debug-port", "--no-logo", | ||
224 | 43 | "--timeout", "--uri-path", "--lib-path", "--module-path", "--classpath", | ||
225 | 44 | "--option", "--trailing-nl", "--stop-words", "--thesaurus", | ||
226 | 45 | "--compile-plan", "--execute-plan", NULL }; | ||
227 | 38 | return result; | 46 | return result; |
228 | 39 | } | 47 | } |
229 | 48 | |||
230 | 40 | bool theTiming; | 49 | bool theTiming; |
231 | 41 | std::string theOutputFile; | 50 | std::string theOutputFile; |
232 | 42 | std::vector<std::string> theSerializationParameter; | 51 | std::vector<std::string> theSerializationParameter; |
233 | @@ -70,6 +79,7 @@ | |||
234 | 70 | std::string theUriPath; | 79 | std::string theUriPath; |
235 | 71 | std::string theLibPath; | 80 | std::string theLibPath; |
236 | 72 | std::string theModulePath; | 81 | std::string theModulePath; |
237 | 82 | std::string theClasspath; | ||
238 | 73 | std::vector<std::string> theOption; | 83 | std::vector<std::string> theOption; |
239 | 74 | bool theTrailingNl; | 84 | bool theTrailingNl; |
240 | 75 | std::vector<std::string> theStopWords; | 85 | std::vector<std::string> theStopWords; |
241 | @@ -136,6 +146,7 @@ | |||
242 | 136 | const std::string &uriPath () const { return theUriPath; } | 146 | const std::string &uriPath () const { return theUriPath; } |
243 | 137 | const std::string &libPath () const { return theLibPath; } | 147 | const std::string &libPath () const { return theLibPath; } |
244 | 138 | const std::string &modulePath () const { return theModulePath; } | 148 | const std::string &modulePath () const { return theModulePath; } |
245 | 149 | const std::string &classpath () const { return theClasspath; } | ||
246 | 139 | const std::vector<std::string> &option () const { return theOption; } | 150 | const std::vector<std::string> &option () const { return theOption; } |
247 | 140 | const bool &trailingNl () const { return theTrailingNl; } | 151 | const bool &trailingNl () const { return theTrailingNl; } |
248 | 141 | const std::vector<std::string> &stopWords () const { return theStopWords; } | 152 | const std::vector<std::string> &stopWords () const { return theStopWords; } |
249 | @@ -158,12 +169,16 @@ | |||
250 | 158 | else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0) { | 169 | else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0) { |
251 | 159 | int d = 2; | 170 | int d = 2; |
252 | 160 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 171 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
254 | 161 | if (*argv == NULL) { result = "No value given for --output-file option"; break; } init_val (*argv, theOutputFile, d); | 172 | if (*argv == NULL) { result = "No value given for --output-file option"; break; } |
255 | 173 | |||
256 | 174 | init_val (*argv, theOutputFile, d); | ||
257 | 162 | } | 175 | } |
258 | 163 | else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0) { | 176 | else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0) { |
259 | 164 | int d = 2; | 177 | int d = 2; |
260 | 165 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 178 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
262 | 166 | if (*argv == NULL) { result = "No value given for --serialization-parameter option"; break; } init_val (*argv, theSerializationParameter, d); | 179 | if (*argv == NULL) { result = "No value given for --serialization-parameter option"; break; } |
263 | 180 | |||
264 | 181 | init_val (*argv, theSerializationParameter, d); | ||
265 | 167 | } | 182 | } |
266 | 168 | else if (strcmp (*argv, "--serialize-html") == 0) { | 183 | else if (strcmp (*argv, "--serialize-html") == 0) { |
267 | 169 | theSerializeHtml = true; | 184 | theSerializeHtml = true; |
268 | @@ -189,37 +204,51 @@ | |||
269 | 189 | else if (strcmp (*argv, "--base-uri") == 0) { | 204 | else if (strcmp (*argv, "--base-uri") == 0) { |
270 | 190 | int d = 2; | 205 | int d = 2; |
271 | 191 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 206 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
273 | 192 | if (*argv == NULL) { result = "No value given for --base-uri option"; break; } init_val (*argv, theBaseUri, d); | 207 | if (*argv == NULL) { result = "No value given for --base-uri option"; break; } |
274 | 208 | |||
275 | 209 | init_val (*argv, theBaseUri, d); | ||
276 | 193 | } | 210 | } |
277 | 194 | else if (strcmp (*argv, "--boundary-space") == 0) { | 211 | else if (strcmp (*argv, "--boundary-space") == 0) { |
278 | 195 | int d = 2; | 212 | int d = 2; |
279 | 196 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 213 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
281 | 197 | if (*argv == NULL) { result = "No value given for --boundary-space option"; break; } init_val (*argv, theBoundarySpace, d); | 214 | if (*argv == NULL) { result = "No value given for --boundary-space option"; break; } |
282 | 215 | |||
283 | 216 | init_val (*argv, theBoundarySpace, d); | ||
284 | 198 | } | 217 | } |
285 | 199 | else if (strcmp (*argv, "--default-collation") == 0) { | 218 | else if (strcmp (*argv, "--default-collation") == 0) { |
286 | 200 | int d = 2; | 219 | int d = 2; |
287 | 201 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 220 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
289 | 202 | if (*argv == NULL) { result = "No value given for --default-collation option"; break; } init_val (*argv, theDefaultCollation, d); | 221 | if (*argv == NULL) { result = "No value given for --default-collation option"; break; } |
290 | 222 | |||
291 | 223 | init_val (*argv, theDefaultCollation, d); | ||
292 | 203 | } | 224 | } |
293 | 204 | else if (strcmp (*argv, "--construction-mode") == 0) { | 225 | else if (strcmp (*argv, "--construction-mode") == 0) { |
294 | 205 | int d = 2; | 226 | int d = 2; |
295 | 206 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 227 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
297 | 207 | if (*argv == NULL) { result = "No value given for --construction-mode option"; break; } init_val (*argv, theConstructionMode, d); | 228 | if (*argv == NULL) { result = "No value given for --construction-mode option"; break; } |
298 | 229 | |||
299 | 230 | init_val (*argv, theConstructionMode, d); | ||
300 | 208 | } | 231 | } |
301 | 209 | else if (strcmp (*argv, "--ordering-mode") == 0) { | 232 | else if (strcmp (*argv, "--ordering-mode") == 0) { |
302 | 210 | int d = 2; | 233 | int d = 2; |
303 | 211 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 234 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
305 | 212 | if (*argv == NULL) { result = "No value given for --ordering-mode option"; break; } init_val (*argv, theOrderingMode, d); | 235 | if (*argv == NULL) { result = "No value given for --ordering-mode option"; break; } |
306 | 236 | |||
307 | 237 | init_val (*argv, theOrderingMode, d); | ||
308 | 213 | } | 238 | } |
309 | 214 | else if (strcmp (*argv, "--multiple") == 0 || strncmp (*argv, "-m", 2) == 0) { | 239 | else if (strcmp (*argv, "--multiple") == 0 || strncmp (*argv, "-m", 2) == 0) { |
310 | 215 | int d = 2; | 240 | int d = 2; |
311 | 216 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 241 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
313 | 217 | if (*argv == NULL) { result = "No value given for --multiple option"; break; } init_val (*argv, theMultiple, d); | 242 | if (*argv == NULL) { result = "No value given for --multiple option"; break; } |
314 | 243 | |||
315 | 244 | init_val (*argv, theMultiple, d); | ||
316 | 218 | } | 245 | } |
317 | 219 | else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-q", 2) == 0) { | 246 | else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-q", 2) == 0) { |
318 | 220 | int d = 2; | 247 | int d = 2; |
319 | 221 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 248 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
321 | 222 | if (*argv == NULL) { result = "No value given for --query option"; break; } init_val (*argv, theQueriesOrFiles, d); | 249 | if (*argv == NULL) { result = "No value given for --query option"; break; } |
322 | 250 | |||
323 | 251 | init_val (*argv, theQueriesOrFiles, d); | ||
324 | 223 | } | 252 | } |
325 | 224 | else if (strcmp (*argv, "--as-files") == 0 || strncmp (*argv, "-f", 2) == 0) { | 253 | else if (strcmp (*argv, "--as-files") == 0 || strncmp (*argv, "-f", 2) == 0) { |
326 | 225 | theAsFiles = true; | 254 | theAsFiles = true; |
327 | @@ -227,17 +256,23 @@ | |||
328 | 227 | else if (strcmp (*argv, "--external-variable") == 0 || strncmp (*argv, "-e", 2) == 0) { | 256 | else if (strcmp (*argv, "--external-variable") == 0 || strncmp (*argv, "-e", 2) == 0) { |
329 | 228 | int d = 2; | 257 | int d = 2; |
330 | 229 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 258 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
332 | 230 | if (*argv == NULL) { result = "No value given for --external-variable option"; break; } init_val (*argv, theExternalVariable, d); | 259 | if (*argv == NULL) { result = "No value given for --external-variable option"; break; } |
333 | 260 | |||
334 | 261 | init_val (*argv, theExternalVariable, d); | ||
335 | 231 | } | 262 | } |
336 | 232 | else if (strcmp (*argv, "--context-item") == 0) { | 263 | else if (strcmp (*argv, "--context-item") == 0) { |
337 | 233 | int d = 2; | 264 | int d = 2; |
338 | 234 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 265 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
340 | 235 | if (*argv == NULL) { result = "No value given for --context-item option"; break; } init_val (*argv, theContextItem, d); | 266 | if (*argv == NULL) { result = "No value given for --context-item option"; break; } |
341 | 267 | |||
342 | 268 | init_val (*argv, theContextItem, d); | ||
343 | 236 | } | 269 | } |
344 | 237 | else if (strcmp (*argv, "--optimization-level") == 0) { | 270 | else if (strcmp (*argv, "--optimization-level") == 0) { |
345 | 238 | int d = 2; | 271 | int d = 2; |
346 | 239 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 272 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
348 | 240 | if (*argv == NULL) { result = "No value given for --optimization-level option"; break; } init_val (*argv, theOptimizationLevel, d); | 273 | if (*argv == NULL) { result = "No value given for --optimization-level option"; break; } |
349 | 274 | |||
350 | 275 | init_val (*argv, theOptimizationLevel, d); | ||
351 | 241 | } | 276 | } |
352 | 242 | else if (strcmp (*argv, "--lib-module") == 0 || strncmp (*argv, "-l", 2) == 0) { | 277 | else if (strcmp (*argv, "--lib-module") == 0 || strncmp (*argv, "-l", 2) == 0) { |
353 | 243 | theLibModule = true; | 278 | theLibModule = true; |
354 | @@ -257,12 +292,16 @@ | |||
355 | 257 | else if (strcmp (*argv, "--debug-host") == 0 || strncmp (*argv, "-h", 2) == 0) { | 292 | else if (strcmp (*argv, "--debug-host") == 0 || strncmp (*argv, "-h", 2) == 0) { |
356 | 258 | int d = 2; | 293 | int d = 2; |
357 | 259 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 294 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
359 | 260 | if (*argv == NULL) { result = "No value given for --debug-host option"; break; } init_val (*argv, theDebugHost, d); | 295 | if (*argv == NULL) { result = "No value given for --debug-host option"; break; } |
360 | 296 | |||
361 | 297 | init_val (*argv, theDebugHost, d); | ||
362 | 261 | } | 298 | } |
363 | 262 | else if (strcmp (*argv, "--debug-port") == 0 || strncmp (*argv, "-p", 2) == 0) { | 299 | else if (strcmp (*argv, "--debug-port") == 0 || strncmp (*argv, "-p", 2) == 0) { |
364 | 263 | int d = 2; | 300 | int d = 2; |
365 | 264 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 301 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
367 | 265 | if (*argv == NULL) { result = "No value given for --debug-port option"; break; } init_val (*argv, theDebugPort, d); | 302 | if (*argv == NULL) { result = "No value given for --debug-port option"; break; } |
368 | 303 | |||
369 | 304 | init_val (*argv, theDebugPort, d); | ||
370 | 266 | } | 305 | } |
371 | 267 | else if (strcmp (*argv, "--no-logo") == 0) { | 306 | else if (strcmp (*argv, "--no-logo") == 0) { |
372 | 268 | theNoLogo = true; | 307 | theNoLogo = true; |
373 | @@ -270,27 +309,44 @@ | |||
374 | 270 | else if (strcmp (*argv, "--timeout") == 0) { | 309 | else if (strcmp (*argv, "--timeout") == 0) { |
375 | 271 | int d = 2; | 310 | int d = 2; |
376 | 272 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 311 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
378 | 273 | if (*argv == NULL) { result = "No value given for --timeout option"; break; } init_val (*argv, theTimeout, d); | 312 | if (*argv == NULL) { result = "No value given for --timeout option"; break; } |
379 | 313 | |||
380 | 314 | init_val (*argv, theTimeout, d); | ||
381 | 274 | } | 315 | } |
382 | 275 | else if (strcmp (*argv, "--uri-path") == 0) { | 316 | else if (strcmp (*argv, "--uri-path") == 0) { |
383 | 276 | int d = 2; | 317 | int d = 2; |
384 | 277 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 318 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
386 | 278 | if (*argv == NULL) { result = "No value given for --uri-path option"; break; } init_val (*argv, theUriPath, d); | 319 | if (*argv == NULL) { result = "No value given for --uri-path option"; break; } |
387 | 320 | |||
388 | 321 | init_val (*argv, theUriPath, d); | ||
389 | 279 | } | 322 | } |
390 | 280 | else if (strcmp (*argv, "--lib-path") == 0) { | 323 | else if (strcmp (*argv, "--lib-path") == 0) { |
391 | 281 | int d = 2; | 324 | int d = 2; |
392 | 282 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 325 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
394 | 283 | if (*argv == NULL) { result = "No value given for --lib-path option"; break; } init_val (*argv, theLibPath, d); | 326 | if (*argv == NULL) { result = "No value given for --lib-path option"; break; } |
395 | 327 | |||
396 | 328 | init_val (*argv, theLibPath, d); | ||
397 | 284 | } | 329 | } |
398 | 285 | else if (strcmp (*argv, "--module-path") == 0) { | 330 | else if (strcmp (*argv, "--module-path") == 0) { |
399 | 286 | int d = 2; | 331 | int d = 2; |
400 | 287 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 332 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
402 | 288 | if (*argv == NULL) { result = "No value given for --module-path option"; break; } init_val (*argv, theModulePath, d); | 333 | if (*argv == NULL) { result = "No value given for --module-path option"; break; } |
403 | 334 | |||
404 | 335 | init_val (*argv, theModulePath, d); | ||
405 | 336 | } | ||
406 | 337 | else if (strcmp (*argv, "--classpath") == 0) { | ||
407 | 338 | int d = 2; | ||
408 | 339 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | ||
409 | 340 | if (*argv == NULL) { result = "No value given for --classpath option"; break; } | ||
410 | 341 | |||
411 | 342 | init_val (*argv, theClasspath, d); | ||
412 | 289 | } | 343 | } |
413 | 290 | else if (strcmp (*argv, "--option") == 0) { | 344 | else if (strcmp (*argv, "--option") == 0) { |
414 | 291 | int d = 2; | 345 | int d = 2; |
415 | 292 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 346 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
417 | 293 | if (*argv == NULL) { result = "No value given for --option option"; break; } init_val (*argv, theOption, d); | 347 | if (*argv == NULL) { result = "No value given for --option option"; break; } |
418 | 348 | |||
419 | 349 | init_val (*argv, theOption, d); | ||
420 | 294 | } | 350 | } |
421 | 295 | else if (strcmp (*argv, "--trailing-nl") == 0) { | 351 | else if (strcmp (*argv, "--trailing-nl") == 0) { |
422 | 296 | theTrailingNl = true; | 352 | theTrailingNl = true; |
423 | @@ -298,12 +354,16 @@ | |||
424 | 298 | else if (strcmp (*argv, "--stop-words") == 0) { | 354 | else if (strcmp (*argv, "--stop-words") == 0) { |
425 | 299 | int d = 2; | 355 | int d = 2; |
426 | 300 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 356 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
428 | 301 | if (*argv == NULL) { result = "No value given for --stop-words option"; break; } init_val (*argv, theStopWords, d); | 357 | if (*argv == NULL) { result = "No value given for --stop-words option"; break; } |
429 | 358 | |||
430 | 359 | init_val (*argv, theStopWords, d); | ||
431 | 302 | } | 360 | } |
432 | 303 | else if (strcmp (*argv, "--thesaurus") == 0) { | 361 | else if (strcmp (*argv, "--thesaurus") == 0) { |
433 | 304 | int d = 2; | 362 | int d = 2; |
434 | 305 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 363 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
436 | 306 | if (*argv == NULL) { result = "No value given for --thesaurus option"; break; } init_val (*argv, theThesaurus, d); | 364 | if (*argv == NULL) { result = "No value given for --thesaurus option"; break; } |
437 | 365 | |||
438 | 366 | init_val (*argv, theThesaurus, d); | ||
439 | 307 | } | 367 | } |
440 | 308 | else if (strcmp (*argv, "--compile-plan") == 0 || strncmp (*argv, "-c", 2) == 0) { | 368 | else if (strcmp (*argv, "--compile-plan") == 0 || strncmp (*argv, "-c", 2) == 0) { |
441 | 309 | theCompilePlan = true; | 369 | theCompilePlan = true; |
442 | @@ -327,46 +387,47 @@ | |||
443 | 327 | 387 | ||
444 | 328 | const char *get_help_msg () const { | 388 | const char *get_help_msg () const { |
445 | 329 | return | 389 | return |
486 | 330 | "--timing, -t\nPrint timing information. In case of multiple queries the timing information is provided per each query. Both wallclock time and user time (which excludes I/O, network delays and other kernel waits) are shown.\n\n" | 390 | "--timing, -t\nPrint timing information. In case of multiple queries the timing information is provided per each query. Both wallclock time and user time (which excludes I/O, network delays and other kernel waits) are shown.\n\n" |
487 | 331 | "--output-file, -o\nWrite the result to the given file.\n\n" | 391 | "--output-file, -o\nWrite the result to the given file.\n\n" |
488 | 332 | "--serialization-parameter, -z\nSet serialization parameter in the form of a parameter=value pair (see http://www.w3.org/TR/xslt-xquery-serialization/#serparam, e.g.: -z method=xhtml -z doctype-system=DTD/xhtml1-strict.dtd -z indent=yes).\n\n" | 392 | "--serialization-parameter, -z\nSet serialization parameter in the form of a parameter=value pair (see http://www.w3.org/TR/xslt-xquery-serialization/#serparam, e.g.: -z method=xhtml -z doctype-system=DTD/xhtml1-strict.dtd -z indent=yes).\n\n" |
489 | 333 | "--serialize-html\nSerialize the result as HTML.\n\n" | 393 | "--serialize-html\nSerialize the result as HTML.\n\n" |
490 | 334 | "--serialize-text\nSerialize the result as Text.\n\n" | 394 | "--serialize-text\nSerialize the result as Text.\n\n" |
491 | 335 | "--indent, -i\nIndent output.\n\n" | 395 | "--indent, -i\nIndent output.\n\n" |
492 | 336 | "--print-query\nPrint the queries.\n\n" | 396 | "--print-query\nPrint the queries.\n\n" |
493 | 337 | "--print-errors-as-xml, -x\nPrint the errors as XML.\n\n" | 397 | "--print-errors-as-xml, -x\nPrint the errors as XML.\n\n" |
494 | 338 | "--byte-order-mark\nSet the byte-order-mark for the serializer.\n\n" | 398 | "--byte-order-mark\nSet the byte-order-mark for the serializer.\n\n" |
495 | 339 | "--omit-xml-declaration, -r\nOmit the XML declaration from the result.\n\n" | 399 | "--omit-xml-declaration, -r\nOmit the XML declaration from the result.\n\n" |
496 | 340 | "--base-uri\nSet the base URI property of the static context.\n\n" | 400 | "--base-uri\nSet the base URI property of the static context.\n\n" |
497 | 341 | "--boundary-space\nSet the boundary-space policy ('strip' or 'preserve') in the static context.\n\n" | 401 | "--boundary-space\nSet the boundary-space policy ('strip' or 'preserve') in the static context.\n\n" |
498 | 342 | "--default-collation\nAdd the given collation and set the value of the default collation in the static context to the given collation.\n\n" | 402 | "--default-collation\nAdd the given collation and set the value of the default collation in the static context to the given collation.\n\n" |
499 | 343 | "--construction-mode\nSet the construction mode ('strip' or 'preserve') in the static context.\n\n" | 403 | "--construction-mode\nSet the construction mode ('strip' or 'preserve') in the static context.\n\n" |
500 | 344 | "--ordering-mode\nSet the ordering mode ('ordered' or 'unordered') in the static context.\n\n" | 404 | "--ordering-mode\nSet the ordering mode ('ordered' or 'unordered') in the static context.\n\n" |
501 | 345 | "--multiple, -m\nExecute the given queries multiple times.\n\n" | 405 | "--multiple, -m\nExecute the given queries multiple times.\n\n" |
502 | 346 | "--query, -q\nQuery test or file URI (file://...)\n\n" | 406 | "--query, -q\nQuery test or file URI (file://...)\n\n" |
503 | 347 | "--as-files, -f\nTreat all -q arguments as file paths instead of URIs or inline queries.\n\n" | 407 | "--as-files, -f\nTreat all -q arguments as file paths instead of URIs or inline queries.\n\n" |
504 | 348 | "--external-variable, -e\nProvide the value for a variable given a file (name=file) or a value (name:=value)\n\n" | 408 | "--external-variable, -e\nProvide the value for a variable given a file (name=file) or a value (name:=value)\n\n" |
505 | 349 | "--context-item\nSet the context item to the XML document in a given file.\n\n" | 409 | "--context-item\nSet the context item to the XML document in a given file.\n\n" |
506 | 350 | "--optimization-level\nOptimization level for the query compiler (O0, O1 or O2 - default: O1)\n\n" | 410 | "--optimization-level\nOptimization level for the query compiler (O0, O1 or O2 - default: O1)\n\n" |
507 | 351 | "--lib-module, -l\nQuery compiler option to treat the query as a library module. If this is set --compile-only option is also set to true.\n\n" | 411 | "--lib-module, -l\nQuery compiler option to treat the query as a library module. If this is set --compile-only option is also set to true.\n\n" |
508 | 352 | "--parse-only\nStop after parsing the query.\n\n" | 412 | "--parse-only\nStop after parsing the query.\n\n" |
509 | 353 | "--compile-only\nOnly compile (don't execute)\n\n" | 413 | "--compile-only\nOnly compile (don't execute)\n\n" |
510 | 354 | "--no-serializer\nDo not serialize (discard) result.\n\n" | 414 | "--no-serializer\nDo not serialize (discard) result.\n\n" |
511 | 355 | "--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n" | 415 | "--debug, -d\nLaunch the Zorba debugger server and connect to a DBGP-enabled debugger client.\n\n" |
512 | 356 | "--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n" | 416 | "--debug-host, -h\nThe host where the DBGP-enabled debugger client listens for connections. Defaults to: 127.0.0.1\n\n" |
513 | 357 | "--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n" | 417 | "--debug-port, -p\nThe port on which the DBGP-enabled debugger client listens for connections. Defaults to: 28028\n\n" |
514 | 358 | "--no-logo\nPrint no logo when starting.\n\n" | 418 | "--no-logo\nPrint no logo when starting.\n\n" |
515 | 359 | "--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n" | 419 | "--timeout\nSpecify a timeout in seconds. After the specified time, the execution of the query will be aborted.\n\n" |
516 | 360 | "--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" | 420 | "--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" |
517 | 361 | "--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n" | 421 | "--lib-path\nLibrary path (list of directories) where Zorba will look for dynamic libraries (e.g., module external function implementations.\n\n" |
518 | 362 | "--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n" | 422 | "--module-path\nPath (list of directories) to add to both the URI and Library paths.\n\n" |
519 | 363 | "--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" | 423 | "--classpath\nJVM classpath to be used by modules using Java implementations\n\n" |
520 | 364 | "--trailing-nl\nOutput a trailing newline after the result of the query.\n\n" | 424 | "--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" |
521 | 365 | "--stop-words\nMapping specifying a stop-words URI to another.\n\n" | 425 | "--trailing-nl\nOutput a trailing newline after the result of the query.\n\n" |
522 | 366 | "--thesaurus\nMapping specifying a thesaurus URI to another.\n\n" | 426 | "--stop-words\nMapping specifying a stop-words URI to another.\n\n" |
523 | 367 | "--compile-plan, -c\nOutput the query plan as binary.\n\n" | 427 | "--thesaurus\nMapping specifying a thesaurus URI to another.\n\n" |
524 | 368 | "--execute-plan\nTake a query plan as binary and execute it. Binary query plans can be generated using the --compile-plan option.\n\n" | 428 | "--compile-plan, -c\nOutput the query plan as binary.\n\n" |
525 | 369 | ; | 429 | "--execute-plan\nTake a query plan as binary and execute it. Binary query plans can be generated using the --compile-plan option.\n\n" |
526 | 430 | ; | ||
527 | 370 | } | 431 | } |
528 | 371 | 432 | ||
529 | 372 | static const ZorbaCMDPropertiesBase *instance () { | 433 | static const ZorbaCMDPropertiesBase *instance () { |
530 | 373 | 434 | ||
531 | === modified file 'cmake_modules/ZorbaModule.cmake' | |||
532 | --- cmake_modules/ZorbaModule.cmake 2012-02-23 16:48:01 +0000 | |||
533 | +++ cmake_modules/ZorbaModule.cmake 2012-03-19 16:17:13 +0000 | |||
534 | @@ -140,7 +140,6 @@ | |||
535 | 140 | ENDIF (NOT IS_ABSOLUTE "${MODULE_FILE}") | 140 | ENDIF (NOT IS_ABSOLUTE "${MODULE_FILE}") |
536 | 141 | GET_FILENAME_COMPONENT (module_name "${MODULE_FILE}" NAME) | 141 | GET_FILENAME_COMPONENT (module_name "${MODULE_FILE}" NAME) |
537 | 142 | 142 | ||
538 | 143 | |||
539 | 144 | MANGLE_URI (${MODULE_URI} ".xq" module_path module_filename) | 143 | MANGLE_URI (${MODULE_URI} ".xq" module_path module_filename) |
540 | 145 | 144 | ||
541 | 146 | # Compute a CMake-symbol-safe version of the target URI, for storing | 145 | # Compute a CMake-symbol-safe version of the target URI, for storing |
542 | @@ -314,7 +313,7 @@ | |||
543 | 314 | ENDIF (MODULE_VERSION) | 313 | ENDIF (MODULE_VERSION) |
544 | 315 | FOREACH (version_infix "" ${version_infixes}) | 314 | FOREACH (version_infix "" ${version_infixes}) |
545 | 316 | ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}" | 315 | ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${module_path}/${module_filename}" |
547 | 317 | "${version_infix}" "" "${MODULE_TEST_ONLY}") | 316 | "${version_infix}" "" 1 "${MODULE_TEST_ONLY}") |
548 | 318 | ENDFOREACH (version_infix) | 317 | ENDFOREACH (version_infix) |
549 | 319 | 318 | ||
550 | 320 | # Also copy the dynamic library from the location it was built. | 319 | # Also copy the dynamic library from the location it was built. |
551 | @@ -322,7 +321,7 @@ | |||
552 | 322 | GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION) | 321 | GET_TARGET_PROPERTY (lib_location "${module_lib_target}" LOCATION) |
553 | 323 | GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME) | 322 | GET_FILENAME_COMPONENT (lib_filename "${lib_location}" NAME) |
554 | 324 | ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}" | 323 | ADD_COPY_RULE ("LIB" "${lib_location}" "${module_path}/${lib_filename}" |
556 | 325 | "" "${module_lib_target}" "${MODULE_TEST_ONLY}") | 324 | "" "${module_lib_target}" 0 "${MODULE_TEST_ONLY}") |
557 | 326 | ENDIF (module_lib_target) | 325 | ENDIF (module_lib_target) |
558 | 327 | 326 | ||
559 | 328 | # Last but not least, whip up a test case that ensures the module | 327 | # Last but not least, whip up a test case that ensures the module |
560 | @@ -375,7 +374,7 @@ | |||
561 | 375 | ENDIF (NOT SCHEMA_TEST_ONLY) | 374 | ENDIF (NOT SCHEMA_TEST_ONLY) |
562 | 376 | 375 | ||
563 | 377 | ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}" | 376 | ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${schema_path}/${schema_filename}" |
565 | 378 | "" "" "${SCHEMA_TEST_ONLY}") | 377 | "" "" 1 "${SCHEMA_TEST_ONLY}") |
566 | 379 | 378 | ||
567 | 380 | ENDMACRO (DECLARE_ZORBA_SCHEMA) | 379 | ENDMACRO (DECLARE_ZORBA_SCHEMA) |
568 | 381 | 380 | ||
569 | @@ -407,25 +406,70 @@ | |||
570 | 407 | MANGLE_URI (${URI_FILE_URI} "" uri_file_path uri_file_filename) | 406 | MANGLE_URI (${URI_FILE_URI} "" uri_file_path uri_file_filename) |
571 | 408 | 407 | ||
572 | 409 | ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${uri_file_path}/${uri_file_filename}" | 408 | ADD_COPY_RULE ("URI" "${SOURCE_FILE}" "${uri_file_path}/${uri_file_filename}" |
574 | 410 | "" "" "${URI_FILE_TEST_ONLY}") | 409 | "" "" 1 "${URI_FILE_TEST_ONLY}") |
575 | 411 | 410 | ||
576 | 412 | ENDMACRO (DECLARE_ZORBA_URI_FILE) | 411 | ENDMACRO (DECLARE_ZORBA_URI_FILE) |
577 | 413 | 412 | ||
578 | 413 | |||
579 | 414 | # Inform Zorba of a .jar file that should be made available on the CLASSPATH | ||
580 | 415 | # of the JVM, should the JVM be started. QQQ more doc needed | ||
581 | 416 | # | ||
582 | 417 | # Args: FILE - path to file (must be absolute) | ||
583 | 418 | # EXTERNAL - (optional) FILE specifies a path that should be added | ||
584 | 419 | # to CLASSPATH as-is | ||
585 | 420 | # TEST_ONLY - (optional) Jar file is for testcases only and should not | ||
586 | 421 | # be installed | ||
587 | 422 | MACRO (DECLARE_ZORBA_JAR) | ||
588 | 423 | PARSE_ARGUMENTS (JAR "FILE" "" "TEST_ONLY;EXTERNAL" ${ARGN}) | ||
589 | 424 | IF (NOT JAR_FILE) | ||
590 | 425 | MESSAGE (FATAL_ERROR "'FILE' argument is required for DECLARE_ZORBA_JAR") | ||
591 | 426 | ENDIF (NOT JAR_FILE) | ||
592 | 427 | |||
593 | 428 | # Initialize classpath file and set up copy rule (once per project) | ||
594 | 429 | SET (_CP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-classpath.txt") | ||
595 | 430 | GET_PROPERTY (_known_project GLOBAL PROPERTY "${PROJECT_NAME}-jars") | ||
596 | 431 | IF (NOT _known_project) | ||
597 | 432 | FILE (REMOVE "${_CP_FILE}") | ||
598 | 433 | SET_PROPERTY (GLOBAL PROPERTY "${PROJECT_NAME}-jars" 1) | ||
599 | 434 | ADD_COPY_RULE ("LIB" "${_CP_FILE}" "jars/${PROJECT_NAME}-classpath.txt" | ||
600 | 435 | "" "" 1 "${JAR_TEST_ONLY}") | ||
601 | 436 | ENDIF (NOT _known_project) | ||
602 | 437 | |||
603 | 438 | # Iterate over all supplied jar files | ||
604 | 439 | FOREACH (_jar_file ${JAR_FILE}) | ||
605 | 440 | |||
606 | 441 | IF (JAR_EXTERNAL) | ||
607 | 442 | # Put absolute path into classpath file | ||
608 | 443 | FILE (APPEND "${_CP_FILE}" "${_jar_file}\n") | ||
609 | 444 | ELSE (JAR_EXTERNAL) | ||
610 | 445 | # Copy jar to jars/ directory and add relative path to classpath file | ||
611 | 446 | GET_FILENAME_COMPONENT (_output_filename "${_jar_file}" NAME) | ||
612 | 447 | ADD_COPY_RULE ("LIB" "${_jar_file}" "jars/${_output_filename}" "" "" | ||
613 | 448 | 1 "${JAR_TEST_ONLY}") | ||
614 | 449 | FILE (APPEND "${_CP_FILE}" "${_output_filename}\n") | ||
615 | 450 | ENDIF (JAR_EXTERNAL) | ||
616 | 451 | |||
617 | 452 | ENDFOREACH (_jar_file) | ||
618 | 453 | ENDMACRO (DECLARE_ZORBA_JAR) | ||
619 | 454 | |||
620 | 455 | |||
621 | 414 | # Utility macro for setting up a build rule to copy a file to a | 456 | # Utility macro for setting up a build rule to copy a file to a |
624 | 415 | # particular (possibly versioned) file in a shared directory if such a file has | 457 | # particular (possibly versioned) file in a shared directory if such a |
625 | 416 | # not already been output. | 458 | # file has not already been output. |
626 | 459 | # | ||
627 | 417 | # FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared | 460 | # FILE_TYPE: Either "URI" or "LIB"; will be used to determine which shared |
630 | 418 | # directory to place output in (URI_PATH or LIB_PATH). Also, "URI" files | 461 | # directory to place output in (URI_PATH or LIB_PATH). |
629 | 419 | # will have an INSTALL() directive to put them in the install image. | ||
631 | 420 | # INPUT_FILE: Absolute path to file to copy. | 462 | # INPUT_FILE: Absolute path to file to copy. |
632 | 421 | # OUTPUT_FILE: Relative path to output file (relative to URI_PATH). | 463 | # OUTPUT_FILE: Relative path to output file (relative to URI_PATH). |
633 | 422 | # VERSION_ARG: Version; may be "" for non-versioned files. | 464 | # VERSION_ARG: Version; may be "" for non-versioned files. |
634 | 423 | # DEPEND_TARGET: A CMake target name upon which the copy rule should depend; | 465 | # DEPEND_TARGET: A CMake target name upon which the copy rule should depend; |
635 | 424 | # may be "". | 466 | # may be "". |
636 | 467 | # INSTALL: If 1, an INSTALL() directive will be executed to put the | ||
637 | 468 | # file into the install image. | ||
638 | 425 | # TEST_ONLY: If 1, file is for testcases only; will be copied into | 469 | # TEST_ONLY: If 1, file is for testcases only; will be copied into |
640 | 426 | # TEST_URI_PATH/TEST_LIB_PATH and will not be installed | 470 | # TEST_URI_PATH/TEST_LIB_PATH and will not be installed. |
641 | 427 | MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG | 471 | MACRO (ADD_COPY_RULE FILE_TYPE INPUT_FILE OUTPUT_FILE VERSION_ARG |
643 | 428 | DEPEND_TARGET TEST_ONLY) | 472 | DEPEND_TARGET INSTALL TEST_ONLY) |
644 | 429 | # Choose output base directory | 473 | # Choose output base directory |
645 | 430 | IF (${TEST_ONLY} EQUAL 1) | 474 | IF (${TEST_ONLY} EQUAL 1) |
646 | 431 | SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH") | 475 | SET (_output_basedir "${CMAKE_BINARY_DIR}/TEST_${FILE_TYPE}_PATH") |
647 | @@ -470,13 +514,13 @@ | |||
648 | 470 | SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES | 514 | SET_PROPERTY (GLOBAL APPEND PROPERTY ZORBA_URI_FILES |
649 | 471 | "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}" "${_is_core}") | 515 | "${INPUT_FILE}" "${_output_file}" "${DEPEND_TARGET}" "${_is_core}") |
650 | 472 | 516 | ||
653 | 473 | # Also set up an INSTALL rule (unless TEST_ONLY or LIB). | 517 | # Also set up an INSTALL rule (unless TEST_ONLY). |
654 | 474 | IF ( (NOT "${FILE_TYPE}" STREQUAL "LIB") AND (NOT ${TEST_ONLY} EQUAL 1) ) | 518 | IF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) ) |
655 | 475 | 519 | ||
656 | 476 | IF(NOT _is_core) | 520 | IF(NOT _is_core) |
657 | 477 | STRING(REPLACE "-" "_" component_name ${PROJECT_NAME}) | 521 | STRING(REPLACE "-" "_" component_name ${PROJECT_NAME}) |
658 | 478 | INSTALL (FILES "${INPUT_FILE}" | 522 | INSTALL (FILES "${INPUT_FILE}" |
660 | 479 | DESTINATION "${ZORBA_NONCORE_URI_DIR}/${_output_path}" | 523 | DESTINATION "${ZORBA_NONCORE_${FILE_TYPE}_DIR}/${_output_path}" |
661 | 480 | RENAME "${_output_filename}" | 524 | RENAME "${_output_filename}" |
662 | 481 | COMPONENT "${component_name}") | 525 | COMPONENT "${component_name}") |
663 | 482 | 526 | ||
664 | @@ -496,11 +540,11 @@ | |||
665 | 496 | 540 | ||
666 | 497 | ELSE(NOT _is_core) | 541 | ELSE(NOT _is_core) |
667 | 498 | INSTALL (FILES "${INPUT_FILE}" | 542 | INSTALL (FILES "${INPUT_FILE}" |
669 | 499 | DESTINATION "${ZORBA_CORE_URI_DIR}/${_output_path}" | 543 | DESTINATION "${ZORBA_CORE_${FILE_TYPE}_DIR}/${_output_path}" |
670 | 500 | RENAME "${_output_filename}") | 544 | RENAME "${_output_filename}") |
671 | 501 | ENDIF(NOT _is_core) | 545 | ENDIF(NOT _is_core) |
672 | 502 | 546 | ||
674 | 503 | ENDIF ( (NOT "${FILE_TYPE}" STREQUAL "LIB") AND (NOT ${TEST_ONLY} EQUAL 1) ) | 547 | ENDIF ( (${INSTALL} EQUAL 1) AND (NOT ${TEST_ONLY} EQUAL 1) ) |
675 | 504 | ENDIF (file_found EQUAL -1) | 548 | ENDIF (file_found EQUAL -1) |
676 | 505 | ENDMACRO (ADD_COPY_RULE) | 549 | ENDMACRO (ADD_COPY_RULE) |
677 | 506 | 550 | ||
678 | 507 | 551 | ||
679 | === modified file 'include/zorba/properties_base.h' | |||
680 | --- include/zorba/properties_base.h 2012-01-11 15:56:57 +0000 | |||
681 | +++ include/zorba/properties_base.h 2012-03-19 16:17:13 +0000 | |||
682 | @@ -101,8 +101,44 @@ | |||
683 | 101 | std::vector<std::string>& val, | 101 | std::vector<std::string>& val, |
684 | 102 | unsigned delta); | 102 | unsigned delta); |
685 | 103 | 103 | ||
686 | 104 | /** | ||
687 | 105 | * \brief This class provides access to global properties. | ||
688 | 106 | * | ||
689 | 107 | * This class provides access to global properties set for Zorba in environment | ||
690 | 108 | * and configuration file. | ||
691 | 109 | * It is available using Zorba.getProperties() method. | ||
692 | 110 | * \see { Zorba::getProperties() } | ||
693 | 111 | */ | ||
694 | 112 | class ZORBA_DLL_PUBLIC PropertiesGlobal : public PropertiesBase | ||
695 | 113 | { | ||
696 | 114 | public: | ||
697 | 115 | virtual ~PropertiesGlobal() {} | ||
698 | 116 | |||
699 | 117 | /** | ||
700 | 118 | * \brief Get global JVM classpath property. | ||
701 | 119 | * | ||
702 | 120 | * Before the JVM is started this will return the classpath set by | ||
703 | 121 | * command line option, the CLASSPATH environment variable and in Zorba | ||
704 | 122 | * config file. | ||
705 | 123 | * | ||
706 | 124 | * After the JVM is started this will contain in addition the paths to jars | ||
707 | 125 | * used by modules that make use of the JVM. | ||
708 | 126 | */ | ||
709 | 127 | virtual void getJVMClassPath(std::string & jvmClasspath) {} | ||
710 | 128 | |||
711 | 129 | /** | ||
712 | 130 | * \brief Set global JVM classpath property. | ||
713 | 131 | * | ||
714 | 132 | * This method should be used to set additional JVM classpath for modules | ||
715 | 133 | * that make use of JVM. This will overide the classpath set by CLASSPATH | ||
716 | 134 | * environment variable or Zorba config file. | ||
717 | 135 | * | ||
718 | 136 | * Once the JVM is started this method doesn't have any effect. | ||
719 | 137 | */ | ||
720 | 138 | virtual void setJVMClassPath(const std::string & jvmClasspath) {} | ||
721 | 139 | }; | ||
722 | 140 | |||
723 | 104 | } | 141 | } |
724 | 105 | |||
725 | 106 | #endif // ZORBA_PROPERTIES_BASE_H | 142 | #endif // ZORBA_PROPERTIES_BASE_H |
726 | 107 | /* | 143 | /* |
727 | 108 | * Local variables: | 144 | * Local variables: |
728 | 109 | 145 | ||
729 | === modified file 'include/zorba/util/file.h' | |||
730 | --- include/zorba/util/file.h 2012-01-11 15:56:57 +0000 | |||
731 | +++ include/zorba/util/file.h 2012-03-19 16:17:13 +0000 | |||
732 | @@ -24,6 +24,7 @@ | |||
733 | 24 | #include <cstdio> | 24 | #include <cstdio> |
734 | 25 | #include <string> | 25 | #include <string> |
735 | 26 | #include <time.h> | 26 | #include <time.h> |
736 | 27 | #include <vector> | ||
737 | 27 | 28 | ||
738 | 28 | #include <zorba/config.h> | 29 | #include <zorba/config.h> |
739 | 29 | #include <zorba/file.h> | 30 | #include <zorba/file.h> |
740 | @@ -84,6 +85,7 @@ | |||
741 | 84 | void mkdir(); | 85 | void mkdir(); |
742 | 85 | void deep_mkdir(); | 86 | void deep_mkdir(); |
743 | 86 | void rmdir(bool ignore = true); | 87 | void rmdir(bool ignore = true); |
744 | 88 | void lsdir(std::vector<std::string> &list); | ||
745 | 87 | #ifndef _WIN32_WCE | 89 | #ifndef _WIN32_WCE |
746 | 88 | void chdir(); | 90 | void chdir(); |
747 | 89 | #endif | 91 | #endif |
748 | 90 | 92 | ||
749 | === modified file 'include/zorba/zorba.h' | |||
750 | --- include/zorba/zorba.h 2012-01-11 15:56:57 +0000 | |||
751 | +++ include/zorba/zorba.h 2012-03-19 16:17:13 +0000 | |||
752 | @@ -34,14 +34,18 @@ | |||
753 | 34 | #include <zorba/xquery.h> | 34 | #include <zorba/xquery.h> |
754 | 35 | #include <zorba/zorba_string.h> | 35 | #include <zorba/zorba_string.h> |
755 | 36 | #include <zorba/iterator.h> | 36 | #include <zorba/iterator.h> |
756 | 37 | #include <zorba/properties_base.h> | ||
757 | 37 | 38 | ||
758 | 38 | namespace zorba { | 39 | namespace zorba { |
759 | 39 | 40 | ||
760 | 40 | /** | 41 | /** |
761 | 41 | * The Zorba class is the single point of access to the %Zorba engine. | 42 | * The Zorba class is the single point of access to the %Zorba engine. |
762 | 42 | * There exists one instance of the Zorba class per process. | 43 | * There exists one instance of the Zorba class per process. |
765 | 43 | * It can be used to (1) create and compile queries, (2) create static contexts, | 44 | * It can be used to (1) create and compile queries, |
766 | 44 | * (3) provides access to the XmlDataManager, and (4) provides access to the ItemFactory. | 45 | * (2) create static contexts, |
767 | 46 | * (3) provides access to the XmlDataManager, | ||
768 | 47 | * (4) provides access to the ItemFactory, and | ||
769 | 48 | * (5) provides access to the PropertiesGlobal. | ||
770 | 45 | */ | 49 | */ |
771 | 46 | class ZORBA_DLL_PUBLIC Zorba | 50 | class ZORBA_DLL_PUBLIC Zorba |
772 | 47 | { | 51 | { |
773 | @@ -301,7 +305,7 @@ | |||
774 | 301 | virtual StaticContext_t | 305 | virtual StaticContext_t |
775 | 302 | createStaticContext(DiagnosticHandler* aDiagnosticHandler = 0) = 0; | 306 | createStaticContext(DiagnosticHandler* aDiagnosticHandler = 0) = 0; |
776 | 303 | 307 | ||
778 | 304 | /** \brief Gets the singelton instance of the ItemFactory. | 308 | /** \brief Gets the singleton instance of the ItemFactory. |
779 | 305 | * | 309 | * |
780 | 306 | * @return ItemFactory the singleton instance of the ItemFactory. | 310 | * @return ItemFactory the singleton instance of the ItemFactory. |
781 | 307 | */ | 311 | */ |
782 | @@ -310,18 +314,24 @@ | |||
783 | 310 | 314 | ||
784 | 311 | /** \brief Gets the singleton instance of the XmlDataManager object. | 315 | /** \brief Gets the singleton instance of the XmlDataManager object. |
785 | 312 | * | 316 | * |
787 | 313 | * @return XmlDataManager the singelton instance of the XmlDataManager. | 317 | * @return XmlDataManager the singleton instance of the XmlDataManager. |
788 | 314 | */ | 318 | */ |
789 | 315 | virtual XmlDataManager* | 319 | virtual XmlDataManager* |
790 | 316 | getXmlDataManager() = 0; | 320 | getXmlDataManager() = 0; |
791 | 317 | 321 | ||
792 | 318 | /** \brief Gets the singleton instance of Zorba's audit provider object. | 322 | /** \brief Gets the singleton instance of Zorba's audit provider object. |
793 | 319 | * | 323 | * |
795 | 320 | * @return audit::Provider the singelton instance of Zorba's audit provider. | 324 | * @return audit::Provider the singeleton instance of Zorba's audit provider. |
796 | 321 | */ | 325 | */ |
797 | 322 | virtual audit::Provider* | 326 | virtual audit::Provider* |
798 | 323 | getAuditProvider() = 0; | 327 | getAuditProvider() = 0; |
799 | 324 | 328 | ||
800 | 329 | /** \brief Gets the singleton instance of Zorba's properties object. | ||
801 | 330 | * | ||
802 | 331 | * @return zorba::Properties the singleton instance of Zorba's properties object. | ||
803 | 332 | */ | ||
804 | 333 | virtual PropertiesGlobal* getPropertiesGlobal() = 0; | ||
805 | 334 | |||
806 | 325 | }; /* class Zorba */ | 335 | }; /* class Zorba */ |
807 | 326 | 336 | ||
808 | 327 | 337 | ||
809 | 328 | 338 | ||
810 | === modified file 'src/api/staticcontextimpl.h' | |||
811 | --- src/api/staticcontextimpl.h 2012-02-29 11:10:30 +0000 | |||
812 | +++ src/api/staticcontextimpl.h 2012-03-19 16:17:13 +0000 | |||
813 | @@ -281,6 +281,7 @@ | |||
814 | 281 | virtual void | 281 | virtual void |
815 | 282 | getFullLibPath(std::vector<String>& aLibPath) const; | 282 | getFullLibPath(std::vector<String>& aLibPath) const; |
816 | 283 | 283 | ||
817 | 284 | |||
818 | 284 | protected: | 285 | protected: |
819 | 285 | String | 286 | String |
820 | 286 | createInvokeQuery(const Function_t&, size_t aArity) const; | 287 | createInvokeQuery(const Function_t&, size_t aArity) const; |
821 | 287 | 288 | ||
822 | === modified file 'src/api/zorbaimpl.cpp' | |||
823 | --- src/api/zorbaimpl.cpp 2012-01-31 19:47:57 +0000 | |||
824 | +++ src/api/zorbaimpl.cpp 2012-03-19 16:17:13 +0000 | |||
825 | @@ -35,6 +35,7 @@ | |||
826 | 35 | #include "diagnostics/xquery_diagnostics.h" | 35 | #include "diagnostics/xquery_diagnostics.h" |
827 | 36 | 36 | ||
828 | 37 | #include "system/globalenv.h" | 37 | #include "system/globalenv.h" |
829 | 38 | #include "system/properties.h" | ||
830 | 38 | 39 | ||
831 | 39 | #include "context/static_context.h" | 40 | #include "context/static_context.h" |
832 | 40 | 41 | ||
833 | @@ -269,6 +270,15 @@ | |||
834 | 269 | } | 270 | } |
835 | 270 | 271 | ||
836 | 271 | 272 | ||
837 | 273 | /******************************************************************************* | ||
838 | 274 | |||
839 | 275 | ********************************************************************************/ | ||
840 | 276 | PropertiesGlobal* ZorbaImpl::getPropertiesGlobal() | ||
841 | 277 | { | ||
842 | 278 | return Properties::instance(); | ||
843 | 279 | } | ||
844 | 280 | |||
845 | 281 | |||
846 | 272 | void ZorbaImpl::notifyError( DiagnosticHandler *eh, ZorbaException const &ze ) { | 282 | void ZorbaImpl::notifyError( DiagnosticHandler *eh, ZorbaException const &ze ) { |
847 | 273 | eh->error( ze ); | 283 | eh->error( ze ); |
848 | 274 | } | 284 | } |
849 | 275 | 285 | ||
850 | === modified file 'src/api/zorbaimpl.h' | |||
851 | --- src/api/zorbaimpl.h 2012-01-11 15:56:57 +0000 | |||
852 | +++ src/api/zorbaimpl.h 2012-03-19 16:17:13 +0000 | |||
853 | @@ -134,6 +134,8 @@ | |||
854 | 134 | 134 | ||
855 | 135 | audit::Provider* getAuditProvider(); | 135 | audit::Provider* getAuditProvider(); |
856 | 136 | 136 | ||
857 | 137 | PropertiesGlobal* getPropertiesGlobal(); | ||
858 | 138 | |||
859 | 137 | protected: | 139 | protected: |
860 | 138 | ZorbaImpl(); | 140 | ZorbaImpl(); |
861 | 139 | 141 | ||
862 | 140 | 142 | ||
863 | === modified file 'src/context/dynamic_loader.cpp' | |||
864 | --- src/context/dynamic_loader.cpp 2012-01-18 13:57:48 +0000 | |||
865 | +++ src/context/dynamic_loader.cpp 2012-03-19 16:17:13 +0000 | |||
866 | @@ -132,8 +132,15 @@ | |||
867 | 132 | ExternalModule* | 132 | ExternalModule* |
868 | 133 | DynamicLoader::loadModule(const zstring& aFile) const | 133 | DynamicLoader::loadModule(const zstring& aFile) const |
869 | 134 | { | 134 | { |
872 | 135 | // function pointer to create a module | 135 | handle_t handle; |
873 | 136 | ExternalModule* (*createModule)() = NULL; | 136 | std::map<const zstring, handle_t>::const_iterator lIter; |
874 | 137 | |||
875 | 138 | lIter = theLibraries.find(aFile); | ||
876 | 139 | if (lIter != theLibraries.end()) | ||
877 | 140 | { | ||
878 | 141 | handle = lIter->second; | ||
879 | 142 | return createModule(handle, aFile); | ||
880 | 143 | } | ||
881 | 137 | 144 | ||
882 | 138 | #ifdef WIN32 | 145 | #ifdef WIN32 |
883 | 139 | WCHAR wpath_str[1024]; | 146 | WCHAR wpath_str[1024]; |
884 | @@ -146,43 +153,51 @@ | |||
885 | 146 | 0, aFile.c_str(), -1, | 153 | 0, aFile.c_str(), -1, |
886 | 147 | wpath_str, sizeof(wpath_str)/sizeof(WCHAR)); | 154 | wpath_str, sizeof(wpath_str)/sizeof(WCHAR)); |
887 | 148 | } | 155 | } |
889 | 149 | HMODULE handle = LoadLibraryW(wpath_str); | 156 | |
890 | 157 | handle = LoadLibraryW(wpath_str); | ||
891 | 150 | if (!handle) | 158 | if (!handle) |
892 | 151 | throw ZORBA_EXCEPTION( | 159 | throw ZORBA_EXCEPTION( |
893 | 152 | zerr::ZOSE0005_DLL_LOAD_FAILED, | 160 | zerr::ZOSE0005_DLL_LOAD_FAILED, |
894 | 153 | ERROR_PARAMS( aFile, os_error::get_err_string() ) | 161 | ERROR_PARAMS( aFile, os_error::get_err_string() ) |
895 | 154 | ); | 162 | ); |
897 | 155 | 163 | #else | |
898 | 164 | handle = dlopen(aFile.c_str(), RTLD_NOW); | ||
899 | 165 | if (!handle) | ||
900 | 166 | throw ZORBA_EXCEPTION( | ||
901 | 167 | zerr::ZOSE0005_DLL_LOAD_FAILED, ERROR_PARAMS( aFile, zstring(dlerror()) ) | ||
902 | 168 | ); | ||
903 | 169 | #endif | ||
904 | 170 | |||
905 | 171 | theLibraries[aFile] = handle; | ||
906 | 172 | return createModule(handle, aFile); | ||
907 | 173 | } | ||
908 | 174 | |||
909 | 175 | |||
910 | 176 | ExternalModule* | ||
911 | 177 | DynamicLoader::createModule(handle_t handle, const zstring& aFile) const | ||
912 | 178 | { | ||
913 | 179 | // function pointer to create a module | ||
914 | 180 | ExternalModule* (*createModuleFunction)() = NULL; | ||
915 | 181 | |||
916 | 182 | #ifdef WIN32 | ||
917 | 156 | createModule = (ExternalModule* (*)())GetProcAddress(handle, "createModule"); | 183 | createModule = (ExternalModule* (*)())GetProcAddress(handle, "createModule"); |
919 | 157 | if (createModule == NULL) | 184 | if (createModuleFunction == NULL) |
920 | 158 | throw ZORBA_EXCEPTION( | 185 | throw ZORBA_EXCEPTION( |
921 | 159 | zerr::ZAPI0015_CREATEMODULE_NOT_FOUND, | 186 | zerr::ZAPI0015_CREATEMODULE_NOT_FOUND, |
922 | 160 | ERROR_PARAMS( aFile, os_error::get_err_string() ) | 187 | ERROR_PARAMS( aFile, os_error::get_err_string() ) |
923 | 161 | ); | 188 | ); |
924 | 162 | |||
925 | 163 | #else | 189 | #else |
934 | 164 | void* handle = dlopen(aFile.c_str(), RTLD_NOW); | 190 | createModuleFunction = (ExternalModule* (*)()) dlsym(handle, "createModule"); |
935 | 165 | if (!handle) | 191 | if (createModuleFunction == NULL) |
928 | 166 | throw ZORBA_EXCEPTION( | ||
929 | 167 | zerr::ZOSE0005_DLL_LOAD_FAILED, ERROR_PARAMS( aFile, zstring(dlerror()) ) | ||
930 | 168 | ); | ||
931 | 169 | |||
932 | 170 | createModule = (ExternalModule* (*)()) dlsym(handle, "createModule"); | ||
933 | 171 | if (createModule == NULL) | ||
936 | 172 | { | 192 | { |
937 | 173 | dlclose(handle); | 193 | dlclose(handle); |
938 | 174 | throw ZORBA_EXCEPTION( | 194 | throw ZORBA_EXCEPTION( |
942 | 175 | zerr::ZAPI0015_CREATEMODULE_NOT_FOUND, | 195 | zerr::ZAPI0015_CREATEMODULE_NOT_FOUND, |
943 | 176 | ERROR_PARAMS( aFile, dlerror() ) | 196 | ERROR_PARAMS( aFile, dlerror() ) |
944 | 177 | ); | 197 | ); |
945 | 178 | } | 198 | } |
946 | 179 | #endif | 199 | #endif |
953 | 180 | if (theLibraries.find(handle) == theLibraries.end()) | 200 | return createModuleFunction(); |
948 | 181 | { | ||
949 | 182 | theLibraries.insert(handle); | ||
950 | 183 | } | ||
951 | 184 | |||
952 | 185 | return createModule(); | ||
954 | 186 | } | 201 | } |
955 | 187 | 202 | ||
956 | 188 | 203 | ||
957 | @@ -193,13 +208,13 @@ | |||
958 | 193 | 208 | ||
959 | 194 | DynamicLoader::~DynamicLoader() | 209 | DynamicLoader::~DynamicLoader() |
960 | 195 | { | 210 | { |
962 | 196 | for (LibrarySet_t::const_iterator lIter = theLibraries.begin(); | 211 | for (LibraryMap_t::const_iterator lIter = theLibraries.begin(); |
963 | 197 | lIter != theLibraries.end(); ++lIter) | 212 | lIter != theLibraries.end(); ++lIter) |
964 | 198 | { | 213 | { |
965 | 199 | #ifdef WIN32 | 214 | #ifdef WIN32 |
967 | 200 | FreeLibrary(*lIter); | 215 | FreeLibrary(lIter->second); |
968 | 201 | #else | 216 | #else |
970 | 202 | dlclose(*lIter); | 217 | dlclose(lIter->second); |
971 | 203 | #endif | 218 | #endif |
972 | 204 | } | 219 | } |
973 | 205 | } | 220 | } |
974 | 206 | 221 | ||
975 | === modified file 'src/context/dynamic_loader.h' | |||
976 | --- src/context/dynamic_loader.h 2012-01-11 15:56:57 +0000 | |||
977 | +++ src/context/dynamic_loader.h 2012-03-19 16:17:13 +0000 | |||
978 | @@ -18,7 +18,7 @@ | |||
979 | 18 | #define ZORBA_DYNAMIC_LOADER_H | 18 | #define ZORBA_DYNAMIC_LOADER_H |
980 | 19 | 19 | ||
981 | 20 | #include "common/common.h" | 20 | #include "common/common.h" |
983 | 21 | #include <set> | 21 | #include <map> |
984 | 22 | #include "common/shared_types.h" | 22 | #include "common/shared_types.h" |
985 | 23 | 23 | ||
986 | 24 | namespace zorba { | 24 | namespace zorba { |
987 | @@ -40,15 +40,20 @@ | |||
988 | 40 | 40 | ||
989 | 41 | ~DynamicLoader(); | 41 | ~DynamicLoader(); |
990 | 42 | 42 | ||
991 | 43 | ExternalModule* loadModule(const zstring& aFile) const; | ||
992 | 44 | 43 | ||
993 | 45 | #ifdef WIN32 | 44 | #ifdef WIN32 |
995 | 46 | typedef std::set<HMODULE> LibrarySet_t; | 45 | typedef HMODULE handle_t; |
996 | 47 | #else | 46 | #else |
998 | 48 | typedef std::set<void*> LibrarySet_t; | 47 | typedef void * handle_t; |
999 | 49 | #endif | 48 | #endif |
1000 | 50 | 49 | ||
1002 | 51 | mutable LibrarySet_t theLibraries; | 50 | ExternalModule* loadModule(const zstring& aFile) const; |
1003 | 51 | ExternalModule* createModule(handle_t handle, const zstring& aFile) const; | ||
1004 | 52 | |||
1005 | 53 | |||
1006 | 54 | typedef std::map<const zstring, handle_t> LibraryMap_t; | ||
1007 | 55 | |||
1008 | 56 | mutable LibraryMap_t theLibraries; | ||
1009 | 52 | }; | 57 | }; |
1010 | 53 | 58 | ||
1011 | 54 | } /* namespace zorba */ | 59 | } /* namespace zorba */ |
1012 | 55 | 60 | ||
1013 | === modified file 'src/context/static_context.cpp' | |||
1014 | --- src/context/static_context.cpp 2012-03-15 15:27:46 +0000 | |||
1015 | +++ src/context/static_context.cpp 2012-03-19 16:17:13 +0000 | |||
1016 | @@ -1699,6 +1699,43 @@ | |||
1017 | 1699 | } | 1699 | } |
1018 | 1700 | 1700 | ||
1019 | 1701 | 1701 | ||
1020 | 1702 | //////////////////////////////////////////////////////////////////////////////// | ||
1021 | 1703 | // // | ||
1022 | 1704 | // JVM Classpath // | ||
1023 | 1705 | // // | ||
1024 | 1706 | //////////////////////////////////////////////////////////////////////////////// | ||
1025 | 1707 | |||
1026 | 1708 | /******************************************************************************* | ||
1027 | 1709 | |||
1028 | 1710 | ********************************************************************************/ | ||
1029 | 1711 | void static_context::set_jvm_class_path(const std::vector<zstring>& path) | ||
1030 | 1712 | { | ||
1031 | 1713 | theJVMClassPath = path; | ||
1032 | 1714 | } | ||
1033 | 1715 | |||
1034 | 1716 | |||
1035 | 1717 | /******************************************************************************* | ||
1036 | 1718 | |||
1037 | 1719 | ********************************************************************************/ | ||
1038 | 1720 | void static_context::get_jvm_class_path(std::vector<zstring>& path) const | ||
1039 | 1721 | { | ||
1040 | 1722 | path.insert(path.end(), theJVMClassPath.begin(), theJVMClassPath.end()); | ||
1041 | 1723 | } | ||
1042 | 1724 | |||
1043 | 1725 | /******************************************************************************* | ||
1044 | 1726 | |||
1045 | 1727 | ********************************************************************************/ | ||
1046 | 1728 | void static_context::get_full_jvm_class_path(std::vector<zstring>& path) const | ||
1047 | 1729 | { | ||
1048 | 1730 | if (theParent != NULL) | ||
1049 | 1731 | { | ||
1050 | 1732 | theParent->get_full_jvm_class_path(path); | ||
1051 | 1733 | } | ||
1052 | 1734 | |||
1053 | 1735 | get_jvm_class_path(path); | ||
1054 | 1736 | } | ||
1055 | 1737 | |||
1056 | 1738 | |||
1057 | 1702 | ///////////////////////////////////////////////////////////////////////////////// | 1739 | ///////////////////////////////////////////////////////////////////////////////// |
1058 | 1703 | // // | 1740 | // // |
1059 | 1704 | // Validating Items // | 1741 | // Validating Items // |
1060 | 1705 | 1742 | ||
1061 | === modified file 'src/context/static_context.h' | |||
1062 | --- src/context/static_context.h 2012-03-14 15:28:15 +0000 | |||
1063 | +++ src/context/static_context.h 2012-03-19 16:17:13 +0000 | |||
1064 | @@ -510,6 +510,8 @@ | |||
1065 | 510 | 510 | ||
1066 | 511 | ExternalModuleMap * theExternalModulesMap; | 511 | ExternalModuleMap * theExternalModulesMap; |
1067 | 512 | 512 | ||
1068 | 513 | checked_vector<zstring> theJVMClassPath; | ||
1069 | 514 | |||
1070 | 513 | rchandle<TypeManager> theTypeManager; | 515 | rchandle<TypeManager> theTypeManager; |
1071 | 514 | 516 | ||
1072 | 515 | NamespaceBindings * theNamespaceBindings; | 517 | NamespaceBindings * theNamespaceBindings; |
1073 | @@ -713,6 +715,15 @@ | |||
1074 | 713 | void get_full_lib_path(std::vector<zstring>& oLibPath) const; | 715 | void get_full_lib_path(std::vector<zstring>& oLibPath) const; |
1075 | 714 | 716 | ||
1076 | 715 | // | 717 | // |
1077 | 718 | // JVM classpath | ||
1078 | 719 | // | ||
1079 | 720 | void set_jvm_class_path(const std::vector<zstring>& aClassPath); | ||
1080 | 721 | |||
1081 | 722 | void get_jvm_class_path(std::vector<zstring>& oClassPath) const; | ||
1082 | 723 | |||
1083 | 724 | void get_full_jvm_class_path(std::vector<zstring>& path) const; | ||
1084 | 725 | |||
1085 | 726 | // | ||
1086 | 716 | // Validating Items | 727 | // Validating Items |
1087 | 717 | // | 728 | // |
1088 | 718 | bool validate( | 729 | bool validate( |
1089 | 719 | 730 | ||
1090 | === modified file 'src/precompiled/stdafx.h' | |||
1091 | --- src/precompiled/stdafx.h 2012-03-15 15:30:19 +0000 | |||
1092 | +++ src/precompiled/stdafx.h 2012-03-19 16:17:13 +0000 | |||
1093 | @@ -80,7 +80,7 @@ | |||
1094 | 80 | // #include "compiler/expression/ft_expr.h" | 80 | // #include "compiler/expression/ft_expr.h" |
1095 | 81 | // #include "compiler/expression/ftnode.h" | 81 | // #include "compiler/expression/ftnode.h" |
1096 | 82 | // #include "compiler/parser/query_loc.h" | 82 | // #include "compiler/parser/query_loc.h" |
1098 | 83 | #include "util/cxx_util.h" | 83 | // #include "util/cxx_util.h" |
1099 | 84 | // #include "util/indent.h" | 84 | // #include "util/indent.h" |
1100 | 85 | // #include "util/stl_util.h" | 85 | // #include "util/stl_util.h" |
1101 | 86 | // #include "diagnostics/xquery_diagnostics.h" | 86 | // #include "diagnostics/xquery_diagnostics.h" |
1102 | @@ -166,7 +166,7 @@ | |||
1103 | 166 | // #include "compiler/api/compiler_api.h" | 166 | // #include "compiler/api/compiler_api.h" |
1104 | 167 | // #include "compiler/api/compiler_api_impl.h" | 167 | // #include "compiler/api/compiler_api_impl.h" |
1105 | 168 | // #include "system/globalenv.h" | 168 | // #include "system/globalenv.h" |
1107 | 169 | // #include "system/properties.h" | 169 | #include "system/properties.h" |
1108 | 170 | // #include "system/zorba_properties.h" | 170 | // #include "system/zorba_properties.h" |
1109 | 171 | // #include "context/decimal_format.h" | 171 | // #include "context/decimal_format.h" |
1110 | 172 | // #include "context/default_uri_mappers.h" | 172 | // #include "context/default_uri_mappers.h" |
1111 | @@ -182,7 +182,7 @@ | |||
1112 | 182 | // #include "context/stemmer_wrappers.h" | 182 | // #include "context/stemmer_wrappers.h" |
1113 | 183 | // #include "context/uri_resolver.h" | 183 | // #include "context/uri_resolver.h" |
1114 | 184 | // #include "context/uri_resolver_wrapper.h" | 184 | // #include "context/uri_resolver_wrapper.h" |
1116 | 185 | #include "diagnostics/assert.h" | 185 | // //#include "diagnostics/assert.h" |
1117 | 186 | // #include "diagnostics/diagnostic.h" | 186 | // #include "diagnostics/diagnostic.h" |
1118 | 187 | // #include "diagnostics/dict.h" | 187 | // #include "diagnostics/dict.h" |
1119 | 188 | // #include "diagnostics/dict_impl.h" | 188 | // #include "diagnostics/dict_impl.h" |
1120 | @@ -370,8 +370,7 @@ | |||
1121 | 370 | #include "zorba/diagnostic_handler.h" | 370 | #include "zorba/diagnostic_handler.h" |
1122 | 371 | #include "zorba/xquery_warning.h" | 371 | #include "zorba/xquery_warning.h" |
1123 | 372 | #include "runtime/full_text/ftcontains_visitor.h" | 372 | #include "runtime/full_text/ftcontains_visitor.h" |
1127 | 373 | #include "store/naive/naive_ft_token_iterator.h" | 373 | #include "store/naive/node_items.h" |
1128 | 374 | #include "store/api/ft_token_iterator.h" | 374 | |
1126 | 375 | #include "store/naive/ft_token_store.h" | ||
1129 | 376 | #endif | 375 | #endif |
1130 | 377 | /* vim:set et sw=2 ts=2: */ | 376 | /* vim:set et sw=2 ts=2: */ |
1131 | 378 | 377 | ||
1132 | === modified file 'src/system/properties.h' | |||
1133 | --- src/system/properties.h 2012-01-11 15:56:57 +0000 | |||
1134 | +++ src/system/properties.h 2012-03-19 16:17:13 +0000 | |||
1135 | @@ -67,6 +67,27 @@ | |||
1136 | 67 | 67 | ||
1137 | 68 | std::ostream& debug_out() { return *debug_stream; } | 68 | std::ostream& debug_out() { return *debug_stream; } |
1138 | 69 | 69 | ||
1139 | 70 | /** | ||
1140 | 71 | * Before the JVM is started this will return the classpath set by | ||
1141 | 72 | * command line option, the CLASSPATH environment variable and in Zorba | ||
1142 | 73 | * config file. | ||
1143 | 74 | * | ||
1144 | 75 | * After the JVM is started this will contain in addition the paths to jars | ||
1145 | 76 | * used by modules that make use of the JVM. | ||
1146 | 77 | */ | ||
1147 | 78 | void getJVMClassPath(std::string & jvmClasspath) | ||
1148 | 79 | { jvmClasspath = theCLASSPATH ; } | ||
1149 | 80 | |||
1150 | 81 | /** | ||
1151 | 82 | * This method should be used to set additional JVM classpath for modules | ||
1152 | 83 | * that make use of JVM. This will overide the classpath set by CLASSPATH | ||
1153 | 84 | * environment variable or Zorba config file. | ||
1154 | 85 | * | ||
1155 | 86 | * Once the JVM is started this method doesn't have any effect. | ||
1156 | 87 | */ | ||
1157 | 88 | void setJVMClassPath(const std::string & jvmClasspath) | ||
1158 | 89 | { theCLASSPATH = jvmClasspath; } | ||
1159 | 90 | |||
1160 | 70 | protected: | 91 | protected: |
1161 | 71 | /** | 92 | /** |
1162 | 72 | * Gets the Operation System folder where the properties of the current | 93 | * Gets the Operation System folder where the properties of the current |
1163 | 73 | 94 | ||
1164 | === modified file 'src/system/zorba_properties.h' | |||
1165 | --- src/system/zorba_properties.h 2012-02-29 11:10:30 +0000 | |||
1166 | +++ src/system/zorba_properties.h 2012-03-19 16:17:13 +0000 | |||
1167 | @@ -26,13 +26,25 @@ | |||
1168 | 26 | namespace zorba | 26 | namespace zorba |
1169 | 27 | { | 27 | { |
1170 | 28 | 28 | ||
1172 | 29 | class ZORBA_DLL_PUBLIC ZorbaProperties : public ::zorba::PropertiesBase | 29 | class ZORBA_DLL_PUBLIC ZorbaProperties : public ::zorba::PropertiesGlobal |
1173 | 30 | { | 30 | { |
1174 | 31 | protected: | 31 | protected: |
1175 | 32 | const char** get_all_options() const | 32 | const char** get_all_options() const |
1176 | 33 | { | 33 | { |
1179 | 34 | static const char* result [] = | 34 | static const char* result [] = { |
1180 | 35 | { "--trace-parsing", "--trace-scanning", "--use-serializer", "--optimizer", "--result-file", "--debug-file", "--abort", "--query", "--print-query", "--print-time", "--print-ast", "--print-xqdoc", "--print-translated", "--print-normalized", "--print-optimized", "--print-iterator-tree", "--print-item-flow", "--print-static-types", "--dump-lib", "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt", "--print-locations", "--force-gflwor", "--reorder-globals", "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting", "--infer-joins", "--no-copy-optim", "--serialize-only-query", "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug", "--compile-only", "--tz", "--external-var", "--serializer-param", "--iter-plan-test", "--dot-plan-file", "--max-udf-call-depth", NULL }; | 35 | "--trace-parsing", "--trace-scanning", "--use-serializer", "--optimizer", |
1181 | 36 | "--result-file", "--debug-file", "--abort", "--query", "--print-query", | ||
1182 | 37 | "--print-time", "--print-ast", "--print-xqdoc", "--print-translated", | ||
1183 | 38 | "--print-normalized", "--print-optimized", "--print-iterator-tree", | ||
1184 | 39 | "--print-item-flow", "--print-static-types", "--dump-lib", | ||
1185 | 40 | "--stable-iterator-ids", "--no-tree-ids", "--print-intermediate-opt", | ||
1186 | 41 | "--print-locations", "--force-gflwor", "--reorder-globals", | ||
1187 | 42 | "--specialize-num", "--specialize-cmp", "--inline-udf", "--loop-hoisting", | ||
1188 | 43 | "--infer-joins", "--no-copy-optim", "--serialize-only-query", | ||
1189 | 44 | "--trace-translator", "--trace-codegen", "--trace-fulltext", "--debug", | ||
1190 | 45 | "--compile-only", "--tz", "--external-var", "--serializer-param", | ||
1191 | 46 | "--iter-plan-test", "--dot-plan-file", "--max-udf-call-depth", | ||
1192 | 47 | "--CLASSPATH", NULL }; | ||
1193 | 36 | 48 | ||
1194 | 37 | return result; | 49 | return result; |
1195 | 38 | } | 50 | } |
1196 | @@ -80,6 +92,7 @@ | |||
1197 | 80 | bool theIterPlanTest; | 92 | bool theIterPlanTest; |
1198 | 81 | std::string theDotPlanFile; | 93 | std::string theDotPlanFile; |
1199 | 82 | uint32_t theMaxUdfCallDepth; | 94 | uint32_t theMaxUdfCallDepth; |
1200 | 95 | std::string theCLASSPATH; | ||
1201 | 83 | 96 | ||
1202 | 84 | void initialize() | 97 | void initialize() |
1203 | 85 | { | 98 | { |
1204 | @@ -165,6 +178,7 @@ | |||
1205 | 165 | const bool &iterPlanTest () const { return theIterPlanTest; } | 178 | const bool &iterPlanTest () const { return theIterPlanTest; } |
1206 | 166 | const std::string &dotPlanFile () const { return theDotPlanFile; } | 179 | const std::string &dotPlanFile () const { return theDotPlanFile; } |
1207 | 167 | const uint32_t &maxUdfCallDepth () const { return theMaxUdfCallDepth; } | 180 | const uint32_t &maxUdfCallDepth () const { return theMaxUdfCallDepth; } |
1208 | 181 | const std::string &CLASSPATH () const { return theCLASSPATH; } | ||
1209 | 168 | 182 | ||
1210 | 169 | std::string load_argv (int argc, const char **argv) | 183 | std::string load_argv (int argc, const char **argv) |
1211 | 170 | { | 184 | { |
1212 | @@ -200,7 +214,9 @@ | |||
1213 | 200 | else if (strcmp (*argv, "--debug-file") == 0) { | 214 | else if (strcmp (*argv, "--debug-file") == 0) { |
1214 | 201 | int d = 2; | 215 | int d = 2; |
1215 | 202 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 216 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1217 | 203 | if (*argv == NULL) { result = "No value given for --debug-file option"; break; } init_val (*argv, theDebugFile, d); | 217 | if (*argv == NULL) { result = "No value given for --debug-file option"; break; } |
1218 | 218 | |||
1219 | 219 | init_val (*argv, theDebugFile, d); | ||
1220 | 204 | } | 220 | } |
1221 | 205 | else if (strcmp (*argv, "--abort") == 0) { | 221 | else if (strcmp (*argv, "--abort") == 0) { |
1222 | 206 | theAbort = true; | 222 | theAbort = true; |
1223 | @@ -208,7 +224,9 @@ | |||
1224 | 208 | else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-e", 2) == 0) { | 224 | else if (strcmp (*argv, "--query") == 0 || strncmp (*argv, "-e", 2) == 0) { |
1225 | 209 | int d = 2; | 225 | int d = 2; |
1226 | 210 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 226 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1228 | 211 | if (*argv == NULL) { result = "No value given for --query option"; break; } init_val (*argv, theQuery, d); | 227 | if (*argv == NULL) { result = "No value given for --query option"; break; } |
1229 | 228 | |||
1230 | 229 | init_val (*argv, theQuery, d); | ||
1231 | 212 | } | 230 | } |
1232 | 213 | else if (strcmp (*argv, "--print-query") == 0 || strncmp (*argv, "-q", 2) == 0) { | 231 | else if (strcmp (*argv, "--print-query") == 0 || strncmp (*argv, "-q", 2) == 0) { |
1233 | 214 | thePrintQuery = true; | 232 | thePrintQuery = true; |
1234 | @@ -240,7 +258,9 @@ | |||
1235 | 240 | else if (strcmp (*argv, "--print-static-types") == 0) { | 258 | else if (strcmp (*argv, "--print-static-types") == 0) { |
1236 | 241 | int d = 2; | 259 | int d = 2; |
1237 | 242 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 260 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1239 | 243 | if (*argv == NULL) { result = "No value given for --print-static-types option"; break; } init_val (*argv, thePrintStaticTypes, d); | 261 | if (*argv == NULL) { result = "No value given for --print-static-types option"; break; } |
1240 | 262 | |||
1241 | 263 | init_val (*argv, thePrintStaticTypes, d); | ||
1242 | 244 | } | 264 | } |
1243 | 245 | else if (strcmp (*argv, "--dump-lib") == 0) { | 265 | else if (strcmp (*argv, "--dump-lib") == 0) { |
1244 | 246 | theDumpLib = true; | 266 | theDumpLib = true; |
1245 | @@ -263,32 +283,44 @@ | |||
1246 | 263 | else if (strcmp (*argv, "--reorder-globals") == 0) { | 283 | else if (strcmp (*argv, "--reorder-globals") == 0) { |
1247 | 264 | int d = 2; | 284 | int d = 2; |
1248 | 265 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 285 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1250 | 266 | if (*argv == NULL) { result = "No value given for --reorder-globals option"; break; } init_val (*argv, theReorderGlobals, d); | 286 | if (*argv == NULL) { result = "No value given for --reorder-globals option"; break; } |
1251 | 287 | |||
1252 | 288 | init_val (*argv, theReorderGlobals, d); | ||
1253 | 267 | } | 289 | } |
1254 | 268 | else if (strcmp (*argv, "--specialize-num") == 0) { | 290 | else if (strcmp (*argv, "--specialize-num") == 0) { |
1255 | 269 | int d = 2; | 291 | int d = 2; |
1256 | 270 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 292 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1258 | 271 | if (*argv == NULL) { result = "No value given for --specialize-num option"; break; } init_val (*argv, theSpecializeNum, d); | 293 | if (*argv == NULL) { result = "No value given for --specialize-num option"; break; } |
1259 | 294 | |||
1260 | 295 | init_val (*argv, theSpecializeNum, d); | ||
1261 | 272 | } | 296 | } |
1262 | 273 | else if (strcmp (*argv, "--specialize-cmp") == 0) { | 297 | else if (strcmp (*argv, "--specialize-cmp") == 0) { |
1263 | 274 | int d = 2; | 298 | int d = 2; |
1264 | 275 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 299 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1266 | 276 | if (*argv == NULL) { result = "No value given for --specialize-cmp option"; break; } init_val (*argv, theSpecializeCmp, d); | 300 | if (*argv == NULL) { result = "No value given for --specialize-cmp option"; break; } |
1267 | 301 | |||
1268 | 302 | init_val (*argv, theSpecializeCmp, d); | ||
1269 | 277 | } | 303 | } |
1270 | 278 | else if (strcmp (*argv, "--inline-udf") == 0) { | 304 | else if (strcmp (*argv, "--inline-udf") == 0) { |
1271 | 279 | int d = 2; | 305 | int d = 2; |
1272 | 280 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 306 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1274 | 281 | if (*argv == NULL) { result = "No value given for --inline-udf option"; break; } init_val (*argv, theInlineUdf, d); | 307 | if (*argv == NULL) { result = "No value given for --inline-udf option"; break; } |
1275 | 308 | |||
1276 | 309 | init_val (*argv, theInlineUdf, d); | ||
1277 | 282 | } | 310 | } |
1278 | 283 | else if (strcmp (*argv, "--loop-hoisting") == 0) { | 311 | else if (strcmp (*argv, "--loop-hoisting") == 0) { |
1279 | 284 | int d = 2; | 312 | int d = 2; |
1280 | 285 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 313 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1282 | 286 | if (*argv == NULL) { result = "No value given for --loop-hoisting option"; break; } init_val (*argv, theLoopHoisting, d); | 314 | if (*argv == NULL) { result = "No value given for --loop-hoisting option"; break; } |
1283 | 315 | |||
1284 | 316 | init_val (*argv, theLoopHoisting, d); | ||
1285 | 287 | } | 317 | } |
1286 | 288 | else if (strcmp (*argv, "--infer-joins") == 0) { | 318 | else if (strcmp (*argv, "--infer-joins") == 0) { |
1287 | 289 | int d = 2; | 319 | int d = 2; |
1288 | 290 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 320 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1290 | 291 | if (*argv == NULL) { result = "No value given for --infer-joins option"; break; } init_val (*argv, theInferJoins, d); | 321 | if (*argv == NULL) { result = "No value given for --infer-joins option"; break; } |
1291 | 322 | |||
1292 | 323 | init_val (*argv, theInferJoins, d); | ||
1293 | 292 | } | 324 | } |
1294 | 293 | else if (strcmp (*argv, "--no-copy-optim") == 0) | 325 | else if (strcmp (*argv, "--no-copy-optim") == 0) |
1295 | 294 | { | 326 | { |
1296 | @@ -325,17 +357,23 @@ | |||
1297 | 325 | else if (strcmp (*argv, "--tz") == 0) { | 357 | else if (strcmp (*argv, "--tz") == 0) { |
1298 | 326 | int d = 2; | 358 | int d = 2; |
1299 | 327 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 359 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1301 | 328 | if (*argv == NULL) { result = "No value given for --tz option"; break; } init_val (*argv, theTz, d); | 360 | if (*argv == NULL) { result = "No value given for --tz option"; break; } |
1302 | 361 | |||
1303 | 362 | init_val (*argv, theTz, d); | ||
1304 | 329 | } | 363 | } |
1305 | 330 | else if (strcmp (*argv, "--external-var") == 0 || strncmp (*argv, "-x", 2) == 0) { | 364 | else if (strcmp (*argv, "--external-var") == 0 || strncmp (*argv, "-x", 2) == 0) { |
1306 | 331 | int d = 2; | 365 | int d = 2; |
1307 | 332 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 366 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1309 | 333 | if (*argv == NULL) { result = "No value given for --external-var option"; break; } init_val (*argv, theExternalVar, d); | 367 | if (*argv == NULL) { result = "No value given for --external-var option"; break; } |
1310 | 368 | |||
1311 | 369 | init_val (*argv, theExternalVar, d); | ||
1312 | 334 | } | 370 | } |
1313 | 335 | else if (strcmp (*argv, "--serializer-param") == 0 || strncmp (*argv, "-z", 2) == 0) { | 371 | else if (strcmp (*argv, "--serializer-param") == 0 || strncmp (*argv, "-z", 2) == 0) { |
1314 | 336 | int d = 2; | 372 | int d = 2; |
1315 | 337 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 373 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1317 | 338 | if (*argv == NULL) { result = "No value given for --serializer-param option"; break; } init_val (*argv, theSerializerParam, d); | 374 | if (*argv == NULL) { result = "No value given for --serializer-param option"; break; } |
1318 | 375 | |||
1319 | 376 | init_val (*argv, theSerializerParam, d); | ||
1320 | 339 | } | 377 | } |
1321 | 340 | else if (strcmp (*argv, "--iter-plan-test") == 0) { | 378 | else if (strcmp (*argv, "--iter-plan-test") == 0) { |
1322 | 341 | theIterPlanTest = true; | 379 | theIterPlanTest = true; |
1323 | @@ -343,12 +381,23 @@ | |||
1324 | 343 | else if (strcmp (*argv, "--dot-plan-file") == 0) { | 381 | else if (strcmp (*argv, "--dot-plan-file") == 0) { |
1325 | 344 | int d = 2; | 382 | int d = 2; |
1326 | 345 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 383 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1328 | 346 | if (*argv == NULL) { result = "No value given for --dot-plan-file option"; break; } init_val (*argv, theDotPlanFile, d); | 384 | if (*argv == NULL) { result = "No value given for --dot-plan-file option"; break; } |
1329 | 385 | |||
1330 | 386 | init_val (*argv, theDotPlanFile, d); | ||
1331 | 347 | } | 387 | } |
1332 | 348 | else if (strcmp (*argv, "--max-udf-call-depth") == 0) { | 388 | else if (strcmp (*argv, "--max-udf-call-depth") == 0) { |
1333 | 349 | int d = 2; | 389 | int d = 2; |
1334 | 350 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | 390 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } |
1336 | 351 | if (*argv == NULL) { result = "No value given for --max-udf-call-depth option"; break; } init_val (*argv, theMaxUdfCallDepth, d); | 391 | if (*argv == NULL) { result = "No value given for --max-udf-call-depth option"; break; } |
1337 | 392 | |||
1338 | 393 | init_val (*argv, theMaxUdfCallDepth, d); | ||
1339 | 394 | } | ||
1340 | 395 | else if (strcmp (*argv, "--CLASSPATH") == 0) { | ||
1341 | 396 | int d = 2; | ||
1342 | 397 | if ((*argv) [1] == '-' || (*argv) [2] == '\0') { d = 0; ++argv; } | ||
1343 | 398 | if (*argv == NULL) { result = "No value given for --CLASSPATH option"; break; } | ||
1344 | 399 | |||
1345 | 400 | init_val (*argv, theCLASSPATH, d); | ||
1346 | 352 | } | 401 | } |
1347 | 353 | else if (strcmp (*argv, "--") == 0) { | 402 | else if (strcmp (*argv, "--") == 0) { |
1348 | 354 | copy_args (++argv); | 403 | copy_args (++argv); |
1349 | @@ -413,6 +462,7 @@ | |||
1350 | 413 | "--iter-plan-test\nrun as iterator plan test\n\n" | 462 | "--iter-plan-test\nrun as iterator plan test\n\n" |
1351 | 414 | "--dot-plan-file\ngenerate the dot iterator plan\n\n" | 463 | "--dot-plan-file\ngenerate the dot iterator plan\n\n" |
1352 | 415 | "--max-udf-call-depth\nmaximum stack depth of udf function calls\n\n" | 464 | "--max-udf-call-depth\nmaximum stack depth of udf function calls\n\n" |
1353 | 465 | "--CLASSPATH\nJVM classpath to be used by modules using Java implementations\n\n" | ||
1354 | 416 | ; | 466 | ; |
1355 | 417 | } | 467 | } |
1356 | 418 | 468 | ||
1357 | 419 | 469 | ||
1358 | === modified file 'src/system/zorba_properties.txt' | |||
1359 | --- src/system/zorba_properties.txt 2012-02-29 11:10:30 +0000 | |||
1360 | +++ src/system/zorba_properties.txt 2012-03-19 16:17:13 +0000 | |||
1361 | @@ -43,3 +43,4 @@ | |||
1362 | 43 | ("iter-plan-test", "run as iterator plan test") | 43 | ("iter-plan-test", "run as iterator plan test") |
1363 | 44 | ("dot-plan-file", po::value<std::string>(), "generate the dot iterator plan") | 44 | ("dot-plan-file", po::value<std::string>(), "generate the dot iterator plan") |
1364 | 45 | ("max-udf-call-depth", po::value<uint32_t>()->default_value(1024), "maximum stack depth of udf function calls") | 45 | ("max-udf-call-depth", po::value<uint32_t>()->default_value(1024), "maximum stack depth of udf function calls") |
1365 | 46 | ("CLASSPATH", po::value<std::string>(), "JVM classpath to be used by modules using Java implementations") | ||
1366 | 46 | \ No newline at end of file | 47 | \ No newline at end of file |
1367 | 47 | 48 | ||
1368 | === modified file 'src/util/file.cpp' | |||
1369 | --- src/util/file.cpp 2012-01-11 15:56:57 +0000 | |||
1370 | +++ src/util/file.cpp 2012-03-19 16:17:13 +0000 | |||
1371 | @@ -277,6 +277,18 @@ | |||
1372 | 277 | #endif | 277 | #endif |
1373 | 278 | } | 278 | } |
1374 | 279 | 279 | ||
1375 | 280 | void file::lsdir(std::vector<std::string> &list) { | ||
1376 | 281 | #ifdef ZORBA_WITH_FILE_ACCESS | ||
1377 | 282 | try { | ||
1378 | 283 | fs::lsdir( c_str(), list ); | ||
1379 | 284 | set_filetype( type_directory ); | ||
1380 | 285 | } | ||
1381 | 286 | catch ( fs::exception const &e ) { | ||
1382 | 287 | throw ZORBA_IO_EXCEPTION( e.function(), e.path() ); | ||
1383 | 288 | } | ||
1384 | 289 | #endif | ||
1385 | 290 | } | ||
1386 | 291 | |||
1387 | 280 | void file::deep_mkdir() { | 292 | void file::deep_mkdir() { |
1388 | 281 | #ifdef ZORBA_WITH_FILE_ACCESS | 293 | #ifdef ZORBA_WITH_FILE_ACCESS |
1389 | 282 | vector<file> files; | 294 | vector<file> files; |
1390 | 283 | 295 | ||
1391 | === modified file 'src/util/fs_util.cpp' | |||
1392 | --- src/util/fs_util.cpp 2012-01-11 15:56:57 +0000 | |||
1393 | +++ src/util/fs_util.cpp 2012-03-19 16:17:13 +0000 | |||
1394 | @@ -277,6 +277,30 @@ | |||
1395 | 277 | #endif | 277 | #endif |
1396 | 278 | } | 278 | } |
1397 | 279 | 279 | ||
1398 | 280 | void lsdir( char const *path, std::vector<std::string> &list ) | ||
1399 | 281 | { | ||
1400 | 282 | DIR *dir; | ||
1401 | 283 | struct dirent *ent; | ||
1402 | 284 | |||
1403 | 285 | dir = opendir (path); | ||
1404 | 286 | if (dir != NULL) | ||
1405 | 287 | { | ||
1406 | 288 | /* print all the files and directories within directory */ | ||
1407 | 289 | while ((ent = readdir (dir)) != NULL) | ||
1408 | 290 | { | ||
1409 | 291 | //printf ("%s\n", ent->d_name); | ||
1410 | 292 | std::string item(ent->d_name); | ||
1411 | 293 | list.push_back(item); | ||
1412 | 294 | } | ||
1413 | 295 | closedir (dir); | ||
1414 | 296 | } | ||
1415 | 297 | else | ||
1416 | 298 | { | ||
1417 | 299 | /* could not open directory */ | ||
1418 | 300 | throw fs::exception( "lsdir()", path ); | ||
1419 | 301 | } | ||
1420 | 302 | } | ||
1421 | 303 | |||
1422 | 280 | bool remove( char const *path ) { | 304 | bool remove( char const *path ) { |
1423 | 281 | #ifndef WIN32 | 305 | #ifndef WIN32 |
1424 | 282 | return ::remove( path ) == 0; | 306 | return ::remove( path ) == 0; |
1425 | 283 | 307 | ||
1426 | === modified file 'src/util/fs_util.h' | |||
1427 | --- src/util/fs_util.h 2012-01-11 15:56:57 +0000 | |||
1428 | +++ src/util/fs_util.h 2012-03-19 16:17:13 +0000 | |||
1429 | @@ -17,6 +17,14 @@ | |||
1430 | 17 | #ifndef ZORBA_FS_UTIL_H | 17 | #ifndef ZORBA_FS_UTIL_H |
1431 | 18 | #define ZORBA_FS_UTIL_H | 18 | #define ZORBA_FS_UTIL_H |
1432 | 19 | 19 | ||
1433 | 20 | #include <vector> | ||
1434 | 21 | |||
1435 | 22 | #ifdef WIN32 | ||
1436 | 23 | # include "win32/dirent.h" | ||
1437 | 24 | #else | ||
1438 | 25 | # include <dirent.h> /* for implementing lsdir */ | ||
1439 | 26 | #endif /* WIN32 */ | ||
1440 | 27 | |||
1441 | 20 | #include <zorba/config.h> | 28 | #include <zorba/config.h> |
1442 | 21 | 29 | ||
1443 | 22 | #include <stdexcept> | 30 | #include <stdexcept> |
1444 | @@ -144,6 +152,26 @@ | |||
1445 | 144 | mkdir( path.c_str() ); | 152 | mkdir( path.c_str() ); |
1446 | 145 | } | 153 | } |
1447 | 146 | 154 | ||
1448 | 155 | /** | ||
1449 | 156 | * List files in dir | ||
1450 | 157 | * | ||
1451 | 158 | * @param path The full path of the directory to list. | ||
1452 | 159 | * @throws fs::exception if the list fails. | ||
1453 | 160 | */ | ||
1454 | 161 | void lsdir( char const *path, std::vector<std::string> & list ); | ||
1455 | 162 | |||
1456 | 163 | /** | ||
1457 | 164 | * List files in dir | ||
1458 | 165 | * | ||
1459 | 166 | * @tparam PathStringType The \a path string type. | ||
1460 | 167 | * @param path The full path of the directory to list. | ||
1461 | 168 | * @throws fs::exception if the list fails. | ||
1462 | 169 | */ | ||
1463 | 170 | template<class PathStringType> inline | ||
1464 | 171 | void lsdir( PathStringType const &path, std::vector<std::string> & list ) { | ||
1465 | 172 | lsdir( path.c_str(), list ); | ||
1466 | 173 | } | ||
1467 | 174 | |||
1468 | 147 | #endif /* ZORBA_WITH_FILE_ACCESS */ | 175 | #endif /* ZORBA_WITH_FILE_ACCESS */ |
1469 | 148 | 176 | ||
1470 | 149 | ////////// File creation ////////////////////////////////////////////////////// | 177 | ////////// File creation ////////////////////////////////////////////////////// |
1471 | 150 | 178 | ||
1472 | === added file 'src/util/win32/dirent.h' | |||
1473 | --- src/util/win32/dirent.h 1970-01-01 00:00:00 +0000 | |||
1474 | +++ src/util/win32/dirent.h 2012-03-19 16:17:13 +0000 | |||
1475 | @@ -0,0 +1,372 @@ | |||
1476 | 1 | /***************************************************************************** | ||
1477 | 2 | * dirent.h - dirent API for Microsoft Visual Studio | ||
1478 | 3 | * | ||
1479 | 4 | * Copyright (C) 2006 Toni Ronkko | ||
1480 | 5 | * | ||
1481 | 6 | * Permission is hereby granted, free of charge, to any person obtaining | ||
1482 | 7 | * a copy of this software and associated documentation files (the | ||
1483 | 8 | * ``Software''), to deal in the Software without restriction, including | ||
1484 | 9 | * without limitation the rights to use, copy, modify, merge, publish, | ||
1485 | 10 | * distribute, sublicense, and/or sell copies of the Software, and to | ||
1486 | 11 | * permit persons to whom the Software is furnished to do so, subject to | ||
1487 | 12 | * the following conditions: | ||
1488 | 13 | * | ||
1489 | 14 | * The above copyright notice and this permission notice shall be included | ||
1490 | 15 | * in all copies or substantial portions of the Software. | ||
1491 | 16 | * | ||
1492 | 17 | * THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
1493 | 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
1494 | 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | ||
1495 | 20 | * IN NO EVENT SHALL TONI RONKKO BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
1496 | 21 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
1497 | 22 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
1498 | 23 | * OTHER DEALINGS IN THE SOFTWARE. | ||
1499 | 24 | * | ||
1500 | 25 | * Mar 15, 2011, Toni Ronkko | ||
1501 | 26 | * Defined FILE_ATTRIBUTE_DEVICE for MSVC 6.0. | ||
1502 | 27 | * | ||
1503 | 28 | * Aug 11, 2010, Toni Ronkko | ||
1504 | 29 | * Added d_type and d_namlen fields to dirent structure. The former is | ||
1505 | 30 | * especially useful for determining whether directory entry represents a | ||
1506 | 31 | * file or a directory. For more information, see | ||
1507 | 32 | * http://www.delorie.com/gnu/docs/glibc/libc_270.html | ||
1508 | 33 | * | ||
1509 | 34 | * Aug 11, 2010, Toni Ronkko | ||
1510 | 35 | * Improved conformance to the standards. For example, errno is now set | ||
1511 | 36 | * properly on failure and assert() is never used. Thanks to Peter Brockam | ||
1512 | 37 | * for suggestions. | ||
1513 | 38 | * | ||
1514 | 39 | * Aug 11, 2010, Toni Ronkko | ||
1515 | 40 | * Fixed a bug in rewinddir(): when using relative directory names, change | ||
1516 | 41 | * of working directory no longer causes rewinddir() to fail. | ||
1517 | 42 | * | ||
1518 | 43 | * Dec 15, 2009, John Cunningham | ||
1519 | 44 | * Added rewinddir member function | ||
1520 | 45 | * | ||
1521 | 46 | * Jan 18, 2008, Toni Ronkko | ||
1522 | 47 | * Using FindFirstFileA and WIN32_FIND_DATAA to avoid converting string | ||
1523 | 48 | * between multi-byte and unicode representations. This makes the | ||
1524 | 49 | * code simpler and also allows the code to be compiled under MingW. Thanks | ||
1525 | 50 | * to Azriel Fasten for the suggestion. | ||
1526 | 51 | * | ||
1527 | 52 | * Mar 4, 2007, Toni Ronkko | ||
1528 | 53 | * Bug fix: due to the strncpy_s() function this file only compiled in | ||
1529 | 54 | * Visual Studio 2005. Using the new string functions only when the | ||
1530 | 55 | * compiler version allows. | ||
1531 | 56 | * | ||
1532 | 57 | * Nov 2, 2006, Toni Ronkko | ||
1533 | 58 | * Major update: removed support for Watcom C, MS-DOS and Turbo C to | ||
1534 | 59 | * simplify the file, updated the code to compile cleanly on Visual | ||
1535 | 60 | * Studio 2005 with both unicode and multi-byte character strings, | ||
1536 | 61 | * removed rewinddir() as it had a bug. | ||
1537 | 62 | * | ||
1538 | 63 | * Aug 20, 2006, Toni Ronkko | ||
1539 | 64 | * Removed all remarks about MSVC 1.0, which is antiqued now. Simplified | ||
1540 | 65 | * comments by removing SGML tags. | ||
1541 | 66 | * | ||
1542 | 67 | * May 14 2002, Toni Ronkko | ||
1543 | 68 | * Embedded the function definitions directly to the header so that no | ||
1544 | 69 | * source modules need to be included in the Visual Studio project. Removed | ||
1545 | 70 | * all the dependencies to other projects so that this very header can be | ||
1546 | 71 | * used independently. | ||
1547 | 72 | * | ||
1548 | 73 | * May 28 1998, Toni Ronkko | ||
1549 | 74 | * First version. | ||
1550 | 75 | *****************************************************************************/ | ||
1551 | 76 | #ifndef DIRENT_H | ||
1552 | 77 | #define DIRENT_H | ||
1553 | 78 | |||
1554 | 79 | #define WIN32_LEAN_AND_MEAN | ||
1555 | 80 | #include <windows.h> | ||
1556 | 81 | #include <string.h> | ||
1557 | 82 | #include <stdlib.h> | ||
1558 | 83 | #include <sys/types.h> | ||
1559 | 84 | #include <sys/stat.h> | ||
1560 | 85 | #include <errno.h> | ||
1561 | 86 | |||
1562 | 87 | /* Entries missing from MSVC 6.0 */ | ||
1563 | 88 | #if !defined(FILE_ATTRIBUTE_DEVICE) | ||
1564 | 89 | # define FILE_ATTRIBUTE_DEVICE 0x40 | ||
1565 | 90 | #endif | ||
1566 | 91 | |||
1567 | 92 | /* File type and permission flags for stat() */ | ||
1568 | 93 | #if defined(_MSC_VER) && !defined(S_IREAD) | ||
1569 | 94 | # define S_IFMT _S_IFMT /* file type mask */ | ||
1570 | 95 | # define S_IFDIR _S_IFDIR /* directory */ | ||
1571 | 96 | # define S_IFCHR _S_IFCHR /* character device */ | ||
1572 | 97 | # define S_IFFIFO _S_IFFIFO /* pipe */ | ||
1573 | 98 | # define S_IFREG _S_IFREG /* regular file */ | ||
1574 | 99 | # define S_IREAD _S_IREAD /* read permission */ | ||
1575 | 100 | # define S_IWRITE _S_IWRITE /* write permission */ | ||
1576 | 101 | # define S_IEXEC _S_IEXEC /* execute permission */ | ||
1577 | 102 | #endif | ||
1578 | 103 | #define S_IFBLK 0 /* block device */ | ||
1579 | 104 | #define S_IFLNK 0 /* link */ | ||
1580 | 105 | #define S_IFSOCK 0 /* socket */ | ||
1581 | 106 | |||
1582 | 107 | #if defined(_MSC_VER) | ||
1583 | 108 | # define S_IRUSR S_IREAD /* read, user */ | ||
1584 | 109 | # define S_IWUSR S_IWRITE /* write, user */ | ||
1585 | 110 | # define S_IXUSR 0 /* execute, user */ | ||
1586 | 111 | # define S_IRGRP 0 /* read, group */ | ||
1587 | 112 | # define S_IWGRP 0 /* write, group */ | ||
1588 | 113 | # define S_IXGRP 0 /* execute, group */ | ||
1589 | 114 | # define S_IROTH 0 /* read, others */ | ||
1590 | 115 | # define S_IWOTH 0 /* write, others */ | ||
1591 | 116 | # define S_IXOTH 0 /* execute, others */ | ||
1592 | 117 | #endif | ||
1593 | 118 | |||
1594 | 119 | /* Indicates that d_type field is available in dirent structure */ | ||
1595 | 120 | #define _DIRENT_HAVE_D_TYPE | ||
1596 | 121 | |||
1597 | 122 | /* File type flags for d_type */ | ||
1598 | 123 | #define DT_UNKNOWN 0 | ||
1599 | 124 | #define DT_REG S_IFREG | ||
1600 | 125 | #define DT_DIR S_IFDIR | ||
1601 | 126 | #define DT_FIFO S_IFFIFO | ||
1602 | 127 | #define DT_SOCK S_IFSOCK | ||
1603 | 128 | #define DT_CHR S_IFCHR | ||
1604 | 129 | #define DT_BLK S_IFBLK | ||
1605 | 130 | |||
1606 | 131 | /* Macros for converting between st_mode and d_type */ | ||
1607 | 132 | #define IFTODT(mode) ((mode) & S_IFMT) | ||
1608 | 133 | #define DTTOIF(type) (type) | ||
1609 | 134 | |||
1610 | 135 | /* | ||
1611 | 136 | * File type macros. Note that block devices, sockets and links cannot be | ||
1612 | 137 | * distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are | ||
1613 | 138 | * only defined for compatibility. These macros should always return false | ||
1614 | 139 | * on Windows. | ||
1615 | 140 | */ | ||
1616 | 141 | #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFFIFO) | ||
1617 | 142 | #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) | ||
1618 | 143 | #define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) | ||
1619 | 144 | #define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) | ||
1620 | 145 | #define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) | ||
1621 | 146 | #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) | ||
1622 | 147 | #define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK) | ||
1623 | 148 | |||
1624 | 149 | #ifdef __cplusplus | ||
1625 | 150 | extern "C" { | ||
1626 | 151 | #endif | ||
1627 | 152 | |||
1628 | 153 | |||
1629 | 154 | typedef struct dirent | ||
1630 | 155 | { | ||
1631 | 156 | char d_name[MAX_PATH + 1]; /* File name */ | ||
1632 | 157 | size_t d_namlen; /* Length of name without \0 */ | ||
1633 | 158 | int d_type; /* File type */ | ||
1634 | 159 | } dirent; | ||
1635 | 160 | |||
1636 | 161 | |||
1637 | 162 | typedef struct DIR | ||
1638 | 163 | { | ||
1639 | 164 | dirent curentry; /* Current directory entry */ | ||
1640 | 165 | WIN32_FIND_DATAA find_data; /* Private file data */ | ||
1641 | 166 | int cached; /* True if data is valid */ | ||
1642 | 167 | HANDLE search_handle; /* Win32 search handle */ | ||
1643 | 168 | char patt[MAX_PATH + 3]; /* Initial directory name */ | ||
1644 | 169 | } DIR; | ||
1645 | 170 | |||
1646 | 171 | |||
1647 | 172 | /* Forward declarations */ | ||
1648 | 173 | static DIR *opendir(const char *dirname); | ||
1649 | 174 | static struct dirent *readdir(DIR *dirp); | ||
1650 | 175 | static int closedir(DIR *dirp); | ||
1651 | 176 | static void rewinddir(DIR* dirp); | ||
1652 | 177 | |||
1653 | 178 | |||
1654 | 179 | /* Use the new safe string functions introduced in Visual Studio 2005 */ | ||
1655 | 180 | #if defined(_MSC_VER) && _MSC_VER >= 1400 | ||
1656 | 181 | # define DIRENT_STRNCPY(dest,src,size) strncpy_s((dest),(size),(src),_TRUNCATE) | ||
1657 | 182 | #else | ||
1658 | 183 | # define DIRENT_STRNCPY(dest,src,size) strncpy((dest),(src),(size)) | ||
1659 | 184 | #endif | ||
1660 | 185 | |||
1661 | 186 | /* Set errno variable */ | ||
1662 | 187 | #if defined(_MSC_VER) | ||
1663 | 188 | #define DIRENT_SET_ERRNO(x) _set_errno (x) | ||
1664 | 189 | #else | ||
1665 | 190 | #define DIRENT_SET_ERRNO(x) (errno = (x)) | ||
1666 | 191 | #endif | ||
1667 | 192 | |||
1668 | 193 | |||
1669 | 194 | /***************************************************************************** | ||
1670 | 195 | * Open directory stream DIRNAME for read and return a pointer to the | ||
1671 | 196 | * internal working area that is used to retrieve individual directory | ||
1672 | 197 | * entries. | ||
1673 | 198 | */ | ||
1674 | 199 | static DIR *opendir(const char *dirname) | ||
1675 | 200 | { | ||
1676 | 201 | DIR *dirp; | ||
1677 | 202 | |||
1678 | 203 | /* ensure that the resulting search pattern will be a valid file name */ | ||
1679 | 204 | if (dirname == NULL) { | ||
1680 | 205 | DIRENT_SET_ERRNO (ENOENT); | ||
1681 | 206 | return NULL; | ||
1682 | 207 | } | ||
1683 | 208 | if (strlen (dirname) + 3 >= MAX_PATH) { | ||
1684 | 209 | DIRENT_SET_ERRNO (ENAMETOOLONG); | ||
1685 | 210 | return NULL; | ||
1686 | 211 | } | ||
1687 | 212 | |||
1688 | 213 | /* construct new DIR structure */ | ||
1689 | 214 | dirp = (DIR*) malloc (sizeof (struct DIR)); | ||
1690 | 215 | if (dirp != NULL) { | ||
1691 | 216 | int error; | ||
1692 | 217 | |||
1693 | 218 | /* | ||
1694 | 219 | * Convert relative directory name to an absolute one. This | ||
1695 | 220 | * allows rewinddir() to function correctly when the current working | ||
1696 | 221 | * directory is changed between opendir() and rewinddir(). | ||
1697 | 222 | */ | ||
1698 | 223 | if (GetFullPathNameA (dirname, MAX_PATH, dirp->patt, NULL)) { | ||
1699 | 224 | char *p; | ||
1700 | 225 | |||
1701 | 226 | /* append the search pattern "\\*\0" to the directory name */ | ||
1702 | 227 | p = strchr (dirp->patt, '\0'); | ||
1703 | 228 | if (dirp->patt < p && *(p-1) != '\\' && *(p-1) != ':') { | ||
1704 | 229 | *p++ = '\\'; | ||
1705 | 230 | } | ||
1706 | 231 | *p++ = '*'; | ||
1707 | 232 | *p = '\0'; | ||
1708 | 233 | |||
1709 | 234 | /* open directory stream and retrieve the first entry */ | ||
1710 | 235 | dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data); | ||
1711 | 236 | if (dirp->search_handle != INVALID_HANDLE_VALUE) { | ||
1712 | 237 | /* a directory entry is now waiting in memory */ | ||
1713 | 238 | dirp->cached = 1; | ||
1714 | 239 | error = 0; | ||
1715 | 240 | } else { | ||
1716 | 241 | /* search pattern is not a directory name? */ | ||
1717 | 242 | DIRENT_SET_ERRNO (ENOENT); | ||
1718 | 243 | error = 1; | ||
1719 | 244 | } | ||
1720 | 245 | } else { | ||
1721 | 246 | /* buffer too small */ | ||
1722 | 247 | DIRENT_SET_ERRNO (ENOMEM); | ||
1723 | 248 | error = 1; | ||
1724 | 249 | } | ||
1725 | 250 | |||
1726 | 251 | if (error) { | ||
1727 | 252 | free (dirp); | ||
1728 | 253 | dirp = NULL; | ||
1729 | 254 | } | ||
1730 | 255 | } | ||
1731 | 256 | |||
1732 | 257 | return dirp; | ||
1733 | 258 | } | ||
1734 | 259 | |||
1735 | 260 | |||
1736 | 261 | /***************************************************************************** | ||
1737 | 262 | * Read a directory entry, and return a pointer to a dirent structure | ||
1738 | 263 | * containing the name of the entry in d_name field. Individual directory | ||
1739 | 264 | * entries returned by this very function include regular files, | ||
1740 | 265 | * sub-directories, pseudo-directories "." and "..", but also volume labels, | ||
1741 | 266 | * hidden files and system files may be returned. | ||
1742 | 267 | */ | ||
1743 | 268 | static struct dirent *readdir(DIR *dirp) | ||
1744 | 269 | { | ||
1745 | 270 | DWORD attr; | ||
1746 | 271 | if (dirp == NULL) { | ||
1747 | 272 | /* directory stream did not open */ | ||
1748 | 273 | DIRENT_SET_ERRNO (EBADF); | ||
1749 | 274 | return NULL; | ||
1750 | 275 | } | ||
1751 | 276 | |||
1752 | 277 | /* get next directory entry */ | ||
1753 | 278 | if (dirp->cached != 0) { | ||
1754 | 279 | /* a valid directory entry already in memory */ | ||
1755 | 280 | dirp->cached = 0; | ||
1756 | 281 | } else { | ||
1757 | 282 | /* get the next directory entry from stream */ | ||
1758 | 283 | if (dirp->search_handle == INVALID_HANDLE_VALUE) { | ||
1759 | 284 | return NULL; | ||
1760 | 285 | } | ||
1761 | 286 | if (FindNextFileA (dirp->search_handle, &dirp->find_data) == FALSE) { | ||
1762 | 287 | /* the very last entry has been processed or an error occured */ | ||
1763 | 288 | FindClose (dirp->search_handle); | ||
1764 | 289 | dirp->search_handle = INVALID_HANDLE_VALUE; | ||
1765 | 290 | return NULL; | ||
1766 | 291 | } | ||
1767 | 292 | } | ||
1768 | 293 | |||
1769 | 294 | /* copy as a multibyte character string */ | ||
1770 | 295 | DIRENT_STRNCPY ( dirp->curentry.d_name, | ||
1771 | 296 | dirp->find_data.cFileName, | ||
1772 | 297 | sizeof(dirp->curentry.d_name) ); | ||
1773 | 298 | dirp->curentry.d_name[MAX_PATH] = '\0'; | ||
1774 | 299 | |||
1775 | 300 | /* compute the length of name */ | ||
1776 | 301 | dirp->curentry.d_namlen = strlen (dirp->curentry.d_name); | ||
1777 | 302 | |||
1778 | 303 | /* determine file type */ | ||
1779 | 304 | attr = dirp->find_data.dwFileAttributes; | ||
1780 | 305 | if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) { | ||
1781 | 306 | dirp->curentry.d_type = DT_CHR; | ||
1782 | 307 | } else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) { | ||
1783 | 308 | dirp->curentry.d_type = DT_DIR; | ||
1784 | 309 | } else { | ||
1785 | 310 | dirp->curentry.d_type = DT_REG; | ||
1786 | 311 | } | ||
1787 | 312 | return &dirp->curentry; | ||
1788 | 313 | } | ||
1789 | 314 | |||
1790 | 315 | |||
1791 | 316 | /***************************************************************************** | ||
1792 | 317 | * Close directory stream opened by opendir() function. Close of the | ||
1793 | 318 | * directory stream invalidates the DIR structure as well as any previously | ||
1794 | 319 | * read directory entry. | ||
1795 | 320 | */ | ||
1796 | 321 | static int closedir(DIR *dirp) | ||
1797 | 322 | { | ||
1798 | 323 | if (dirp == NULL) { | ||
1799 | 324 | /* invalid directory stream */ | ||
1800 | 325 | DIRENT_SET_ERRNO (EBADF); | ||
1801 | 326 | return -1; | ||
1802 | 327 | } | ||
1803 | 328 | |||
1804 | 329 | /* release search handle */ | ||
1805 | 330 | if (dirp->search_handle != INVALID_HANDLE_VALUE) { | ||
1806 | 331 | FindClose (dirp->search_handle); | ||
1807 | 332 | dirp->search_handle = INVALID_HANDLE_VALUE; | ||
1808 | 333 | } | ||
1809 | 334 | |||
1810 | 335 | /* release directory structure */ | ||
1811 | 336 | free (dirp); | ||
1812 | 337 | return 0; | ||
1813 | 338 | } | ||
1814 | 339 | |||
1815 | 340 | |||
1816 | 341 | /***************************************************************************** | ||
1817 | 342 | * Resets the position of the directory stream to which dirp refers to the | ||
1818 | 343 | * beginning of the directory. It also causes the directory stream to refer | ||
1819 | 344 | * to the current state of the corresponding directory, as a call to opendir() | ||
1820 | 345 | * would have done. If dirp does not refer to a directory stream, the effect | ||
1821 | 346 | * is undefined. | ||
1822 | 347 | */ | ||
1823 | 348 | static void rewinddir(DIR* dirp) | ||
1824 | 349 | { | ||
1825 | 350 | if (dirp != NULL) { | ||
1826 | 351 | /* release search handle */ | ||
1827 | 352 | if (dirp->search_handle != INVALID_HANDLE_VALUE) { | ||
1828 | 353 | FindClose (dirp->search_handle); | ||
1829 | 354 | } | ||
1830 | 355 | |||
1831 | 356 | /* open new search handle and retrieve the first entry */ | ||
1832 | 357 | dirp->search_handle = FindFirstFileA (dirp->patt, &dirp->find_data); | ||
1833 | 358 | if (dirp->search_handle != INVALID_HANDLE_VALUE) { | ||
1834 | 359 | /* a directory entry is now waiting in memory */ | ||
1835 | 360 | dirp->cached = 1; | ||
1836 | 361 | } else { | ||
1837 | 362 | /* failed to re-open directory: no directory entry in memory */ | ||
1838 | 363 | dirp->cached = 0; | ||
1839 | 364 | } | ||
1840 | 365 | } | ||
1841 | 366 | } | ||
1842 | 367 | |||
1843 | 368 | |||
1844 | 369 | #ifdef __cplusplus | ||
1845 | 370 | } | ||
1846 | 371 | #endif | ||
1847 | 372 | #endif /*DIRENT_H*/ | ||
1848 | 0 | 373 | ||
1849 | === modified file 'swig/XQuery.i' | |||
1850 | --- swig/XQuery.i 2012-01-11 15:56:57 +0000 | |||
1851 | +++ swig/XQuery.i 2012-03-19 16:17:13 +0000 | |||
1852 | @@ -14,6 +14,7 @@ | |||
1853 | 14 | * limitations under the License. | 14 | * limitations under the License. |
1854 | 15 | */ | 15 | */ |
1855 | 16 | 16 | ||
1856 | 17 | |||
1857 | 17 | %{ // start Implementation | 18 | %{ // start Implementation |
1858 | 18 | 19 | ||
1859 | 19 | class Iterator | 20 | class Iterator |
1860 | @@ -67,6 +68,40 @@ | |||
1861 | 67 | }; // class Iterator | 68 | }; // class Iterator |
1862 | 68 | 69 | ||
1863 | 69 | 70 | ||
1864 | 71 | |||
1865 | 72 | |||
1866 | 73 | |||
1867 | 74 | class IStream | ||
1868 | 75 | { | ||
1869 | 76 | private: | ||
1870 | 77 | std::istream* theIStream; | ||
1871 | 78 | |||
1872 | 79 | public: | ||
1873 | 80 | IStream() {} | ||
1874 | 81 | IStream(const IStream& anIStream) : theIStream(anIStream.theIStream) {} | ||
1875 | 82 | IStream(std::istream& anIStream) : theIStream(&anIStream) {} | ||
1876 | 83 | |||
1877 | 84 | std::string readToString() | ||
1878 | 85 | { | ||
1879 | 86 | std::stringstream lStream; | ||
1880 | 87 | |||
1881 | 88 | lStream << theIStream; | ||
1882 | 89 | return lStream.str(); | ||
1883 | 90 | } | ||
1884 | 91 | |||
1885 | 92 | |||
1886 | 93 | int read(char *BYTE, int LENGTH) | ||
1887 | 94 | { | ||
1888 | 95 | theIStream->read(BYTE, LENGTH); | ||
1889 | 96 | //theIStream->read(byteArray, len); | ||
1890 | 97 | int readLength = theIStream->gcount(); | ||
1891 | 98 | return readLength; | ||
1892 | 99 | } | ||
1893 | 100 | |||
1894 | 101 | |||
1895 | 102 | }; // class IStream | ||
1896 | 103 | |||
1897 | 104 | |||
1898 | 70 | class Item | 105 | class Item |
1899 | 71 | { | 106 | { |
1900 | 72 | friend class Iterator; | 107 | friend class Iterator; |
1901 | @@ -84,13 +119,10 @@ | |||
1902 | 84 | Item(const Item& aItem) : theItem(aItem.theItem) {} | 119 | Item(const Item& aItem) : theItem(aItem.theItem) {} |
1903 | 85 | Item(const zorba::Item& aZItem) : theItem(aZItem) {} | 120 | Item(const zorba::Item& aZItem) : theItem(aZItem) {} |
1904 | 86 | 121 | ||
1906 | 87 | static Item createEmptyItem() | 122 | static Item createEmptyItem() |
1907 | 88 | { return Item(); } | 123 | { return Item(); } |
1908 | 89 | 124 | ||
1913 | 90 | std::string getStringValue() const | 125 | std::string serialize() const |
1910 | 91 | { return std::string(theItem.getStringValue().c_str()); } | ||
1911 | 92 | |||
1912 | 93 | std::string serialize() const | ||
1914 | 94 | { | 126 | { |
1915 | 95 | std::stringstream lStream; | 127 | std::stringstream lStream; |
1916 | 96 | Zorba_SerializerOptions_t lOptions; | 128 | Zorba_SerializerOptions_t lOptions; |
1917 | @@ -100,6 +132,22 @@ | |||
1918 | 100 | return lStream.str(); | 132 | return lStream.str(); |
1919 | 101 | } | 133 | } |
1920 | 102 | 134 | ||
1921 | 135 | void serializeToOutputStream(std::ostream &outStream) const | ||
1922 | 136 | { | ||
1923 | 137 | Zorba_SerializerOptions_t lOptions; | ||
1924 | 138 | zorba::Serializer_t lSerializer = zorba::Serializer::createSerializer(lOptions); | ||
1925 | 139 | zorba::SingletonItemSequence lSequence(theItem); | ||
1926 | 140 | lSerializer->serialize(&lSequence, outStream); | ||
1927 | 141 | } | ||
1928 | 142 | |||
1929 | 143 | IStream getStream() | ||
1930 | 144 | { | ||
1931 | 145 | return IStream(theItem.getStream()); | ||
1932 | 146 | } | ||
1933 | 147 | |||
1934 | 148 | std::string getStringValue() const | ||
1935 | 149 | { return std::string(theItem.getStringValue().c_str()); } | ||
1936 | 150 | |||
1937 | 103 | Iterator getAtomizationValue () const | 151 | Iterator getAtomizationValue () const |
1938 | 104 | { return Iterator(theItem.getAtomizationValue()); } | 152 | { return Iterator(theItem.getAtomizationValue()); } |
1939 | 105 | 153 | ||
1940 | @@ -274,11 +322,15 @@ | |||
1941 | 274 | } | 322 | } |
1942 | 275 | 323 | ||
1943 | 276 | 324 | ||
1945 | 277 | %} // end Implementation | 325 | |
1946 | 326 | %} // end Implementation | ||
1947 | 327 | |||
1948 | 278 | 328 | ||
1949 | 279 | 329 | ||
1950 | 280 | // Interfaces | 330 | // Interfaces |
1951 | 281 | 331 | ||
1952 | 332 | |||
1953 | 333 | |||
1954 | 282 | class DynamicContext | 334 | class DynamicContext |
1955 | 283 | { | 335 | { |
1956 | 284 | public: | 336 | public: |
1957 | @@ -292,12 +344,25 @@ | |||
1958 | 292 | setContextItem(Item); | 344 | setContextItem(Item); |
1959 | 293 | }; | 345 | }; |
1960 | 294 | 346 | ||
1962 | 295 | class Item | 347 | |
1963 | 348 | class IStream | ||
1964 | 349 | { | ||
1965 | 350 | public: | ||
1966 | 351 | std::string readToString(); | ||
1967 | 352 | int read(char * BYTE, long LENGTH); | ||
1968 | 353 | }; // class IStream | ||
1969 | 354 | |||
1970 | 355 | |||
1971 | 356 | class Item | ||
1972 | 296 | { | 357 | { |
1973 | 297 | public: | 358 | public: |
1974 | 298 | static Item createEmptyItem(); | 359 | static Item createEmptyItem(); |
1975 | 360 | |||
1976 | 361 | std::string serialize() const; | ||
1977 | 362 | void serializeToOutputStream(std::ostream &outStream) const; | ||
1978 | 363 | IStream getStream(); | ||
1979 | 364 | |||
1980 | 299 | std::string getStringValue() const; | 365 | std::string getStringValue() const; |
1981 | 300 | std::string serialize() const; | ||
1982 | 301 | Iterator getAtomizationValue () const; | 366 | Iterator getAtomizationValue () const; |
1983 | 302 | Iterator getAttributes () const; | 367 | Iterator getAttributes () const; |
1984 | 303 | bool getBooleanValue () const; | 368 | bool getBooleanValue () const; |
1985 | @@ -319,6 +384,7 @@ | |||
1986 | 319 | bool isPosOrNegInf () const; | 384 | bool isPosOrNegInf () const; |
1987 | 320 | }; // class Item | 385 | }; // class Item |
1988 | 321 | 386 | ||
1989 | 387 | |||
1990 | 322 | class Iterator | 388 | class Iterator |
1991 | 323 | { | 389 | { |
1992 | 324 | public: | 390 | public: |
1993 | @@ -328,6 +394,7 @@ | |||
1994 | 328 | void destroy(); | 394 | void destroy(); |
1995 | 329 | }; // class Iterator | 395 | }; // class Iterator |
1996 | 330 | 396 | ||
1997 | 397 | |||
1998 | 331 | class XQuery | 398 | class XQuery |
1999 | 332 | { | 399 | { |
2000 | 333 | public: | 400 | public: |
2001 | 334 | 401 | ||
2002 | === modified file 'swig/java/CMakeLists.txt' | |||
2003 | --- swig/java/CMakeLists.txt 2012-01-11 15:56:57 +0000 | |||
2004 | +++ swig/java/CMakeLists.txt 2012-03-19 16:17:13 +0000 | |||
2005 | @@ -21,7 +21,7 @@ | |||
2006 | 21 | include (CMakeJavaInformation ) | 21 | include (CMakeJavaInformation ) |
2007 | 22 | MESSAGE(STATUS "SWIG Java: generating Java API") | 22 | MESSAGE(STATUS "SWIG Java: generating Java API") |
2008 | 23 | 23 | ||
2010 | 24 | # EXECUTE_PROCESS( COMMAND ${JAVA_RUNTIME} -version OUTPUT_VARIABLE JAVA_VERSION ) | 24 | EXECUTE_PROCESS( COMMAND ${JAVA_RUNTIME} -version OUTPUT_VARIABLE JAVA_VERSION ) |
2011 | 25 | MESSAGE(STATUS "SWIG Java: JNI found at: " ${JAVA_INCLUDE_PATH} ) | 25 | MESSAGE(STATUS "SWIG Java: JNI found at: " ${JAVA_INCLUDE_PATH} ) |
2012 | 26 | 26 | ||
2013 | 27 | SET_SOURCE_FILES_PROPERTIES( zorba_api.i PROPERTIES CPLUSPLUS ON ) | 27 | SET_SOURCE_FILES_PROPERTIES( zorba_api.i PROPERTIES CPLUSPLUS ON ) |
2014 | @@ -89,6 +89,7 @@ | |||
2015 | 89 | ENDIF(NOT WIN32) | 89 | ENDIF(NOT WIN32) |
2016 | 90 | ENDIF ( APPLE ) | 90 | ENDIF ( APPLE ) |
2017 | 91 | 91 | ||
2018 | 92 | |||
2019 | 92 | ELSE (JAVA_INCLUDE_PATH) | 93 | ELSE (JAVA_INCLUDE_PATH) |
2020 | 93 | MESSAGE ( STATUS "SWIG Java: not generating JAVA API because jni headers not found.") | 94 | MESSAGE ( STATUS "SWIG Java: not generating JAVA API because jni headers not found.") |
2021 | 94 | ENDIF (JAVA_INCLUDE_PATH) | 95 | ENDIF (JAVA_INCLUDE_PATH) |
2022 | 95 | 96 | ||
2023 | === added file 'swig/various.i' | |||
2024 | --- swig/various.i 1970-01-01 00:00:00 +0000 | |||
2025 | +++ swig/various.i 2012-03-19 16:17:13 +0000 | |||
2026 | @@ -0,0 +1,184 @@ | |||
2027 | 1 | /* This is from http://www.opensource.apple.com/source/swig/swig-6/swig/Lib/java/various.i?txt */ | ||
2028 | 2 | |||
2029 | 3 | /* ----------------------------------------------------------------------------- | ||
2030 | 4 | * See the LICENSE file for information on copyright, usage and redistribution | ||
2031 | 5 | * of SWIG, and the README file for authors - http://www.swig.org/release.html. | ||
2032 | 6 | * | ||
2033 | 7 | * various.i | ||
2034 | 8 | * | ||
2035 | 9 | * SWIG Typemap library for Java. | ||
2036 | 10 | * Various useful typemaps. | ||
2037 | 11 | * ----------------------------------------------------------------------------- */ | ||
2038 | 12 | |||
2039 | 13 | #ifdef SWIGJAVA | ||
2040 | 14 | |||
2041 | 15 | /* | ||
2042 | 16 | * char **STRING_ARRAY typemaps. | ||
2043 | 17 | * These typemaps are for C String arrays which are NULL terminated. | ||
2044 | 18 | * char *values[] = { "one", "two", "three", NULL }; // note NULL | ||
2045 | 19 | * char ** is mapped to a Java String[]. | ||
2046 | 20 | * | ||
2047 | 21 | * Example usage wrapping: | ||
2048 | 22 | * %apply char **STRING_ARRAY { char **input }; | ||
2049 | 23 | * char ** foo(char **input); | ||
2050 | 24 | * | ||
2051 | 25 | * Java usage: | ||
2052 | 26 | * String numbers[] = { "one", "two", "three" }; | ||
2053 | 27 | * String[] ret = modulename.foo( numbers }; | ||
2054 | 28 | */ | ||
2055 | 29 | %typemap(jni) char **STRING_ARRAY "jobjectArray" | ||
2056 | 30 | %typemap(jtype) char **STRING_ARRAY "String[]" | ||
2057 | 31 | %typemap(jstype) char **STRING_ARRAY "String[]" | ||
2058 | 32 | %typemap(in) char **STRING_ARRAY (jint size) { | ||
2059 | 33 | int i = 0; | ||
2060 | 34 | size = JCALL1(GetArrayLength, jenv, $input); | ||
2061 | 35 | #ifdef __cplusplus | ||
2062 | 36 | $1 = new char*[size+1]; | ||
2063 | 37 | #else | ||
2064 | 38 | $1 = (char **)calloc(size+1, sizeof(char *)); | ||
2065 | 39 | #endif | ||
2066 | 40 | for (i = 0; i<size; i++) { | ||
2067 | 41 | jstring j_string = (jstring)JCALL2(GetObjectArrayElement, jenv, $input, i); | ||
2068 | 42 | const char *c_string = JCALL2(GetStringUTFChars, jenv, j_string, 0); | ||
2069 | 43 | #ifdef __cplusplus | ||
2070 | 44 | $1[i] = new char [strlen(c_string)+1]; | ||
2071 | 45 | #else | ||
2072 | 46 | $1[i] = (char *)calloc(strlen(c_string)+1, sizeof(const char *)); | ||
2073 | 47 | #endif | ||
2074 | 48 | strcpy($1[i], c_string); | ||
2075 | 49 | JCALL2(ReleaseStringUTFChars, jenv, j_string, c_string); | ||
2076 | 50 | JCALL1(DeleteLocalRef, jenv, j_string); | ||
2077 | 51 | } | ||
2078 | 52 | $1[i] = 0; | ||
2079 | 53 | } | ||
2080 | 54 | |||
2081 | 55 | %typemap(freearg) char **STRING_ARRAY { | ||
2082 | 56 | int i; | ||
2083 | 57 | for (i=0; i<size$argnum-1; i++) | ||
2084 | 58 | #ifdef __cplusplus | ||
2085 | 59 | delete[] $1[i]; | ||
2086 | 60 | delete[] $1; | ||
2087 | 61 | #else | ||
2088 | 62 | free($1[i]); | ||
2089 | 63 | free($1); | ||
2090 | 64 | #endif | ||
2091 | 65 | } | ||
2092 | 66 | |||
2093 | 67 | %typemap(out) char **STRING_ARRAY { | ||
2094 | 68 | int i; | ||
2095 | 69 | int len=0; | ||
2096 | 70 | jstring temp_string; | ||
2097 | 71 | const jclass clazz = JCALL1(FindClass, jenv, "java/lang/String"); | ||
2098 | 72 | |||
2099 | 73 | while ($1[len]) len++; | ||
2100 | 74 | jresult = JCALL3(NewObjectArray, jenv, len, clazz, NULL); | ||
2101 | 75 | /* exception checking omitted */ | ||
2102 | 76 | |||
2103 | 77 | for (i=0; i<len; i++) { | ||
2104 | 78 | temp_string = JCALL1(NewStringUTF, jenv, *result++); | ||
2105 | 79 | JCALL3(SetObjectArrayElement, jenv, jresult, i, temp_string); | ||
2106 | 80 | JCALL1(DeleteLocalRef, jenv, temp_string); | ||
2107 | 81 | } | ||
2108 | 82 | } | ||
2109 | 83 | |||
2110 | 84 | %typemap(javain) char **STRING_ARRAY "$javainput" | ||
2111 | 85 | %typemap(javaout) char **STRING_ARRAY { | ||
2112 | 86 | return $jnicall; | ||
2113 | 87 | } | ||
2114 | 88 | |||
2115 | 89 | /* | ||
2116 | 90 | * char **STRING_OUT typemaps. | ||
2117 | 91 | * These are typemaps for returning strings when using a C char ** parameter type. | ||
2118 | 92 | * The returned string appears in the 1st element of the passed in Java String array. | ||
2119 | 93 | * | ||
2120 | 94 | * Example usage wrapping: | ||
2121 | 95 | * void foo(char **string_out); | ||
2122 | 96 | * | ||
2123 | 97 | * Java usage: | ||
2124 | 98 | * String stringOutArray[] = { "" }; | ||
2125 | 99 | * modulename.foo(stringOutArray); | ||
2126 | 100 | * System.out.println( stringOutArray[0] ); | ||
2127 | 101 | */ | ||
2128 | 102 | %typemap(jni) char **STRING_OUT "jobjectArray" | ||
2129 | 103 | %typemap(jtype) char **STRING_OUT "String[]" | ||
2130 | 104 | %typemap(jstype) char **STRING_OUT "String[]" | ||
2131 | 105 | %typemap(javain) char **STRING_OUT "$javainput" | ||
2132 | 106 | |||
2133 | 107 | %typemap(in) char **STRING_OUT($*1_ltype temp) { | ||
2134 | 108 | if (!$input) { | ||
2135 | 109 | SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "array null"); | ||
2136 | 110 | return $null; | ||
2137 | 111 | } | ||
2138 | 112 | if (JCALL1(GetArrayLength, jenv, $input) == 0) { | ||
2139 | 113 | SWIG_JavaThrowException(jenv, SWIG_JavaIndexOutOfBoundsException, "Array must contain at least 1 element"); | ||
2140 | 114 | return $null; | ||
2141 | 115 | } | ||
2142 | 116 | $1 = &temp; | ||
2143 | 117 | } | ||
2144 | 118 | |||
2145 | 119 | %typemap(argout) char **STRING_OUT { | ||
2146 | 120 | jstring jnewstring = NULL; | ||
2147 | 121 | if($1) { | ||
2148 | 122 | jnewstring = JCALL1(NewStringUTF, jenv, *$1); | ||
2149 | 123 | } | ||
2150 | 124 | JCALL3(SetObjectArrayElement, jenv, $input, 0, jnewstring); | ||
2151 | 125 | } | ||
2152 | 126 | |||
2153 | 127 | /* | ||
2154 | 128 | * char *BYTE typemaps. | ||
2155 | 129 | * These are input typemaps for mapping a Java byte[] array to a C char array. | ||
2156 | 130 | * Note that as a Java array is used and thus passeed by reference, the C routine | ||
2157 | 131 | * can return data to Java via the parameter. | ||
2158 | 132 | * | ||
2159 | 133 | * Example usage wrapping: | ||
2160 | 134 | * void foo(char *array); | ||
2161 | 135 | * | ||
2162 | 136 | * Java usage: | ||
2163 | 137 | * byte b[] = new byte[20]; | ||
2164 | 138 | * modulename.foo(b); | ||
2165 | 139 | */ | ||
2166 | 140 | %typemap(jni) char *BYTE "jbyteArray" | ||
2167 | 141 | %typemap(jtype) char *BYTE "byte[]" | ||
2168 | 142 | %typemap(jstype) char *BYTE "byte[]" | ||
2169 | 143 | %typemap(in) char *BYTE { | ||
2170 | 144 | $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0); | ||
2171 | 145 | } | ||
2172 | 146 | |||
2173 | 147 | %typemap(argout) char *BYTE { | ||
2174 | 148 | JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1, 0); | ||
2175 | 149 | } | ||
2176 | 150 | |||
2177 | 151 | %typemap(javain) char *BYTE "$javainput" | ||
2178 | 152 | |||
2179 | 153 | /* Prevent default freearg typemap from being used */ | ||
2180 | 154 | %typemap(freearg) char *BYTE "" | ||
2181 | 155 | |||
2182 | 156 | #else | ||
2183 | 157 | |||
2184 | 158 | #endif | ||
2185 | 159 | |||
2186 | 160 | |||
2187 | 161 | /* %include "typemaps.i" | ||
2188 | 162 | |||
2189 | 163 | #if defined(SWIGJAVA) | ||
2190 | 164 | |||
2191 | 165 | %typemap(in) (char * BYTE, int LENGTH) | ||
2192 | 166 | { | ||
2193 | 167 | // Functions from jni.h | ||
2194 | 168 | $1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0); | ||
2195 | 169 | $2 = (int) JCALL1(GetArrayLength, jenv, $input); | ||
2196 | 170 | } | ||
2197 | 171 | |||
2198 | 172 | %typemap(jni) (char * BYTE, int LENGTH) "jbyteArray" | ||
2199 | 173 | %typemap(jtype) (char * BYTE, int LENGTH) "byte[]" | ||
2200 | 174 | %typemap(jstype) (char * BYTE, int LENGTH) "byte[]" | ||
2201 | 175 | %typemap(javain) (char * BYTE, int LENGTH) "$javainput" | ||
2202 | 176 | |||
2203 | 177 | // Specify signature of method to handle | ||
2204 | 178 | %apply (char * BYTE, int LENGTH) { (char * byteArray, long len) }; | ||
2205 | 179 | |||
2206 | 180 | #else | ||
2207 | 181 | %apply (char * BYTE, int LENGTH) { (char * byteArray, long len) }; | ||
2208 | 182 | #endif | ||
2209 | 183 | |||
2210 | 184 | */ | ||
2211 | 0 | 185 | ||
2212 | === modified file 'swig/zorba_api.i' | |||
2213 | --- swig/zorba_api.i 2012-01-11 15:56:57 +0000 | |||
2214 | +++ swig/zorba_api.i 2012-03-19 16:17:13 +0000 | |||
2215 | @@ -14,7 +14,10 @@ | |||
2216 | 14 | * limitations under the License. | 14 | * limitations under the License. |
2217 | 15 | */ | 15 | */ |
2218 | 16 | 16 | ||
2220 | 17 | %module zorba_api | 17 | %module(directors="1") zorba_api |
2221 | 18 | |||
2222 | 19 | /*%feature("director") IStream;*/ | ||
2223 | 20 | |||
2224 | 18 | %include "std_string.i" | 21 | %include "std_string.i" |
2225 | 19 | %include "exception.i" | 22 | %include "exception.i" |
2226 | 20 | 23 | ||
2227 | @@ -34,6 +37,8 @@ | |||
2228 | 34 | } | 37 | } |
2229 | 35 | } | 38 | } |
2230 | 36 | 39 | ||
2231 | 40 | |||
2232 | 41 | |||
2233 | 37 | %{ // Implementations | 42 | %{ // Implementations |
2234 | 38 | 43 | ||
2235 | 39 | 44 | ||
2236 | @@ -52,6 +57,7 @@ | |||
2237 | 52 | class Item; | 57 | class Item; |
2238 | 53 | class Iterator; | 58 | class Iterator; |
2239 | 54 | class XQuery; | 59 | class XQuery; |
2240 | 60 | class IStream; | ||
2241 | 55 | class Store; | 61 | class Store; |
2242 | 56 | class Zorba; | 62 | class Zorba; |
2243 | 57 | 63 | ||
2244 | @@ -70,6 +76,7 @@ | |||
2245 | 70 | %} | 76 | %} |
2246 | 71 | 77 | ||
2247 | 72 | 78 | ||
2248 | 79 | %include "various.i" | ||
2249 | 73 | 80 | ||
2250 | 74 | %include "XQuery.i" | 81 | %include "XQuery.i" |
2251 | 75 | %include "Store.i" | 82 | %include "Store.i" |
2252 | 76 | 83 | ||
2253 | === modified file 'test/rbkt/modules/CMakeLists.txt' | |||
2254 | --- test/rbkt/modules/CMakeLists.txt 2012-02-23 16:48:01 +0000 | |||
2255 | +++ test/rbkt/modules/CMakeLists.txt 2012-03-19 16:17:13 +0000 | |||
2256 | @@ -58,3 +58,5 @@ | |||
2257 | 58 | # This is as good a place as any to test this feature | 58 | # This is as good a place as any to test this feature |
2258 | 59 | DECLARE_ZORBA_URI_FILE(FILE "random-file.txt" | 59 | DECLARE_ZORBA_URI_FILE(FILE "random-file.txt" |
2259 | 60 | URI "http://www.zorba-xquery.com/random-file" TEST_ONLY) | 60 | URI "http://www.zorba-xquery.com/random-file" TEST_ONLY) |
2260 | 61 | |||
2261 | 62 | ADD_SUBDIRECTORY(java) | ||
2262 | 61 | 63 | ||
2263 | === added directory 'test/rbkt/modules/java' | |||
2264 | === added file 'test/rbkt/modules/java/CMakeLists.txt' | |||
2265 | --- test/rbkt/modules/java/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
2266 | +++ test/rbkt/modules/java/CMakeLists.txt 2012-03-19 16:17:13 +0000 | |||
2267 | @@ -0,0 +1,39 @@ | |||
2268 | 1 | # Copyright 2006-2008 The FLWOR Foundation. | ||
2269 | 2 | # | ||
2270 | 3 | # Licensed under the Apache License, Version 2.0 (the "License") | ||
2271 | 4 | # you may not use this file except in compliance with the License. | ||
2272 | 5 | # You may obtain a copy of the License at | ||
2273 | 6 | # | ||
2274 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
2275 | 8 | # | ||
2276 | 9 | # Unless required by applicable law or agreed to in writing, software | ||
2277 | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
2278 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
2279 | 12 | # See the License for the specific language governing permissions and | ||
2280 | 13 | # limitations under the License. | ||
2281 | 14 | |||
2282 | 15 | # For now we only test building a .jar that we want Zorba to make available | ||
2283 | 16 | # on the JVM claspath. This test scenario should be extended to include a | ||
2284 | 17 | # Zorba module using the .jar, etc. | ||
2285 | 18 | # We make use of the much-improved Java support added in CMake 2.8.6. | ||
2286 | 19 | COMPARE_VERSION_STRINGS (${CMAKE_VERSION} "2.8.6" RESULT) | ||
2287 | 20 | IF (${RESULT} GREATER -1) | ||
2288 | 21 | FIND_PACKAGE (Java COMPONENTS Development) | ||
2289 | 22 | IF (Java_Development_FOUND) | ||
2290 | 23 | INCLUDE (UseJava) | ||
2291 | 24 | |||
2292 | 25 | # Declare two "different" jars, for testing | ||
2293 | 26 | ADD_JAR (JavaTest Test.java) | ||
2294 | 27 | ADD_JAR (JavaTest2 Test.java) | ||
2295 | 28 | |||
2296 | 29 | # Tell Zorba about the jars | ||
2297 | 30 | GET_PROPERTY (JavaTest_JAR_FILE TARGET JavaTest PROPERTY JAR_FILE) | ||
2298 | 31 | GET_PROPERTY (JavaTest2_JAR_FILE TARGET JavaTest2 PROPERTY JAR_FILE) | ||
2299 | 32 | DECLARE_ZORBA_JAR(FILE ${JavaTest_JAR_FILE} ${JavaTest2_JAR_FILE} TEST_ONLY) | ||
2300 | 33 | |||
2301 | 34 | # Pretend to tell Zorba about some system jars | ||
2302 | 35 | DECLARE_ZORBA_JAR(EXTERNAL FILE | ||
2303 | 36 | "${PROJECT_SOURCE_DIR}/MyJar.jar" "${PROJECT_SOURCE_DIR}/MyJar2.jar") | ||
2304 | 37 | |||
2305 | 38 | ENDIF (Java_Development_FOUND) | ||
2306 | 39 | ENDIF (${RESULT} GREATER -1) | ||
2307 | 0 | 40 | ||
2308 | === added file 'test/rbkt/modules/java/Test.java' | |||
2309 | --- test/rbkt/modules/java/Test.java 1970-01-01 00:00:00 +0000 | |||
2310 | +++ test/rbkt/modules/java/Test.java 2012-03-19 16:17:13 +0000 | |||
2311 | @@ -0,0 +1,7 @@ | |||
2312 | 1 | package org.zorbaxquery; | ||
2313 | 2 | |||
2314 | 3 | public class Test { | ||
2315 | 4 | public static void main(String[] args) { | ||
2316 | 5 | System.out.println("Hello, world"); | ||
2317 | 6 | } | ||
2318 | 7 | } |
Attempt to merge into lp:zorba failed due to conflicts:
text conflict in modules/ ExternalModules .conf