diff --git a/.gitignore b/.gitignore index f8359345..4a7a8a1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +<<<<<<< HEAD .DS_Store .*.sw? *.cso @@ -6,4 +7,13 @@ tmp/ lib/iphone/phonegap-min.js lib/iphone/phonegap.js android/bin -android/gen \ No newline at end of file +android/gen +======= +default.properties +gen +assets/www/phonegap.js +local.properties +framework/phonegap.jar +framework/bin +framework/assets/www/.DS_Store +>>>>>>> fbe96f891bc56cfff38037bf6087d60ceb17e286 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..6092a574 --- /dev/null +++ b/LICENSE @@ -0,0 +1,426 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + SUBCOMPONENTS + + Apache Callback includes software components under different license terms. + Your use of these subcomponents is subject to the terms and conditions of + the following licenses. + + For the framework/libs/junit-4.10.jar component: + + Common Public License - v 1.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC + LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM + CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + + 1. DEFINITIONS + + "Contribution" means: + + a) in the case of the initial Contributor, the initial code and + documentation distributed under this Agreement, and + b) in the case of each subsequent Contributor: + + i) changes to the Program, and + + ii) additions to the Program; + + where such changes and/or additions to the Program originate from and are +distributed by that particular Contributor. A Contribution 'originates' from a +Contributor if it was added to the Program by such Contributor itself or anyone +acting on such Contributor's behalf. Contributions do not include additions to +the Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) are +not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are +necessarily infringed by the use or sale of its Contribution alone or when +combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, +including all Contributors. + + 2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free copyright license to +reproduce, prepare derivative works of, publicly display, publicly perform, +distribute and sublicense the Contribution of such Contributor, if any, and +such derivative works, in source code and object code form. + + b) Subject to the terms of this Agreement, each Contributor hereby grants +Recipient a non-exclusive, worldwide, royalty-free patent license under +Licensed Patents to make, use, sell, offer to sell, import and otherwise +transfer the Contribution of such Contributor, if any, in source code and +object code form. This patent license shall apply to the combination of the +Contribution and the Program if, at the time the Contribution is added by the +Contributor, such addition of the Contribution causes such combination to be +covered by the Licensed Patents. The patent license shall not apply to any +other combinations which include the Contribution. No hardware per se is +licensed hereunder. + + c) Recipient understands that although each Contributor grants the +licenses to its Contributions set forth herein, no assurances are provided by +any Contributor that the Program does not infringe the patent or other +intellectual property rights of any other entity. Each Contributor disclaims +any liability to Recipient for claims brought by any other entity based on +infringement of intellectual property rights or otherwise. As a condition to +exercising the rights and licenses granted hereunder, each Recipient hereby +assumes sole responsibility to secure any other intellectual property rights +needed, if any. For example, if a third party patent license is required to +allow Recipient to distribute the Program, it is Recipient's responsibility to +acquire that license before distributing the Program. + + d) Each Contributor represents that to its knowledge it has sufficient +copyright rights in its Contribution, if any, to grant the copyright license +set forth in this Agreement. + + 3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under +its own license agreement, provided that: + + a) it complies with the terms and conditions of this Agreement; and + + b) its license agreement: + + i) effectively disclaims on behalf of all Contributors all warranties and +conditions, express and implied, including warranties or conditions of title +and non-infringement, and implied warranties or conditions of merchantability +and fitness for a particular purpose; + + ii) effectively excludes on behalf of all Contributors all liability for +damages, including direct, indirect, special, incidental and consequential +damages, such as lost profits; + + iii) states that any provisions which differ from this Agreement are +offered by that Contributor alone and not by any other party; and + + iv) states that source code for the Program is available from such +Contributor, and informs licensees how to obtain it in a reasonable manner on +or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + + a) it must be made available under this Agreement; and + + b) a copy of this Agreement must be included with each copy of the +Program. + +Contributors may not remove or alter any copyright notices contained within the +Program. + +Each Contributor must identify itself as the originator of its Contribution, if +any, in a manner that reasonably allows subsequent Recipients to identify the +originator of the Contribution. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with +respect to end users, business partners and the like. While this license is +intended to facilitate the commercial use of the Program, the Contributor who +includes the Program in a commercial product offering should do so in a manner +which does not create potential liability for other Contributors. Therefore, if +a Contributor includes the Program in a commercial product offering, such +Contributor ("Commercial Contributor") hereby agrees to defend and indemnify +every other Contributor ("Indemnified Contributor") against any losses, damages +and costs (collectively "Losses") arising from claims, lawsuits and other legal +actions brought by a third party against the Indemnified Contributor to the +extent caused by the acts or omissions of such Commercial Contributor in +connection with its distribution of the Program in a commercial product +offering. The obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In order +to qualify, an Indemnified Contributor must: a) promptly notify the Commercial +Contributor in writing of such claim, and b) allow the Commercial Contributor +to control, and cooperate with the Commercial Contributor in, the defense and +any related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product +offering, Product X. That Contributor is then a Commercial Contributor. If that +Commercial Contributor then makes performance claims, or offers warranties +related to Product X, those performance claims and warranties are such +Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a court +requires any other Contributor to pay any damages as a result, the Commercial +Contributor must pay those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, +NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each +Recipient is solely responsible for determining the appropriateness of using +and distributing the Program and assumes all risks associated with its exercise +of rights under this Agreement, including but not limited to the risks and +costs of program errors, compliance with applicable laws, damage to or loss of +data, programs or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY +CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY +WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS +GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable +law, it shall not affect the validity or enforceability of the remainder of the +terms of this Agreement, and without further action by the parties hereto, such +provision shall be reformed to the minimum extent necessary to make such +provision valid and enforceable. + +If Recipient institutes patent litigation against a Contributor with respect to +a patent applicable to software (including a cross-claim or counterclaim in a +lawsuit), then any patent licenses granted by that Contributor to such +Recipient under this Agreement shall terminate as of the date such litigation +is filed. In addition, if Recipient institutes patent litigation against any +entity (including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software or +hardware) infringes such Recipient's patent(s), then such Recipient's rights +granted under Section 2(b) shall terminate as of the date such litigation is +filed. + +All Recipient's rights under this Agreement shall terminate if it fails to +comply with any of the material terms or conditions of this Agreement and does +not cure such failure in a reasonable period of time after becoming aware of +such noncompliance. If all Recipient's rights under this Agreement terminate, +Recipient agrees to cease use and distribution of the Program as soon as +reasonably practicable. However, Recipient's obligations under this Agreement +and any licenses granted by Recipient relating to the Program shall continue +and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in +order to avoid inconsistency the Agreement is copyrighted and may only be +modified in the following manner. The Agreement Steward reserves the right to +publish new versions (including revisions) of this Agreement from time to time. +No one other than the Agreement Steward has the right to modify this Agreement. +IBM is the initial Agreement Steward. IBM may assign the responsibility to +serve as the Agreement Steward to a suitable separate entity. Each new version +of the Agreement will be given a distinguishing version number. The Program +(including Contributions) may always be distributed subject to the version of +the Agreement under which it was received. In addition, after a new version of +the Agreement is published, Contributor may elect to distribute the Program +(including its Contributions) under the new version. Except as expressly stated +in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to +the intellectual property of any Contributor under this Agreement, whether +expressly, by implication, estoppel or otherwise. All rights in the Program not +expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the +intellectual property laws of the United States of America. No party to this +Agreement will bring a legal action under this Agreement more than one year +after the cause of action arose. Each party waives its rights to a jury trial +in any resulting litigation. diff --git a/Makefile b/Makefile deleted file mode 100644 index 625dc6a3..00000000 --- a/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -SHELL = /bin/sh -CHMOD = chmod -CP = cp -MV = mv -NOOP = $(SHELL) -c true -RM_F = rm -f -RM_RF = rm -rf -TEST_F = test -f -TOUCH = touch -UMASK_NULL = umask 0 -DEV_NULL = > /dev/null 2>&1 -MKPATH = mkdir -p -CAT = cat -MAKE = make -OPEN = open -ECHO = echo -ECHO_N = echo -n -JAVA = java -DOXYGEN = -IPHONE_DOCSET_TMPDIR = docs/iphone/tmp - -all :: iphone blackberry android docs - -clean :: clean_docs clean_libs - -clean_docs: - -$(RM_RF) docs/javascript - -$(RM_RF) docs/iphone - -clean_libs: - -$(RM_RF) lib - -iphone/www/phonegap.js: lib/iphone/phonegap-min.js - $(CP) lib/iphone/phonegap-min.js $@ - -docs :: javascript_docs iphone_docs - -iphone_docs: -javascript_docs :: javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js - $(JAVA) -jar util/jsdoc-toolkit/jsrun.jar util/jsdoc-toolkit/app/run.js -a -d=docs/javascript -t=util/jsdoc-toolkit/templates/jsdoc javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js -iphone: lib/iphone/phonegap-min.js - -lib/iphone/phonegap-min.js: lib/iphone/phonegap.js - $(JAVA) -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o $@ lib/iphone/phonegap.js - -lib/iphone/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/network.js javascripts/iphone/accelerometer.js javascripts/iphone/bonjour.js javascripts/iphone/contact.js javascripts/iphone/camera.js javascripts/iphone/debugconsole.js javascripts/iphone/device.js javascripts/iphone/geolocation.js javascripts/iphone/compass.js javascripts/iphone/media.js javascripts/iphone/notification.js javascripts/iphone/phonegap.js javascripts/iphone/uicontrols.js javascripts/iphone/network.js - $(RM_RF) lib/iphone - $(MKPATH) lib/iphone - $(RM_F) $@ - $(CAT) javascripts/phonegap.js.base >> $@ - $(CAT) javascripts/acceleration.js >> $@ - $(CAT) javascripts/accelerometer.js >> $@ - $(CAT) javascripts/camera.js >> $@ - $(CAT) javascripts/contact.js >> $@ - $(CAT) javascripts/debugconsole.js >> $@ - $(CAT) javascripts/device.js >> $@ - $(CAT) javascripts/file.js >> $@ - $(CAT) javascripts/geolocation.js >> $@ - $(CAT) javascripts/compass.js >> $@ - $(CAT) javascripts/map.js >> $@ - $(CAT) javascripts/media.js >> $@ - $(CAT) javascripts/notification.js >> $@ - $(CAT) javascripts/orientation.js >> $@ - $(CAT) javascripts/position.js >> $@ - $(CAT) javascripts/sms.js >> $@ - $(CAT) javascripts/telephony.js >> $@ - $(CAT) javascripts/uicontrols.js >> $@ - $(CAT) javascripts/network.js >> $@ - $(CAT) javascripts/iphone/accelerometer.js >> $@ - $(CAT) javascripts/iphone/bonjour.js >> $@ - $(CAT) javascripts/iphone/contact.js >> $@ - $(CAT) javascripts/iphone/camera.js >> $@ - $(CAT) javascripts/iphone/debugconsole.js >> $@ - $(CAT) javascripts/iphone/device.js >> $@ - $(CAT) javascripts/iphone/geolocation.js >> $@ - $(CAT) javascripts/iphone/compass.js >> $@ - $(CAT) javascripts/iphone/media.js >> $@ - $(CAT) javascripts/iphone/notification.js >> $@ - $(CAT) javascripts/iphone/phonegap.js >> $@ - $(CAT) javascripts/iphone/uicontrols.js >> $@ - $(CAT) javascripts/iphone/network.js >> $@ - -blackberry: lib/blackberry/phonegap-min.js - -lib/blackberry/phonegap-min.js: lib/blackberry/phonegap.js - $(JAVA) -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o $@ lib/blackberry/phonegap.js - -lib/blackberry/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/blackberry/file.js javascripts/blackberry/geolocation.js - $(RM_RF) lib/blackberry - $(MKPATH) lib/blackberry - $(RM_F) $@ - $(CAT) javascripts/phonegap.js.base >> $@ - $(CAT) javascripts/acceleration.js >> $@ - $(CAT) javascripts/accelerometer.js >> $@ - $(CAT) javascripts/camera.js >> $@ - $(CAT) javascripts/contact.js >> $@ - $(CAT) javascripts/debugconsole.js >> $@ - $(CAT) javascripts/device.js >> $@ - $(CAT) javascripts/file.js >> $@ - $(CAT) javascripts/geolocation.js >> $@ - $(CAT) javascripts/compass.js >> $@ - $(CAT) javascripts/map.js >> $@ - $(CAT) javascripts/media.js >> $@ - $(CAT) javascripts/notification.js >> $@ - $(CAT) javascripts/orientation.js >> $@ - $(CAT) javascripts/position.js >> $@ - $(CAT) javascripts/sms.js >> $@ - $(CAT) javascripts/telephony.js >> $@ - $(CAT) javascripts/uicontrols.js >> $@ - $(CAT) javascripts/blackberry/file.js >> $@ - $(CAT) javascripts/blackberry/geolocation.js >> $@ -android: lib/android/phonegap-min.js - -lib/android/phonegap-min.js: lib/android/phonegap.js - $(JAVA) -jar util/yuicompressor-2.4.2.jar --charset UTF-8 -o $@ lib/android/phonegap.js - -lib/android/phonegap.js: javascripts/phonegap.js.base javascripts/acceleration.js javascripts/accelerometer.js javascripts/camera.js javascripts/contact.js javascripts/debugconsole.js javascripts/device.js javascripts/file.js javascripts/geolocation.js javascripts/compass.js javascripts/map.js javascripts/media.js javascripts/notification.js javascripts/orientation.js javascripts/position.js javascripts/sms.js javascripts/telephony.js javascripts/uicontrols.js javascripts/android/device.js javascripts/android/geolocation.js javascripts/android/notification.js - $(RM_RF) lib/android - $(MKPATH) lib/android - $(RM_F) $@ - $(CAT) javascripts/phonegap.js.base >> $@ - $(CAT) javascripts/acceleration.js >> $@ - $(CAT) javascripts/accelerometer.js >> $@ - $(CAT) javascripts/camera.js >> $@ - $(CAT) javascripts/contact.js >> $@ - $(CAT) javascripts/debugconsole.js >> $@ - $(CAT) javascripts/device.js >> $@ - $(CAT) javascripts/file.js >> $@ - $(CAT) javascripts/geolocation.js >> $@ - $(CAT) javascripts/compass.js >> $@ - $(CAT) javascripts/map.js >> $@ - $(CAT) javascripts/media.js >> $@ - $(CAT) javascripts/notification.js >> $@ - $(CAT) javascripts/orientation.js >> $@ - $(CAT) javascripts/position.js >> $@ - $(CAT) javascripts/sms.js >> $@ - $(CAT) javascripts/telephony.js >> $@ - $(CAT) javascripts/uicontrols.js >> $@ - $(CAT) javascripts/android/device.js >> $@ - $(CAT) javascripts/android/geolocation.js >> $@ - $(CAT) javascripts/android/notification.js >> $@ - $(CAT) javascripts/android/accelerometer.js >> $@ diff --git a/README.md b/README.md index b890df53..53085534 100644 --- a/README.md +++ b/README.md @@ -1,111 +1,24 @@ +# PhoneGap -PhoneGap -============================================================= -PhoneGap is a development tool that allows web developers to -take advantage of the core features in the iPhone and Android -SDK using JavaScript. +> Easily create apps using the web technologies you know and love: HTML, CSS, and JavaScript +## Getting Started -Get Started -------------------------------------------------------------- -Download the source. +- [Learn about PhoneGap](http://phonegap.com/) +- [Learn about PhoneGap Enterprise](http://enterprise.phonegap.com/) - git clone git://github.com/sintaxi/phonegap.git - -PhoneGap project is separated into a native project for each -device, javascript files and a rakefile. +## Projects - phonegap - |- README.md - |- Rakefile - |- android/ - |- blackberry/ - |- iphone/ - `- javascripts/ - -Each project has a respective README.md file. view that file -for detailed information on how to work with that device. PhoneGap -offers one unified API for accessing core functionality on all -devices. Where possible, phonegap follows the **HTML5 spec**. +- [PhoneGap CLI](https://github.com/phonegap/phonegap-cli) +- [PhoneGap Desktop App](https://github.com/phonegap/phonegap-app-desktop) +- [PhoneGap Mobile App](https://github.com/phonegap/phonegap-app-developer) +- [Apache Cordova](http://cordova.io/) +_Check out the [Github Organization](https://github.com/phonegap) for all of our projects._ -API -------------------------------------------------------------- +## Community -### Device - -Exposes properties of the phone, such as its device ID, model, and OS version number. - -### Location - -Gain access to the Latitude / Longitude of the device, and depending on the type of device, the course, speed, and altitude. - -### Accelerometer - -Monitor the accelerometer on the device to detect orientation, shaking and other similar actions. - -### Contacts - -Query the phone addressbook to read the users contacts. - -### Orientation - -Read the device layout orientation, e.g. landscape vs portrait. - -### Camera - -Brings up the camera or photo browser on the phone to allow the user to upload a photo. - -### Vibrate - -Triggers the vibration alert on the phone, if it is supported. - -### Sound - -Play sound files (WAV, MP3, etc). - -### Telephony - -Trigger and activate phone calls. - -XUI -------------------------------------------------------------- -You may work with any Javascript framework within a PhoneGap -application. [XUI](http://xuijs.com) is the "officially preferred" -framework of the phonegap core team. XUI is inspired by JQuery, -optimized for web browsers and weighs in at 6.2k (2.4k minified and gziped). - - -Community -------------------------------------------------------------- - * Website - [phonegap.com](http://phonegap.com) - * Google Group - [groups.google.com/group/phonegap](http://groups.google.com/group/phonegap) - * Wiki - [phonegap.pbwiki.com/](http://phonegap.pbwiki.com/) - * Twitter - [twitter.com/phonegap](http://twitter.com/phonegap) - - -The MIT License -------------------------------------------------------------- -Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -------------------------------------------------------------- - -*phonegap is a [nitobi](http://nitobi.com) sponsored project* +- [Twitter](http://twitter.com/phonegap) +- [Facebook](http://facebook.com/phonegap) +- [Mailing List](http://groups.google.com/group/phonegap) +- [IRC](http://webchat.freenode.net/?channels=#phonegap) diff --git a/Rakefile b/Rakefile deleted file mode 100644 index de9c67b2..00000000 --- a/Rakefile +++ /dev/null @@ -1,83 +0,0 @@ -LIBPATH = File.expand_path(File.dirname(__FILE__)) + File::SEPARATOR - -# -# builds and tests -# -desc 'writes lib/phonegap.js and lib/phonegap-min.js and runs docs' -task :default do - build - doc -end - -task :doc do - doc -end - -def doc - puts 'writing the full interface source for documentation into tmp/phonegap.js' - final = "#{ LIBPATH }tmp#{ File::SEPARATOR }phonegap.js" - js = "" - interfaces_to_build.each do |lib| - js << import("#{ LIBPATH }javascripts#{ File::SEPARATOR }#{ lib }.js") - end - FileUtils.mkdir_p "#{ LIBPATH }tmp" - open(final,'w'){|f| f.puts( js )} - sh "java -jar util#{ File::SEPARATOR }jsdoc-toolkit#{ File::SEPARATOR }jsrun.jar util#{ File::SEPARATOR }jsdoc-toolkit#{ File::SEPARATOR }app#{ File::SEPARATOR }run.js -a -d=javascripts/docs -t=util#{ File::SEPARATOR }jsdoc-toolkit#{ File::SEPARATOR }templates#{ File::SEPARATOR }jsdoc tmp#{ File::SEPARATOR }phonegap.js" -end - -def build - puts 'writing the full JS file to lib/phonegap.js' - platforms_to_build.each do |platform| - final = "#{ LIBPATH }lib#{ File::SEPARATOR }#{ platform }#{ File::SEPARATOR }phonegap.js" - js = "" - - interfaces_to_build.each do |interface| - js << import("#{ LIBPATH }javascripts#{ File::SEPARATOR }#{ interface }.js") - begin - js << import("#{ LIBPATH }javascripts#{ File::SEPARATOR }#{ platform }#{ File::SEPARATOR }#{ interface }.js") - rescue - end - end - - FileUtils.mkdir_p "#{ LIBPATH }lib#{ File::SEPARATOR }#{ platform }" - open(final,'w'){|f| f.puts( js )} - end - - min -end - -# the sub libraries used by xui -def interfaces_to_build - %w(device acceleration accelerometer media camera contact uicontrols debugconsole file geolocation map notification orientation position sms telephony) -end - -# the sub libraries used by xui -def platforms_to_build - %w(android blackberry iphone) -end - -# helper for build_sub_libaries -def import(lib) - s = "" - r = "" - open(lib) { |f| s << "\n#{f.read}\n\n" } - s.each_line {|l| r << " #{l}"} - r -end - -# creates lib/xui-min.js (tho not obfuscates) -def min - puts 'minifying js' - platforms_to_build.each do |platform| - min_file = "#{ LIBPATH }lib#{ File::SEPARATOR }#{ platform }#{ File::SEPARATOR }phonegap-min.js" - doc_file = "#{ LIBPATH }lib#{ File::SEPARATOR }#{ platform }#{ File::SEPARATOR }phonegap.js" - sh "java -jar #{LIBPATH}#{ File::SEPARATOR }util#{ File::SEPARATOR }yuicompressor-2.4.2.jar --charset UTF-8 -o #{min_file} #{doc_file}" - end -end - -# opens up the specs -def spec - puts 'running automated test suite' - #sh "open -a WebKit file://#{ LIBPATH }/spec/index.html" - #sh "open -a '/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app' file://#{ LIBPATH }/spec/index.html" -end diff --git a/android/.classpath b/android/.classpath deleted file mode 100644 index f0b94296..00000000 --- a/android/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/android/.project b/android/.project deleted file mode 100644 index 16f5706a..00000000 --- a/android/.project +++ /dev/null @@ -1,33 +0,0 @@ - - - PhoneGap - - - - - - com.android.ide.eclipse.adt.ResourceManagerBuilder - - - - - com.android.ide.eclipse.adt.PreCompilerBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - com.android.ide.eclipse.adt.ApkBuilder - - - - - - com.android.ide.eclipse.adt.AndroidNature - org.eclipse.jdt.core.javanature - - diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml deleted file mode 100644 index 49712247..00000000 --- a/android/AndroidManifest.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/assets/www/index.html b/android/assets/www/index.html deleted file mode 100644 index d1ac7d5d..00000000 --- a/android/assets/www/index.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - PhoneGap - - - - - -

Welcome to PhoneGap!

-

this file is located at assets/index.html

-
-

Platform:  

-

Version:  

-

UUID:  

-
-
-
X:
 
-
Y:
 
-
Z:
 
-
- Watch Accelerometer - Get Location - Call 411 - Beep - Vibrate - - diff --git a/android/assets/www/master.css b/android/assets/www/master.css deleted file mode 100644 index 1d1bea20..00000000 --- a/android/assets/www/master.css +++ /dev/null @@ -1,95 +0,0 @@ - body { - background:#222 none repeat scroll 0 0; - color:#666; - font-family:Helvetica; - font-size:72%; - line-height:1.5em; - margin:0; - border-top:1px solid #393939; - } - - #info{ - background:#ffa; - border: 1px solid #ffd324; - -webkit-border-radius: 5px; - border-radius: 5px; - clear:both; - margin:15px 6px 0; - width:295px; - padding:4px 0px 2px 10px; - } - - #info > h4{ - font-size:.95em; - margin:5px 0; - } - - #stage.theme{ - padding-top:3px; - } - - /* Definition List */ - #stage.theme > dl{ - padding-top:10px; - clear:both; - margin:0; - list-style-type:none; - padding-left:10px; - overflow:auto; - } - - #stage.theme > dl > dt{ - font-weight:bold; - float:left; - margin-left:5px; - } - - #stage.theme > dl > dd{ - width:45px; - float:left; - color:#a87; - font-weight:bold; - } - - /* Content Styling */ - #stage.theme > h1, #stage.theme > h2, #stage.theme > p{ - margin:1em 0 .5em 13px; - } - - #stage.theme > h1{ - color:#eee; - font-size:1.6em; - text-align:center; - margin:0; - margin-top:15px; - padding:0; - } - - #stage.theme > h2{ - clear:both; - margin:0; - padding:3px; - font-size:1em; - text-align:center; - } - - /* Stage Buttons */ - #stage.theme a.btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:left; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; - } - #stage.theme a.btn.large{ - width:308px; - padding:1.2em 0; - } diff --git a/android/assets/www/phonegap.js b/android/assets/www/phonegap.js deleted file mode 100644 index 75ac2872..00000000 --- a/android/assets/www/phonegap.js +++ /dev/null @@ -1,1049 +0,0 @@ -if (typeof(DeviceInfo) != 'object') - DeviceInfo = {}; - -/** - * This represents the PhoneGap API itself, and provides a global namespace for accessing - * information about the state of PhoneGap. - * @class - */ -PhoneGap = { - queue: { - ready: true, - commands: [], - timer: null - }, - _constructors: [] -}; - -/** - * Boolean flag indicating if the PhoneGap API is available and initialized. - */ -PhoneGap.available = DeviceInfo.uuid != undefined; - -/** - * Add an initialization function to a queue that ensures it will run and initialize - * application constructors only once PhoneGap has been initialized. - * @param {Function} func The function callback you want run once PhoneGap is initialized - */ -PhoneGap.addConstructor = function(func) { - var state = document.readyState; - if (state != 'loaded' && state != 'complete') - PhoneGap._constructors.push(func); - else - func(); -}; -(function() { - var timer = setInterval(function() { - var state = document.readyState; - if (state != 'loaded' && state != 'complete') - return; - clearInterval(timer); - while (PhoneGap._constructors.length > 0) { - var constructor = PhoneGap._constructors.shift(); - try { - constructor(); - } catch(e) { - if (typeof(debug['log']) == 'function') - debug.log("Failed to run constructor: " + debug.processMessage(e)); - else - alert("Failed to run constructor: " + e.message); - } - } - }, 1); -})(); - - -/** - * Execute a PhoneGap command in a queued fashion, to ensure commands do not - * execute with any race conditions, and only run when PhoneGap is ready to - * recieve them. - * @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method" - * @param {String[]} [args] Zero or more arguments to pass to the method - */ -PhoneGap.exec = function() { - PhoneGap.queue.commands.push(arguments); - if (PhoneGap.queue.timer == null) - PhoneGap.queue.timer = setInterval(PhoneGap.run_command, 10); -}; -/** - * Internal function used to dispatch the request to PhoneGap. This needs to be implemented per-platform to - * ensure that methods are called on the phone in a way appropriate for that device. - * @private - */ -PhoneGap.run_command = function() { -}; - -/** - * This class contains acceleration information - * @constructor - * @param {Number} x The force applied by the device in the x-axis. - * @param {Number} y The force applied by the device in the y-axis. - * @param {Number} z The force applied by the device in the z-axis. - */ -function Acceleration(x, y, z) { - /** - * The force applied by the device in the x-axis. - */ - this.x = x; - /** - * The force applied by the device in the y-axis. - */ - this.y = y; - /** - * The force applied by the device in the z-axis. - */ - this.z = z; - /** - * The time that the acceleration was obtained. - */ - this.timestamp = new Date().getTime(); -} - -/** - * This class specifies the options for requesting acceleration data. - * @constructor - */ -function AccelerationOptions() { - /** - * The timeout after which if acceleration data cannot be obtained the errorCallback - * is called. - */ - this.timeout = 10000; -} -/** - * This class provides access to device accelerometer data. - * @constructor - */ -function Accelerometer() { - /** - * The last known acceleration. - */ - this.lastAcceleration = null; -} - -/** - * Asynchronously aquires the current acceleration. - * @param {Function} successCallback The function to call when the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ -Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) { - // If the acceleration is available then call success - // If the acceleration is not available then call error - - // Created for iPhone, Iphone passes back _accel obj litteral - if (typeof successCallback == "function") { - var accel = new Acceleration(_accel.x,_accel.y,_accel.z); - Accelerometer.lastAcceleration = accel; - successCallback(accel); - } -} - -/** - * Asynchronously aquires the acceleration repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ - -Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) { - this.getCurrentAcceleration(successCallback, errorCallback, options); - // TODO: add the interval id to a list so we can clear all watches - var frequency = (options != undefined)? options.frequency : 10000; - return setInterval(function() { - navigator.accelerometer.getCurrentAcceleration(successCallback, errorCallback, options); - }, frequency); -} - -/** - * Clears the specified accelerometer watch. - * @param {String} watchId The ID of the watch returned from #watchAcceleration. - */ -Accelerometer.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer(); -}); -/** - * This class provides access to the device camera. - * @constructor - */ -function Camera() { - -} - -/** - * - * @param {Function} successCallback - * @param {Function} errorCallback - * @param {Object} options - */ -Camera.prototype.getPicture = function(successCallback, errorCallback, options) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.camera == "undefined") navigator.camera = new Camera(); -}); -/** - * This class provides access to the device contacts. - * @constructor - */ - -function Contact(jsonObject) { - this.firstName = ""; - this.lastName = ""; - this.phoneNumber = ""; - this.address = ""; -} - -Contact.prototype.displayName = function() -{ - // TODO: can be tuned according to prefs - return this.firstName + " " + this.lastName; -} - -function ContactManager() { - // Dummy object to hold array of contacts - this.contacts = []; - this.timestamp = new Date().getTime(); -} - -ContactManager.prototype.getAllContacts = function(successCallback, errorCallback, options) { - // Interface -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.ContactManager == "undefined") navigator.ContactManager = new ContactManager(); -}); -/** - * This class provides access to the debugging console. - * @constructor - */ -function DebugConsole() { -} - -/** - * Utility function for rendering and indenting strings, or serializing - * objects to a string capable of being printed to the console. - * @param {Object|String} message The string or object to convert to an indented string - * @private - */ -DebugConsole.prototype.processMessage = function(message) { - if (typeof(message) != 'object') { - return message; - } else { - /** - * @function - * @ignore - */ - function indent(str) { - return str.replace(/^/mg, " "); - } - /** - * @function - * @ignore - */ - function makeStructured(obj) { - var str = ""; - for (var i in obj) { - try { - if (typeof(obj[i]) == 'object') { - str += i + ":\n" + indent(makeStructured(obj[i])) + "\n"; - } else { - str += i + " = " + indent(String(obj[i])).replace(/^ /, "") + "\n"; - } - } catch(e) { - str += i + " = EXCEPTION: " + e.message + "\n"; - } - } - return str; - } - return "Object:\n" + makeStructured(message); - } -}; - -/** - * Print a normal log message to the console - * @param {Object|String} message Message or object to print to the console - */ -DebugConsole.prototype.log = function(message) { -}; - -/** - * Print a warning message to the console - * @param {Object|String} message Message or object to print to the console - */ -DebugConsole.prototype.warn = function(message) { -}; - -/** - * Print an error message to the console - * @param {Object|String} message Message or object to print to the console - */ -DebugConsole.prototype.error = function(message) { -}; - -PhoneGap.addConstructor(function() { - window.debug = new DebugConsole(); -}); -/** - * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the - * phone, etc. - * @constructor - */ -function Device() { - this.available = PhoneGap.available; - this.platform = null; - this.version = null; - this.name = null; - this.gap = null; - this.uuid = null; - try { - if (window.DroidGap) { - this.available = true; - this.uuid = window.DroidGap.getUuid(); - this.version = window.DroidGap.getOSVersion(); - this.gapVersion = window.DroidGap.getVersion(); - this.platform = window.DroidGap.getPlatform(); - this.name = window.DroidGap.getProductName(); - } else { - this.platform = DeviceInfo.platform; - this.version = DeviceInfo.version; - this.name = DeviceInfo.name; - this.gap = DeviceInfo.gap; - this.uuid = DeviceInfo.uuid; - } - } catch(e) { - this.available = false; - } -} - -PhoneGap.addConstructor(function() { - navigator.device = window.device = new Device(); -}); -/** - * This class provides generic read and write access to the mobile device file system. - */ -function File() { - /** - * The data of a file. - */ - this.data = ""; - /** - * The name of the file. - */ - this.name = ""; -} - -/** - * Reads a file from the mobile device. This function is asyncronous. - * @param {String} fileName The name (including the path) to the file on the mobile device. - * The file name will likely be device dependant. - * @param {Function} successCallback The function to call when the file is successfully read. - * @param {Function} errorCallback The function to call when there is an error reading the file from the device. - */ -File.prototype.read = function(fileName, successCallback, errorCallback) { - -} - -/** - * Writes a file to the mobile device. - * @param {File} file The file to write to the device. - */ -File.prototype.write = function(file) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.file == "undefined") navigator.file = new File(); -}); -/** - * This class provides access to device GPS data. - * @constructor - */ -function Geolocation() { - /** - * The last known GPS position. - */ - this.lastPosition = null; - this.lastError = null; - this.callbacks = { - onLocationChanged: [], - onError: [] - }; -}; - -/** - * Asynchronously aquires the current position. - * @param {Function} successCallback The function to call when the position - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the position data. - * @param {PositionOptions} options The options for getting the position data - * such as timeout. - */ -Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) { - var referenceTime = 0; - if (this.lastPosition) - referenceTime = this.lastPosition.timeout; - else - this.start(options); - - var timeout = 20000; - var interval = 500; - if (typeof(options) == 'object' && options.interval) - interval = options.interval; - - if (typeof(successCallback) != 'function') - successCallback = function() {}; - if (typeof(errorCallback) != 'function') - errorCallback = function() {}; - - var dis = this; - var delay = 0; - var timer = setInterval(function() { - delay += interval; - - if (typeof(dis.lastPosition) == 'object' && dis.lastPosition.timestamp > referenceTime) { - successCallback(dis.lastPosition); - clearInterval(timer); - } else if (delay >= timeout) { - errorCallback(); - clearInterval(timer); - } - }, interval); -}; - -/** - * Asynchronously aquires the position repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the position - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the position data. - * @param {PositionOptions} options The options for getting the position data - * such as timeout and the frequency of the watch. - */ -Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) { - // Invoke the appropriate callback with a new Position object every time the implementation - // determines that the position of the hosting device has changed. - - this.getCurrentPosition(successCallback, errorCallback, options); - var frequency = 10000; - if (typeof(options) == 'object' && options.frequency) - frequency = options.frequency; - - var that = this; - return setInterval(function() { - that.getCurrentPosition(successCallback, errorCallback, options); - }, frequency); -}; - - -/** - * Clears the specified position watch. - * @param {String} watchId The ID of the watch returned from #watchPosition. - */ -Geolocation.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -}; - -/** - * Called by the geolocation framework when the current location is found. - * @param {PositionOptions} position The current position. - */ -Geolocation.prototype.setLocation = function(position) { - this.lastPosition = position; - for (var i = 0; i < this.callbacks.onLocationChanged.length; i++) { - var f = this.callbacks.onLocationChanged.shift(); - f(position); - } -}; - -/** - * Called by the geolocation framework when an error occurs while looking up the current position. - * @param {String} message The text of the error message. - */ -Geolocation.prototype.setError = function(message) { - this.lastError = message; - for (var i = 0; i < this.callbacks.onError.length; i++) { - var f = this.callbacks.onError.shift(); - f(message); - } -}; - -PhoneGap.addConstructor(function() { - if (typeof navigator.geolocation == "undefined") navigator.geolocation = new Geolocation(); -}); -/** - * This class provides access to native mapping applications on the device. - */ -function Map() { - -} - -/** - * Shows a native map on the device with pins at the given positions. - * @param {Array} positions - */ -Map.prototype.show = function(positions) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.map == "undefined") navigator.map = new Map(); -}); - -/** - * This class provides access to the device media, interfaces to both sound and video - * @constructor - */ -function Media(src) { - this.src = src; -} - -Media.prototype.play = function() { -} - -Media.prototype.pause = function() { -} - -Media.prototype.stop = function() { -} - - -/** - * This class contains information about any Media errors. - * @constructor - */ -function MediaError() { - this.code = null, - this.message = ""; -} - -MediaError.MEDIA_ERR_ABORTED = 1; -MediaError.MEDIA_ERR_NETWORK = 2; -MediaError.MEDIA_ERR_DECODE = 3; -MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; - - -//if (typeof navigator.audio == "undefined") navigator.audio = new Media(src); -/** - * This class provides access to notifications on the device. - */ -function Notification() { - -} - -/** - * Open a native alert dialog, with a customizable title and button text. - * @param {String} message Message to print in the body of the alert - * @param {String} [title="Alert"] Title of the alert dialog (default: Alert) - * @param {String} [buttonLabel="OK"] Label of the close button (default: OK) - */ -Notification.prototype.alert = function(message, title, buttonLabel) { - // Default is to use a browser alert; this will use "index.html" as the title though - alert(message); -}; - -/** - * Start spinning the activity indicator on the statusbar - */ -Notification.prototype.activityStart = function() { -}; - -/** - * Stop spinning the activity indicator on the statusbar, if it's currently spinning - */ -Notification.prototype.activityStop = function() { -}; - -/** - * Causes the device to blink a status LED. - * @param {Integer} count The number of blinks. - * @param {String} colour The colour of the light. - */ -Notification.prototype.blink = function(count, colour) { - -}; - -/** - * Causes the device to vibrate. - * @param {Integer} mills The number of milliseconds to vibrate for. - */ -Notification.prototype.vibrate = function(mills) { - -}; - -/** - * Causes the device to beep. - * @param {Integer} count The number of beeps. - * @param {Integer} volume The volume of the beep. - */ -Notification.prototype.beep = function(count, volume) { - -}; - -// TODO: of course on Blackberry and Android there notifications in the UI as well - -PhoneGap.addConstructor(function() { - if (typeof navigator.notification == "undefined") navigator.notification = new Notification(); -}); - -/** - * This class provides access to the device orientation. - * @constructor - */ -function Orientation() { - /** - * The current orientation, or null if the orientation hasn't changed yet. - */ - this.currentOrientation = null; -} - -/** - * Set the current orientation of the phone. This is called from the device automatically. - * - * When the orientation is changed, the DOMEvent \c orientationChanged is dispatched against - * the document element. The event has the property \c orientation which can be used to retrieve - * the device's current orientation, in addition to the \c Orientation.currentOrientation class property. - * - * @param {Number} orientation The orientation to be set - */ -Orientation.prototype.setOrientation = function(orientation) { - Orientation.currentOrientation = orientation; - var e = document.createEvent('Events'); - e.initEvent('orientationChanged', 'false', 'false'); - e.orientation = orientation; - document.dispatchEvent(e); -}; - -/** - * Asynchronously aquires the current orientation. - * @param {Function} successCallback The function to call when the orientation - * is known. - * @param {Function} errorCallback The function to call when there is an error - * getting the orientation. - */ -Orientation.prototype.getCurrentOrientation = function(successCallback, errorCallback) { - // If the position is available then call success - // If the position is not available then call error -}; - -/** - * Asynchronously aquires the orientation repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the orientation - * data is available. - * @param {Function} errorCallback The function to call when there is an error - * getting the orientation data. - */ -Orientation.prototype.watchOrientation = function(successCallback, errorCallback) { - // Invoke the appropriate callback with a new Position object every time the implementation - // determines that the position of the hosting device has changed. - this.getCurrentPosition(successCallback, errorCallback); - return setInterval(function() { - navigator.orientation.getCurrentOrientation(successCallback, errorCallback); - }, 10000); -}; - -/** - * Clears the specified orientation watch. - * @param {String} watchId The ID of the watch returned from #watchOrientation. - */ -Orientation.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -}; - -PhoneGap.addConstructor(function() { - if (typeof navigator.orientation == "undefined") navigator.orientation = new Orientation(); -}); -/** - * This class contains position information. - * @param {Object} lat - * @param {Object} lng - * @param {Object} acc - * @param {Object} alt - * @param {Object} altacc - * @param {Object} head - * @param {Object} vel - * @constructor - */ -function Position(coords, timestamp) { - this.coords = coords; - this.timestamp = new Date().getTime(); -} - -function Coordinates(lat, lng, alt, acc, head, vel) { - /** - * The latitude of the position. - */ - this.latitude = lat; - /** - * The longitude of the position, - */ - this.longitude = lng; - /** - * The accuracy of the position. - */ - this.accuracy = acc; - /** - * The altitude of the position. - */ - this.altitude = alt; - /** - * The direction the device is moving at the position. - */ - this.heading = head; - /** - * The velocity with which the device is moving at the position. - */ - this.speed = vel; -} - -/** - * This class specifies the options for requesting position data. - * @constructor - */ -function PositionOptions() { - /** - * Specifies the desired position accuracy. - */ - this.enableHighAccuracy = true; - /** - * The timeout after which if position data cannot be obtained the errorCallback - * is called. - */ - this.timeout = 10000; -} - -/** - * This class contains information about any GSP errors. - * @constructor - */ -function PositionError() { - this.code = null; - this.message = ""; -} - -PositionError.UNKNOWN_ERROR = 0; -PositionError.PERMISSION_DENIED = 1; -PositionError.POSITION_UNAVAILABLE = 2; -PositionError.TIMEOUT = 3; -/** - * This class provides access to the device SMS functionality. - * @constructor - */ -function Sms() { - -} - -/** - * Sends an SMS message. - * @param {Integer} number The phone number to send the message to. - * @param {String} message The contents of the SMS message to send. - * @param {Function} successCallback The function to call when the SMS message is sent. - * @param {Function} errorCallback The function to call when there is an error sending the SMS message. - * @param {PositionOptions} options The options for accessing the GPS location such as timeout and accuracy. - */ -Sms.prototype.send = function(number, message, successCallback, errorCallback, options) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.sms == "undefined") navigator.sms = new Sms(); -}); -/** - * This class provides access to the telephony features of the device. - * @constructor - */ -function Telephony() { - -} - -/** - * Calls the specifed number. - * @param {Integer} number The number to be called. - */ -Telephony.prototype.call = function(number) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.telephony == "undefined") navigator.telephony = new Telephony(); -}); -/** - * This class exposes mobile phone interface controls to JavaScript, such as - * native tab and tool bars, etc. - * @constructor - */ -function UIControls() { - this.tabBarTag = 0; - this.tabBarCallbacks = {}; -} - -/** - * Create a native tab bar that can have tab buttons added to it which can respond to events. - */ -UIControls.prototype.createTabBar = function() {}; - -/** - * Show a tab bar. The tab bar has to be created first. - * @param {Object} [options] Options indicating how the tab bar should be shown: - * - \c height integer indicating the height of the tab bar (default: \c 49) - * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom) - */ -UIControls.prototype.showTabBar = function(options) {}; - -/** - * Hide a tab bar. The tab bar has to be created first. - */ -UIControls.prototype.hideTabBar = function(animate) {}; - -/** - * Create a new tab bar item for use on a previously created tab bar. Use ::showTabBarItems to show the new item on the tab bar. - * - * If the supplied image name is one of the labels listed below, then this method will construct a tab button - * using the standard system buttons. Note that if you use one of the system images, that the \c title you supply will be ignored. - * - * Tab Buttons - * - tabButton:More - * - tabButton:Favorites - * - tabButton:Featured - * - tabButton:TopRated - * - tabButton:Recents - * - tabButton:Contacts - * - tabButton:History - * - tabButton:Bookmarks - * - tabButton:Search - * - tabButton:Downloads - * - tabButton:MostRecent - * - tabButton:MostViewed - * @param {String} name internal name to refer to this tab by - * @param {String} [title] title text to show on the tab, or null if no text should be shown - * @param {String} [image] image filename or internal identifier to show, or null if now image should be shown - * @param {Object} [options] Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden - */ -UIControls.prototype.createTabBarItem = function(name, label, image, options) {}; - -/** - * Update an existing tab bar item to change its badge value. - * @param {String} name internal name used to represent this item when it was created - * @param {Object} options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden - */ -UIControls.prototype.updateTabBarItem = function(name, options) {}; - -/** - * Show previously created items on the tab bar - * @param {String} arguments... the item names to be shown - * @param {Object} [options] dictionary of options, notable options including: - * - \c animate indicates that the items should animate onto the tab bar - * @see createTabBarItem - * @see createTabBar - */ -UIControls.prototype.showTabBarItems = function(tabs, options) {}; - -/** - * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item. - * @param {String} tabName the name of the tab to select, or null if all tabs should be deselected - * @see createTabBarItem - * @see showTabBarItems - */ -UIControls.prototype.selectTabBarItem = function(tab) {}; - -/** - * Function called when a tab bar item has been selected. - * @param {Number} tag the tag number for the item that has been selected - */ -UIControls.prototype.tabBarItemSelected = function(tag) { - if (typeof(this.tabBarCallbacks[tag]) == 'function') - this.tabBarCallbacks[tag](); -}; - -/** - * Create a toolbar. - */ -UIControls.prototype.createToolBar = function() {}; - -/** - * Function called when a tab bar item has been selected. - * @param {String} title the title to set within the toolbar - */ -UIControls.prototype.setToolBarTitle = function(title) {}; - -PhoneGap.addConstructor(function() { - window.uicontrols = new UIControls(); -}); -/* - * Since we can't guarantee that we will have the most recent, we just try our best! - * - * Also, the API doesn't specify which version is the best version of the API - */ - -Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) -{ - var position = Geo.getCurrentLocation(); - this.global_success = successCallback; - this.fail = errorCallback; -} - - -// Run the global callback -Geolocation.prototype.gotCurrentPosition = function(lat, lng, alt, altacc, head, vel, stamp) -{ - if (lat == "undefined" || lng == "undefined") - { - this.fail(); - } - else - { - coords = new Coordinates(lat, lng, alt, altacc, head, vel); - loc = new Position(coords, stamp); - this.global_success(loc); - } -} - -/* - * This turns on the GeoLocator class, which has two listeners. - * The listeners have their own timeouts, and run independently of this process - * In this case, we return the key to the watch hash - */ - -Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) -{ - var frequency = (options != undefined)? options.frequency : 10000; - - if (!this.listeners) - { - this.listeners = []; - } - - var key = this.listeners.push( {"success" : successCallback, "fail" : failCallback }) - 1; - - // TO-DO: Get the names of the method and pass them as strings to the Java. - return Geolocation.start(frequency, key); -} - -/* - * Retrieve and stop this listener from listening to the GPS - * - */ -Geolocation.prototype.success = function(key, lat, lng, alt, altacc, head, vel, stamp) -{ - var coords = new Coordinates(lat, lng, alt, altacc, head, vel); - var loc = new Position(coords, stamp); - this.listeners[key].success(loc); -} - -Geolocation.prototype.fail = function(key) -{ - this.listeners[key].fail(); -} - -Geolocation.prototype.clearWatch = function(watchId) -{ - Geo.stop(watchId); -} - - -Notification.prototype.vibrate = function(mills) -{ - DroidGap.vibrate(mills); -} - -/* - * On the Android, we don't beep, we notify you with your - * notification! We shouldn't keep hammering on this, and should - * review what we want beep to do. - */ - -Notification.prototype.beep = function(count, volume) -{ - DroidGap.beep(count); -} -// Need to define these for android -_accel = {} -_accel.x = 0; -_accel.y = 0; -_accel.z = 0; - -function gotAccel(x, y, z) -{ - _accel.x = x; - _accel.y = y; - _accel.z = z; -} - -/** - * This class provides access to device accelerometer data. - * @constructor - */ -function Accelerometer() { - /** - * The last known acceleration. - */ - this.lastAcceleration = null; -} - -/** - * Asynchronously aquires the current acceleration. - * @param {Function} successCallback The function to call when the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ -Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) { - // If the acceleration is available then call success - // If the acceleration is not available then call error - - // Created for iPhone, Iphone passes back _accel obj litteral - if (typeof successCallback == "function") { - var accel = new Acceleration(_accel.x,_accel.y,_accel.z); - Accelerometer.lastAcceleration = accel; - successCallback(accel); - } -} - -/** - * Asynchronously aquires the acceleration repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ - -Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) { - // TODO: add the interval id to a list so we can clear all watches - var frequency = (options != undefined)? options.frequency : 10000; - - Accel.start(frequency); - return setInterval(function() { - navigator.accelerometer.getCurrentAcceleration(successCallback, errorCallback, options); - }, frequency); -} - -/** - * Clears the specified accelerometer watch. - * @param {String} watchId The ID of the watch returned from #watchAcceleration. - */ -Accelerometer.prototype.clearWatch = function(watchId) { - Accel.stop(); - clearInterval(watchId); -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer(); -}); diff --git a/android/build.xml b/android/build.xml deleted file mode 100644 index d6f6edbf..00000000 --- a/android/build.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/android/default.properties b/android/default.properties deleted file mode 100644 index 19e9e9df..00000000 --- a/android/default.properties +++ /dev/null @@ -1,22 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system use, -# "build.properties", and override values to adapt the script to your -# project structure. - -# Project target. -target=Google Inc.:Google APIs:3 -# apk configurations. This property allows creation of APK files with limited -# resources. For example, if your application contains many locales and -# you wish to release multiple smaller apks instead of a large one, you can -# define configuration to create apks with limited language sets. -# Format is a comma separated list of configuration names. For each -# configuration, a property will declare the resource configurations to -# include. Example: -# apk-configurations=european,northamerica -# apk-config-european=en,fr,it,de,es -# apk-config-northamerica=en,es -apk-configurations= diff --git a/android/local.properties b/android/local.properties deleted file mode 100644 index e3fc4c14..00000000 --- a/android/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must *NOT* be checked in Version Control Systems, -# as it contains information specific to your local configuration. - -# location of the SDK. This is only used by Ant -# For customization when using a Version Control System, please read the -# header note. -sdk-location=/home/bowserj/android-sdk-linux_x86-1.5_r1 diff --git a/android/res/drawable/icon.png b/android/res/drawable/icon.png deleted file mode 100644 index 697df7f3..00000000 Binary files a/android/res/drawable/icon.png and /dev/null differ diff --git a/android/res/layout/main.xml b/android/res/layout/main.xml deleted file mode 100644 index 4a019a49..00000000 --- a/android/res/layout/main.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - diff --git a/android/res/raw/bird.mp3 b/android/res/raw/bird.mp3 deleted file mode 100644 index 9a63a12d..00000000 Binary files a/android/res/raw/bird.mp3 and /dev/null differ diff --git a/android/res/raw/off.mp3 b/android/res/raw/off.mp3 deleted file mode 100644 index 669b8222..00000000 Binary files a/android/res/raw/off.mp3 and /dev/null differ diff --git a/android/res/raw/on.mp3 b/android/res/raw/on.mp3 deleted file mode 100644 index ab6759f4..00000000 Binary files a/android/res/raw/on.mp3 and /dev/null differ diff --git a/android/res/values/strings.xml b/android/res/values/strings.xml deleted file mode 100644 index 77ae125f..00000000 --- a/android/res/values/strings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - PhoneGap - file:///android_asset/www/index.html - diff --git a/android/src/com/phonegap/demo/AccelListener.java b/android/src/com/phonegap/demo/AccelListener.java deleted file mode 100644 index acb2f2a8..00000000 --- a/android/src/com/phonegap/demo/AccelListener.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.phonegap.demo; - -import static android.hardware.SensorManager.DATA_X; -import static android.hardware.SensorManager.DATA_Y; -import static android.hardware.SensorManager.DATA_Z; -import android.hardware.SensorManager; -import android.content.Context; -import android.hardware.SensorListener; -import android.webkit.WebView; - -public class AccelListener implements SensorListener{ - - WebView mAppView; - Context mCtx; - String mKey; - int mTime = 10000; - boolean started = false; - - private SensorManager sensorManager; - - private long lastUpdate = -1; - - AccelListener(Context ctx, WebView appView) - { - mCtx = ctx; - mAppView = appView; - sensorManager = (SensorManager) mCtx.getSystemService(Context.SENSOR_SERVICE); - } - - public void start(int time) - { - mTime = time; - if (!started) - { - sensorManager.registerListener(this, - SensorManager.SENSOR_ACCELEROMETER, - SensorManager.SENSOR_DELAY_GAME); - } - } - - public void stop() - { - if(started) - sensorManager.unregisterListener(this); - } - - public void onAccuracyChanged(int sensor, int accuracy) { - // This should call the FAIL method - } - - public void onSensorChanged(int sensor, float[] values) { - if (sensor != SensorManager.SENSOR_ACCELEROMETER || values.length < 3) - return; - long curTime = System.currentTimeMillis(); - if (lastUpdate == -1 || (curTime - lastUpdate) > mTime) { - - lastUpdate = curTime; - - float x = values[DATA_X]; - float y = values[DATA_Y]; - float z = values[DATA_Z]; - mAppView.loadUrl("javascript:gotAccel(" + x + ", " + y + "," + z + " )"); - } - } - - -} diff --git a/android/src/com/phonegap/demo/AccelTuple.java b/android/src/com/phonegap/demo/AccelTuple.java deleted file mode 100644 index 95a101a1..00000000 --- a/android/src/com/phonegap/demo/AccelTuple.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Softwareâ€), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -public class AccelTuple { - public long accelX; - public long accelY; - public long accelZ; -} diff --git a/android/src/com/phonegap/demo/AudioHandler.java b/android/src/com/phonegap/demo/AudioHandler.java deleted file mode 100644 index b6e76268..00000000 --- a/android/src/com/phonegap/demo/AudioHandler.java +++ /dev/null @@ -1,186 +0,0 @@ -package com.phonegap.demo; - -import java.io.File; -import java.io.IOException; - -import android.content.Context; -import android.media.AudioManager; -import android.media.MediaPlayer; -import android.media.MediaPlayer.OnErrorListener; -import android.media.MediaRecorder; -import android.media.MediaPlayer.OnBufferingUpdateListener; -import android.media.MediaPlayer.OnCompletionListener; -import android.media.MediaPlayer.OnPreparedListener; -import android.util.Log; - -public class AudioHandler implements OnCompletionListener, OnPreparedListener, OnErrorListener { - private MediaRecorder recorder; - private boolean isRecording = false; - MediaPlayer mPlayer; - private boolean isPlaying = false; - private String recording; - private String saveFile; - private Context mCtx; - - public AudioHandler(String file, Context ctx) { - this.recording = file; - this.mCtx = ctx; - } - - protected void startRecording(String file){ - if (!isRecording){ - saveFile=file; - recorder = new MediaRecorder(); - recorder.setAudioSource(MediaRecorder.AudioSource.MIC); - recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); - recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); - recorder.setOutputFile(this.recording); - try { - recorder.prepare(); - } catch (IllegalStateException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - isRecording = true; - recorder.start(); - } - } - - private void moveFile(String file) { - /* this is a hack to save the file as the specified name */ - File f = new File (this.recording); - f.renameTo(new File("/sdcard" + file)); - } - - protected void stopRecording(){ - try{ - if((recorder != null)&&(isRecording)) - { - isRecording = false; - recorder.stop(); - recorder.release(); - } - moveFile(saveFile); - }catch (Exception e){e.printStackTrace();} - } - - protected void startPlaying(String file) { - if (isPlaying==false) { - try { - mPlayer = new MediaPlayer(); - isPlaying=true; - Log.d("Audio startPlaying", "audio: " + file); - if (isStreaming(file)) - { - Log.d("AudioStartPlaying", "Streaming"); - // Streaming prepare async - mPlayer.setDataSource(file); - mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); - mPlayer.prepareAsync(); - } else { - Log.d("AudioStartPlaying", "File"); - // Not streaming prepare synchronous, abstract base directory - mPlayer.setDataSource("/sdcard/" + file); - mPlayer.prepare(); - } - mPlayer.setOnPreparedListener(this); - } catch (Exception e) { e.printStackTrace(); } - } - } - - protected void stopPlaying() { - if (isPlaying) { - mPlayer.stop(); - mPlayer.release(); - isPlaying=false; - } - } - - public void onCompletion(MediaPlayer mPlayer) { - mPlayer.stop(); - mPlayer.release(); - isPlaying=false; - } - - protected long getCurrentPosition() { - if (isPlaying) - { - return(mPlayer.getCurrentPosition()); - } else { return(-1); } - } - - private boolean isStreaming(String file) - { - if (file.contains("http://")) { - return true; - } else { - return false; - } - } - - protected long getDuration(String file) { - long duration = -2; - if (!isPlaying & !isStreaming(file)) { - try { - mPlayer = new MediaPlayer(); - mPlayer.setDataSource("/sdcard/" + file); - mPlayer.prepare(); - duration = mPlayer.getDuration(); - mPlayer.release(); - } catch (Exception e) { e.printStackTrace(); return(-3); } - } else - if (isPlaying & !isStreaming(file)) { - duration = mPlayer.getDuration(); - } else - if (isPlaying & isStreaming(file)) { - try { - duration = mPlayer.getDuration(); - } catch (Exception e) { e.printStackTrace(); return(-4); } - }else { return -1; } - return duration; - } - - public void onPrepared(MediaPlayer mPlayer) { - if (isPlaying) { - mPlayer.setOnCompletionListener(this); - mPlayer.setOnBufferingUpdateListener(new OnBufferingUpdateListener() - { - public void onBufferingUpdate(MediaPlayer mPlayer, int percent) - { - /* TODO: call back, e.g. update outer progress bar */ - Log.d("AudioOnBufferingUpdate", "percent: " + percent); - } - }); - mPlayer.start(); - } - } - - public boolean onError(MediaPlayer mPlayer, int arg1, int arg2) { - Log.e("AUDIO onError", "error " + arg1 + " " + arg2); - return false; - } - - protected void setAudioOutputDevice(int output){ - // Changes the default audio output device to speaker or earpiece - AudioManager audiMgr = (AudioManager) mCtx.getSystemService(Context.AUDIO_SERVICE); - if (output == (2)) - audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL); - else if (output == (1)){ - audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL); - }else - Log.e("AudioHandler setAudioOutputDevice", " unknown output device"); - } - - protected int getAudioOutputDevice(){ - AudioManager audiMgr = (AudioManager) mCtx.getSystemService(Context.AUDIO_SERVICE); - if (audiMgr.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_EARPIECE) - return 1; - else if (audiMgr.getRouting(AudioManager.MODE_NORMAL) == AudioManager.ROUTE_SPEAKER) - return 2; - else - return -1; - } -} diff --git a/android/src/com/phonegap/demo/DirectoryManager.java b/android/src/com/phonegap/demo/DirectoryManager.java deleted file mode 100644 index ef91d240..00000000 --- a/android/src/com/phonegap/demo/DirectoryManager.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.phonegap.demo; - -import java.io.File; - -import android.os.Environment; -import android.os.StatFs; -import android.util.Log; - -public class DirectoryManager { - - protected boolean testFileExists (String name){ - boolean status; - if ((testSaveLocationExists())&&(!name.equals(""))){ - File path = Environment.getExternalStorageDirectory(); - File newPath = constructFilePaths(path.toString(), name); - status = newPath.exists(); - }else{ - status = false; - } - return status; - } - - protected long getFreeDiskSpace(){ - /* - * gets the available SD card free space or returns -1 if the SD card is not mounted. - */ - String status = Environment.getExternalStorageState(); - long freeSpace = 0; - if (status.equals(Environment.MEDIA_MOUNTED)) { - try { - File path = Environment.getExternalStorageDirectory(); - StatFs stat = new StatFs(path.getPath()); - long blockSize = stat.getBlockSize(); - long availableBlocks = stat.getAvailableBlocks(); - freeSpace = availableBlocks*blockSize/1024; - } catch (Exception e) {e.printStackTrace(); } - } else { return -1; } - return (freeSpace); - } - - protected boolean createDirectory(String directoryName){ - boolean status; - if ((testSaveLocationExists())&&(!directoryName.equals(""))){ - File path = Environment.getExternalStorageDirectory(); - File newPath = constructFilePaths(path.toString(), directoryName); - status = newPath.mkdir(); - status = true; - }else - status = false; - return status; - } - - protected boolean testSaveLocationExists(){ - String sDCardStatus = Environment.getExternalStorageState(); - boolean status; - if (sDCardStatus.equals(Environment.MEDIA_MOUNTED)){ - status = true; - }else - status = false; - return status; - } - - protected boolean deleteDirectory(String fileName){ - boolean status; - SecurityManager checker = new SecurityManager(); - - if ((testSaveLocationExists())&&(!fileName.equals(""))){ - - File path = Environment.getExternalStorageDirectory(); - File newPath = constructFilePaths(path.toString(), fileName); - checker.checkDelete(newPath.toString()); - if(newPath.isDirectory()){ - String[] listfile = newPath.list(); - // delete all files within the specified directory and then delete the directory - try{ - for (int i=0; i < listfile.length; i++){ - File deletedFile = new File (newPath.toString()+"/"+listfile[i].toString()); - deletedFile.delete(); - } - newPath.delete(); - Log.i("DirectoryManager deleteDirectory", fileName); - status = true; - }catch (Exception e){ - e.printStackTrace(); - status = false; - } - - }else - status = false; - }else - status = false; - return status; - } - - protected boolean deleteFile(String fileName){ - boolean status; - SecurityManager checker = new SecurityManager(); - - if ((testSaveLocationExists())&&(!fileName.equals(""))){ - - File path = Environment.getExternalStorageDirectory(); - File newPath = constructFilePaths(path.toString(), fileName); - checker.checkDelete(newPath.toString()); - if (newPath.isFile()){ - try { - Log.i("DirectoryManager deleteFile", fileName); - newPath.delete(); - status = true; - }catch (SecurityException se){ - se.printStackTrace(); - status = false; - } - }else - status = false; - }else - status = false; - return status; - } - - private File constructFilePaths (String file1, String file2){ - File newPath; - newPath = new File(file1+"/"+file2); - return newPath; - } - -} \ No newline at end of file diff --git a/android/src/com/phonegap/demo/DroidGap.java b/android/src/com/phonegap/demo/DroidGap.java deleted file mode 100644 index 7d49187a..00000000 --- a/android/src/com/phonegap/demo/DroidGap.java +++ /dev/null @@ -1,130 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * Software), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import java.lang.reflect.Field; - -import android.app.Activity; -import android.app.AlertDialog; -import android.content.Context; -import android.content.res.Configuration; -import android.os.Bundle; -import android.util.Log; -import android.view.Window; -import android.view.WindowManager; -import android.webkit.JsResult; -import android.webkit.WebChromeClient; -import android.webkit.WebView; - -public class DroidGap extends Activity { - - private static final String LOG_TAG = "DroidGap"; - private WebView appView; - private String uri; - private PhoneGap gap; - private GeoBroker geo; - private AccelListener accel; - - /** Called when the activity is first created. */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - getWindow().requestFeature(Window.FEATURE_NO_TITLE); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); - setContentView(R.layout.main); - - appView = (WebView) findViewById(R.id.appView); - - /* This changes the setWebChromeClient to log alerts to LogCat! Important for Javascript Debugging */ - - appView.setWebChromeClient(new GapClient(this)); - appView.getSettings().setJavaScriptEnabled(true); - appView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); - - /* Bind the appView object to the gap class methods */ - bindBrowser(appView); - - /* Load a URI from the strings.xml file */ - Class c = R.string.class; - Field f; - - int i = 0; - - try { - f = c.getField("url"); - i = f.getInt(f); - this.uri = this.getResources().getString(i); - } catch (Exception e) - { - this.uri = "http://www.phonegap.com"; - } - appView.loadUrl(this.uri); - - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - //don't reload the current page when the orientation is changed - super.onConfigurationChanged(newConfig); - } - - private void bindBrowser(WebView appView) - { - // The PhoneGap class handles the Notification and Android Specific crap - this.gap = new PhoneGap(this, appView); - this.geo = new GeoBroker(appView, this); - this.accel = new AccelListener(this, appView); - // This creates the new javascript interfaces for PhoneGap - // Ewww - It's called DroidGap again. :( - appView.addJavascriptInterface(gap, "DroidGap"); - appView.addJavascriptInterface(geo, "Geo"); - appView.addJavascriptInterface(accel, "Accel"); - } - - /** - * Provides a hook for calling "alert" from javascript. Useful for - * debugging your javascript. - */ - final class GapClient extends WebChromeClient { - - Context mCtx; - GapClient(Context ctx) - { - mCtx = ctx; - } - - @Override - public boolean onJsAlert(WebView view, String url, String message, JsResult result) { - Log.d(LOG_TAG, message); - // This shows the dialog box. This can be commented out for dev - AlertDialog.Builder alertBldr = new AlertDialog.Builder(mCtx); - alertBldr.setMessage(message); - alertBldr.setTitle("Alert"); - alertBldr.show(); - result.confirm(); - return true; - } - } - -} \ No newline at end of file diff --git a/android/src/com/phonegap/demo/GeoBroker.java b/android/src/com/phonegap/demo/GeoBroker.java deleted file mode 100644 index 682e010b..00000000 --- a/android/src/com/phonegap/demo/GeoBroker.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.phonegap.demo; - -import java.util.HashMap; - -import android.content.Context; -import android.webkit.WebView; - -/* - * This class is the interface to the Geolocation. It's bound to the geo object. - * - * This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener - */ - -public class GeoBroker { - private WebView mAppView; - private Context mCtx; - private HashMap geoListeners; - - GeoBroker(WebView view, Context ctx) - { - mCtx = ctx; - mAppView = view; - } - - public void getCurrentLocation() - { - GeoListener listener = new GeoListener("global", mCtx, 10000, mAppView); - } - - public String start(int freq, String key) - { - GeoListener listener = new GeoListener(key, mCtx, freq, mAppView); - geoListeners.put(key, listener); - return key; - } - - public void stop(String key) - { - GeoListener geo = geoListeners.get(key); - } -} diff --git a/android/src/com/phonegap/demo/GeoListener.java b/android/src/com/phonegap/demo/GeoListener.java deleted file mode 100644 index 4a7f0195..00000000 --- a/android/src/com/phonegap/demo/GeoListener.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.phonegap.demo; - -import android.content.Context; -import android.location.Location; -import android.webkit.WebView; - -public class GeoListener { - String id; - String successCallback; - String failCallback; - GpsListener mGps; - NetworkListener mNetwork; - Context mCtx; - private WebView mAppView; - - int interval; - - GeoListener(String i, Context ctx, int time, WebView appView) - { - id = i; - interval = time; - mCtx = ctx; - mGps = new GpsListener(mCtx, interval, this); - mNetwork = new NetworkListener(mCtx, interval, this); - mAppView = appView; - } - - void success(Location loc) - { - /* - * We only need to figure out what we do when we succeed! - */ - - String params; - /* - * Build the giant string to send back to Javascript! - */ - params = loc.getLatitude() + "," + loc.getLongitude() + ", " + loc.getAltitude() + "," + loc.getAccuracy() + "," + loc.getBearing(); - params += "," + loc.getSpeed() + "," + loc.getTime(); - if(id != "global") - { - mAppView.loadUrl("javascript:navigator.geolocation.success(" + id + "," + params + ")"); - } - else - { - mAppView.loadUrl("javascript:navigator.geolocation.gotCurrentPosition(" + params + ")"); - this.stop(); - } - } - - void fail() - { - // Do we need to know why? How would we handle this? - if (id != "global") { - mAppView.loadUrl("javascript:navigator.geolocation.fail(" + id + ")"); - } - else - { - mAppView.loadUrl("javascript:navigator.geolocation.fail()"); - } - } - - // This stops the listener - void stop() - { - mGps.stop(); - mNetwork.stop(); - } - - public Location getCurrentLocation() { - Location loc = mGps.getLocation(); - if (loc == null) - loc = mNetwork.getLocation(); - return loc; - } -} diff --git a/android/src/com/phonegap/demo/GeoTuple.java b/android/src/com/phonegap/demo/GeoTuple.java deleted file mode 100644 index e6272cbb..00000000 --- a/android/src/com/phonegap/demo/GeoTuple.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Softwareâ€), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -public class GeoTuple { - - public double lat; - public double lng; - public double ele; - -} diff --git a/android/src/com/phonegap/demo/GpsListener.java b/android/src/com/phonegap/demo/GpsListener.java deleted file mode 100644 index 7a34ef13..00000000 --- a/android/src/com/phonegap/demo/GpsListener.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Softwareâ€), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import android.content.Context; -import android.location.Location; -import android.location.LocationManager; -import android.location.LocationListener; -import android.os.Bundle; -import android.util.Log; - -public class GpsListener implements LocationListener { - - private Context mCtx; - private Location cLoc; - private LocationManager mLocMan; - private static final String LOG_TAG = "PhoneGap"; - private GeoListener owner; - - public GpsListener(Context ctx, int interval, GeoListener m) - { - owner = m; - mCtx = ctx; - mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE); - mLocMan.requestLocationUpdates(LocationManager.GPS_PROVIDER, interval, 0, this); - cLoc = mLocMan.getLastKnownLocation(LocationManager.GPS_PROVIDER); - } - - public Location getLocation() - { - cLoc = mLocMan.getLastKnownLocation(LocationManager.GPS_PROVIDER); - return cLoc; - } - - public void onProviderDisabled(String provider) { - // TODO Auto-generated method stub - Log.d(LOG_TAG, "The provider " + provider + " is disabled"); - owner.fail(); - } - - public void onProviderEnabled(String provider) { - // TODO Auto-generated method stub - Log.d(LOG_TAG, "The provider "+ provider + " is enabled"); - } - - - public void onStatusChanged(String provider, int status, Bundle extras) { - // TODO Auto-generated method stub - Log.d(LOG_TAG, "The status of the provider " + provider + " has changed"); - if(status == 0) - { - Log.d(LOG_TAG, provider + " is OUT OF SERVICE"); - owner.fail(); - } - else if(status == 1) - { - Log.d(LOG_TAG, provider + " is TEMPORARILY_UNAVAILABLE"); - } - else - { - Log.d(LOG_TAG, provider + " is Available"); - } - } - - - public void onLocationChanged(Location location) { - Log.d(LOG_TAG, "The location has been updated!"); - owner.success(location); - } - - public boolean hasLocation() { - return (cLoc != null); - } - - public void stop() - { - mLocMan.removeUpdates(this); - } - -} diff --git a/android/src/com/phonegap/demo/HttpHandler.java b/android/src/com/phonegap/demo/HttpHandler.java deleted file mode 100644 index bd26d75f..00000000 --- a/android/src/com/phonegap/demo/HttpHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.phonegap.demo; - -import java.io.EOFException; -import java.io.FileOutputStream; -import java.io.InputStream; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.impl.client.DefaultHttpClient; - -public class HttpHandler { - - protected Boolean get(String url, String file) - { - HttpEntity entity = getHttpEntity(url); - try { - writeToDisk(entity, file); - } catch (Exception e) { e.printStackTrace(); return false; } - try { - entity.consumeContent(); - } catch (Exception e) { e.printStackTrace(); return false; } - return true; - } - - private HttpEntity getHttpEntity(String url) - /** - * get the http entity at a given url - */ - { - HttpEntity entity=null; - try { - DefaultHttpClient httpclient = new DefaultHttpClient(); - HttpGet httpget = new HttpGet(url); - HttpResponse response = httpclient.execute(httpget); - entity = response.getEntity(); - } catch (Exception e) { e.printStackTrace(); return null; } - return entity; - } - - private void writeToDisk(HttpEntity entity, String file) throws EOFException - /** - * writes a HTTP entity to the specified filename and location on disk - */ - { - int i=0; - String FilePath="/sdcard/" + file; - try { - InputStream in = entity.getContent(); - byte buff[] = new byte[1024]; - FileOutputStream out= - new FileOutputStream(FilePath); - do { - int numread = in.read(buff); - if (numread <= 0) - break; - out.write(buff, 0, numread); - System.out.println("numread" + numread); - i++; - } while (true); - out.flush(); - out.close(); - } catch (Exception e) { e.printStackTrace(); } - } -} diff --git a/android/src/com/phonegap/demo/NetworkListener.java b/android/src/com/phonegap/demo/NetworkListener.java deleted file mode 100644 index 2db7b8c6..00000000 --- a/android/src/com/phonegap/demo/NetworkListener.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Softwareâ€), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import android.content.Context; -import android.location.Location; -import android.location.LocationManager; -import android.location.LocationListener; -import android.os.Bundle; -import android.util.Log; - -public class NetworkListener implements LocationListener { - - private Context mCtx; - private Location cLoc; - private LocationManager mLocMan; - private static final String LOG_TAG = "PhoneGap"; - GeoListener owner; - - public NetworkListener(Context ctx, int interval, GeoListener m) - { - owner = m; - mCtx = ctx; - mLocMan = (LocationManager) mCtx.getSystemService(Context.LOCATION_SERVICE); - mLocMan.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, interval, 0, this); - cLoc = mLocMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); - } - - public Location getLocation() - { - cLoc = mLocMan.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); - return cLoc; - } - - public void onProviderDisabled(String provider) { - // TODO Auto-generated method stub - Log.d(LOG_TAG, "The provider " + provider + " is disabled"); - } - - - public void onProviderEnabled(String provider) { - // TODO Auto-generated method stub - Log.d(LOG_TAG, "The provider "+ provider + " is enabled"); - } - - - public void onStatusChanged(String provider, int status, Bundle extras) { - // TODO Auto-generated method stub - Log.d(LOG_TAG, "The status of the provider " + provider + " has changed"); - if(status == 0) - { - Log.d(LOG_TAG, provider + " is OUT OF SERVICE"); - } - else if(status == 1) - { - Log.d(LOG_TAG, provider + " is TEMPORARILY_UNAVAILABLE"); - } - else - { - Log.d(LOG_TAG, provider + " is Available"); - } - } - - - /* - * The GPS is the primary form of Geolocation in PhoneGap. Only fire the success variables if the GPS is down - * for some reason - */ - public void onLocationChanged(Location location) { - Log.d(LOG_TAG, "The location has been updated!"); - if (!owner.mGps.hasLocation()) - { - owner.success(location); - } - cLoc = location; - } - - public void stop() - { - mLocMan.removeUpdates(this); - } - -} diff --git a/android/src/com/phonegap/demo/Orientation.java b/android/src/com/phonegap/demo/Orientation.java deleted file mode 100644 index 755e4156..00000000 --- a/android/src/com/phonegap/demo/Orientation.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * “Softwareâ€), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED “AS ISâ€, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -import android.content.Context; -import android.hardware.SensorManager; -import android.hardware.SensorListener; -import android.webkit.WebView; - -public class Orientation implements SensorListener{ - - private WebView mAppView; - private SensorManager sensorManager; - private Context mCtx; - - Orientation(WebView kit, Context ctx) { - mAppView = kit; - mCtx = ctx; - sensorManager = (SensorManager) mCtx.getSystemService(Context.SENSOR_SERVICE); - this.resumeAccel(); - } - - public void onSensorChanged(int sensor, final float[] values) { - if (sensor != SensorManager.SENSOR_ACCELEROMETER || values.length < 3) - return; - float x = values[0]; - float y = values[1]; - float z = values[2]; - mAppView.loadUrl("javascript:gotAcceleration(" + x + ", " + y + "," + z + ")"); - } - - public void onAccuracyChanged(int arg0, int arg1) { - // This is a stub method. - - } - - public void pauseAccel() - { - sensorManager.unregisterListener(this); - } - - public void resumeAccel() - { - sensorManager.registerListener(this, - SensorManager.SENSOR_ACCELEROMETER, - SensorManager.SENSOR_DELAY_GAME); - } - -} diff --git a/android/src/com/phonegap/demo/PhoneGap.java b/android/src/com/phonegap/demo/PhoneGap.java deleted file mode 100644 index adccfbdb..00000000 --- a/android/src/com/phonegap/demo/PhoneGap.java +++ /dev/null @@ -1,309 +0,0 @@ -package com.phonegap.demo; -/* License (MIT) - * Copyright (c) 2008 Nitobi - * website: http://phonegap.com - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * Software), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -import java.io.IOException; -import java.util.TimeZone; - -import android.content.Context; -import android.content.IntentFilter; -import android.net.Uri; -import android.os.Handler; -import android.os.Vibrator; -import android.telephony.TelephonyManager; -import android.webkit.WebView; -import android.media.Ringtone; -import android.media.RingtoneManager; - -public class PhoneGap{ - - private static final String LOG_TAG = "PhoneGap"; - /* - * UUID, version and availability - */ - public boolean droid = true; - public static String version = "0.2"; - public static String platform = "Android"; - public static String uuid; - private Context mCtx; - private WebView mAppView; - SmsListener mSmsListener; - DirectoryManager fileManager; - AudioHandler audio; - - public PhoneGap(Context ctx, WebView appView) { - this.mCtx = ctx; - this.mAppView = appView; - - mSmsListener = new SmsListener(ctx,mAppView); - fileManager = new DirectoryManager(); - audio = new AudioHandler("/sdcard/tmprecording.mp3", ctx); - uuid = getUuid(); - } - - public void beep(long pattern) - { - RingtoneManager beeper = new RingtoneManager(mCtx); - Uri ringtone = beeper.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); - Ringtone notification = beeper.getRingtone(mCtx, ringtone); - for (long i = 0; i < pattern; ++i) - { - notification.play(); - } - } - - public void vibrate(long pattern){ - // Start the vibration, 0 defaults to half a second. - if (pattern == 0) - pattern = 500; - Vibrator vibrator = (Vibrator) mCtx.getSystemService(Context.VIBRATOR_SERVICE); - vibrator.vibrate(pattern); - } - - public String getPlatform() - { - return this.platform; - } - - public String getUuid() - { - - TelephonyManager operator = (TelephonyManager) mCtx.getSystemService(Context.TELEPHONY_SERVICE); - String uuid = operator.getDeviceId(); - return uuid; - } - - public void init() - { - mAppView.loadUrl("javascript:Device.setData('Android','" + version + "','" + this.getUuid() + "')"); - } - - public String getModel() - { - String model = android.os.Build.MODEL; - return model; - } - public String getProductName() - { - String productname = android.os.Build.PRODUCT; - return productname; - } - public String getOSVersion() - { - String osversion = android.os.Build.VERSION.RELEASE; - return osversion; - } - public String getSDKVersion() - { - String sdkversion = android.os.Build.VERSION.SDK; - return sdkversion; - } - - public String getVersion() - { - return version; - } - - // Old SMS code, figure out what to do with this! - // BTW: This is awesome! - - public void notificationWatchPosition(String filter) - /** - * Starts the listener for incoming notifications of type filter - * TODO: JavaScript Call backs for success and error handling. More filter types. - */ - { - if (filter.contains("SMS")) - { - IntentFilter mFilter = new IntentFilter("android.provider.Telephony.SMS_RECEIVED"); - mCtx.registerReceiver(mSmsListener,mFilter); - } - } - - public void notificationClearWatch(String filter) - /** - * Stops the listener for incoming notifications of type filter - * TODO: JavaScript Call backs for success and error handling - */ - { - if (filter.contains("SMS")) - { - mCtx.unregisterReceiver(mSmsListener); - } - } - - public void httpGet(String url, String file) - /** - * grabs a file from specified url and saves it to a name and location - * the base directory /sdcard is abstracted so that paths may be the same from one mobile OS to another - * TODO: JavaScript call backs and error handling - */ - { - HttpHandler http = new HttpHandler(); - http.get(url, file); - } - - - - - public int testSaveLocationExists(){ - if (fileManager.testSaveLocationExists()) - return 0; - else - return 1; - } - - public long getFreeDiskSpace(){ - long freeDiskSpace=fileManager.getFreeDiskSpace(); - return freeDiskSpace; - } - - public int testFileExists(String file){ - if (fileManager.testFileExists(file)) - return 0; - else - return 1; - } - - public int testDirectoryExists(String file){ - if (fileManager.testFileExists(file)) - return 0; - else - return 1; - } - - /** - * Delete a specific directory. - * Everyting in side the directory would be gone. - * TODO: JavaScript Call backs for success and error handling - */ - public int deleteDirectory (String dir){ - if (fileManager.deleteDirectory(dir)) - return 0; - else - return 1; - } - - - /** - * Delete a specific file. - * TODO: JavaScript Call backs for success and error handling - */ - public int deleteFile (String file){ - if (fileManager.deleteFile(file)) - return 0; - else - return 1; - } - - - /** - * Create a new directory. - * TODO: JavaScript Call backs for success and error handling - */ - public int createDirectory(String dir){ - if (fileManager.createDirectory(dir)) - return 0; - else - return 1; - } - - - /** - * AUDIO - * TODO: Basic functions done but needs more work on error handling and call backs, remove record hack - */ - - public void startRecordingAudio(String file) - { - /* for this to work the recording needs to be specified in the constructor, - * a hack to get around this, I'm moving the recording after it's complete - */ - audio.startRecording(file); - } - - public void stopRecordingAudio() - { - audio.stopRecording(); - } - - public void startPlayingAudio(String file) - { - audio.startPlaying(file); - } - - public void stopPlayingAudio() - { - audio.stopPlaying(); - } - - public long getCurrentPositionAudio() - { - System.out.println(audio.getCurrentPosition()); - return(audio.getCurrentPosition()); - } - - public long getDurationAudio(String file) - { - System.out.println(audio.getDuration(file)); - return(audio.getDuration(file)); - } - - public void setAudioOutputDevice(int output){ - audio.setAudioOutputDevice(output); - } - - public int getAudioOutputDevice(){ - return audio.getAudioOutputDevice(); - } - - public String getLine1Number() { - TelephonyManager tm = - (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); - return(tm.getLine1Number()); - } - - public String getVoiceMailNumber() { - TelephonyManager tm = - (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); - return(tm.getVoiceMailNumber()); - } - - public String getNetworkOperatorName(){ - TelephonyManager tm = - (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); - return(tm.getNetworkOperatorName()); - } - - public String getSimCountryIso(){ - TelephonyManager tm = - (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); - return(tm.getSimCountryIso()); - } - - public String getTimeZoneID() { - TimeZone tz = TimeZone.getDefault(); - return(tz.getID()); - } - -} - diff --git a/android/src/com/phonegap/demo/SmsListener.java b/android/src/com/phonegap/demo/SmsListener.java deleted file mode 100644 index 57c61ba6..00000000 --- a/android/src/com/phonegap/demo/SmsListener.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.phonegap.demo; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.telephony.gsm.SmsMessage; -import android.util.Log; -import android.webkit.WebView; - -public class SmsListener extends BroadcastReceiver -{ - private WebView mAppView; - - public SmsListener(Context ctx, WebView mAppView) - { - this.mAppView = mAppView; - } - - String ACTION = "android.provider.Telephony.SMS_RECEIVED"; - - public void onReceive(Context ctx, Intent intent) - { - SmsMessage[] msg; - if (intent.getAction().equals(ACTION)) - { - msg = getMessagesFromIntent(intent); - String smsContent = null; - String sendersNumber = null; - for(int i=0; i < msg.length; i++) - { - sendersNumber = msg[i].getDisplayOriginatingAddress(); - smsContent = msg[i].getDisplayMessageBody(); - } - onReceiveSMS(sendersNumber, smsContent); - } - } - - protected void onReceiveSMS(String sendersNumber, String smsContent) - /** - * Call back to Java Script - */ - { - mAppView.loadUrl("javascript:onReceiveSms('"+sendersNumber+"',"+"'"+ smsContent +"'"+")"); - } - - private SmsMessage[] getMessagesFromIntent(Intent intent) - { - SmsMessage retMsgs[] = null; - Bundle bdl = intent.getExtras(); - try - { - Object pdus[] = (Object [])bdl.get("pdus"); - retMsgs = new SmsMessage[pdus.length]; - for(int n=0; n < pdus.length; n++) - { - byte[] byteData = (byte[])pdus[n]; - retMsgs[n] = SmsMessage.createFromPdu(byteData); - } - } catch(Exception e) - { - Log.e("SMS_getMessagesFromIntent", "fail", e); - } - return retMsgs; - } - -} - diff --git a/blackberry/.classpath b/blackberry/.classpath deleted file mode 100644 index 6c335059..00000000 --- a/blackberry/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/blackberry/.gitignore b/blackberry/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/blackberry/.project b/blackberry/.project deleted file mode 100644 index 101fd233..00000000 --- a/blackberry/.project +++ /dev/null @@ -1,29 +0,0 @@ - - - PhoneGap - - - - - - net.rim.eide.RIMResourcesBuilder - - - - - net.rim.eide.PreprocessBuilder - - - - - net.rim.eide.JavaIncrementalProjectBuilder - - - - - - net.rim.eide.rimnature - org.eclipse.jdt.core.javanature - net.rim.eide.PreprocessingNature - - diff --git a/blackberry/.settings/net.rim.eide.keys.Project.prefs b/blackberry/.settings/net.rim.eide.keys.Project.prefs deleted file mode 100644 index 0a031f6b..00000000 --- a/blackberry/.settings/net.rim.eide.keys.Project.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Fri May 15 15:56:25 CEST 2009 -RIM.BLACKBERRY.TYPE=COPY -eclipse.preferences.version=1 diff --git a/blackberry/.settings/org.eclipse.jdt.core.prefs b/blackberry/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index dce69ca2..00000000 --- a/blackberry/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,5 +0,0 @@ -#Sat May 16 13:53:35 CEST 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.compliance=1.4 -org.eclipse.jdt.core.compiler.source=1.3 diff --git a/blackberry/README b/blackberry/README deleted file mode 100644 index e69de29b..00000000 diff --git a/blackberry/README.md b/blackberry/README.md deleted file mode 100644 index 9ca45cb0..00000000 --- a/blackberry/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# GAP - -### Blackberry \ No newline at end of file diff --git a/blackberry/phonegap.jdp b/blackberry/phonegap.jdp deleted file mode 100644 index 5ed95231..00000000 --- a/blackberry/phonegap.jdp +++ /dev/null @@ -1,136 +0,0 @@ -## RIM Java Development Environment -# RIM Project file -# -# This file is generated and managed by BlackBerry developer tools. -# It SHOULD NOT BE modified manually. -# -AddOn=0 -AlwaysBuild=0 -[AlxImports -] -AutoRestart=0 -[ClassProtection -] -[CustomBuildFiles -] -[CustomBuildRules -] -[DefFiles -] -[DependsOn -] -ExcludeFromBuildAll=0 -[Files -..\..\..\..\workspace_blackberry\phonegap\src\0.png -..\..\..\..\workspace_blackberry\phonegap\src\1.png -..\..\..\..\workspace_blackberry\phonegap\src\2.png -..\..\..\..\workspace_blackberry\phonegap\src\3.png -..\..\..\..\workspace_blackberry\phonegap\src\4.png -..\..\..\..\workspace_blackberry\phonegap\src\5.png -..\..\..\..\workspace_blackberry\phonegap\src\camera.html -..\..\..\..\workspace_blackberry\phonegap\src\camera.js -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\Command.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\CommandManager.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\impl\CameraCommand.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\impl\ContactsCommand.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\impl\GeoLocationCommand.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\impl\InitializationCommand.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\impl\TelephonyCommand.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\api\impl\VibrationCommand.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\io\AsynchronousResourceFetcher.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\io\Callback.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\io\ConnectionManager.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\io\QueueResourceFetcher.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\model\Position.java -..\..\..\..\workspace_blackberry\phonegap\src\com\nitobi\phonegap\PhoneGap.java -..\..\..\..\workspace_blackberry\phonegap\src\contacts.html -..\..\..\..\workspace_blackberry\phonegap\src\contacts.js -..\..\..\..\workspace_blackberry\phonegap\src\device.html -..\..\..\..\workspace_blackberry\phonegap\src\device.js -..\..\..\..\workspace_blackberry\phonegap\src\geolocation.js -..\..\..\..\workspace_blackberry\phonegap\src\index.html -..\..\..\..\workspace_blackberry\phonegap\src\io.html -..\..\..\..\workspace_blackberry\phonegap\src\location.html -..\..\..\..\workspace_blackberry\phonegap\src\position.js -..\..\..\..\workspace_blackberry\phonegap\src\telephony.html -..\..\..\..\workspace_blackberry\phonegap\src\telephony.js -..\..\..\..\workspace_blackberry\phonegap\src\vibration.html -..\..\..\..\workspace_blackberry\phonegap\src\www\js\camera.js -..\..\..\..\workspace_blackberry\phonegap\src\www\js\contacts.js -..\..\..\..\workspace_blackberry\phonegap\src\www\js\device.js -..\..\..\..\workspace_blackberry\phonegap\src\www\js\geolocation.js -..\..\..\..\workspace_blackberry\phonegap\src\www\js\position.js -..\..\..\..\workspace_blackberry\phonegap\src\www\js\telephony.js -..\..\..\..\workspace_blackberry\phonegap\src\www\test\camera.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\contacts.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\device.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\images\0.png -..\..\..\..\workspace_blackberry\phonegap\src\www\test\images\1.png -..\..\..\..\workspace_blackberry\phonegap\src\www\test\images\2.png -..\..\..\..\workspace_blackberry\phonegap\src\www\test\images\3.png -..\..\..\..\workspace_blackberry\phonegap\src\www\test\images\4.png -..\..\..\..\workspace_blackberry\phonegap\src\www\test\images\5.png -..\..\..\..\workspace_blackberry\phonegap\src\www\test\index.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\io.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\location.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\telephony.html -..\..\..\..\workspace_blackberry\phonegap\src\www\test\vibration.html -src\com\nitobi\phonegap\api\Command.java -src\com\nitobi\phonegap\api\CommandManager.java -src\com\nitobi\phonegap\api\impl\CameraCommand.java -src\com\nitobi\phonegap\api\impl\ContactsCommand.java -src\com\nitobi\phonegap\api\impl\GeoLocationCommand.java -src\com\nitobi\phonegap\api\impl\InitializationCommand.java -src\com\nitobi\phonegap\api\impl\TelephonyCommand.java -src\com\nitobi\phonegap\api\impl\VibrationCommand.java -src\com\nitobi\phonegap\io\AsynchronousResourceFetcher.java -src\com\nitobi\phonegap\io\Callback.java -src\com\nitobi\phonegap\io\ConnectionManager.java -src\com\nitobi\phonegap\io\QueueResourceFetcher.java -src\com\nitobi\phonegap\model\Position.java -src\com\nitobi\phonegap\PhoneGap.java -src\www\js\camera.js -src\www\js\contacts.js -src\www\js\device.js -src\www\js\geolocation.js -src\www\js\position.js -src\www\js\telephony.js -src\www\test\camera.html -src\www\test\contacts.html -src\www\test\device.html -src\www\test\images\0.png -src\www\test\images\1.png -src\www\test\images\2.png -src\www\test\images\3.png -src\www\test\images\4.png -src\www\test\images\5.png -src\www\test\index.html -src\www\test\io.html -src\www\test\location.html -src\www\test\telephony.html -src\www\test\vibration.html -] -HaveAlxImports=0 -HaveDefs=0 -HaveImports=0 -[Icons -] -[ImplicitRules -] -[Imports -] -Listing=0 -MidletClass=data:///www/test/index.html -Options=-quiet -OutputFileName=phonegap -[PackageProtection -] -RibbonPosition=0 -[RolloverIcons -] -RunOnStartup=0 -StartupTier=7 -SystemModule=0 -Title=PhoneGap -Type=0 -UserData=|src diff --git a/blackberry/src/com/nitobi/phonegap/PhoneGap.java b/blackberry/src/com/nitobi/phonegap/PhoneGap.java deleted file mode 100644 index 4010d4e1..00000000 --- a/blackberry/src/com/nitobi/phonegap/PhoneGap.java +++ /dev/null @@ -1,171 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap; - -import java.util.Vector; - -import javax.microedition.io.HttpConnection; - -import net.rim.device.api.browser.field.BrowserContent; -import net.rim.device.api.browser.field.BrowserContentManager; -import net.rim.device.api.browser.field.Event; -import net.rim.device.api.browser.field.RedirectEvent; -import net.rim.device.api.browser.field.RenderingApplication; -import net.rim.device.api.browser.field.RenderingOptions; -import net.rim.device.api.browser.field.RequestedResource; -import net.rim.device.api.browser.field.UrlRequestedEvent; -import net.rim.device.api.system.Display; -import net.rim.device.api.ui.Screen; -import net.rim.device.api.ui.UiApplication; -import net.rim.device.api.ui.container.MainScreen; - -import com.nitobi.phonegap.api.CommandManager; -import com.nitobi.phonegap.io.AsynchronousResourceFetcher; -import com.nitobi.phonegap.io.Callback; -import com.nitobi.phonegap.io.ConnectionManager; -import com.nitobi.phonegap.io.QueueResourceFetcher; - -/** - * Bridges HTML/JS/CSS to a native Blackberry application. - * - * @author Jose Noheda - * - */ -public class PhoneGap extends UiApplication implements RenderingApplication { - - public static final String PHONEGAP_PROTOCOL = "gap://"; - private static final String DEFAULT_INITIAL_URL = "data:///www/test/index.html"; - - private Screen mainScreen; - private Vector pendingResponses = new Vector(); - private QueueResourceFetcher queueResourceFetcher; - private CommandManager commandManager = new CommandManager(); - private ConnectionManager connectionManager = new ConnectionManager(); - private BrowserContentManager _browserContentManager = new BrowserContentManager(0); - - /** - * Launches the application. Accepts up to one parameter, an URL to the index page. - */ - public static void main(String[] args) { - PhoneGap bridge = args.length > 0 ? new PhoneGap(args[0]) : new PhoneGap(); - bridge.enterEventDispatcher(); - } - - /** - * By default, the main page is set to data:///www/test/index.html - */ - public PhoneGap() { - init(DEFAULT_INITIAL_URL); - } - - /** - * Launches the application with a custom index page. - * - * @param url a http:// or data:// string - */ - public PhoneGap(final String url) { - init((url != null) && (url.trim().length() > 0) ? url : DEFAULT_INITIAL_URL); - } - - private void init(final String url) { - RenderingOptions renderingOptions = _browserContentManager.getRenderingSession().getRenderingOptions(); - renderingOptions.setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_ENABLED, true); - renderingOptions.setProperty(RenderingOptions.CORE_OPTIONS_GUID, RenderingOptions.JAVASCRIPT_LOCATION_ENABLED, true); - // The following line is commented out for now, until we figure out how to use this rendering mode properly. - //renderingOptions.setProperty(RenderingOptions.CORE_OPTIONS_GUID, 17000, true); - mainScreen = new MainScreen(); - mainScreen.add(_browserContentManager); - pushScreen(mainScreen); - queueResourceFetcher = new QueueResourceFetcher(this, connectionManager); - loadUrl(url); - invokeLater(queueResourceFetcher); - } - - private void loadUrl(String url) { - invokeAndWait(new AsynchronousResourceFetcher(url, new Callback() { - public void execute(final Object input) { - // setContent here causes Blackberry to freeze - leads to two calls: handleNewContent and finishLoading. - // finishLoading then calls Object.wait(), which is likely the cause for the freeze? Help! - _browserContentManager.setContent((HttpConnection) input, PhoneGap.this, null); - } - }, connectionManager)); - } - - public Object eventOccurred(final Event event) { - if (event instanceof RedirectEvent) { - RedirectEvent command = (RedirectEvent) event; - String url = command.getLocation(); - if (url.startsWith(PHONEGAP_PROTOCOL)) { - String response = commandManager.processInstruction(url); - if ((response != null) && (response.trim().length() > 0)) pendingResponses.addElement(response); - } - } - if (event instanceof UrlRequestedEvent) { - final String url = ((UrlRequestedEvent) event).getURL(); - new Thread(new AsynchronousResourceFetcher(url, new Callback() { - public void execute(final Object input) { - _browserContentManager.setContent((HttpConnection) input, PhoneGap.this, null); - } - }, connectionManager)).start(); - } - return null; - } - - public String getHTTPCookie(String url) { - StringBuffer responseCode = new StringBuffer(); - synchronized (pendingResponses) { - for (int index = 0; index < pendingResponses.size(); index++) - responseCode.append(pendingResponses.elementAt(index)); - pendingResponses.removeAllElements(); - } - return responseCode.toString(); - } - - public int getAvailableHeight(BrowserContent browserContent) { - return Display.getHeight(); - } - - public int getAvailableWidth(BrowserContent browserContent) { - return Display.getWidth(); - } - - public int getHistoryPosition(BrowserContent browserContent) { - return 0; // No support - } - - public HttpConnection getResource(RequestedResource resource, BrowserContent referrer) { - if ((resource != null) && (resource.getUrl() != null) && !resource.isCacheOnly()) { - String url = resource.getUrl().trim(); - if ((referrer == null) || (connectionManager.isInternal(url))) - return connectionManager.getUnmanagedConnection(url); - else - queueResourceFetcher.enqueue(resource, referrer); - } - return null; - } - - public void invokeRunnable(Runnable runnable) { - invokeLater(runnable); - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/Command.java b/blackberry/src/com/nitobi/phonegap/api/Command.java deleted file mode 100644 index 20a871ea..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/Command.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api; - -/** - * Each part of the PhoneGap API. - * - * @author Jose Noheda [jose.noheda@gmail.com] - * - */ -public interface Command { - - /** - * Executes the request and returns JS code to chang client state. - * - * @param instruction the command to execute - * @return a string with Javascript code or null - */ - String execute(String instruction); - - /** - * Determines if this command can process a request. - * - * @param instruction the command to execute - * - * @return true if this command understands the petition - */ - boolean accept(String instruction); - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/CommandManager.java b/blackberry/src/com/nitobi/phonegap/api/CommandManager.java deleted file mode 100644 index a8bf96be..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/CommandManager.java +++ /dev/null @@ -1,73 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api; - -import com.nitobi.phonegap.api.impl.CameraCommand; -import com.nitobi.phonegap.api.impl.ContactsCommand; -import com.nitobi.phonegap.api.impl.GeoLocationCommand; -import com.nitobi.phonegap.api.impl.InitializationCommand; -import com.nitobi.phonegap.api.impl.TelephonyCommand; -import com.nitobi.phonegap.api.impl.VibrationCommand; - -/** - * Given a execution request detects matching {@link Command} and executes it. - * - * @author Jose Noheda - * - */ -public final class CommandManager { - - // List of installed Commands - private Command[] commands = new Command[6]; - - public CommandManager() { - commands[0] = new CameraCommand(); - commands[1] = new ContactsCommand(); - commands[2] = new VibrationCommand(); - commands[3] = new TelephonyCommand(); - commands[4] = new GeoLocationCommand(); - commands[5] = new InitializationCommand(); - } - - /** - * Receives a request for execution and fulfills it as long as one of - * the configured {@link Command} can understand it. Command precedence - * is important (just one of them will be executed). - * - * @param instruction any API command - * @return JS code to execute by the client or null - */ - public String processInstruction(String instruction) { - for (int index = 0; index < commands.length; index++) { - Command command = (Command) commands[index]; - if (command.accept(instruction)) - try { - return command.execute(instruction); - } catch(Exception e) { - System.out.println("Exception executing command [" + instruction + "]: " + e.getMessage()); - } - } - return null; - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/impl/CameraCommand.java b/blackberry/src/com/nitobi/phonegap/api/impl/CameraCommand.java deleted file mode 100644 index 5ee18c01..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/impl/CameraCommand.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api.impl; - -import net.rim.blackberry.api.invoke.CameraArguments; -import net.rim.blackberry.api.invoke.Invoke; -import net.rim.device.api.io.file.FileSystemJournal; -import net.rim.device.api.io.file.FileSystemJournalEntry; -import net.rim.device.api.io.file.FileSystemJournalListener; -import net.rim.device.api.system.Characters; -import net.rim.device.api.system.ControlledAccessException; -import net.rim.device.api.system.EventInjector; -import net.rim.device.api.ui.UiApplication; - -import com.nitobi.phonegap.api.Command; - -/** - * Switchs current application to the camera to take a photo. - * - * @author Jose Noheda - * - */ -public class CameraCommand implements Command { - - private static final int INVOKE_COMMAND = 0; - private static final int PICTURE_COMMAND = 1; - private static final String CODE = "gap://camera"; - - private long lastUSN = 0; - private String photoPath; - private FileSystemJournalListener listener; - - public CameraCommand() { - listener = new FileSystemJournalListener() { - public void fileJournalChanged() { - long USN = FileSystemJournal.getNextUSN(); - for (long i = USN - 1; i >= lastUSN; --i) { - FileSystemJournalEntry entry = FileSystemJournal.getEntry(i); - if (entry != null) { - if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED || entry.getEvent() == FileSystemJournalEntry.FILE_CHANGED || entry.getEvent() == FileSystemJournalEntry.FILE_RENAMED) { - if (entry.getPath().indexOf(".jpg") != -1) { - lastUSN = USN; - photoPath = entry.getPath(); - closeCamera(); - } - } - } - } - lastUSN = USN; - } - }; - } - - /** - * Able to run the camera command. Ex: gap://camera/obtain - */ - public boolean accept(String instruction) { - return instruction != null && instruction.startsWith(CODE); - } - - /** - * Invokes internal camera application. - */ - public String execute(String instruction) { - switch (getCommand(instruction)) { - case PICTURE_COMMAND: - UiApplication.getUiApplication().removeFileSystemJournalListener(listener); - return "navigator.camera.picture = '" + photoPath + "'"; - case INVOKE_COMMAND: - photoPath = null; - UiApplication.getUiApplication().addFileSystemJournalListener(listener); - Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments()); - } - return null; - } - - private int getCommand(String instruction) { - String command = instruction.substring(instruction.lastIndexOf('/') + 1); - if ("obtain".equals(command)) return INVOKE_COMMAND; - if ("picture".equals(command)) return PICTURE_COMMAND; - return -1; - } - - public void closeCamera() { - try { - EventInjector.KeyEvent inject = new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN, Characters.ESCAPE, 0); - inject.post(); - inject.post(); - } catch (ControlledAccessException ex) { - // Don't allow key injection - figure out what to do - } - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/impl/ContactsCommand.java b/blackberry/src/com/nitobi/phonegap/api/impl/ContactsCommand.java deleted file mode 100644 index 23323dc7..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/impl/ContactsCommand.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api.impl; - -import java.util.Enumeration; - -import javax.microedition.pim.Contact; -import javax.microedition.pim.PIM; - -import net.rim.blackberry.api.pdap.BlackBerryContact; -import net.rim.blackberry.api.pdap.BlackBerryContactList; - -import com.nitobi.phonegap.api.Command; - -/** - * Finds data in agenda. - * - * @author Jose Noheda - * - */ -public class ContactsCommand implements Command { - - private static final int SEARCH_COMMAND = 0; - private static final String CODE = "gap://contacts"; - - /** - * Able to run the call command. Ex: gap://contacts/search/name/Joe - */ - public boolean accept(String instruction) { - return instruction != null && instruction.startsWith(CODE); - } - - /** - * Invokes internal phone application. - */ - public String execute(String instruction) { - switch (getCommand(instruction)) { - case SEARCH_COMMAND: - return "navigator.ContactManager.contacts = navigator.ContactManager.contacts.concat(" + getAgendaByName("Joe") + ");"; - } - return null; - } - - private int getCommand(String instruction) { - String command = instruction.substring(instruction.substring(7).indexOf('/') + 1); - if (command.indexOf("search") > 0) return SEARCH_COMMAND; - return -1; - } - - private String getAgendaByName(String name) { - try { - BlackBerryContactList agenda = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY); - if (agenda != null) { - StringBuffer contacts = new StringBuffer("["); - Enumeration matches = agenda.itemsByName(name); - while (matches.hasMoreElements()) { - BlackBerryContact contact = (BlackBerryContact) matches.nextElement(); - contacts.append("{email:'"); - contacts.append(contact.getString(Contact.EMAIL, 0)); - contacts.append("', phone:'"); - contacts.append(contact.getString(Contact.TEL, 0)); - contacts.append("'},"); - } - return contacts.deleteCharAt(contacts.length() - 1).append("]").toString(); - } - } catch (Exception ex) { - System.out.println("Exception getting contact list: " + ex.getMessage()); - } - return null; - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/impl/GeoLocationCommand.java b/blackberry/src/com/nitobi/phonegap/api/impl/GeoLocationCommand.java deleted file mode 100644 index 2993736f..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/impl/GeoLocationCommand.java +++ /dev/null @@ -1,151 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api.impl; - -import javax.microedition.location.Location; -import javax.microedition.location.LocationException; -import javax.microedition.location.LocationListener; -import javax.microedition.location.LocationProvider; - -import net.rim.blackberry.api.invoke.Invoke; -import net.rim.blackberry.api.invoke.MapsArguments; - -import com.nitobi.phonegap.api.Command; -import com.nitobi.phonegap.model.Position; - -/** - * Wraps all GPS functions. - * - * @author Jose Noheda - * - */ -public class GeoLocationCommand implements Command { - - private static final int MAP_COMMAND = 0; - private static final int STOP_COMMAND = 1; - private static final int START_COMMAND = 2; - private static final int CHECK_COMMAND = 3; - private static final int CAPTURE_INTERVAL = 5; - private static final String CODE = "gap://location"; - - private Position position; - private boolean availableGPS = true; - private LocationProvider locationProvider; - - public GeoLocationCommand() { - try { - locationProvider = LocationProvider.getInstance(null); - } catch (LocationException e) { - availableGPS = false; - } - } - - /** - * Able to run the location command (all options). - * Ex: gap://location/start - */ - public boolean accept(String instruction) { - return instruction != null && instruction.startsWith(CODE); - } - - /** - * Deletes the last valid obtained position. - */ - public void clearPosition() { - position = null; - } - - /** - * Executes the following sub-commands: - * START: Initiliazes the internal GPS module - * STOP: Stops GPS module (saving battery life) - * CHECK: Reads latest position available - * MAP: Invokes the internal MAP application - */ - public String execute(String instruction) { - if (!availableGPS) return ";alert('GPS not available');"; - switch (getCommand(instruction)) { - case MAP_COMMAND: if (position != null) Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(MapsArguments.ARG_LOCATION_DOCUMENT, getLocationDocument())); - break; - case STOP_COMMAND: clearPosition(); - locationProvider.setLocationListener(null, 0, 0, 0); - return ";navigator.geolocation.started = false;navigator.geolocation.lastPosition = null;"; - case START_COMMAND: locationProvider.setLocationListener(new LocationListenerImpl(this), CAPTURE_INTERVAL, 1, 1); - return ";navigator.geolocation.started = true;"; - case CHECK_COMMAND: if (position != null) return ";navigator.geolocation.lastPosition = " + position.toJavascript() + ";"; - } - return null; - } - - private int getCommand(String instruction) { - String command = instruction.substring(instruction.lastIndexOf('/') + 1); - if ("map".equals(command)) return MAP_COMMAND; - if ("stop".equals(command)) return STOP_COMMAND; - if ("start".equals(command)) return START_COMMAND; - if ("check".equals(command)) return CHECK_COMMAND; - return -1; - } - - private void updateLocation(double lat, double lng, float speed, float heading, float altitude) { - position = new Position(); - position.setLatitude(lat); - position.setLongitude(lng); - position.setVelocity(speed); - position.setHeading(heading); - position.setAltitude(altitude); - } - - private String getLocationDocument() { - StringBuffer location = new StringBuffer(""); - return location.toString(); - } - - /** - * Implementation of the LocationListener interface - */ - private class LocationListenerImpl implements LocationListener { - - private GeoLocationCommand command; - - public LocationListenerImpl(GeoLocationCommand command) { - this.command = command; - } - - public void locationUpdated(LocationProvider provider, Location location) { - if (location.isValid()) { - float heading = location.getCourse(); - double longitude = location.getQualifiedCoordinates().getLongitude(); - double latitude = location.getQualifiedCoordinates().getLatitude(); - float altitude = location.getQualifiedCoordinates().getAltitude(); - float speed = location.getSpeed(); - command.updateLocation(latitude, longitude, speed, heading, altitude); - } else command.clearPosition(); - } - - public void providerStateChanged(LocationProvider provider, int newState) {} - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/impl/InitializationCommand.java b/blackberry/src/com/nitobi/phonegap/api/impl/InitializationCommand.java deleted file mode 100644 index 9f81f4d3..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/impl/InitializationCommand.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api.impl; - -import com.nitobi.phonegap.api.Command; -import net.rim.device.api.system.DeviceInfo; - -/** - * Configures the Device API. - * - * @author Jose Noheda [jose.noheda@gmail.com] - * - */ -public class InitializationCommand implements Command { - - private static final String CODE = "gap://initialize"; - - /** - * Able to run the initialize command (usually onLoad). - */ - public boolean accept(String instruction) { - return instruction != null && instruction.startsWith(CODE); - } - - /** - * Fills the JS variable Device with: - * Model - * Flash memory available - * Platform - * Vendor - * Battery - * Software version - * Camera support - * ID - * Simulator - * - */ - public String execute(String instruction) { - StringBuffer deviceInfo = new StringBuffer(";Device.model = '"); - deviceInfo.append(DeviceInfo.getDeviceName()).append("';Device.flash = "); - deviceInfo.append(DeviceInfo.getTotalFlashSize()).append(";Device.platform = '"); - deviceInfo.append(DeviceInfo.getPlatformVersion()).append("';Device.vendor = '"); - deviceInfo.append(DeviceInfo.getManufacturerName()).append("';Device.battery = "); - deviceInfo.append(DeviceInfo.getBatteryLevel()).append(";Device.version = '"); - deviceInfo.append(DeviceInfo.getSoftwareVersion()).append("';Device.isSimulator = "); - deviceInfo.append(DeviceInfo.isSimulator()).append(";Device.hasCamera = "); - deviceInfo.append(DeviceInfo.hasCamera()).append(";Device.uuid = "); - deviceInfo.append(DeviceInfo.getDeviceId()).append(";"); - return deviceInfo.toString(); - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/impl/TelephonyCommand.java b/blackberry/src/com/nitobi/phonegap/api/impl/TelephonyCommand.java deleted file mode 100644 index 958f4938..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/impl/TelephonyCommand.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api.impl; - -import net.rim.blackberry.api.invoke.Invoke; -import net.rim.blackberry.api.invoke.PhoneArguments; - -import com.nitobi.phonegap.api.Command; - -/** - * Makes a telephone call by switching to the internal application. - * - * @author Jose Noheda - * - */ -public class TelephonyCommand implements Command { - - private static final String CODE = "gap://call"; - - /** - * Able to run the call command. Ex: gap://call/555666777 - */ - public boolean accept(String instruction) { - return instruction != null && instruction.startsWith(CODE); - } - - /** - * Invokes internal phone application. - */ - public String execute(String instruction) { - String number = getNumber(instruction); - if (number != null) - Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, new PhoneArguments(PhoneArguments.ARG_CALL, number)); - return null; - } - - private String getNumber(String instruction) { - try { - return instruction.substring(instruction.lastIndexOf('/') + 1); - } catch(Exception ex) { - return null; - } - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/api/impl/VibrationCommand.java b/blackberry/src/com/nitobi/phonegap/api/impl/VibrationCommand.java deleted file mode 100644 index 94b24aef..00000000 --- a/blackberry/src/com/nitobi/phonegap/api/impl/VibrationCommand.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.api.impl; - -import net.rim.device.api.system.Alert; - -import com.nitobi.phonegap.api.Command; - -/** - * Vibrates the phone if able. - * - * @author Jose Noheda - * - */ -public class VibrationCommand implements Command { - - private static final int DURATION = 5; - private static final String CODE = "gap://vibrate"; - - /** - * Able to run the vibrate command. Ex: gap://vibrate/10 - */ - public boolean accept(String instruction) { - return instruction != null && instruction.startsWith(CODE); - } - - /** - * Checks if the phone has the require vibration module and - * activates it (by default, for 5 seconds). - */ - public String execute(String instruction) { - if (Alert.isVibrateSupported()) Alert.startVibrate(getVibrateDuration(instruction)); - return null; - } - - private int getVibrateDuration(String instruction) { - try { - return Integer.parseInt(instruction.substring(instruction.lastIndexOf('/') + 1)); - } catch(Exception ex) { - return DURATION; - } - } - -} \ No newline at end of file diff --git a/blackberry/src/com/nitobi/phonegap/io/AsynchronousResourceFetcher.java b/blackberry/src/com/nitobi/phonegap/io/AsynchronousResourceFetcher.java deleted file mode 100644 index 5dd880c2..00000000 --- a/blackberry/src/com/nitobi/phonegap/io/AsynchronousResourceFetcher.java +++ /dev/null @@ -1,47 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.io; - -/** - * Fetches a resource and executes a callback. - * - * @author Jose Noheda - * - */ -public class AsynchronousResourceFetcher implements Runnable { - - private String url; - private Callback callback; - private ConnectionManager connectionManager; - - public AsynchronousResourceFetcher(String url, Callback callback, ConnectionManager connectionManager) { - this.url = url; - this.callback = callback; - this.connectionManager = connectionManager; - } - - public void run() { - callback.execute(connectionManager.getUnmanagedConnection(url)); - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/io/Callback.java b/blackberry/src/com/nitobi/phonegap/io/Callback.java deleted file mode 100644 index 1420f893..00000000 --- a/blackberry/src/com/nitobi/phonegap/io/Callback.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.io; - -/** - * Indicates the need to execute some additional code once the requested - * task has finished. - * - * @author Jose Noheda - * - */ -public interface Callback { - - /** - * Method to execute once the asynchronous process has finished. - * - * @param input anything - */ - public void execute(final Object input); - -} diff --git a/blackberry/src/com/nitobi/phonegap/io/ConnectionManager.java b/blackberry/src/com/nitobi/phonegap/io/ConnectionManager.java deleted file mode 100644 index f2ce1b42..00000000 --- a/blackberry/src/com/nitobi/phonegap/io/ConnectionManager.java +++ /dev/null @@ -1,157 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.io; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.InputStream; - -import javax.microedition.io.Connection; -import javax.microedition.io.Connector; -import javax.microedition.io.HttpConnection; -import javax.microedition.io.InputConnection; - -import net.rim.device.api.io.Base64OutputStream; -import net.rim.device.api.system.Application; - -/** - * Manages all HTTP connections. - * - * @author Jose Noheda - * - */ -public final class ConnectionManager { - - public static final String DATA = "data"; - public static final String DATA_PROTOCOL = DATA + ":///"; - private static final byte[] DATA_URL = (ConnectionManager.DATA + ":text/html;base64,").getBytes(); - - /** - * Creates a connection and returns it. Calling this method without care may saturate BB capacity. - * - * @param url a http:// or data:// URL - */ - public HttpConnection getUnmanagedConnection(String url) { - if ((url != null) && (url.trim().length() > 0)) - return isInternal(url) ? getDataProtocolConnection(url) : getExternalConnection(url); - return null; - } - - /** - * Loads an external URL and provides a connection that holds the array of bytes. Internal - * URLs (data://) simply pass through. - * - * @param url a http:// or data:// URL - */ - public InputConnection getPreLoadedConnection(String url) { - InputConnection connection = getUnmanagedConnection(url); - if ((connection != null) && (!isInternal(url))) { - try { - final byte[] data = read(connection.openInputStream()); - close(connection); - if (data != null) { - connection = new InputConnection() { - public DataInputStream openDataInputStream() throws IOException { - return new DataInputStream(openInputStream()); - } - - public InputStream openInputStream() throws IOException { - return new ByteArrayInputStream(data); - } - - public void close() throws IOException { - return; - } - }; - } - } catch(IOException ioe) { - close(connection); - System.out.println("Problems reading an external URL"); - } - } - return connection; - } - - /** - * Detects data:// URLs - */ - public boolean isInternal(String url) { - return (url != null) && url.startsWith(ConnectionManager.DATA_PROTOCOL); - } - - public HttpConnection asHttpConnection(String url) { - return null; - } - - private static void close(Connection connection) { - if (connection != null) { - try { - connection.close(); - } catch(Exception ioe) { - System.out.println("Problem closing a connection"); - } - } - } - - private static HttpConnection getExternalConnection(String url) { - try { - return (HttpConnection) Connector.open(url); - } catch (Exception ex) { - return null; - } - } - - private static HttpConnection getDataProtocolConnection(String url) { - String dataUrl = url.startsWith(ConnectionManager.DATA_PROTOCOL) ? url.substring(ConnectionManager.DATA_PROTOCOL.length()-1) : url; - ByteArrayOutputStream output = new ByteArrayOutputStream(); - try { - output.write(ConnectionManager.DATA_URL); - Base64OutputStream boutput = new Base64OutputStream(output); - boutput.write(read(Application.class.getResourceAsStream(dataUrl))); - boutput.flush(); - boutput.close(); - output.flush(); - output.close(); - return (HttpConnection) Connector.open(output.toString()); - } catch (IOException ex) { - return null; - } - } - - private static byte[] read(InputStream input) throws IOException { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - try { - int bytesRead = -1; - byte[] buffer = new byte[1024]; - while ((bytesRead = input.read(buffer)) != -1) bytes.write(buffer, 0, bytesRead); - } finally { - try { - input.close(); - } catch (IOException ex) {} - } - return bytes.toByteArray(); - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/io/QueueResourceFetcher.java b/blackberry/src/com/nitobi/phonegap/io/QueueResourceFetcher.java deleted file mode 100644 index f43ed847..00000000 --- a/blackberry/src/com/nitobi/phonegap/io/QueueResourceFetcher.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.io; - -import java.util.Vector; - -import javax.microedition.io.InputConnection; - -import net.rim.device.api.browser.field.BrowserContent; -import net.rim.device.api.browser.field.RequestedResource; -import net.rim.device.api.ui.UiApplication; - -/** - * Download manager for concurrent connections. - * - * @author Jose Noheda - * - */ -public final class QueueResourceFetcher implements Runnable { - - private UiApplication main; - private BrowserContent browser; - private Vector queue = new Vector(); - private ConnectionManager connectionManager; - - public QueueResourceFetcher(UiApplication application, ConnectionManager connectionManager) { - this.main = application; - this.connectionManager = connectionManager; - } - - /** - * Adds a new element to download. - */ - public void enqueue(RequestedResource resource, BrowserContent referrer) { - if (browser != referrer) { - queue.removeAllElements(); - browser = referrer; - } - queue.addElement(resource); - } - - /** - * Downloads all queued resources. - */ - public void run() { - if (!queue.isEmpty()) processResource(); - main.invokeLater(this, queue.isEmpty() ? 250 : 1, false); - } - - private void processResource() { - RequestedResource resource = null; - synchronized (queue) { - if (!queue.isEmpty()) { - resource = (RequestedResource) queue.elementAt(0); - queue.removeElementAt(0); - } - } - if (resource != null) { - InputConnection connection = connectionManager.getPreLoadedConnection(resource.getUrl()); - if (connection != null) { - resource.setInputConnection(connection); - browser.resourceReady(resource); - } - } - } - -} diff --git a/blackberry/src/com/nitobi/phonegap/model/Position.java b/blackberry/src/com/nitobi/phonegap/model/Position.java deleted file mode 100644 index 652883b6..00000000 --- a/blackberry/src/com/nitobi/phonegap/model/Position.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * The MIT License - * ------------------------------------------------------------- - * Copyright (c) 2008, Rob Ellis, Brock Whitten, Brian Leroux, Joe Bowser, Dave Johnson, Nitobi - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.nitobi.phonegap.model; - -/** - * Stores geo location variables. - * - * @author Jose Noheda - * - */ -public class Position { - - private double _lat = 0; - private double _lng = 0; - private float heading = 0; - private float altitude = 0; - private float velocity = 0; - - public double getLatitude() { - return _lat; - } - - public void setLatitude(double _lat) { - this._lat = _lat; - } - - public double getLongitude() { - return _lng; - } - - public void setLongitude(double _lng) { - this._lng = _lng; - } - - public float getHeading() { - return heading; - } - - public void setHeading(float heading) { - this.heading = heading; - } - - public float getAltitude() { - return altitude; - } - - public void setAltitude(float altitude) { - this.altitude = altitude; - } - - public float getVelocity() { - return velocity; - } - - public void setVelocity(float velocity) { - this.velocity = velocity; - } - - public String toJavascript() { - return "new Position(" + _lat + "," + _lng + ",1," + altitude + ",1" + heading + "," + velocity + ")"; - } - -} diff --git a/blackberry/src/www/js/camera.js b/blackberry/src/www/js/camera.js deleted file mode 100644 index 0ef78214..00000000 --- a/blackberry/src/www/js/camera.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * This class provides access to the device camera. - * @constructor - */ -function Camera() { - this.picture = null; -} - -Camera.prototype.launch = function () { - if (Device.hasCamera) Device.exec("camera", ["obtain"], true); - else alert("Camera not supported"); -} - -/** - * - * @param {Function} successCallback - * @param {Function} errorCallback - * @param {Object} options - */ -Camera.prototype.getPicture = function(successCallback, errorCallback, options) { - if (Device.hasCamera) Device.exec("camera", ["picture"], true); - else alert("Camera not supported"); -} - -if (typeof navigator.camera == "undefined") navigator.camera = new Camera(); \ No newline at end of file diff --git a/blackberry/src/www/js/contacts.js b/blackberry/src/www/js/contacts.js deleted file mode 100644 index d20e207b..00000000 --- a/blackberry/src/www/js/contacts.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This class represents a Contact in the manager. - * @constructor - */ -function Contact() { - this.name = ""; - this.phone = ""; - this.address = ""; -} - -/** - * - * @param {Object} successCallback - * @param {Object} errorCallback - * @param {Object} options - */ -Contact.prototype.get = function(successCallback, errorCallback, options) { - -} - - -function ContactManager() { - this.contacts = []; - this.timestap = new Date().getTime(); -} - -ContactManager.prototype.get = function(successCallback, errorCallback, options) { - Device.exec("contacts", [options.operation, options.field, options.value], true); -} - -if (typeof navigator.ContactManager == "undefined") navigator.ContactManager = new ContactManager(); \ No newline at end of file diff --git a/blackberry/src/www/js/device.js b/blackberry/src/www/js/device.js deleted file mode 100644 index dc8473d4..00000000 --- a/blackberry/src/www/js/device.js +++ /dev/null @@ -1,33 +0,0 @@ -window.Device = { - isIPhone: false, - isIPod: false, - isBlackBerry: true, - - init: function() { - this.exec("initialize"); - this.poll(function() { - Device.available = typeof Device.model == "string"; - }); - }, - exec: function(command, params, sync) { - if (Device.available || command == "initialize") { - try { - var url = "gap://" + command; - if (params) url += "/" + params.join("/"); - document.location = url; - if (sync) this.poll(); - } catch(e) { - console.log("Command '" + command + "' has not been executed, because of exception: " + e); - alert("Error executing command '" + command + "'.") - } - } - }, - poll: function(callback) { - eval(document.cookie + (callback ? ";callback();" : "")); - }, - vibrate: function(secs) { - return Device.exec("vibrate", [secs]); - } -}; - -window.Device.init(); \ No newline at end of file diff --git a/blackberry/src/www/js/geolocation.js b/blackberry/src/www/js/geolocation.js deleted file mode 100644 index 8f230e5e..00000000 --- a/blackberry/src/www/js/geolocation.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * This class provides access to device GPS data. - * @constructor - */ -function Geolocation() { - /** - * Was the GPS started? - */ - this.started = false; - - /** - * The last known GPS position. - */ - this.lastPosition = null; -} - -/** - * Starts the GPS of the device - */ -Geolocation.prototype.start = function() { - if (this.started) { - alert("GPS already started"); - return; - } - Device.exec("location", ["start"], true); -} - -/** - * Stops the GPS of the device - */ -Geolocation.prototype.stop = function() { - if (!this.started) { - alert("GPS not started"); - return; - } - if (this.locationTimeout) window.clearTimeout(this.locationTimeout); - Device.exec("location", ["stop"], true); -} - -/** - * Maps current location - */ -Geolocation.prototype.map = function() { - if (this.lastPosition == null) { - alert("No position to map yet"); - return; - } - Device.exec("location", ["map"], true); -} - -/** - * Asynchronously adquires the current position. - * - * @param {Function} successCallback The function to call when the position - * data is available - * - * @param {Function} errorCallback The function to call when there is an error - * getting the position data. - * - * @param {PositionOptions} options The options for getting the position data - * such as timeout. - */ -Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) { - if (!this.started) { - alert("GPS not started"); - return; - } - this.onSuccess = successCallback; - this.locationTimeout = window.setInterval("navigator.geolocation._getCurrentPosition();", 1000); -} - -Geolocation.prototype._getCurrentPosition = function() { - this.lastPosition = null; - Device.exec("location", ["check"], true); - if (this.lastPosition != null) { - window.clearTimeout(this.locationTimeout); - if (this.onSuccess) this.onSuccess(); - this.onSuccess = null; - } -} - -if (typeof navigator.geolocation == "undefined") navigator.geolocation = new Geolocation(); diff --git a/blackberry/src/www/js/position.js b/blackberry/src/www/js/position.js deleted file mode 100644 index 21439dd8..00000000 --- a/blackberry/src/www/js/position.js +++ /dev/null @@ -1,75 +0,0 @@ -/** - * This class contains position information. - * @param {Object} lat - * @param {Object} lng - * @param {Object} acc - * @param {Object} alt - * @param {Object} altacc - * @param {Object} head - * @param {Object} vel - * @constructor - */ -function Position(lat, lng, acc, alt, altacc, head, vel) { - /** - * The latitude of the position. - */ - this.latitude = lat; - /** - * The longitude of the position, - */ - this.longitude = lng; - /** - * The accuracy of the position. - */ - this.accuracy = acc; - /** - * The altitude of the position. - */ - this.altitude = alt; - /** - * The altitude accuracy of the position. - */ - this.altitudeAccuracy = altacc; - /** - * The direction the device is moving at the position. - */ - this.heading = head; - /** - * The velocity with which the device is moving at the position. - */ - this.velocity = vel; - /** - * The time that the position was obtained. - */ - this.timestamp = new Date().getTime(); -} - -/** - * This class specifies the options for requesting position data. - * @constructor - */ -function PositionOptions() { - /** - * Specifies the desired position accuracy. - */ - this.enableHighAccuracy = true; - /** - * The timeout after which if position data cannot be obtained the errorCallback - * is called. - */ - this.timeout = 10000; -} - -/** - * This class contains information about any GSP errors. - * @constructor - */ -function PositionError() { - this.code = null; - this.message = ""; -} - -PositionError.UNKNOWN_ERROR = 0; -PositionError.PERMISSION_DENIED = 1; -PositionError.POSITION_UNAVAILABLE = 2; -PositionError.TIMEOUT = 3; diff --git a/blackberry/src/www/js/telephony.js b/blackberry/src/www/js/telephony.js deleted file mode 100644 index 2ad33928..00000000 --- a/blackberry/src/www/js/telephony.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This class provides access to the telephony features of the device. - * @constructor - */ -function Telephony() { - this.number = null; -} - -/** - * Calls the specifed number. - * @param {Integer} number The number to be called. - */ -Telephony.prototype.call = function(number) { - this.number = number; - Device.exec("call", [this.number]); -} - -if (typeof navigator.telephony == "undefined") navigator.telephony = new Telephony(); \ No newline at end of file diff --git a/blackberry/src/www/test/camera.html b/blackberry/src/www/test/camera.html deleted file mode 100644 index 95e004bc..00000000 --- a/blackberry/src/www/test/camera.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - -

Set a Camera Image in the emulator first

-
-

Use the Camera

-

Get the picture

-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/blackberry/src/www/test/contacts.html b/blackberry/src/www/test/contacts.html deleted file mode 100644 index ffd1626e..00000000 --- a/blackberry/src/www/test/contacts.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - -

Add a contact with name Joe first

-
-

Find Joe in contacts

-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/blackberry/src/www/test/device.html b/blackberry/src/www/test/device.html deleted file mode 100644 index 5aa49472..00000000 --- a/blackberry/src/www/test/device.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -

Device information

-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/blackberry/src/www/test/images/0.png b/blackberry/src/www/test/images/0.png deleted file mode 100644 index 57de9e16..00000000 Binary files a/blackberry/src/www/test/images/0.png and /dev/null differ diff --git a/blackberry/src/www/test/images/1.png b/blackberry/src/www/test/images/1.png deleted file mode 100644 index ef9daf19..00000000 Binary files a/blackberry/src/www/test/images/1.png and /dev/null differ diff --git a/blackberry/src/www/test/images/2.png b/blackberry/src/www/test/images/2.png deleted file mode 100644 index 72f178dc..00000000 Binary files a/blackberry/src/www/test/images/2.png and /dev/null differ diff --git a/blackberry/src/www/test/images/3.png b/blackberry/src/www/test/images/3.png deleted file mode 100644 index 05863644..00000000 Binary files a/blackberry/src/www/test/images/3.png and /dev/null differ diff --git a/blackberry/src/www/test/images/4.png b/blackberry/src/www/test/images/4.png deleted file mode 100644 index 80cdb614..00000000 Binary files a/blackberry/src/www/test/images/4.png and /dev/null differ diff --git a/blackberry/src/www/test/images/5.png b/blackberry/src/www/test/images/5.png deleted file mode 100644 index 2151c994..00000000 Binary files a/blackberry/src/www/test/images/5.png and /dev/null differ diff --git a/blackberry/src/www/test/index.html b/blackberry/src/www/test/index.html deleted file mode 100644 index 96d87c59..00000000 --- a/blackberry/src/www/test/index.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - Navigate to Internet (needs MDS)
- Test IO (needs MDS)
- Test Device API
- Test Vibration API
- Test Telephony API
- Test GeoLocation API
- Test Camera API
- Test Contacts API
- - \ No newline at end of file diff --git a/blackberry/src/www/test/io.html b/blackberry/src/www/test/io.html deleted file mode 100644 index 9893c5c5..00000000 --- a/blackberry/src/www/test/io.html +++ /dev/null @@ -1,22 +0,0 @@ - - - - - -

You need the MDS proxy running...

-
-
-
-
-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/blackberry/src/www/test/location.html b/blackberry/src/www/test/location.html deleted file mode 100644 index 2125e680..00000000 --- a/blackberry/src/www/test/location.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - -

Start location module

-

Stop location module

-

Get current position

-

Map current position

-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/blackberry/src/www/test/telephony.html b/blackberry/src/www/test/telephony.html deleted file mode 100644 index e0207bca..00000000 --- a/blackberry/src/www/test/telephony.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - -

Call 555 666 777

-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/blackberry/src/www/test/vibration.html b/blackberry/src/www/test/vibration.html deleted file mode 100644 index 1bc98063..00000000 --- a/blackberry/src/www/test/vibration.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - -

Vibrate

-
-
-
-
-
- Back - - \ No newline at end of file diff --git a/configure b/configure deleted file mode 100755 index 17df8beb..00000000 --- a/configure +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -PLATFORMS="iphone blackberry android" - -echo "Building PhoneGap Makefile" -[ -f Makefile ] && cp Makefile Makefile.old - -DOXYGEN= -if [ -d /Applications/Doxygen.app ]; then - DOXYGEN=/Applications/Doxygen.app/Contents/Resources/doxygen -else - for file in $(locate doxygen | grep -E '/doxygen$'); do - if [ -x $file ] && [ -f $file ]; then - DOXYGEN=$file - break - fi - done - if [ "x$DOXYGEN" = "x" ]; then - echo "No Doxygen found; fetch it from http://www.doxygen.org/ and install it in /Applications" - DOXYGEN= - fi -fi - -cat > Makefile < /dev/null 2>&1 -MKPATH = mkdir -p -CAT = cat -MAKE = make -OPEN = open -ECHO = echo -ECHO_N = echo -n -JAVA = java -DOXYGEN = $DOXYGEN -IPHONE_DOCSET_TMPDIR = docs/iphone/tmp - -all :: $PLATFORMS docs - -clean :: clean_docs clean_libs - -clean_docs: - -\$(RM_RF) docs/javascript - -\$(RM_RF) docs/iphone - -clean_libs: - -\$(RM_RF) lib - -iphone/www/phonegap.js: lib/iphone/phonegap-min.js - \$(CP) lib/iphone/phonegap-min.js \$@ - -docs :: javascript_docs iphone_docs - -EOF - -if [ "x$DOXYGEN" != "x" ]; then - cat >> Makefile <> \$(IPHONE_DOCSET_TMPDIR)/doxygen.cfg - \$(ECHO) "GENERATE_DOCSET = YES" >> \$(IPHONE_DOCSET_TMPDIR)/doxygen.cfg - \$(DOXYGEN) \$(IPHONE_DOCSET_TMPDIR)/doxygen.cfg - - \$(MAKE) -C docs/iphone/PhoneGap.docset/html install - \$(OPEN) ~/Library/Developer/Shared/Documentation/DocSets/org.phonegap.PhoneGap.docset - -EOF -else - echo iphone_docs: >> Makefile -fi - -echo javascript_docs :: javascripts/*.js >> Makefile -echo " \$(JAVA) -jar util/jsdoc-toolkit/jsrun.jar util/jsdoc-toolkit/app/run.js -a -d=docs/javascript -t=util/jsdoc-toolkit/templates/jsdoc " javascripts/*.js >> Makefile - -for platform in $PLATFORMS; do - cat >> Makefile <> Makefile - echo " \$(RM_RF) lib/$platform" >> Makefile - echo " \$(MKPATH) lib/$platform" >> Makefile - echo " \$(RM_F) \$@" >> Makefile - for file in $( echo $platform_srcs ); do - echo " \$(CAT) $file >> \$@" >> Makefile - done -done - -echo "Run \"make\" to build" -# vim: set ft=shell tabstop=4 noexpandtab: diff --git a/iphone/.gitignore b/iphone/.gitignore deleted file mode 100755 index 85b415bc..00000000 --- a/iphone/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -build/* -*.pbxuser -*.perspectivev3 -*.mode1v3 diff --git a/iphone/Classes/Bonjour.h b/iphone/Classes/Bonjour.h deleted file mode 100644 index 797e846f..00000000 --- a/iphone/Classes/Bonjour.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Bonjour.h -// PhoneGap -// -// Created by Brant Vasilieff on 3/1/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import -#import -#import "PhoneGapCommand.h" - -@interface Bonjour : PhoneGapCommand -{ - NSString* __identifier; -} - -- (void)start:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iphone/Classes/Bonjour.m b/iphone/Classes/Bonjour.m deleted file mode 100644 index 92372d43..00000000 --- a/iphone/Classes/Bonjour.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// Bonjour.m -// PhoneGap -// -// Created by Brant Vasilieff on 3/1/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "Bonjour.h" - - -@implementation Bonjour - -- (void)start:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ -} - -- (void)stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ -} - -- (id)init -{ - if (self = [super init]) - { - __identifier = nil; - } - return self; -} - -- (void)dealloc -{ - [__identifier release]; - [super dealloc]; -} - -@end diff --git a/iphone/Classes/Camera.h b/iphone/Classes/Camera.h deleted file mode 100644 index fdfefe9f..00000000 --- a/iphone/Classes/Camera.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Camera.h - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import -#import "PhoneGapCommand.h" - -@interface CameraPicker : UIImagePickerController -{ - NSString* successCallback; - NSString* errorCallback; - NSInteger quality; -} - -@property NSInteger quality; -@property (retain) NSString* successCallback; -@property (retain) NSString* errorCallback; - -- (void) dealloc; - -@end - -@interface Camera : PhoneGapCommand -{ - CameraPicker* pickerController; -} - -/* - * getPicture - * - * arguments: - * 1: this is the javascript function that will be called with the results, the first parameter passed to the - * javascript function is the picture as a Base64 encoded string - * 2: this is the javascript function to be called if there was an error - * options: - * quality: integer between 1 and 100 - */ -- (void) getPicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) postImage:(UIImage*)anImage withFilename:(NSString*)filename toUrl:(NSURL*)url; - -- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo; -- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker; - -- (void) dealloc; - -@end - - - diff --git a/iphone/Classes/Camera.m b/iphone/Classes/Camera.m deleted file mode 100644 index 700b2bf3..00000000 --- a/iphone/Classes/Camera.m +++ /dev/null @@ -1,133 +0,0 @@ -// -// Camera.m -// PhoneGap -// -// Created by Shazron Abdullah on 15/07/09. -// Copyright 2009 Nitobi. All rights reserved. -// - -#import "Camera.h" -#import "NSData+Base64.h" -#import "Categories.h" - -@implementation Camera - -- (void) getPicture:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - NSString* successCallback = nil, *errorCallback = nil; - - if (argc > 0) successCallback = [arguments objectAtIndex:0]; - if (argc > 1) errorCallback = [arguments objectAtIndex:1]; - - if (argc < 1) { - NSLog(@"Camera.getPicture: Missing 1st parameter."); - return; - } - - bool hasCamera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]; - if (!hasCamera) { - NSLog(@"Camera.getPicture: Camera not available."); - return; - } - - if (pickerController == nil) { - pickerController = [[CameraPicker alloc] init]; - pickerController.delegate = self; - pickerController.sourceType = UIImagePickerControllerSourceTypeCamera; - pickerController.successCallback = successCallback; - pickerController.errorCallback = errorCallback; - pickerController.quality = [options integerValueForKey:@"quality" defaultValue:100 withRange:NSMakeRange(0, 100)]; - } - - [[super appViewController] presentModalViewController:pickerController animated:YES]; -} - -- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingImage:(UIImage*)image editingInfo:(NSDictionary*)editingInfo -{ - CameraPicker* cameraPicker = (CameraPicker*)picker; - CGFloat quality = (double)cameraPicker.quality / 100.0; - NSData* data = UIImageJPEGRepresentation(image, quality); - - [picker dismissModalViewControllerAnimated:YES]; - - if (cameraPicker.successCallback) { - NSString* jsString = [[NSString alloc] initWithFormat:@"%@(\"%@\");", cameraPicker.successCallback, [data base64EncodedString]]; - [webView stringByEvaluatingJavaScriptFromString:jsString]; - [jsString release]; - } -} - -- (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker -{ - [picker dismissModalViewControllerAnimated:YES]; -} - -- (void) postImage:(UIImage*)anImage withFilename:(NSString*)filename toUrl:(NSURL*)url -{ - NSString *boundary = @"----BOUNDARY_IS_I"; - - NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url]; - [req setHTTPMethod:@"POST"]; - - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary]; - [req setValue:contentType forHTTPHeaderField:@"Content-type"]; - - NSData *imageData = UIImagePNGRepresentation(anImage); - - // adding the body - NSMutableData *postBody = [NSMutableData data]; - - // first parameter an image - [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - [postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"; filename=\"%@\"\r\n", filename] dataUsingEncoding:NSUTF8StringEncoding]]; - [postBody appendData:[@"Content-Type: image/png\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; - [postBody appendData:imageData]; - -// // second parameter information -// [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]]; -// [postBody appendData:[@"Content-Disposition: form-data; name=\"some_other_name\"\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]]; -// [postBody appendData:[@"some_other_value" dataUsingEncoding:NSUTF8StringEncoding]]; -// [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r \n",boundary] dataUsingEncoding:NSUTF8StringEncoding]]; - - [req setHTTPBody:postBody]; - - NSURLResponse* response; - NSError* error; - [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error]; - -// NSData* result = [NSURLConnection sendSynchronousRequest:req returningResponse:&response error:&error]; -// NSString * resultStr = [[[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding] autorelease]; -} - -- (void) dealloc -{ - if (pickerController) { - [pickerController release]; - } - - [super dealloc]; -} - -@end - - -@implementation CameraPicker - -@synthesize quality; -@synthesize successCallback; -@synthesize errorCallback; - -- (void) dealloc -{ - if (successCallback) { - [successCallback release]; - } - if (errorCallback) { - [errorCallback release]; - } - - [super dealloc]; -} - -@end diff --git a/iphone/Classes/Categories.h b/iphone/Classes/Categories.h deleted file mode 100644 index 6a5d7974..00000000 --- a/iphone/Classes/Categories.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Categories.h -// PhoneGap -// -// Created by Shazron Abdullah on 26/05/09. -// Copyright 2009 Nitobi Software. All rights reserved. -// - - -@interface NSMutableDictionary(NSDictionary_Extension) - -- (bool) existsValue:(NSString*)expectedValue forKey:(NSString*)key; -- (NSUInteger) integerValueForKey:(NSString*)key defaultValue:(NSUInteger)defaultValue withRange:(NSRange)range; - -@end diff --git a/iphone/Classes/Categories.m b/iphone/Classes/Categories.m deleted file mode 100644 index 5e7e95d0..00000000 --- a/iphone/Classes/Categories.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// Categories.m -// PhoneGap -// -// Created by Shazron Abdullah on 26/05/09. -// Copyright 2009 Nitobi Software. All rights reserved. -// - -#import "Categories.h" -#import - -@implementation NSMutableDictionary(NSDictionary_Extension) - -- (bool) existsValue:(NSString*)expectedValue forKey:(NSString*)key -{ - id val = [self valueForKey:key]; - bool exists = false; - if (val != nil) { - exists = [(NSString*)val compare:expectedValue options:NSCaseInsensitiveSearch] == 0; - } - - return exists; -} - -- (NSUInteger) integerValueForKey:(NSString*)key defaultValue:(NSUInteger)defaultValue withRange:(NSRange)range -{ - NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; - [numberFormatter setRoundingMode:NSNumberFormatterRoundCeiling]; - - NSUInteger value = defaultValue; - - id val = [self valueForKey:key]; - if (val != nil) { - NSNumber* number = [numberFormatter numberFromString:(NSString*)val]; - value = [number unsignedIntValue]; - } - - [numberFormatter release]; - - // min, max checks - value = MAX(range.location, value); - value = MIN(range.length, value); - - return value; -} - -@end - diff --git a/iphone/Classes/Contacts.h b/iphone/Classes/Contacts.h deleted file mode 100755 index c4214278..00000000 --- a/iphone/Classes/Contacts.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Contact.h - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import -#import -#import -#import "PhoneGapCommand.h" - -@interface Contacts : PhoneGapCommand -{ - ABAddressBookRef addressBook; - NSArray* allPeople; -} - -/* - * allContacts - * - * arguments: - * 1: this is the javascript function that will be called with the results, the first parameter passed to the - * javascript function is a javascript array - * options: - * nameFilter: filter the results by this name (wildcards ok), if available - * pageSize: maximum number of results to retrieve - * pageNumber: page number of results to retrieve - */ -- (void) allContacts:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -/* - * newContact - * - * arguments: - * 1: first name of the new contact - * 2: last name of the new contact - * options: - * gui: set to true to allow the user to add a new contact through the iPhone contact editor - * successCallback: this is the javascript function that will be called with the newly created contact as a JSON object - */ -- (void) newContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -/* - * displayContact - * - * arguments: - * 1: recordID of the contact to display in the iPhone contact display - * options: - * allowsEditing: set to true to allow the user to edit the contact - */ -- (void) displayContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -/* - * chooseContact - * - * arguments: - * 1: this is the javascript function that will be called with the contact data as a JSON object (as the first param) - * options: - * allowsEditing: set to true to not choose the contact, but to edit it in the iPhone contact editor - */ -- (void) chooseContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void) newPersonViewController:(ABNewPersonViewController *)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person; -- (BOOL) personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person - property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue; - -- (void) addressBookDirty; -- (void) dealloc; - -@end - -@interface ContactsPicker : ABPeoplePickerNavigationController -{ - BOOL allowsEditing; - NSString* jsCallback; -} - -@property BOOL allowsEditing; -@property (retain) NSString* jsCallback; - -@end diff --git a/iphone/Classes/Contacts.m b/iphone/Classes/Contacts.m deleted file mode 100755 index bc4e532c..00000000 --- a/iphone/Classes/Contacts.m +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Contact.m - * - * Created by Nitobi on 2/3/09 - * Copyright 2008 Nitobi. All rights reserved. - * Rob Ellis rob.ellis@nitobi.com - * Shazron Abdullah shazron@nitobi.com - * - */ - -#import "Contacts.h" -#import -#import "PhoneGapDelegate.h" -#import "Categories.h" -#import "Notification.h" -#import "OCCFObject.h" -#import "OCABRecord.h" -#import "OCABMutableMultiValue.h" - -@implementation ContactsPicker - -@synthesize allowsEditing; -@synthesize jsCallback; - -@end - - -@implementation Contacts - -void addressBookChanged(ABAddressBookRef addressBook, CFDictionaryRef info, void* context) -{ - // note that this function is only called when another AddressBook instance modifies - // the address book, not the current one. For example, through an OTA MobileMe sync - Contacts* contacts = (Contacts*)context; - [contacts addressBookDirty]; -} - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView -{ - self = (Contacts*)[super initWithWebView:(UIWebView*)theWebView]; - if (self) { - addressBook = ABAddressBookCreate(); - allPeople = nil; - ABAddressBookRegisterExternalChangeCallback(addressBook, addressBookChanged, self); - } - return self; -} - -- (void) contactsCount:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - NSString* jsCallback = nil; - - if (argc > 0) { - jsCallback = [arguments objectAtIndex:0]; - } else { - NSLog(@"Contacts.contactsCount: Missing 1st parameter."); - return; - } - - CFIndex numberOfPeople = ABAddressBookGetPersonCount(addressBook); - NSString* jsString = [[NSString alloc] initWithFormat:@"%@(%d);", jsCallback, numberOfPeople]; - - [webView stringByEvaluatingJavaScriptFromString:jsString]; - [jsString release]; -} - -- (void) allContacts:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - NSString* jsCallback = nil; - - if (argc > 0) { - jsCallback = [arguments objectAtIndex:0]; - } else { - NSLog(@"Contacts.allContacts: Missing 1st parameter."); - return; - } - - NSMutableString* jsArray = [[NSMutableString alloc] init]; - [jsArray appendString:@"["]; - - NSString* filter = [options valueForKey:@"nameFilter"]; - CFArrayRef records = NULL; - CFIndex numberOfPeople = 0; - - if (filter) { - records = ABAddressBookCopyPeopleWithName(addressBook, (CFStringRef)filter); - numberOfPeople = CFArrayGetCount(records); - } else { - if (allPeople == nil) { // lazy loading - allPeople = (NSArray*)ABAddressBookCopyArrayOfAllPeople(addressBook); - } - records = (CFArrayRef)allPeople; - numberOfPeople = ABAddressBookGetPersonCount(addressBook); - } - - CFIndex pageSize = [options integerValueForKey:@"pageSize" defaultValue:numberOfPeople withRange:NSMakeRange(1, numberOfPeople)]; - - NSUInteger maxPages = ceil((double)numberOfPeople / (double)pageSize); - CFIndex pageNumber = [options integerValueForKey:@"pageNumber" defaultValue:1 withRange:NSMakeRange(1, maxPages)]; - - CFIndex skipAmount = (pageNumber - 1) * pageSize; - CFIndex maxIndex = (skipAmount + pageSize); - CFIndex i; - - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - for (i = skipAmount; i < maxIndex; i++) - { - OCABRecord* rec = [[OCABRecord alloc] initWithCFTypeRef:CFArrayGetValueAtIndex(records, i)]; - [jsArray appendString:[rec JSONValue]]; - [rec release]; - - if (i+1 != maxIndex) { - [jsArray appendString:@","]; - } - } - [pool release]; - [jsArray appendString:@"]"]; - - NSString* jsString = [[NSString alloc] initWithFormat:@"%@(%@);", jsCallback, jsArray]; - NSLog(@"%@", jsString); - - [webView stringByEvaluatingJavaScriptFromString:jsString]; - - if (filter) { - CFRelease(records); - } - - [jsArray release]; - [jsString release]; -} - -- (void) newContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -{ - NSUInteger argc = [arguments count]; - NSString* firstName = nil, *lastName = nil, *phoneNumber = nil; - - if (argc > 0) firstName = [arguments objectAtIndex:0]; - if (argc > 1) lastName = [arguments objectAtIndex:1]; - if (argc > 2) phoneNumber = [arguments objectAtIndex:2]; - - ABRecordRef ref = ABPersonCreate(); - OCABRecord* rec = [[OCABRecord alloc] initWithCFTypeRef:ref]; - CFRelease(ref); - - [rec setFirstName: firstName]; - [rec setLastName: lastName]; - - if (phoneNumber) { - [rec setPhoneNumber:phoneNumber withLabel:(NSString*)kABPersonPhoneMainLabel]; - } - - //TODO: add more items to set here, from arguments - - if ([options existsValue:@"true" forKey:@"gui"]) { - ABNewPersonViewController* npController = [[[ABNewPersonViewController alloc] init] autorelease]; - - npController.displayedPerson = [rec ABRecordRef]; - npController.addressBook = addressBook; - npController.newPersonViewDelegate = self; - - UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:npController] autorelease]; - [[super appViewController] presentModalViewController:navController animated: YES]; - } - else { - CFErrorRef errorRef; - bool addOk = false, saveOk = false; - - addOk = ABAddressBookAddRecord(addressBook, [rec ABRecordRef], &errorRef); - if (addOk) { - saveOk = ABAddressBookSave(addressBook, &errorRef); - } - if (saveOk) { - [self addressBookDirty]; - } - - NSString* jsCallback = [options valueForKey:@"successCallback"]; - NSString* firstParam = (addOk && saveOk)? [rec JSONValue] : @""; - - if (jsCallback) { - NSString* jsString = [[NSString alloc] initWithFormat:@"%@(%@);", jsCallback, firstParam]; - [webView stringByEvaluatingJavaScriptFromString:jsString]; - - [jsString release]; - } - } - - [rec release]; -} - -- (void) newPersonViewController:(ABNewPersonViewController*)newPersonViewController didCompleteWithNewPerson:(ABRecordRef)person -{ - if (person != NULL) { - [self addressBookDirty]; - } - [newPersonViewController dismissModalViewControllerAnimated:YES]; -} - -- (void) displayContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - ABRecordID recordID = kABRecordInvalidID; - NSString* errorCallback = nil; - - //TODO: need better argument handling system - if (argc > 0) { - recordID = [[arguments objectAtIndex:0] intValue]; - } else { - NSLog(@"Contacts.displayContact: Missing 1st parameter."); - return; - } - - if (argc > 1) { - errorCallback = [arguments objectAtIndex:1]; - } - - bool allowsEditing = [options existsValue:@"true" forKey:@"allowsEditing"]; - - OCABRecord* rec = [OCABRecord newFromRecordID:recordID andAddressBook:addressBook]; - if (rec) { - ABPersonViewController* personController = [[[ABPersonViewController alloc] init] autorelease]; - personController.displayedPerson = [rec ABRecordRef]; - personController.personViewDelegate = self; - personController.allowsEditing = allowsEditing; - - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] - initWithBarButtonSystemItem:UIBarButtonSystemItemCancel - target: self - action: @selector(dimissModalView:)]; - - personController.navigationItem.leftBarButtonItem = cancelButton; - [cancelButton release]; - - UINavigationController *navController = [[[UINavigationController alloc] initWithRootViewController:personController] autorelease]; - [[super appViewController] presentModalViewController:navController animated: YES]; - - [rec release]; - } - else - { - if (errorCallback) { - NSString* jsString = [[NSString alloc] initWithFormat:@"%@('Contacts.displayContact: Record id %d not found.');", - errorCallback, recordID]; - NSLog(@"%@", jsString); - - [webView stringByEvaluatingJavaScriptFromString:jsString]; - [jsString release]; - } - } -} - -- (void) dimissModalView:(id)sender -{ - UIViewController* controller = ([super appViewController]); - [controller.modalViewController dismissModalViewControllerAnimated:YES]; -} - -- (BOOL) personViewController:(ABPersonViewController *)personViewController shouldPerformDefaultActionForPerson:(ABRecordRef)person - property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifierForValue -{ - return YES; -} - -- (void) chooseContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - NSString* jsCallback = nil; - - //TODO: need better argument handling system - if (argc > 0) { - jsCallback = [arguments objectAtIndex:0]; - } else { - NSLog(@"Contacts.chooseContact: Missing 1st parameter."); - return; - } - - ContactsPicker* pickerController = [[[ContactsPicker alloc] init] autorelease]; - pickerController.peoplePickerDelegate = self; - pickerController.jsCallback = jsCallback; - pickerController.allowsEditing = (BOOL)[options existsValue:@"true" forKey:@"allowsEditing"]; - - [[super appViewController] presentModalViewController:pickerController animated: YES]; -} - -- (BOOL) peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker - shouldContinueAfterSelectingPerson:(ABRecordRef)person -{ - ABPersonViewController* personController = [[[ABPersonViewController alloc] init] autorelease]; - ContactsPicker* picker = (ContactsPicker*)peoplePicker; - - personController.displayedPerson = person; - personController.personViewDelegate = self; - personController.allowsEditing = picker.allowsEditing; - - if (picker.allowsEditing) { - [peoplePicker pushViewController:personController animated:YES]; - } else { - OCABRecord* rec = [[OCABRecord alloc] initWithCFTypeRef:person]; - NSString* jsString = [[NSString alloc] initWithFormat:@"%@(%@);", picker.jsCallback, [rec JSONValue]]; - [webView stringByEvaluatingJavaScriptFromString:jsString]; - - [jsString release]; - [rec release]; - [picker dismissModalViewControllerAnimated:YES]; - } - return NO; -} - -- (BOOL) peoplePickerNavigationController:(ABPeoplePickerNavigationController*)peoplePicker - shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier -{ - return YES; -} - -- (void) peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker -{ - [peoplePicker dismissModalViewControllerAnimated:YES]; -} - -- (void) removeContact:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - ABRecordID recordID = kABRecordInvalidID; - NSString* jsCallback = nil; - - if (argc > 0) { - recordID = [[arguments objectAtIndex:0] intValue]; - } else { - NSLog(@"Contacts.removeContact: Missing 1st parameter."); - return; - } - - if (argc > 1) - jsCallback = [arguments objectAtIndex:1]; - - OCABRecord* rec = [OCABRecord newFromRecordID:recordID andAddressBook:addressBook]; - NSString* firstParam = @""; - bool removeOk = false, saveOk = false; - CFErrorRef errorRef; - - if (rec) { - removeOk = [rec removeFrom:addressBook]; - if (removeOk) { - saveOk = ABAddressBookSave(addressBook, &errorRef); - } - if (saveOk) { - [self addressBookDirty]; - firstParam = [rec JSONValue]; - } - [rec release]; - } - - if (jsCallback) { - NSString* jsString = [[NSString alloc] initWithFormat:@"%@(%@);", jsCallback, firstParam]; - [webView stringByEvaluatingJavaScriptFromString:jsString]; - [jsString release]; - } -} - -- (void) addressBookDirty -{ - [allPeople release]; - allPeople = nil; -} - -- (void)dealloc -{ - ABAddressBookUnregisterExternalChangeCallback(addressBook, addressBookChanged, self); - - if (addressBook) { - CFRelease(addressBook); - } - - [allPeople release]; - [super dealloc]; -} - -@end - diff --git a/iphone/Classes/DebugConsole.h b/iphone/Classes/DebugConsole.h deleted file mode 100644 index 6a6a33f4..00000000 --- a/iphone/Classes/DebugConsole.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// DebugConsole.h -// PhoneGap -// -// Created by Michael Nachbaur on 14/03/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import -#import -#import "PhoneGapCommand.h" - -@interface DebugConsole : PhoneGapCommand { -} - -- (void)log:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iphone/Classes/DebugConsole.m b/iphone/Classes/DebugConsole.m deleted file mode 100644 index 4dc342de..00000000 --- a/iphone/Classes/DebugConsole.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// DebugConsole.m -// PhoneGap -// -// Created by Michael Nachbaur on 14/03/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import "DebugConsole.h" - -@implementation DebugConsole - -- (void)log:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* message = [arguments objectAtIndex:0]; - NSString* log_level = @"INFO"; - if ([options objectForKey:@"logLevel"]) - log_level = [options objectForKey:@"logLevel"]; - - NSLog(@"[%@] %@", log_level, message); -} - -@end diff --git a/iphone/Classes/Device.h b/iphone/Classes/Device.h deleted file mode 100755 index bf221a33..00000000 --- a/iphone/Classes/Device.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Device.h - * Used to display Device centric details handset. - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - */ - -#import -#import -#import "PhoneGapCommand.h" - -@interface Device : PhoneGapCommand { -} - -- (NSDictionary*) getDeviceProperties; - -@end \ No newline at end of file diff --git a/iphone/Classes/Device.m b/iphone/Classes/Device.m deleted file mode 100755 index 0b81cdbc..00000000 --- a/iphone/Classes/Device.m +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Device.m - * Used to display Device centric details handset. - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - */ - -#import "Device.h" - -@implementation Device - -/** - * returns a dictionary with various device settings - * - gap (version) - * - Device platform - * - Device version - * - Device name (e.g. user-defined name of the phone) - * - Device uuid - */ -- (NSDictionary*) getDeviceProperties -{ - UIDevice *device = [UIDevice currentDevice]; - NSMutableDictionary *devProps = [NSMutableDictionary dictionaryWithCapacity:4]; - [devProps setObject:[device model] forKey:@"platform"]; - [devProps setObject:[device systemVersion] forKey:@"version"]; - [devProps setObject:[device uniqueIdentifier] forKey:@"uuid"]; - [devProps setObject:[device name] forKey:@"name"]; - [devProps setObject:@"0.8.0" forKey:@"gap"]; - - NSDictionary *devReturn = [NSDictionary dictionaryWithDictionary:devProps]; - return devReturn; -} - -@end diff --git a/iphone/Classes/File.h b/iphone/Classes/File.h deleted file mode 100755 index 16e14e33..00000000 --- a/iphone/Classes/File.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// File.h -// PhoneGap -// -// Created by Nitobi on 19/12/08. -// Copyright 2008 Nitobi. All rights reserved. -// - -#import - - -@interface File : NSObject { - -} - - - -@end diff --git a/iphone/Classes/File.m b/iphone/Classes/File.m deleted file mode 100755 index c437739c..00000000 --- a/iphone/Classes/File.m +++ /dev/null @@ -1,14 +0,0 @@ -// -// File.m -// PhoneGap -// -// Created by Nitobi on 19/12/08. -// Copyright 2008 Nitobi. All rights reserved. -// - -#import "File.h" - - -@implementation File - -@end diff --git a/iphone/Classes/Image.h b/iphone/Classes/Image.h deleted file mode 100644 index bc2ede7b..00000000 --- a/iphone/Classes/Image.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Image.h - * PhoneGap - * - * Created by Nitobi on 04/02/09. - * Copyright 2009 Nitobi. All rights reserved. - * - */ - -#import -#import "PhoneGapCommand.h" - -@interface Image : PhoneGapCommand { - IBOutlet UIWindow *window; - - UIImagePickerController *picker; // added by urbian - NSString *photoUploadUrl; // added by urbian - NSString *lastUploadedPhoto; // added by urbian - NSURLConnection *conn; // added by urbian - NSMutableData *receivedData; // added by urbian - -} - -@property (nonatomic, retain) UIImagePickerController *picker; -@property (nonatomic, retain) UIWindow *window; - -- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image2 editingInfo:(NSDictionary *)editingInfo; -- (void) imagePickerControllerDidCancel:(UIImagePickerController *)picker; - -@end diff --git a/iphone/Classes/Image.m b/iphone/Classes/Image.m deleted file mode 100644 index e0764396..00000000 --- a/iphone/Classes/Image.m +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Image.m - * PhoneGap - * - * Created by Nitobi on 04/02/09. - * Copyright 2009 Nitobi. All rights reserved. - * Rob Ellis * Brian LeRoux * Brock Whitten - * - * Special thanks to urbian.org - g.mueller @urbian.org - * - */ - -#import "Image.h" - -@implementation Image - -@synthesize window; -@synthesize picker; - -// TODO Move to Image.m -- (void)imagePickerController:(UIImagePickerController *)thePicker didFinishPickingImage:(UIImage *)theImage editingInfo:(NSDictionary *)editingInfo -{ - - //modified by urbian.org - g.mueller @urbian.org - - NSLog(@"photo: picked image"); - - NSData * imageData = UIImageJPEGRepresentation(theImage, 0.75); - - NSString *urlString = [@"http://" stringByAppendingString:photoUploadUrl]; // upload the photo to this url - - NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; - [request setURL:[NSURL URLWithString:urlString]]; - [request setHTTPMethod:@"POST"]; - - // --------- - //Add the header info - NSString *stringBoundary = [NSString stringWithString:@"0xKhTmLbOuNdArY"]; - NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",stringBoundary]; - [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; - - //create the body - NSMutableData *postBody = [NSMutableData data]; - [postBody appendData:[[NSString stringWithFormat:@"--%@\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; - - //add data field and file data - [postBody appendData:[[NSString stringWithString:@"Content-Disposition: form-data; name=\"photo_0\"; filename=\"photo\"\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; - [postBody appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]]; - - [postBody appendData:[NSData dataWithData:imageData]]; - [postBody appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",stringBoundary] dataUsingEncoding:NSUTF8StringEncoding]]; - - // --------- - [request setHTTPBody:postBody]; - - //NSURLConnection * - conn=[[NSURLConnection alloc] initWithRequest:request delegate:self]; - - if(conn) { - receivedData=[[NSMutableData data] retain]; - NSString *sourceSt = [[NSString alloc] initWithBytes:[receivedData bytes] length:[receivedData length] encoding:NSUTF8StringEncoding]; - NSLog([@"photo: connection sucess" stringByAppendingString:sourceSt]); - [sourceSt release]; - - } else { - NSLog(@"photo: upload failed!"); - } - - [[thePicker parentViewController] dismissModalViewControllerAnimated:YES]; - - webView.hidden = NO; - [window bringSubviewToFront:webView]; - -} - - -// TODO Move to Image.m -- (void)imagePickerControllerDidCancel:(UIImagePickerController *)thePicker -{ - // Dismiss the image selection and close the program - [[thePicker parentViewController] dismissModalViewControllerAnimated:YES]; - - //added by urbian - the webapp should know when the user canceled - NSString * jsCallBack = nil; - - jsCallBack = [[NSString alloc] initWithFormat:@"gotPhoto('CANCEL');", lastUploadedPhoto]; - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; - [jsCallBack release]; - - // Hide the imagePicker and bring the web page back into focus - NSLog(@"Photo Cancel Request"); - webView.hidden = NO; - [window bringSubviewToFront:webView]; -} - - - -// TODO Move to Image.m -- (void)connectionDidFinishLoading:(NSURLConnection *)connection { - - NSLog(@"photo: upload finished!"); - - //added by urbian.org - g.mueller - NSString *aStr = [[NSString alloc] initWithData:receivedData encoding:NSUTF8StringEncoding]; - - //upload.php should return "filename=" - NSLog(aStr); - NSArray * parts = [aStr componentsSeparatedByString:@"="]; - //set filename - lastUploadedPhoto = (NSString *)[parts objectAtIndex:1]; - - //now the callback: return lastUploadedPhoto - - NSString * jsCallBack = nil; - - if(lastUploadedPhoto == nil) lastUploadedPhoto = @"ERROR"; - - jsCallBack = [[NSString alloc] initWithFormat:@"gotPhoto('%@');", lastUploadedPhoto]; - - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; - - NSLog(@"Succeeded! Received %d bytes of data",[receivedData length]); - NSLog(jsCallBack); - - // release the connection, and the data object - [conn release]; - [receivedData release]; - [jsCallBack release]; - [aStr release]; -} - - -// TODO Move to Image.m --(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *) response { - - //added by urbian.org - NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *)response; - NSLog(@"HTTP Status Code: %i", [httpResponse statusCode]); - - [receivedData setLength:0]; -} - -- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data -{ - // append the new data to the receivedData - // receivedData is declared as a method instance elsewhere - [receivedData appendData:data]; - NSLog(@"photo: progress"); -} - - -/* - * Failed with Error - */ -- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { - NSLog([@"photo: upload failed! " stringByAppendingString:[error description]]); - -} - - - -@end diff --git a/iphone/Classes/LoadingView.h b/iphone/Classes/LoadingView.h deleted file mode 100644 index 52537e00..00000000 --- a/iphone/Classes/LoadingView.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// LoadingView.h -// LoadingView -// -// Created by Matt Gallagher on 12/04/09. -// Copyright Matt Gallagher 2009. All rights reserved. -// -// Permission is given to use this source code file without charge in any -// project, commercial or otherwise, entirely at your risk, with the condition -// that any redistribution (in part or whole) of source code must retain -// this copyright and permission notice. Attribution in compiled projects is -// appreciated but not required. -// - -#import - -@interface LoadingView : UIView -{ - NSTimeInterval minDuration; - NSDate* timestamp; -} - -@property NSTimeInterval minDuration; -@property (retain) NSDate* timestamp; - -+ (id)loadingViewInView:(UIView *)aSuperview; -- (void)removeView; - -@end diff --git a/iphone/Classes/LoadingView.m b/iphone/Classes/LoadingView.m deleted file mode 100644 index d9dcc735..00000000 --- a/iphone/Classes/LoadingView.m +++ /dev/null @@ -1,218 +0,0 @@ -// -// LoadingView.m -// LoadingView -// -// Created by Matt Gallagher on 12/04/09. -// Copyright Matt Gallagher 2009. All rights reserved. -// -// Permission is given to use this source code file without charge in any -// project, commercial or otherwise, entirely at your risk, with the condition -// that any redistribution (in part or whole) of source code must retain -// this copyright and permission notice. Attribution in compiled projects is -// appreciated but not required. -// - -#import "LoadingView.h" -#import - -// -// NewPathWithRoundRect -// -// Creates a CGPathRect with a round rect of the given radius. -// -CGPathRef NewPathWithRoundRect(CGRect rect, CGFloat cornerRadius) -{ - // - // Create the boundary path - // - CGMutablePathRef path = CGPathCreateMutable(); - CGPathMoveToPoint(path, NULL, - rect.origin.x, - rect.origin.y + rect.size.height - cornerRadius); - - // Top left corner - CGPathAddArcToPoint(path, NULL, - rect.origin.x, - rect.origin.y, - rect.origin.x + rect.size.width, - rect.origin.y, - cornerRadius); - - // Top right corner - CGPathAddArcToPoint(path, NULL, - rect.origin.x + rect.size.width, - rect.origin.y, - rect.origin.x + rect.size.width, - rect.origin.y + rect.size.height, - cornerRadius); - - // Bottom right corner - CGPathAddArcToPoint(path, NULL, - rect.origin.x + rect.size.width, - rect.origin.y + rect.size.height, - rect.origin.x, - rect.origin.y + rect.size.height, - cornerRadius); - - // Bottom left corner - CGPathAddArcToPoint(path, NULL, - rect.origin.x, - rect.origin.y + rect.size.height, - rect.origin.x, - rect.origin.y, - cornerRadius); - - // Close the path at the rounded rect - CGPathCloseSubpath(path); - - return path; -} - -@implementation LoadingView - -@synthesize minDuration; -@synthesize timestamp; - -// -// loadingViewInView: -// -// Constructor for this view. Creates and adds a loading view for covering the -// provided aSuperview. -// -// Parameters: -// aSuperview - the superview that will be covered by the loading view -// -// returns the constructed view, already added as a subview of the aSuperview -// (and hence retained by the superview) -// -+ (id)loadingViewInView:(UIView *)aSuperview -{ - LoadingView *loadingView = - [[[LoadingView alloc] initWithFrame:[aSuperview bounds]] autorelease]; - if (!loadingView) - { - return nil; - } - - loadingView.opaque = NO; - loadingView.autoresizingMask = - UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [aSuperview addSubview:loadingView]; - - const CGFloat DEFAULT_LABEL_WIDTH = 280.0; - const CGFloat DEFAULT_LABEL_HEIGHT = 50.0; - CGRect labelFrame = CGRectMake(0, 0, DEFAULT_LABEL_WIDTH, DEFAULT_LABEL_HEIGHT); - UILabel *loadingLabel = - [[[UILabel alloc] - initWithFrame:labelFrame] - autorelease]; - loadingLabel.text = NSLocalizedString(@"Loading...", nil); - loadingLabel.textColor = [UIColor whiteColor]; - loadingLabel.backgroundColor = [UIColor clearColor]; - loadingLabel.textAlignment = UITextAlignmentCenter; - loadingLabel.font = [UIFont boldSystemFontOfSize:[UIFont labelFontSize]]; - loadingLabel.autoresizingMask = - UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | - UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleBottomMargin; - - [loadingView addSubview:loadingLabel]; - UIActivityIndicatorView *activityIndicatorView = - [[[UIActivityIndicatorView alloc] - initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge] - autorelease]; - [loadingView addSubview:activityIndicatorView]; - activityIndicatorView.autoresizingMask = - UIViewAutoresizingFlexibleLeftMargin | - UIViewAutoresizingFlexibleRightMargin | - UIViewAutoresizingFlexibleTopMargin | - UIViewAutoresizingFlexibleBottomMargin; - [activityIndicatorView startAnimating]; - - CGFloat totalHeight = - loadingLabel.frame.size.height + - activityIndicatorView.frame.size.height; - labelFrame.origin.x = floor(0.5 * (loadingView.frame.size.width - DEFAULT_LABEL_WIDTH)); - labelFrame.origin.y = floor(0.5 * (loadingView.frame.size.height - totalHeight)); - loadingLabel.frame = labelFrame; - - CGRect activityIndicatorRect = activityIndicatorView.frame; - activityIndicatorRect.origin.x = - 0.5 * (loadingView.frame.size.width - activityIndicatorRect.size.width); - activityIndicatorRect.origin.y = - loadingLabel.frame.origin.y + loadingLabel.frame.size.height; - activityIndicatorView.frame = activityIndicatorRect; - - // Set up the fade-in animation - CATransition *animation = [CATransition animation]; - [animation setType:kCATransitionFade]; - [[aSuperview layer] addAnimation:animation forKey:@"layerAnimation"]; - - - loadingView.timestamp = [NSDate date]; - return loadingView; -} - -// -// removeView -// -// Animates the view out from the superview. As the view is removed from the -// superview, it will be released. -// -- (void)removeView -{ - UIView *aSuperview = [self superview]; - [super removeFromSuperview]; - - // Set up the animation - CATransition *animation = [CATransition animation]; - [animation setType:kCATransitionFade]; - - [[aSuperview layer] addAnimation:animation forKey:@"layerAnimation"]; -} - -// -// drawRect: -// -// Draw the view. -// -- (void)drawRect:(CGRect)rect -{ - rect.size.height -= 1; - rect.size.width -= 1; - - const CGFloat RECT_PADDING = 8.0; - rect = CGRectInset(rect, RECT_PADDING, RECT_PADDING); - - const CGFloat ROUND_RECT_CORNER_RADIUS = 5.0; - CGPathRef roundRectPath = NewPathWithRoundRect(rect, ROUND_RECT_CORNER_RADIUS); - - CGContextRef context = UIGraphicsGetCurrentContext(); - - const CGFloat BACKGROUND_OPACITY = 0.85; - CGContextSetRGBFillColor(context, 0, 0, 0, BACKGROUND_OPACITY); - CGContextAddPath(context, roundRectPath); - CGContextFillPath(context); - - const CGFloat STROKE_OPACITY = 0.25; - CGContextSetRGBStrokeColor(context, 1, 1, 1, STROKE_OPACITY); - CGContextAddPath(context, roundRectPath); - CGContextStrokePath(context); - - CGPathRelease(roundRectPath); -} - -// -// dealloc -// -// Release instance memory. -// -- (void)dealloc -{ - if (timestamp) - [timestamp release]; - [super dealloc]; -} - -@end diff --git a/iphone/Classes/Location.h b/iphone/Classes/Location.h deleted file mode 100755 index 8660880a..00000000 --- a/iphone/Classes/Location.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Location.h - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import -#import -#import "PhoneGapCommand.h" - -@interface Location : PhoneGapCommand { - CLLocationManager *locationManager; - BOOL __locationStarted; - BOOL __headingStarted; -} - -@property (nonatomic, retain) CLLocationManager *locationManager; - -- (BOOL) hasHeadingSupport; - -- (void)startLocation:(NSMutableArray*)arguments - withDict:(NSMutableDictionary*)options; - -- (void)stopLocation:(NSMutableArray*)arguments - withDict:(NSMutableDictionary*)options; - -- (void)locationManager:(CLLocationManager *)manager - didUpdateToLocation:(CLLocation *)newLocation - fromLocation:(CLLocation *)oldLocation; - -- (void)locationManager:(CLLocationManager *)manager - didFailWithError:(NSError *)error; - -#ifdef __IPHONE_3_0 - -- (void)startHeading:(NSMutableArray*)arguments - withDict:(NSMutableDictionary*)options; - -- (void)stopHeading:(NSMutableArray*)arguments - withDict:(NSMutableDictionary*)options; - -- (void)locationManager:(CLLocationManager *)manager - didUpdateHeading:(CLHeading *)heading; - -- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager; - -#endif - -@end \ No newline at end of file diff --git a/iphone/Classes/Location.m b/iphone/Classes/Location.m deleted file mode 100755 index 86495089..00000000 --- a/iphone/Classes/Location.m +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Location.m - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import "Location.h" - -@implementation Location - -@synthesize locationManager; - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView -{ - self = (Location*)[super initWithWebView:(UIWebView*)theWebView]; - if (self) { - self.locationManager = [[[CLLocationManager alloc] init] autorelease]; - self.locationManager.delegate = self; // Tells the location manager to send updates to this object - } - return self; -} - -- (BOOL) hasHeadingSupport -{ - // check whether headingAvailable property is avail (for 2.x devices) - if ([self.locationManager respondsToSelector:@selector(headingAvailable)] == NO) - return NO; - - #ifdef __IPHONE_3_0 - // now 3.x device, check whether it has heading support (eg Compass) - if ([self.locationManager headingAvailable] == NO) - return NO; - #endif - - return YES; -} - -- (void)startLocation:(NSMutableArray*)arguments - withDict:(NSMutableDictionary*)options -{ - if (__locationStarted == YES) - return; - if ([self.locationManager locationServicesEnabled] != YES) - return; - - // Tell the location manager to start notifying us of location updates - [self.locationManager startUpdatingLocation]; - __locationStarted = YES; - - if ([options objectForKey:@"distanceFilter"]) { - CLLocationDistance distanceFilter = [(NSString *)[options objectForKey:@"distanceFilter"] doubleValue]; - self.locationManager.distanceFilter = distanceFilter; - } - - if ([options objectForKey:@"desiredAccuracy"]) { - int desiredAccuracy_num = [(NSString *)[options objectForKey:@"desiredAccuracy"] integerValue]; - CLLocationAccuracy desiredAccuracy = kCLLocationAccuracyBest; - if (desiredAccuracy_num < 10) - desiredAccuracy = kCLLocationAccuracyBest; - else if (desiredAccuracy_num < 100) - desiredAccuracy = kCLLocationAccuracyNearestTenMeters; - else if (desiredAccuracy_num < 1000) - desiredAccuracy = kCLLocationAccuracyHundredMeters; - else if (desiredAccuracy_num < 3000) - desiredAccuracy = kCLLocationAccuracyKilometer; - else - desiredAccuracy = kCLLocationAccuracyThreeKilometers; - - self.locationManager.desiredAccuracy = desiredAccuracy; - } -} - -- (void)stopLocation:(NSMutableArray*)arguments - withDict:(NSMutableDictionary*)options -{ - if (__locationStarted == NO) - return; - if ([self.locationManager locationServicesEnabled] != YES) - return; - - [self.locationManager stopUpdatingLocation]; - __locationStarted = NO; -} - -- (void)locationManager:(CLLocationManager *)manager - didUpdateToLocation:(CLLocation *)newLocation - fromLocation:(CLLocation *)oldLocation -{ - int epoch = [newLocation.timestamp timeIntervalSince1970]; - float course = -1.0f; - float speed = -1.0f; -#ifdef __IPHONE_2_2 - course = newLocation.course; - speed = newLocation.speed; -#endif - NSString* coords = [NSString stringWithFormat:@"coords: { latitude: %f, longitude: %f, altitude: %f, heading: %f, speed: %f, accuracy: {horizontal: %f, vertical: %f}, altitudeAccuracy: null }", - newLocation.coordinate.latitude, - newLocation.coordinate.longitude, - newLocation.altitude, - course, - speed, - newLocation.horizontalAccuracy, - newLocation.verticalAccuracy - ]; - - NSString * jsCallBack = [NSString stringWithFormat:@"navigator.geolocation.setLocation({ timestamp: %d, %@ });", epoch, coords]; - NSLog(@"%@", jsCallBack); - - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - -- (void)startHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ -#ifdef __IPHONE_3_0 - if (__headingStarted == YES) - return; - if ([self hasHeadingSupport] == NO) - return; - - // Tell the location manager to start notifying us of heading updates - [self.locationManager startUpdatingHeading]; - __headingStarted = YES; -#endif -} - -- (void)stopHeading:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ -#ifdef __IPHONE_3_0 - if (__headingStarted == NO) - return; - if ([self hasHeadingSupport] == NO) - return; - - [self.locationManager stopUpdatingHeading]; - __headingStarted = NO; -#endif -} - -#ifdef __IPHONE_3_0 - -- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager -{ - return YES; -} - -- (void)locationManager:(CLLocationManager *)manager - didUpdateHeading:(CLHeading *)heading -{ - int epoch = [heading.timestamp timeIntervalSince1970]; - - NSString * jsCallBack = [NSString stringWithFormat:@"navigator.compass.setHeading({ timestamp: %d, magneticHeading: %f, trueHeading: %f, headingAccuracy: %f });", - epoch, heading.magneticHeading, heading.trueHeading, heading.headingAccuracy]; - // NSLog(@"%@", jsCallBack); - - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - -#endif - -- (void)locationManager:(CLLocationManager *)manager - didFailWithError:(NSError *)error -{ - NSString* jsCallBack = @""; - - #ifdef __IPHONE_3_0 - if ([error code] == kCLErrorHeadingFailure) { - jsCallBack = [NSString stringWithFormat:@"navigator.compass.setError(\"%s\");", - [error localizedDescription] - ]; - } else - #endif - { - jsCallBack = [NSString stringWithFormat:@"navigator.geolocation.setError(\"%s\");", - [error localizedDescription] - ]; - } - NSLog(@"%@", jsCallBack); - - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - -- (void)dealloc { - [self.locationManager release]; - [super dealloc]; -} - -@end diff --git a/iphone/Classes/Map.h b/iphone/Classes/Map.h deleted file mode 100644 index 07805a8b..00000000 --- a/iphone/Classes/Map.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// Map.h -// PhoneGap -// -// Created by Brant Vasilieff on 3/4/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import -#import "PhoneGapCommand.h" - -@interface Map : PhoneGapCommand { -} - -- (void)open:(NSArray*)arguments withDict:(NSDictionary*)options; - -@end diff --git a/iphone/Classes/Map.m b/iphone/Classes/Map.m deleted file mode 100644 index 119b99bf..00000000 --- a/iphone/Classes/Map.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// Map.m -// PhoneGap -// -// Created by Brant Vasilieff on 3/4/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "Map.h" - - -@implementation Map - -- (void)open:(NSArray*)arguments withDict:(NSDictionary*)options -{ -} - -@end diff --git a/iphone/Classes/Movie.h b/iphone/Classes/Movie.h deleted file mode 100755 index 89571607..00000000 --- a/iphone/Classes/Movie.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Sound.h - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import "PhoneGapCommand.h" -#import -#import - - -@interface Movie : PhoneGapCommand { - BOOL stopReceived; - BOOL repeat; - MPMoviePlayerController *theMovie; -} - -- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -void propListener ( - void *inClientData, - AudioSessionPropertyID inID, - UInt32 inDataSize, - const void *inData -); - -void interruptionListener ( - void *inClientData, - UInt32 inInterruptionState -); - -@property (nonatomic, retain ) MPMoviePlayerController *theMovie; -@property (nonatomic ) BOOL stopReceived; -@property (nonatomic ) BOOL repeat; - -@end diff --git a/iphone/Classes/Movie.m b/iphone/Classes/Movie.m deleted file mode 100755 index 5ee45526..00000000 --- a/iphone/Classes/Movie.m +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Movie.m - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import "Movie.h" -#import -#import - - -@implementation Movie - -@synthesize theMovie,stopReceived,repeat; - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView -{ - - self = [super initWithWebView:(UIWebView*)theWebView]; - if (self) { - stopReceived = false; - repeat = false; - } - return self; -} - - -- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSBundle * mainBundle = [NSBundle mainBundle]; - NSMutableArray *directoryParts = [NSMutableArray arrayWithArray:[(NSString*)[arguments objectAtIndex:0] componentsSeparatedByString:@"/"]]; - NSString *filename = [directoryParts lastObject]; - [directoryParts removeLastObject]; - - NSMutableArray *filenameParts = [NSMutableArray arrayWithArray:[filename componentsSeparatedByString:@"."]]; - NSString *directoryStr = [directoryParts componentsJoinedByString:@"/"]; - - NSString *filePath = [mainBundle pathForResource:(NSString*)[filenameParts objectAtIndex:0] - ofType:(NSString*)[filenameParts objectAtIndex:1] - inDirectory:directoryStr]; - if (filePath == nil) { - filePath = [mainBundle pathForResource:(NSString*)[filenameParts objectAtIndex:0] - ofType:(NSString*)[filenameParts objectAtIndex:1]]; - if (filePath == nil) { - - NSLog(@"Can't find filename %@ in the app bundle", [arguments objectAtIndex:0]); - return; - } - } - // TODO Create a system facilitating handling callback responses in JavaScript easily, and no - // longer in an ad-hoc fashion. Getting error results of whether or not the Movie played, or - // other errors occurring in the system is important. - - OSStatus error = AudioSessionInitialize(NULL, NULL, interruptionListener, self); - if (error) { - NSLog(@"ERROR INITIALIZING AUDIO SESSION! %d\n", error); - return; - } - - UInt32 sessionCategory = kAudioSessionCategory_AmbientSound; - AudioSessionSetProperty ( kAudioSessionProperty_AudioCategory, sizeof (sessionCategory), &sessionCategory ); - - error = AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange, propListener, self); - if (error) { - NSLog(@"ERROR Adding Property Listener %d\n", error); - return; - } - -// AudioSessionSetActive (true); - - theMovie = [[[MPMoviePlayerController alloc] initWithContentURL: [NSURL fileURLWithPath: filePath]] retain]; - NSLog(@"theMovie description = %@", [(NSObject *)theMovie description]); - - [theMovie setOrientation:UIDeviceOrientationPortrait animated:NO]; - - theMovie.scalingMode = MPMovieScalingModeAspectFill; - theMovie.movieControlMode = MPMovieControlModeDefault; - // Register for the playback finished notification. - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(myMovieFinishedCallback:) - name:MPMoviePlayerPlaybackDidFinishNotification - object:theMovie]; - - // Movie playback is asynchronous, so this method returns immediately. - [theMovie play]; -} - -- (void) stop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { - - NSLog(@"Stop the movie!"); - stopReceived = true; - NSLog(@"theMovie description = %@", [(NSObject *)theMovie description]); - - [theMovie stop]; - - NSLog(@"Finished stopping the movie."); - - -} -#pragma mark AudioSession listeners -void interruptionListener ( - void *inClientData, - UInt32 inInterruptionState -) -{ - if (inInterruptionState == kAudioSessionBeginInterruption) {} - NSLog(@"Movie: interruptionListener"); - -} -void propListener( void * inClientData, - AudioSessionPropertyID inID, - UInt32 inDataSize, - const void * inData) -{ - NSLog(@"Movie: audio prop Listener"); - } - - --(void)myMovieFinishedCallback:(NSNotification*)aNotification -{ - NSLog(@"myMovieFinishedCallback"); - MPMoviePlayerController* myMovie = [aNotification object]; - NSLog(@"myMovie description = %@, theMovie description = %@, stopRecieved = %d", [(NSObject *)myMovie description], theMovie, stopReceived); - if(stopReceived) { - [theMovie stop]; - [[NSNotificationCenter defaultCenter] removeObserver:self - name:MPMoviePlayerPlaybackDidFinishNotification - object:myMovie]; - - [ myMovie release]; - } if(repeat) { - [myMovie play]; - } - -} -+(MPMoviePlayerController *)theMovie { return theMovie;} -+(BOOL) stopReceived { return stopReceived;} -+(BOOL) repeat { return repeat;} -@end diff --git a/iphone/Classes/NSData+Base64.h b/iphone/Classes/NSData+Base64.h deleted file mode 100644 index d9320f42..00000000 --- a/iphone/Classes/NSData+Base64.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// NSData+Base64.h -// base64 -// -// Created by Matt Gallagher on 2009/06/03. -// Copyright 2009 Matt Gallagher. All rights reserved. -// -// Permission is given to use this source code file, free of charge, in any -// project, commercial or otherwise, entirely at your risk, with the condition -// that any redistribution (in part or whole) of source code must retain -// this copyright and permission notice. Attribution in compiled projects is -// appreciated but not required. -// - -void *NewBase64Decode( - const char *inputBuffer, - size_t length, - size_t *outputLength); - -char *NewBase64Encode( - const void *inputBuffer, - size_t length, - bool separateLines, - size_t *outputLength); - -@interface NSData (Base64) - -+ (NSData *)dataFromBase64String:(NSString *)aString; -- (NSString *)base64EncodedString; - -@end diff --git a/iphone/Classes/NSData+Base64.m b/iphone/Classes/NSData+Base64.m deleted file mode 100644 index 0f9c6ac7..00000000 --- a/iphone/Classes/NSData+Base64.m +++ /dev/null @@ -1,298 +0,0 @@ -// -// NSData+Base64.m -// base64 -// -// Created by Matt Gallagher on 2009/06/03. -// Copyright 2009 Matt Gallagher. All rights reserved. -// -// Permission is given to use this source code file, free of charge, in any -// project, commercial or otherwise, entirely at your risk, with the condition -// that any redistribution (in part or whole) of source code must retain -// this copyright and permission notice. Attribution in compiled projects is -// appreciated but not required. -// - -#import "NSData+Base64.h" - -// -// Mapping from 6 bit pattern to ASCII character. -// -static unsigned char base64EncodeLookup[65] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -// -// Definition for "masked-out" areas of the base64DecodeLookup mapping -// -#define xx 65 - -// -// Mapping from ASCII character to 6 bit pattern. -// -static unsigned char base64DecodeLookup[256] = -{ - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx, - xx, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx, - xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, - xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, -}; - -// -// Fundamental sizes of the binary and base64 encode/decode units in bytes -// -#define BINARY_UNIT_SIZE 3 -#define BASE64_UNIT_SIZE 4 - -// -// NewBase64Decode -// -// Decodes the base64 ASCII string in the inputBuffer to a newly malloced -// output buffer. -// -// inputBuffer - the source ASCII string for the decode -// length - the length of the string or -1 (to specify strlen should be used) -// outputLength - if not-NULL, on output will contain the decoded length -// -// returns the decoded buffer. Must be free'd by caller. Length is given by -// outputLength. -// -void *NewBase64Decode( - const char *inputBuffer, - size_t length, - size_t *outputLength) -{ - if (length == -1) - { - length = strlen(inputBuffer); - } - - size_t outputBufferSize = (length / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE; - unsigned char *outputBuffer = (unsigned char *)malloc(outputBufferSize); - - size_t i = 0; - size_t j = 0; - while (i < length) - { - // - // Accumulate 4 valid characters (ignore everything else) - // - unsigned char accumulated[BASE64_UNIT_SIZE]; - size_t accumulateIndex = 0; - while (i < length) - { - unsigned char decode = base64DecodeLookup[inputBuffer[i++]]; - if (decode != xx) - { - accumulated[accumulateIndex] = decode; - accumulateIndex++; - - if (accumulateIndex == BASE64_UNIT_SIZE) - { - break; - } - } - } - - // - // Store the 6 bits from each of the 4 characters as 3 bytes - // - outputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4); - outputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2); - outputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3]; - j += accumulateIndex - 1; - } - - if (outputLength) - { - *outputLength = j; - } - return outputBuffer; -} - -// -// NewBase64Decode -// -// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced -// output buffer. -// -// inputBuffer - the source data for the encode -// length - the length of the input in bytes -// separateLines - if zero, no CR/LF characters will be added. Otherwise -// a CR/LF pair will be added every 64 encoded chars. -// outputLength - if not-NULL, on output will contain the encoded length -// (not including terminating 0 char) -// -// returns the encoded buffer. Must be free'd by caller. Length is given by -// outputLength. -// -char *NewBase64Encode( - const void *buffer, - size_t length, - bool separateLines, - size_t *outputLength) -{ - const unsigned char *inputBuffer = (const unsigned char *)buffer; - - #define MAX_NUM_PADDING_CHARS 2 - #define OUTPUT_LINE_LENGTH 64 - #define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / BASE64_UNIT_SIZE) * BINARY_UNIT_SIZE) - #define CR_LF_SIZE 0 - - // - // Byte accurate calculation of final buffer size - // - size_t outputBufferSize = - ((length / BINARY_UNIT_SIZE) - + ((length % BINARY_UNIT_SIZE) ? 1 : 0)) - * BASE64_UNIT_SIZE; - if (separateLines) - { - outputBufferSize += - (outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE; - } - - // - // Include space for a terminating zero - // - outputBufferSize += 1; - - // - // Allocate the output buffer - // - char *outputBuffer = (char *)malloc(outputBufferSize); - if (!outputBuffer) - { - return NULL; - } - - size_t i = 0; - size_t j = 0; - const size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length; - size_t lineEnd = lineLength; - - while (true) - { - if (lineEnd > length) - { - lineEnd = length; - } - - for (; i + BINARY_UNIT_SIZE - 1 < lineEnd; i += BINARY_UNIT_SIZE) - { - // - // Inner loop: turn 48 bytes into 64 base64 characters - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4) - | ((inputBuffer[i + 1] & 0xF0) >> 4)]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2) - | ((inputBuffer[i + 2] & 0xC0) >> 6)]; - outputBuffer[j++] = base64EncodeLookup[inputBuffer[i + 2] & 0x3F]; - } - - if (lineEnd == length) - { - break; - } - - // - // Add the newline - // - //outputBuffer[j++] = '\r'; - //outputBuffer[j++] = '\n'; - lineEnd += lineLength; - } - - if (i + 1 < length) - { - // - // Handle the single '=' case - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[((inputBuffer[i] & 0x03) << 4) - | ((inputBuffer[i + 1] & 0xF0) >> 4)]; - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2]; - outputBuffer[j++] = '='; - } - else if (i < length) - { - // - // Handle the double '=' case - // - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2]; - outputBuffer[j++] = base64EncodeLookup[(inputBuffer[i] & 0x03) << 4]; - outputBuffer[j++] = '='; - outputBuffer[j++] = '='; - } - outputBuffer[j] = 0; - - // - // Set the output length and return the buffer - // - if (outputLength) - { - *outputLength = j; - } - return outputBuffer; -} - -@implementation NSData (Base64) - -// -// dataFromBase64String: -// -// Creates an NSData object containing the base64 decoded representation of -// the base64 string 'aString' -// -// Parameters: -// aString - the base64 string to decode -// -// returns the autoreleased NSData representation of the base64 string -// -+ (NSData *)dataFromBase64String:(NSString *)aString -{ - NSData *data = [aString dataUsingEncoding:NSASCIIStringEncoding]; - size_t outputLength; - void *outputBuffer = NewBase64Decode([data bytes], [data length], &outputLength); - NSData *result = [NSData dataWithBytes:outputBuffer length:outputLength]; - free(outputBuffer); - return result; -} - -// -// base64EncodedString -// -// Creates an NSString object that contains the base 64 encoding of the -// receiver's data. Lines are broken at 64 characters long. -// -// returns an autoreleased NSString being the base 64 representation of the -// receiver. -// -- (NSString *)base64EncodedString -{ - size_t outputLength; - char *outputBuffer = - NewBase64Encode([self bytes], [self length], true, &outputLength); - - NSString *result = - [[[NSString alloc] - initWithBytes:outputBuffer - length:outputLength - encoding:NSASCIIStringEncoding] - autorelease]; - free(outputBuffer); - return result; -} - -@end diff --git a/iphone/Classes/Network.h b/iphone/Classes/Network.h deleted file mode 100644 index 0983f80e..00000000 --- a/iphone/Classes/Network.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Network.h -// PhoneGap -// -// Created by Shazron Abdullah on 29/07/09. -// Copyright 2009 Nitobi Inc. All rights reserved. -// - -#import -#import "PhoneGapCommand.h" - -@class Reachability; - -@interface Network : PhoneGapCommand { - -} - -- (void) isReachable:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void) reachabilityChanged:(NSNotification *)note; -- (void) updateReachability:(NSString*)callback; - -@end diff --git a/iphone/Classes/Network.m b/iphone/Classes/Network.m deleted file mode 100644 index 3dea5c7e..00000000 --- a/iphone/Classes/Network.m +++ /dev/null @@ -1,64 +0,0 @@ -// -// Network.m -// PhoneGap -// -// Created by Shazron Abdullah on 29/07/09. -// Copyright 2009 Nitobi Inc. All rights reserved. -// - -#import "Network.h" -#import "Reachability.h" -#import "Categories.h" - -@implementation Network - -- (void) isReachable:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - NSString* hostName = nil, *callback = nil; - - if (argc > 0) hostName = [arguments objectAtIndex:0]; - if (argc > 1) callback = [arguments objectAtIndex:1]; - - if (argc < 1) { - NSLog(@"Network.startReachability: Missing 1st argument (hostName)."); - return; - } - - if ([options existsValue:@"true" forKey:@"isIpAddress"]) { - [[Reachability sharedReachability] setAddress:hostName]; - } else { - [[Reachability sharedReachability] setHostName:hostName]; - } - - //[[Reachability sharedReachability] setNetworkStatusNotificationsEnabled:YES]; - [self updateReachability:callback]; - - //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:@"kNetworkReachabilityChangedNotification" object:nil]; -} - -- (void)reachabilityChanged:(NSNotification *)note -{ - [self updateReachability:nil]; -} - -- (void)updateReachability:(NSString*)callback -{ - NSString* jsCallback = @"navigator.network.updateReachability"; - if (callback) - jsCallback = callback; - - NSString* status = [[NSString alloc] initWithFormat:@"%@({ hostName: '%@', ipAddress: '%@', remoteHostStatus: %d, internetConnectionStatus: %d, localWiFiConnectionStatus: %d });", - jsCallback, - [[Reachability sharedReachability] hostName], - [[Reachability sharedReachability] address], - [[Reachability sharedReachability] remoteHostStatus], - [[Reachability sharedReachability] internetConnectionStatus], - [[Reachability sharedReachability] localWiFiConnectionStatus]]; - - - [webView stringByEvaluatingJavaScriptFromString:status]; - [status release]; -} - -@end diff --git a/iphone/Classes/Notification.h b/iphone/Classes/Notification.h deleted file mode 100644 index c426b5ef..00000000 --- a/iphone/Classes/Notification.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Notification.h -// PhoneGap -// -// Created by Michael Nachbaur on 16/04/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import -#import -#import -#import "PhoneGapCommand.h" -#import "LoadingView.h" - -@interface Notification : PhoneGapCommand { - LoadingView* loadingView; -} - -- (void)alert:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)activityStart:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)activityStop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)vibrate:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)loadingStart:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)loadingStop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iphone/Classes/Notification.m b/iphone/Classes/Notification.m deleted file mode 100644 index 5286f93b..00000000 --- a/iphone/Classes/Notification.m +++ /dev/null @@ -1,109 +0,0 @@ -// -// Notification.m -// PhoneGap -// -// Created by Michael Nachbaur on 16/04/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import "Notification.h" -#import "Categories.h" - -@implementation Notification - -- (void)alert:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* message = [arguments objectAtIndex:0]; - NSString* title = [options objectForKey:@"title"]; - NSString* button = [options objectForKey:@"buttonLabel"]; - - if (!title) - title = @"Alert"; - if (!button) - button = @"OK"; - - UIAlertView *openURLAlert = [[UIAlertView alloc] - initWithTitle:title - message:message delegate:nil cancelButtonTitle:button otherButtonTitles:nil]; - [openURLAlert show]; - [openURLAlert release]; -} - -- (void)prompt:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* message = [arguments objectAtIndex:0]; - NSString* title = [options objectForKey:@"title"]; - NSString* button = [options objectForKey:@"buttonLabel"]; - - if (!title) - title = @"Alert"; - if (!button) - button = @"OK"; - - UIAlertView *openURLAlert = [[UIAlertView alloc] - initWithTitle:title - message:message delegate:nil cancelButtonTitle:button otherButtonTitles:nil]; - [openURLAlert show]; - [openURLAlert release]; -} - -- (void)activityStart:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - //[(UIActivityIndicatorView*)[self.webView.window viewWithTag:2] startAnimating]; - NSLog(@"Activity starting"); - UIApplication* app = [UIApplication sharedApplication]; - app.networkActivityIndicatorVisible = YES; -} - -- (void)activityStop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - //[(UIActivityIndicatorView*)[self.webView.window viewWithTag:2] stopAnimating]; - - NSLog(@"Activitiy stopping "); - UIApplication* app = [UIApplication sharedApplication]; - app.networkActivityIndicatorVisible = NO; -} - -- (void)vibrate:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); -} - -- (void)loadingStart:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - if (loadingView == nil) - { - NSLog(@"Loading start"); - UIViewController* c = [super appViewController]; - loadingView = [LoadingView loadingViewInView:c.view]; - - NSRange minMaxDuration = NSMakeRange(2, 3600);// 1 hour max? :) - NSString* durationKey = @"duration"; - // the view will be shown for a minimum of this value if durationKey is not set - loadingView.minDuration = [options integerValueForKey:@"minDuration" defaultValue:minMaxDuration.location withRange:minMaxDuration]; - - // if there's a duration set, we set a timer to close the view - if ([options valueForKey:durationKey]) { - NSTimeInterval duration = [options integerValueForKey:durationKey defaultValue:minMaxDuration.location withRange:minMaxDuration]; - [self performSelector:@selector(loadingStop:withDict:) withObject:nil afterDelay:duration]; - } - } -} - -- (void)loadingStop:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - if (loadingView != nil) - { - NSLog(@"Loading stop"); - NSTimeInterval diff = [[NSDate date] timeIntervalSinceDate:loadingView.timestamp] - loadingView.minDuration; - - if (diff >= 0) { - [loadingView removeView]; // the superview will release (see removeView doc), so no worries for below - loadingView = nil; - } else { - [self performSelector:@selector(loadingStop:withDict:) withObject:nil afterDelay:-1*diff]; - } - } -} - -@end diff --git a/iphone/Classes/OCABMutableMultiValue.h b/iphone/Classes/OCABMutableMultiValue.h deleted file mode 100644 index 68cb9933..00000000 --- a/iphone/Classes/OCABMutableMultiValue.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// OCABMutableMultiValue.h -// PhoneGap -// -// Created by shazron on 29/05/09. -// Copyright 2009 Nitobi Software Inc.. All rights reserved. -// - -@class OCCFObject; - -@interface OCABMutableMultiValue : OCCFObject { - -} - -- (ABMutableMultiValueRef) ABMutableMultiValueRef; -- (CFIndex) count; - -- (NSString*) labelAt:(CFIndex)index; -- (NSString*) localizedLabelAt:(CFIndex)index; -- (NSString*) valueAt:(CFIndex)index; -- (BOOL) addValue:(CFTypeRef)value withLabel:(CFStringRef)label; - -- (NSString*) JSONValue; - -@end diff --git a/iphone/Classes/OCABMutableMultiValue.m b/iphone/Classes/OCABMutableMultiValue.m deleted file mode 100644 index ba98b417..00000000 --- a/iphone/Classes/OCABMutableMultiValue.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// OCABMutableMultiValue.m -// PhoneGap -// -// Created by shazron on 29/05/09. -// Copyright 2009 Nitobi Software Inc.. All rights reserved. -// - -#import -#import "OCCFObject.h" -#import "OCABMutableMultiValue.h" -#import - -@implementation OCABMutableMultiValue - -- (ABMutableMultiValueRef) ABMutableMultiValueRef -{ - return (ABMutableMultiValueRef)__baseRef; -} - -- (CFIndex) count -{ - return ABMultiValueGetCount([self ABMutableMultiValueRef]); -} - -- (NSString*) labelAt:(CFIndex)index -{ - return [(id)ABMultiValueCopyLabelAtIndex([self ABMutableMultiValueRef], index) autorelease]; -} - -- (NSString*) localizedLabelAt:(CFIndex)index -{ - return [(id)ABAddressBookCopyLocalizedLabel((CFStringRef)[self labelAt:index]) autorelease]; -} - -- (NSString*) valueAt:(CFIndex)index -{ - return [(id)ABMultiValueCopyValueAtIndex([self ABMutableMultiValueRef], index) autorelease]; -} - -- (BOOL) addValue:(CFTypeRef)value withLabel:(CFStringRef)label -{ - return ABMultiValueAddValueAndLabel([self ABMutableMultiValueRef], value, label, NULL); -} - -- (NSString*) JSONValue -{ - NSMutableString* json = [[[NSMutableString alloc] initWithString:@"[{"] autorelease]; - NSString* pair = nil; - CFIndex count = [self count]; - - NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - for (CFIndex i = 0; i < count; i++) - { - pair = [[[NSString alloc] initWithFormat:@"label:'%@', value:'%@'", [[self localizedLabelAt:i] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"], [[self valueAt:i] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]] autorelease]; - [json appendString:pair]; - - if (i+1 != count) { - [json appendString:@"},{"]; - } - } - [pool release]; - - [json appendString:@"}]"]; - return json; -} - -@end diff --git a/iphone/Classes/OCABRecord.h b/iphone/Classes/OCABRecord.h deleted file mode 100644 index eafe2d72..00000000 --- a/iphone/Classes/OCABRecord.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// OCABRecordRef.h -// PhoneGap -// -// Created by shazron on 29/05/09. -// Copyright 2009 Nitobi Software Inc.. All rights reserved. -// -#import - -@class OCCFObject, OCABMutableMultiValue; - -@interface OCABRecord : OCCFObject { - CFErrorRef error; -} - -@property CFErrorRef error; - -- (ABRecordRef) ABRecordRef; -+ (OCABRecord*) newFromRecordID:(ABRecordID)recordID andAddressBook:(ABAddressBookRef)addressBook; - -- (NSString*) firstName; -- (NSString*) lastName; -- (NSString*) compositeName; -- (BOOL) setPhoneNumber:(NSString*)phoneNumber withLabel:(NSString*)label; - -- (OCABMutableMultiValue*) phoneNumbers; - -- (BOOL) setFirstName:(NSString*)firstName; -- (BOOL) setLastName:(NSString*)lastName; - -- (BOOL) removeFrom:(ABAddressBookRef)addressBook; - -- (NSString*) JSONValue; - -@end diff --git a/iphone/Classes/OCABRecord.m b/iphone/Classes/OCABRecord.m deleted file mode 100644 index c4c73ce7..00000000 --- a/iphone/Classes/OCABRecord.m +++ /dev/null @@ -1,123 +0,0 @@ -// -// OCABRecordRef.m -// PhoneGap -// -// Created by shazron on 29/05/09. -// Copyright 2009 Nitobi Software Inc.. All rights reserved. -// - -#import "OCCFObject.h" -#import "OCABRecord.h" -#import "OCABMutableMultiValue.h" - - -@implementation OCABRecord - -@synthesize error; - -+ (OCABRecord*) newFromRecordID:(ABRecordID)recordID andAddressBook:(ABAddressBookRef)addressBook -{ - ABRecordRef ref = ABAddressBookGetPersonWithRecordID(addressBook, recordID); - return [[OCABRecord alloc] initWithCFTypeRef:ref]; -} - -- (ABRecordRef) ABRecordRef -{ - return (ABRecordRef)__baseRef; -} - -- (NSString*) firstName -{ - return [(id)ABRecordCopyValue([self ABRecordRef], kABPersonFirstNameProperty) autorelease]; -} - -- (NSString*) lastName -{ - return [(id)ABRecordCopyValue([self ABRecordRef], kABPersonLastNameProperty) autorelease]; -} - -- (NSString*) compositeName -{ - return [(id)ABRecordCopyCompositeName([self ABRecordRef]) autorelease]; -} - - - -- (BOOL) setPhoneNumber:(NSString*)phoneNumber withLabel:(NSString*)label -{ - OCABMutableMultiValue* phoneNumbers = [self phoneNumbers]; - [phoneNumbers addValue:phoneNumber withLabel:(CFStringRef)label]; - return ABRecordSetValue([self ABRecordRef], kABPersonPhoneProperty, [phoneNumbers ABMutableMultiValueRef], &error); -} - -- (ABRecordID) recordID -{ - return ABRecordGetRecordID([self ABRecordRef]); -} - -- (OCABMutableMultiValue*) phoneNumbers -{ - CFTypeRef rec = ABRecordCopyValue([self ABRecordRef], kABPersonPhoneProperty); - if (!rec) { - rec = ABMultiValueCreateMutable(kABMultiStringPropertyType); - } - - id val = [[[OCABMutableMultiValue alloc] initWithCFTypeRef:rec] autorelease]; - CFRelease(rec); - return val; -} -- (OCABMutableMultiValue*) emails -{ - CFTypeRef rec = ABRecordCopyValue([self ABRecordRef], kABPersonEmailProperty); - if (!rec) { - rec = ABMultiValueCreateMutable(kABMultiStringPropertyType); - } - - id val = [[[OCABMutableMultiValue alloc] initWithCFTypeRef:rec] autorelease]; - CFRelease(rec); - return val; -} - -- (BOOL) setFirstName:(NSString*)firstName -{ - return ABRecordSetValue ([self ABRecordRef], kABPersonFirstNameProperty, firstName, &error); -} - -- (BOOL) setLastName:(NSString*)lastName -{ - return ABRecordSetValue ([self ABRecordRef], kABPersonLastNameProperty, lastName, &error); -} - -- (BOOL) removeFrom:(ABAddressBookRef)addressBook -{ - return ABAddressBookRemoveRecord(addressBook, [self ABRecordRef], &error); -} - -- (NSString*) JSONValue -{ - NSString* firstName = [[self firstName] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; - NSString* lastName = [[self lastName] stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; - NSString* emptyString = @""; - NSString* name = @""; - if (firstName != nil && lastName != nil ) - { - name = [NSString stringWithFormat:@"%@ %@",firstName, lastName]; - } - else if ((firstName != nil && lastName == nil ) || (firstName = nil - && lastName != nil )) // logical xor would be nice.. - { - name = [NSString stringWithFormat:@"%@",firstName !=nil ? firstName: lastName]; - } - - return [[[NSString alloc] initWithFormat:@"{ recordID: %d, name:'%@', firstName:'%@', lastName: '%@', phoneNumbers:%@, emails: %@, address:'%@'}", - [self recordID], - name, - firstName == nil? emptyString : firstName, - lastName == nil? emptyString : lastName, - [[self phoneNumbers] JSONValue], - [[self emails] JSONValue], - @"" - ] autorelease]; -} - -@end \ No newline at end of file diff --git a/iphone/Classes/OCCFObject.h b/iphone/Classes/OCCFObject.h deleted file mode 100644 index 24c13dff..00000000 --- a/iphone/Classes/OCCFObject.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// OCCFObject.h -// PhoneGap -// -// Created by shazron on 28/05/09. -// Copyright 2009 Nitobi Software Inc.. All rights reserved. -// - -@interface OCCFObject : NSObject { - CFTypeRef __baseRef; -} - -- initWithCFTypeRef:(CFTypeRef)ref; -- (CFTypeRef) CFTypeRef; -- (BOOL) isEqual:other; - -@end diff --git a/iphone/Classes/OCCFObject.m b/iphone/Classes/OCCFObject.m deleted file mode 100644 index 7cd13390..00000000 --- a/iphone/Classes/OCCFObject.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// OCCFObject.m -// PhoneGap -// -// Created by shazron on 28/05/09. -// Copyright 2009 Nitobi Software Inc. All rights reserved. -// - -#import "OCCFObject.h" - -@implementation OCCFObject - - -- initWithCFTypeRef:(CFTypeRef)ref; -{ - if (ref){ - __baseRef = ref; - CFRetain(ref); - } else { - [self autorelease]; - self = nil; - } - - return self; -} - -- (void) dealloc -{ - if (__baseRef) - { - CFRelease(__baseRef); - } - [super dealloc]; -} - -- (CFTypeRef) CFTypeRef; -{ - return __baseRef; -} - -- (void) release -{ - [super release]; -} - -- (id) retain -{ - return [super retain]; -} - -- (id) autorelease -{ - return [super autorelease]; -} - -- (BOOL)isEqual:(id)object; -{ - BOOL result = (object == self); - - if (!result && [object respondsToSelector:@selector(CFTypeRef)]) - { - result = CFEqual(__baseRef, [object CFTypeRef]); - } - - return result; -} - -@end diff --git a/iphone/Classes/PhoneGapCommand.h b/iphone/Classes/PhoneGapCommand.h deleted file mode 100644 index 48e0a24d..00000000 --- a/iphone/Classes/PhoneGapCommand.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// PhoneGapCommand.h -// PhoneGap -// -// Created by Michael Nachbaur on 13/04/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import -#import - -@class PhoneGapDelegate; - -@interface PhoneGapCommand : NSObject { - UIWebView* webView; - NSDictionary* settings; -} -@property (nonatomic, retain) UIWebView *webView; -@property (nonatomic, retain) NSDictionary *settings; - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings; --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView; - --(PhoneGapDelegate*) appDelegate; --(UIViewController*) appViewController; - -@end diff --git a/iphone/Classes/PhoneGapCommand.m b/iphone/Classes/PhoneGapCommand.m deleted file mode 100644 index af543189..00000000 --- a/iphone/Classes/PhoneGapCommand.m +++ /dev/null @@ -1,49 +0,0 @@ -// -// PhoneGapCommand.m -// PhoneGap -// -// Created by Michael Nachbaur on 13/04/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import "PhoneGapCommand.h" -#import "PhoneGapDelegate.h" - -@implementation PhoneGapCommand -@synthesize webView; -@synthesize settings; - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView settings:(NSDictionary*)classSettings -{ - self = [self initWithWebView:theWebView]; - if (self) - [self setSettings:classSettings]; - return self; -} - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView -{ - self = [super init]; - if (self) - [self setWebView:theWebView]; - return self; -} - -- (void)dealloc -{ - if (self.settings) - [self.settings release]; - [super dealloc]; -} - --(PhoneGapDelegate*) appDelegate -{ - return (PhoneGapDelegate*)[[UIApplication sharedApplication] delegate]; -} - --(UIViewController*) appViewController -{ - return (UIViewController*)[self appDelegate].viewController; -} - -@end \ No newline at end of file diff --git a/iphone/Classes/PhoneGapDelegate.h b/iphone/Classes/PhoneGapDelegate.h deleted file mode 100755 index e9663829..00000000 --- a/iphone/Classes/PhoneGapDelegate.h +++ /dev/null @@ -1,54 +0,0 @@ -#import -#import -#import -#import - -#import "Location.h" -#import "Device.h" -#import "Sound.h" -#import "Contacts.h" -#import "DebugConsole.h" -#import "UIControls.h" -//#import "Image.h" - -@class PhoneGapViewController; -@class Sound; -@class Contacts; -@class Console; -//@class Image; - -@interface PhoneGapDelegate : NSObject < - UIApplicationDelegate, - UIWebViewDelegate, - UIAccelerometerDelegate, - UINavigationControllerDelegate - > -{ - - IBOutlet UIWindow *window; - IBOutlet UIWebView *webView; - IBOutlet PhoneGapViewController *viewController; - - IBOutlet UIImageView *imageView; - IBOutlet UIActivityIndicatorView *activityView; - - NSURLConnection *conn; // added by urbian - NSMutableData *receivedData; // added by urbian - - UIInterfaceOrientation orientationType; - NSDictionary *settings; - NSMutableDictionary *commandObjects; - NSURL *invokedURL; -} - -@property (nonatomic, retain) UIWindow *window; -@property (nonatomic, retain) PhoneGapViewController *viewController; -@property (nonatomic, retain) UIActivityIndicatorView *activityView; -@property (nonatomic, retain) NSMutableDictionary *commandObjects; -@property (nonatomic, retain) NSDictionary *settings; -@property (nonatomic, retain) NSURL *invokedURL; - --(id) getCommandInstance:(NSString*)className; -+ (NSDictionary*)getBundlePlist:(NSString *)plistName; - -@end diff --git a/iphone/Classes/PhoneGapDelegate.m b/iphone/Classes/PhoneGapDelegate.m deleted file mode 100755 index db0c6352..00000000 --- a/iphone/Classes/PhoneGapDelegate.m +++ /dev/null @@ -1,473 +0,0 @@ -#import "PhoneGapDelegate.h" -#import "PhoneGapViewController.h" -#import -#import "Movie.h" - -@implementation PhoneGapDelegate - -@synthesize window; -@synthesize viewController; -@synthesize activityView; -@synthesize commandObjects; -@synthesize settings; -@synthesize invokedURL; - -- (id) init -{ - self = [super init]; - if (self != nil) { - commandObjects = [[NSMutableDictionary alloc] initWithCapacity:4]; - } - return self; -} - -/** - Returns an instance of a PhoneGapCommand object, based on its name. If one exists already, it is returned. - */ --(id) getCommandInstance:(NSString*)className -{ - id obj = [commandObjects objectForKey:className]; - if (!obj) { - // attempt to load the settings for this command class - NSDictionary* classSettings; - classSettings = [settings objectForKey:className]; - - if (classSettings) - obj = [[NSClassFromString(className) alloc] initWithWebView:webView settings:classSettings]; - else - obj = [[NSClassFromString(className) alloc] initWithWebView:webView]; - - [commandObjects setObject:obj forKey:className]; - [obj release]; - } - return obj; -} - -/** - * This is main kick off after the app inits, the views and Settings are setup here. - */ -- (void)applicationDidFinishLaunching:(UIApplication *)application -{ - /* - * PhoneGap.plist - * - * This block of code navigates to the PhoneGap.plist in the Config Group and reads the XML into an Hash (Dictionary) - * - */ - NSDictionary *temp = [PhoneGapDelegate getBundlePlist:@"PhoneGap"]; - settings = [[NSDictionary alloc] initWithDictionary:temp]; - - NSNumber *detectNumber = [settings objectForKey:@"DetectPhoneNumber"]; - NSNumber *useLocation = [settings objectForKey:@"UseLocation"]; - NSNumber *useAccelerometer = [settings objectForKey:@"EnableAcceleration"]; - NSNumber *autoRotate = [settings objectForKey:@"AutoRotate"]; - NSString *startOrientation = [settings objectForKey:@"StartOrientation"]; - NSString *rotateOrientation = [settings objectForKey:@"RotateOrientation"]; - NSString *topActivityIndicator = [settings objectForKey:@"TopActivityIndicator"]; - - /* - * Fire up the GPS Service right away as it takes a moment for data to come back. - */ - if ([useLocation boolValue]) { - [[self getCommandInstance:@"Location"] startLocation:nil withDict:nil]; - } - - webView.delegate = self; - - if ([useAccelerometer boolValue]) { - [[UIAccelerometer sharedAccelerometer] setUpdateInterval:1.0/40.0]; - [[UIAccelerometer sharedAccelerometer] setDelegate:self]; - } - - [window addSubview:viewController.view]; - - /* - * webView - * This is where we define the inital instance of the browser (WebKit) and give it a starting url/file. - */ - NSURL *appURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"www"]]; - NSURLRequest *appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0]; - [webView loadRequest:appReq]; - - webView.detectsPhoneNumbers = [detectNumber boolValue]; - - /* - * imageView - is the Default loading screen, it stay up until the app and UIWebView (WebKit) has completly loaded. - * You can change this image by swapping out the Default.png file within the resource folder. - */ - UIImage* image = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Default" ofType:@"png"]]; - imageView = [[UIImageView alloc] initWithImage:image]; - [image release]; - - imageView.tag = 1; - [window addSubview:imageView]; - [imageView release]; - - /* - * autoRotate - If you want your phone to automatically rotate its display when the phone is rotated - * Value should be BOOL (YES|NO) - */ - [viewController setAutoRotate:[autoRotate boolValue]]; - - /* - * startOrientation - This option dictates what the starting orientation will be of the application - * Value should be one of: portrait, portraitUpsideDown, landscapeLeft, landscapeRight - */ - orientationType = UIInterfaceOrientationPortrait; - if ([startOrientation isEqualToString:@"portrait"]) { - orientationType = UIInterfaceOrientationPortrait; - } else if ([startOrientation isEqualToString:@"portraitUpsideDown"]) { - orientationType = UIInterfaceOrientationPortraitUpsideDown; - } else if ([startOrientation isEqualToString:@"landscapeLeft"]) { - orientationType = UIInterfaceOrientationLandscapeLeft; - } else if ([startOrientation isEqualToString:@"landscapeRight"]) { - orientationType = UIInterfaceOrientationLandscapeRight; - } - [[UIApplication sharedApplication] setStatusBarOrientation:orientationType animated:NO]; - - /* - * rotateOrientation - This option is only enabled when AutoRotate is enabled. If the phone is still rotated - * when AutoRotate is disabled, this will control what orientations will be rotated to. If you wish your app to - * only use landscape or portrait orientations, change the value in PhoneGap.plist to indicate that. - * Value should be one of: any, portrait, landscape - */ - [viewController setRotateOrientation:rotateOrientation]; - - /* - * The Activity View is the top spinning throbber in the status/battery bar. We init it with the default Grey Style. - * - * whiteLarge = UIActivityIndicatorViewStyleWhiteLarge - * white = UIActivityIndicatorViewStyleWhite - * gray = UIActivityIndicatorViewStyleGray - * - */ - UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray; - if ([topActivityIndicator isEqualToString:@"whiteLarge"]) { - topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge; - } else if ([topActivityIndicator isEqualToString:@"white"]) { - topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite; - } else if ([topActivityIndicator isEqualToString:@"gray"]) { - topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray; - } - activityView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:topActivityIndicatorStyle] retain]; - activityView.tag = 2; - [window addSubview:activityView]; - [activityView startAnimating]; - - [window makeKeyAndVisible]; -} - - -/** - When web application loads Add stuff to the DOM, mainly the user-defined settings from the Settings.plist file, and - the device's data such as device ID, platform version, etc. - */ -- (void)webViewDidStartLoad:(UIWebView *)theWebView { - NSDictionary *deviceProperties = [[self getCommandInstance:@"Device"] getDeviceProperties]; - NSMutableString *result = [[NSMutableString alloc] initWithFormat:@"DeviceInfo = %@;", [deviceProperties JSONFragment]]; - - /* Settings.plist - * Read the optional Settings.plist file and push these user-defined settings down into the web application. - * This can be useful for supplying build-time configuration variables down to the app to change its behaviour, - * such as specifying Full / Lite version, or localization (English vs German, for instance). - */ - NSDictionary *temp = [PhoneGapDelegate getBundlePlist:@"Settings"]; - if ([temp respondsToSelector:@selector(JSONFragment)]) { - [result appendFormat:@"\nwindow.Settings = %@;", [temp JSONFragment]]; - } - - NSLog(@"Device initialization: %@", result); - [theWebView stringByEvaluatingJavaScriptFromString:result]; - [result release]; - - if(![[[UIDevice currentDevice] model] isEqualToString:@"iPhone Simulator"]) { - NSLog(@"going to play movie"); - Movie *mov = [[[Movie alloc] init ] retain ]; - NSMutableArray *args = [[[NSMutableArray alloc] init] autorelease]; - [args addObject:@"default.mov"]; - NSMutableDictionary* opts = [[[NSMutableDictionary alloc] init] autorelease]; - [opts setObject:@"1" forKey:@"repeat"]; - [ mov play:args withDict:opts]; - } - - - - // Determine the URL used to invoke this application. - // Described in http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html - NSURL *url = invokedURL; - // if(!url){ - // NSLog(@"No InvokeURL so returning from webViewDidStartLoad"); - // return; - // } - -// Uncomment to have a javascript alert show you the URL used to invoke this instance. -// NSString * jsCallBack = nil; -// jsCallBack = [[NSString alloc] initWithFormat:@"alert('processing url in webViewDidStartLoad %@');", [url absoluteURL]]; -// NSLog(jsCallBack); -// [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; - - - NSString * urlHost = [url host]; - NSLog(@"host = ", urlHost); - -// The info.plist contains this structure: -//CFBundleURLTypes -// -// -// CFBundleURLSchemes -// -// yourscheme -// -// CFBundleURLName -// YourbundleURLName -// -// - - NSArray *URLTypes = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleURLTypes"]; - if(URLTypes == nil ) { return;} - NSDictionary *dict = [URLTypes objectAtIndex:0]; - if(dict == nil ) {return;} - NSArray *URLSchemes = [dict objectForKey:@"CFBundleURLSchemes"]; - if( URLSchemes == nil ) {return;} - NSString *URLScheme = [URLSchemes objectAtIndex:0]; - if( URLScheme == nil ) {return;} - NSLog( @"Found URLScheme == ", URLScheme); - if ([[url scheme] isEqualToString:URLScheme]) { - NSLog(@"%@", [url description]); // Uncomment to watch gap: commands being issued - /* -* Get Command and Options From URL -* We are looking for URLS that match yourscheme://./[][?] -* We have to strip off the leading slash for the options. -* -* Note: We have to go through the following contortions because NSURL "helpfully" unescapes -* certain characters, such as "/" from their hex encoding for us. This normally wouldn't -* be a problem, unless your argument has a "/" in it, such as a file path. -*/ - NSString * command = [url host]; - - NSString * fullUrl = [url description]; - int prefixLength = [command length] + 3 + [URLScheme length ] ; // "yourscheme://" plus the leading "://" - int qsLength = [[url query] length]; - int pathLength = [fullUrl length] - prefixLength; - if (qsLength > 0) - pathLength = pathLength - qsLength - 1; - NSString *path = [fullUrl substringWithRange:NSMakeRange(prefixLength, pathLength)]; - - // Array of arguments - NSMutableArray * arguments = [NSMutableArray arrayWithArray:[path componentsSeparatedByString:@"/"]]; - int i, arguments_count = [arguments count]; - for (i = 0; i < arguments_count; i++) { - [arguments replaceObjectAtIndex:i withObject:[(NSString *)[arguments objectAtIndex:i] - stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; - } - - NSLog(@"Arguments: %@", arguments); - [webView stringByEvaluatingJavaScriptFromString:[[NSString alloc] initWithFormat:@"alert('arguments=%@');", arguments]]; - - NSMutableDictionary * options = [NSMutableDictionary dictionaryWithCapacity:1]; - NSArray * options_parts = [NSArray arrayWithArray:[[url query] componentsSeparatedByString:@"&"]]; - int options_count = [options_parts count]; - - NSString *optionsString = @"var Invoke_params={"; - for (i = 0; i < options_count; i++) { - NSArray *option_part = [[options_parts objectAtIndex:i] componentsSeparatedByString:@"="]; - NSString *name = [(NSString *)[option_part objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSString *value = [(NSString *)[option_part objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - optionsString = [optionsString stringByAppendingFormat:@"%@:'%@'", name, value]; - if(i != options_count -1 ) optionsString = [optionsString stringByAppendingString:@","]; - - [options setObject:value forKey:name]; - } - optionsString = [optionsString stringByAppendingString:@"}"]; - - NSString * jsCallBack = nil; - jsCallBack = [[NSString alloc] initWithFormat:@"%@;", optionsString]; - NSLog(@"js callback = %@", jsCallBack); - // [webView stringByEvaluatingJavaScriptFromString:[[NSString alloc] initWithFormat:@"alert('callback=%@');", jsCallBack]]; - - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; - [jsCallBack release]; - } -} - -/** - Returns the contents of the named plist bundle, loaded as a dictionary object - */ -+ (NSDictionary*)getBundlePlist:(NSString *)plistName -{ - NSString *errorDesc = nil; - NSPropertyListFormat format; - NSString *plistPath = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"]; - NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath]; - NSDictionary *temp = (NSDictionary *)[NSPropertyListSerialization - propertyListFromData:plistXML - mutabilityOption:NSPropertyListMutableContainersAndLeaves - format:&format errorDescription:&errorDesc]; - return temp; -} - -/** - Called when the webview finishes loading. This stops the activity view and closes the imageview - */ -- (void)webViewDidFinishLoad:(UIWebView *)theWebView { - /* - * Hide the Top Activity THROBER in the Battery Bar - */ - [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; - activityView.hidden = YES; - - imageView.hidden = YES; - - [window bringSubviewToFront:viewController.view]; - webView = theWebView; -} - - -/** - * Fail Loading With Error - * Error - If the webpage failed to load display an error with the reson. - * - */ -- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { - NSLog(@"Failed to load webpage with error: %@", [error localizedDescription]); - /* - if ([error code] != NSURLErrorCancelled) - alert([error localizedDescription]); - */ -} - - -/** - * Start Loading Request - * This is where most of the magic happens... We take the request(s) and process the response. - * From here we can re direct links and other protocalls to different internal methods. - * - */ -- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType -{ - NSURL *url = [request URL]; - - /* - * Get Command and Options From URL - * We are looking for URLS that match gap://./[][?] - * We have to strip off the leading slash for the options. - */ - if ([[url scheme] isEqualToString:@"gap"]) { - //NSLog(@"%@", [url description]); // Uncomment to watch gap: commands being issued - /* - * Note: We have to go through the following contortions because NSURL "helpfully" unescapes - * certain characters, such as "/" from their hex encoding for us. This normally wouldn't - * be a problem, unless your argument has a "/" in it, such as a file path. - */ - NSString * command = [url host]; - - NSString * fullUrl = [url description]; - int prefixLength = [command length] + 7; // "gap://" plus the leading "/" - int qsLength = [[url query] length]; - int pathLength = [fullUrl length] - prefixLength; - if (qsLength > 0) - pathLength = pathLength - qsLength - 1; - NSString *path = [fullUrl substringWithRange:NSMakeRange(prefixLength, pathLength)]; - - // Array of arguments - NSMutableArray * arguments = [NSMutableArray arrayWithArray:[path componentsSeparatedByString:@"/"]]; - int i, arguments_count = [arguments count]; - for (i = 0; i < arguments_count; i++) { - [arguments replaceObjectAtIndex:i withObject:[(NSString *)[arguments objectAtIndex:i] - stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; - } - //NSLog(@"Arguments: %@", arguments); - - NSMutableDictionary * options = [NSMutableDictionary dictionaryWithCapacity:1]; - NSArray * options_parts = [NSArray arrayWithArray:[[url query] componentsSeparatedByString:@"&"]]; - int options_count = [options_parts count]; - for (i = 0; i < options_count; i++) { - NSArray *option_part = [[options_parts objectAtIndex:i] componentsSeparatedByString:@"="]; - NSString *name = [(NSString *)[option_part objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSString *value = [(NSString *)[option_part objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - [options setObject:value forKey:name]; - } - //NSLog(@"Options: %@", options); - - // Tell the JS code that we've gotten this command, and we're ready for another - [theWebView stringByEvaluatingJavaScriptFromString:@"PhoneGap.queue.ready = true;"]; - - // Check to see if we are provided a class:method style command. - NSArray* components = [command componentsSeparatedByString:@"."]; - if (components.count == 2) - { - NSString* className = [components objectAtIndex:0]; - NSString* methodName = [components objectAtIndex:1]; - - // Fetch an instance of this class - PhoneGapCommand* obj = [self getCommandInstance:className]; - - // construct the fill method name to ammend the second argument. - NSString* fullMethodName = [[NSString alloc] initWithFormat:@"%@:withDict:", methodName]; - if ([obj respondsToSelector:NSSelectorFromString(fullMethodName)]) - { - [obj performSelector:NSSelectorFromString(fullMethodName) withObject:arguments withObject:options]; - } - else - { - // There's no method to call, so throw an error. - NSLog(@"Class method '%@' not defined in class '%@'", fullMethodName, className); - [NSException raise:NSInternalInconsistencyException format:@"Class method '%@' not defined against class '%@'.", fullMethodName, className]; - } - [fullMethodName release]; - } - return NO; - } - - /* - * If a URL is being loaded that's a local file URL, just load it internally - */ - else if ([url isFileURL]) - { - //NSLog(@"File URL %@", [url description]); - return YES; - } - - /* - * We don't have a PhoneGap or local file request, load it in the main Safari browser. - */ - else - { - //NSLog(@"Unknown URL %@", [url description]); - [[UIApplication sharedApplication] openURL:url]; - return NO; - } - - return YES; -} -- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url -{ - NSLog(@"In handleOpenURL"); - if (!url) { return NO; } - NSLog(@"URL = ", [url absoluteURL]); - invokedURL = [url retain]; - return YES; -} - -/** - * Sends Accel Data back to the Device. - */ -- (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { - NSString * jsCallBack = nil; - jsCallBack = [[NSString alloc] initWithFormat:@"var _accel={x:%f,y:%f,z:%f};", acceleration.x, acceleration.y, acceleration.z]; - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; - [jsCallBack release]; -} - -- (void)dealloc -{ - [commandObjects release]; - [imageView release]; - [viewController release]; - [activityView release]; - [window release]; - [super dealloc]; -} - - -@end diff --git a/iphone/Classes/PhoneGapViewController.h b/iphone/Classes/PhoneGapViewController.h deleted file mode 100755 index bc2d6ddd..00000000 --- a/iphone/Classes/PhoneGapViewController.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// PhoneGapViewController.h -// PhoneGap -// -// Created by Nitobi on 15/12/08. -// Copyright 2008 Nitobi. All rights reserved. -// - - -#import -#import - -@interface PhoneGapViewController : UIViewController { - IBOutlet UIWebView *webView; - BOOL autoRotate; - NSString *rotateOrientation; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation; -- (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration; -- (void)setAutoRotate:(BOOL) shouldRotate; -- (void)setRotateOrientation:(NSString*) orientation; - -@end diff --git a/iphone/Classes/PhoneGapViewController.m b/iphone/Classes/PhoneGapViewController.m deleted file mode 100755 index dada4940..00000000 --- a/iphone/Classes/PhoneGapViewController.m +++ /dev/null @@ -1,63 +0,0 @@ -// -// PhoneGapViewController.m -// PhoneGap -// -// Created by Nitobi on 15/12/08. -// Copyright 2008 Nitobi. All rights reserved. -// - -#import "PhoneGapViewController.h" -#import "PhoneGapDelegate.h" - -@implementation PhoneGapViewController - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation -{ - if (autoRotate == YES) { - return YES; - } else { - if ([rotateOrientation isEqualToString:@"portrait"]) { - return (interfaceOrientation == UIInterfaceOrientationPortrait || - interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown); - } else if ([rotateOrientation isEqualToString:@"landscape"]) { - return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || - interfaceOrientation == UIInterfaceOrientationLandscapeRight); - } else { - return NO; - } - } -} - -/** - Called by UIKit when the device starts to rotate to a new orientation. This fires the \c setOrientation - method on the Orientation object in JavaScript. Look at the JavaScript documentation for more information. - */ -- (void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)toInterfaceOrientation duration: (NSTimeInterval)duration { - double i = 0; - - switch (toInterfaceOrientation){ - case UIInterfaceOrientationPortrait: - i = 0; - break; - case UIInterfaceOrientationPortraitUpsideDown: - i = 180; - break; - case UIInterfaceOrientationLandscapeLeft: - i = 90; - break; - case UIInterfaceOrientationLandscapeRight: - i = -90; - break; - } - [webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"navigator.orientation.setOrientation(%f);", i]]; -} - -- (void) setAutoRotate:(BOOL) shouldRotate { - autoRotate = shouldRotate; -} - -- (void) setRotateOrientation:(NSString*) orientation { - rotateOrientation = orientation; -} - -@end \ No newline at end of file diff --git a/iphone/Classes/Reachability.h b/iphone/Classes/Reachability.h deleted file mode 100644 index 18beaea3..00000000 --- a/iphone/Classes/Reachability.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - -File: Reachability.h -Abstract: SystemConfiguration framework wrapper. - -Version: 1.5 - -Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. -("Apple") in consideration of your agreement to the following terms, and your -use, installation, modification or redistribution of this Apple software -constitutes acceptance of these terms. If you do not agree with these terms, -please do not use, install, modify or redistribute this Apple software. - -In consideration of your agreement to abide by the following terms, and subject -to these terms, Apple grants you a personal, non-exclusive license, under -Apple's copyrights in this original Apple software (the "Apple Software"), to -use, reproduce, modify and redistribute the Apple Software, with or without -modifications, in source and/or binary forms; provided that if you redistribute -the Apple Software in its entirety and without modifications, you must retain -this notice and the following text and disclaimers in all such redistributions -of the Apple Software. -Neither the name, trademarks, service marks or logos of Apple Inc. may be used -to endorse or promote products derived from the Apple Software without specific -prior written permission from Apple. Except as expressly stated in this notice, -no other rights or licenses, express or implied, are granted by Apple herein, -including but not limited to any patent rights that may be infringed by your -derivative works or by other works in which the Apple Software may be -incorporated. - -The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN -COMBINATION WITH YOUR PRODUCTS. - -IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR -DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF -CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Copyright (C) 2008 Apple Inc. All Rights Reserved. - -*/ - -#import -#import - -@class Reachability; - -@interface Reachability : NSObject { - -@private - BOOL _networkStatusNotificationsEnabled; - - NSString *_hostName; - NSString *_address; - - NSMutableDictionary *_reachabilityQueries; -} - -/* - An enumeration that defines the return values of the network state - of the device. - */ -typedef enum { - NotReachable = 0, - ReachableViaCarrierDataNetwork, - ReachableViaWiFiNetwork -} NetworkStatus; - - -// Set to YES to register for changes in network status. Otherwise reachability queries -// will be handled synchronously. -@property BOOL networkStatusNotificationsEnabled; -// The remote host whose reachability will be queried. -// Either this or 'addressName' must be set. -@property (nonatomic, retain) NSString *hostName; -// The IP address of the remote host whose reachability will be queried. -// Either this or 'hostName' must be set. -@property (nonatomic, retain) NSString *address; -// A cache of ReachabilityQuery objects, which encapsulate a SCNetworkReachabilityRef, a host or address, and a run loop. The keys are host names or addresses. -@property (nonatomic, assign) NSMutableDictionary *reachabilityQueries; - -// This class is intended to be used as a singleton. -+ (Reachability *)sharedReachability; - -// Is self.hostName is not nil, determines its reachability. -// If self.hostName is nil and self.address is not nil, determines the reachability of self.address. -- (NetworkStatus)remoteHostStatus; -// Is the device able to communicate with Internet hosts? If so, through which network interface? -- (NetworkStatus)internetConnectionStatus; -// Is the device able to communicate with hosts on the local WiFi network? (Typically these are Bonjour hosts). -- (NetworkStatus)localWiFiConnectionStatus; - -/* - When reachability change notifications are posted, the callback method 'ReachabilityCallback' is called - and posts a notification that the client application can observe to learn about changes. - */ -static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info); - -@end - -@interface ReachabilityQuery : NSObject -{ -@private - SCNetworkReachabilityRef _reachabilityRef; - CFMutableArrayRef _runLoops; - NSString *_hostNameOrAddress; -} -// Keep around each network reachability query object so that we can -// register for updates from those objects. -@property (nonatomic) SCNetworkReachabilityRef reachabilityRef; -@property (nonatomic, retain) NSString *hostNameOrAddress; -@property (nonatomic) CFMutableArrayRef runLoops; - -- (void)scheduleOnRunLoop:(NSRunLoop *)inRunLoop; - -@end - diff --git a/iphone/Classes/Reachability.m b/iphone/Classes/Reachability.m deleted file mode 100644 index c1f159c5..00000000 --- a/iphone/Classes/Reachability.m +++ /dev/null @@ -1,585 +0,0 @@ -/* - -File: Reachability.m -Abstract: SystemConfiguration framework wrapper. - -Version: 1.5 - -Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc. -("Apple") in consideration of your agreement to the following terms, and your -use, installation, modification or redistribution of this Apple software -constitutes acceptance of these terms. If you do not agree with these terms, -please do not use, install, modify or redistribute this Apple software. - -In consideration of your agreement to abide by the following terms, and subject -to these terms, Apple grants you a personal, non-exclusive license, under -Apple's copyrights in this original Apple software (the "Apple Software"), to -use, reproduce, modify and redistribute the Apple Software, with or without -modifications, in source and/or binary forms; provided that if you redistribute -the Apple Software in its entirety and without modifications, you must retain -this notice and the following text and disclaimers in all such redistributions -of the Apple Software. -Neither the name, trademarks, service marks or logos of Apple Inc. may be used -to endorse or promote products derived from the Apple Software without specific -prior written permission from Apple. Except as expressly stated in this notice, -no other rights or licenses, express or implied, are granted by Apple herein, -including but not limited to any patent rights that may be infringed by your -derivative works or by other works in which the Apple Software may be -incorporated. - -The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO -WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED -WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN -COMBINATION WITH YOUR PRODUCTS. - -IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR -DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF -CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF -APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Copyright (C) 2008 Apple Inc. All Rights Reserved. - -*/ - -#import -#import -#import -#import -#import -#include - -#import "Reachability.h" -#import - -static NSString *kLinkLocalAddressKey = @"169.254.0.0"; -static NSString *kDefaultRouteKey = @"0.0.0.0"; - -static Reachability *_sharedReachability; - -// A class extension that declares internal methods for this class. -@interface Reachability() -- (BOOL)isAdHocWiFiNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags; -- (BOOL)isNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags; -- (BOOL)isReachableWithoutRequiringConnection:(SCNetworkReachabilityFlags)flags; -- (SCNetworkReachabilityRef)reachabilityRefForHostName:(NSString *)hostName; -- (SCNetworkReachabilityRef)reachabilityRefForAddress:(NSString *)address; -- (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)outAddress; -- (void)stopListeningForReachabilityChanges; -@end - -@implementation Reachability - -@synthesize networkStatusNotificationsEnabled = _networkStatusNotificationsEnabled; -@synthesize hostName = _hostName; -@synthesize address = _address; -@synthesize reachabilityQueries = _reachabilityQueries; - -+ (Reachability *)sharedReachability -{ - if (!_sharedReachability) { - _sharedReachability = [[Reachability alloc] init]; - // Clients of Reachability will typically call [[Reachability sharedReachability] setHostName:] - // before calling one of the status methods. - _sharedReachability.hostName = nil; - _sharedReachability.address = nil; - _sharedReachability.networkStatusNotificationsEnabled = NO; - _sharedReachability.reachabilityQueries = [[NSMutableDictionary alloc] init]; - } - return _sharedReachability; -} - -- (void) dealloc -{ - [self stopListeningForReachabilityChanges]; - - [_sharedReachability.reachabilityQueries release]; - [_sharedReachability release]; - [super dealloc]; -} - -- (BOOL)isReachableWithoutRequiringConnection:(SCNetworkReachabilityFlags)flags -{ - // kSCNetworkReachabilityFlagsReachable indicates that the specified nodename or address can - // be reached using the current network configuration. - BOOL isReachable = flags & kSCNetworkReachabilityFlagsReachable; - - // This flag indicates that the specified nodename or address can - // be reached using the current network configuration, but a - // connection must first be established. - // - // If the flag is false, we don't have a connection. But because CFNetwork - // automatically attempts to bring up a WWAN connection, if the WWAN reachability - // flag is present, a connection is not required. - BOOL noConnectionRequired = !(flags & kSCNetworkReachabilityFlagsConnectionRequired); - if ((flags & kSCNetworkReachabilityFlagsIsWWAN)) { - noConnectionRequired = YES; - } - - return (isReachable && noConnectionRequired) ? YES : NO; -} - -// Returns whether or not the current host name is reachable with the current network configuration. -- (BOOL)isHostReachable:(NSString *)host -{ - if (!host || ![host length]) { - return NO; - } - - SCNetworkReachabilityFlags flags; - SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [host UTF8String]); - BOOL gotFlags = SCNetworkReachabilityGetFlags(reachability, &flags); - - CFRelease(reachability); - - if (!gotFlags) { - return NO; - } - - return [self isReachableWithoutRequiringConnection:flags]; -} - -// This returns YES if the address 169.254.0.0 is reachable without requiring a connection. -- (BOOL)isAdHocWiFiNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags -{ - // Look in the cache of reachability queries for one that matches this query. - ReachabilityQuery *query = [self.reachabilityQueries objectForKey:kLinkLocalAddressKey]; - SCNetworkReachabilityRef adHocWiFiNetworkReachability = query.reachabilityRef; - - // If a cached reachability query was not found, create one. - if (!adHocWiFiNetworkReachability) { - - // Build a sockaddr_in that we can pass to the address reachability query. - struct sockaddr_in sin; - - bzero(&sin, sizeof(sin)); - sin.sin_len = sizeof(sin); - sin.sin_family = AF_INET; - // IN_LINKLOCALNETNUM is defined in as 169.254.0.0 - sin.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM); - - adHocWiFiNetworkReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&sin); - - query = [[[ReachabilityQuery alloc] init] autorelease]; - query.hostNameOrAddress = kLinkLocalAddressKey; - query.reachabilityRef = adHocWiFiNetworkReachability; - - // Add the reachability query to the cache. - [self.reachabilityQueries setObject:query forKey:kLinkLocalAddressKey]; - } - - // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop. - // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register - // to receive notifications from it in the current run loop, which may be different than the run loop - // that was previously used when registering the SCNetworkReachabilityRef for notifications. - // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance. - // By default, they are not enabled. - [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]]; - - SCNetworkReachabilityFlags addressReachabilityFlags; - BOOL gotFlags = SCNetworkReachabilityGetFlags(adHocWiFiNetworkReachability, &addressReachabilityFlags); - if (!gotFlags) { - // There was an error getting the reachability flags. - return NO; - } - - // Callers of this method might want to use the reachability flags, so if an 'out' parameter - // was passed in, assign the reachability flags to it. - if (outFlags) { - *outFlags = addressReachabilityFlags; - } - - return [self isReachableWithoutRequiringConnection:addressReachabilityFlags]; -} - -// ReachabilityCallback is registered as the callback for network state changes in startListeningForReachabilityChanges. -static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - - // Post a notification to notify the client that the network reachability changed. - [[NSNotificationCenter defaultCenter] postNotificationName:@"kNetworkReachabilityChangedNotification" object:nil]; - - [pool release]; -} - -// Perform a reachability query for the address 0.0.0.0. If that address is reachable without -// requiring a connection, a network interface is available. We'll have to do more work to -// determine which network interface is available. -- (BOOL)isNetworkAvailableFlags:(SCNetworkReachabilityFlags *)outFlags -{ - ReachabilityQuery *query = [self.reachabilityQueries objectForKey:kDefaultRouteKey]; - SCNetworkReachabilityRef defaultRouteReachability = query.reachabilityRef; - - // If a cached reachability query was not found, create one. - if (!defaultRouteReachability) { - - struct sockaddr_in zeroAddress; - bzero(&zeroAddress, sizeof(zeroAddress)); - zeroAddress.sin_len = sizeof(zeroAddress); - zeroAddress.sin_family = AF_INET; - - defaultRouteReachability = SCNetworkReachabilityCreateWithAddress(NULL, (struct sockaddr *)&zeroAddress); - - ReachabilityQuery *query = [[[ReachabilityQuery alloc] init] autorelease]; - query.hostNameOrAddress = kDefaultRouteKey; - query.reachabilityRef = defaultRouteReachability; - - [self.reachabilityQueries setObject:query forKey:kDefaultRouteKey]; - } - - // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop. - // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register - // to receive notifications from it in the current run loop, which may be different than the run loop - // that was previously used when registering the SCNetworkReachabilityRef for notifications. - // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance. - // By default, they are not enabled. - [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]]; - - SCNetworkReachabilityFlags flags; - BOOL gotFlags = SCNetworkReachabilityGetFlags(defaultRouteReachability, &flags); - if (!gotFlags) { - return NO; - } - - BOOL isReachable = [self isReachableWithoutRequiringConnection:flags]; - - // Callers of this method might want to use the reachability flags, so if an 'out' parameter - // was passed in, assign the reachability flags to it. - if (outFlags) { - *outFlags = flags; - } - - return isReachable; -} - -// Be a good citizen and unregister for network state changes when the application terminates. -- (void)stopListeningForReachabilityChanges -{ - // Walk through the cache that holds SCNetworkReachabilityRefs for reachability - // queries to particular hosts or addresses. - NSEnumerator *enumerator = [self.reachabilityQueries objectEnumerator]; - ReachabilityQuery *reachabilityQuery; - - while (reachabilityQuery = [enumerator nextObject]) { - - CFArrayRef runLoops = reachabilityQuery.runLoops; - NSUInteger runLoopCounter, maxRunLoops = CFArrayGetCount(runLoops); - - for (runLoopCounter = 0; runLoopCounter < maxRunLoops; runLoopCounter++) { - CFRunLoopRef nextRunLoop = (CFRunLoopRef)CFArrayGetValueAtIndex(runLoops, runLoopCounter); - - SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityQuery.reachabilityRef, nextRunLoop, kCFRunLoopDefaultMode); - } - - CFArrayRemoveAllValues(reachabilityQuery.runLoops); - } -} - -/* - Create a SCNetworkReachabilityRef for hostName, which lets us determine if hostName - is currently reachable, and lets us register to receive notifications when the - reachability of hostName changes. - */ -- (SCNetworkReachabilityRef)reachabilityRefForHostName:(NSString *)hostName -{ - if (!hostName || ![hostName length]) { - return NULL; - } - - // Look in the cache for an existing SCNetworkReachabilityRef for hostName. - ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:hostName]; - SCNetworkReachabilityRef reachabilityRefForHostName = cachedQuery.reachabilityRef; - - if (reachabilityRefForHostName) { - return reachabilityRefForHostName; - } - - // Didn't find an existing SCNetworkReachabilityRef for hostName, so create one ... - reachabilityRefForHostName = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [hostName UTF8String]); - - NSAssert1(reachabilityRefForHostName != NULL, @"Failed to create SCNetworkReachabilityRef for host: %@", hostName); - - ReachabilityQuery *query = [[[ReachabilityQuery alloc] init] autorelease]; - query.hostNameOrAddress = hostName; - query.reachabilityRef = reachabilityRefForHostName; - - // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop. - // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register - // to receive notifications from it in the current run loop, which may be different than the run loop - // that was previously used when registering the SCNetworkReachabilityRef for notifications. - // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance. - // By default, they are not enabled. - [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]]; - - // ... and add it to the cache. - [self.reachabilityQueries setObject:query forKey:hostName]; - return reachabilityRefForHostName; -} - -/* - Create a SCNetworkReachabilityRef for the IP address in addressString, which lets us determine if - the address is currently reachable, and lets us register to receive notifications when the - reachability of the address changes. - */ -- (SCNetworkReachabilityRef)reachabilityRefForAddress:(NSString *)addressString -{ - if (!addressString || ![addressString length]) { - return NULL; - } - - struct sockaddr_in address; - - BOOL gotAddress = [self addressFromString:addressString address:&address]; - if (!gotAddress) { - // The attempt to convert addressString to a sockaddr_in failed. - NSAssert1(gotAddress != NO, @"Failed to convert an IP address string to a sockaddr_in: %@", addressString); - return NULL; - } - - // Look in the cache for an existing SCNetworkReachabilityRef for addressString. - ReachabilityQuery *cachedQuery = [self.reachabilityQueries objectForKey:addressString]; - SCNetworkReachabilityRef reachabilityRefForAddress = cachedQuery.reachabilityRef; - - if (reachabilityRefForAddress) { - return reachabilityRefForAddress; - } - - // Didn't find an existing SCNetworkReachabilityRef for addressString, so create one. - reachabilityRefForAddress = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (struct sockaddr *)&address); - - NSAssert1(reachabilityRefForAddress != NULL, @"Failed to create SCNetworkReachabilityRef for address: %@", addressString); - - ReachabilityQuery *query = [[[ReachabilityQuery alloc] init] autorelease]; - query.hostNameOrAddress = addressString; - query.reachabilityRef = reachabilityRefForAddress; - - // If necessary, register for notifcations for the SCNetworkReachabilityRef on the current run loop. - // If an existing SCNetworkReachabilityRef was found in the cache, we can reuse it and register - // to receive notifications from it in the current run loop, which may be different than the run loop - // that was previously used when registering the SCNetworkReachabilityRef for notifications. - // -scheduleOnRunLoop: will schedule only if network status notifications are enabled in the Reachability instance. - // By default, they are not enabled. - [query scheduleOnRunLoop:[NSRunLoop currentRunLoop]]; - - // ... and add it to the cache. - [self.reachabilityQueries setObject:query forKey:addressString]; - return reachabilityRefForAddress; -} - -- (NetworkStatus)remoteHostStatus -{ - /* - If the current host name or address is reachable, determine which network interface it is reachable through. - If the host is reachable and the reachability flags include kSCNetworkReachabilityFlagsIsWWAN, it - is reachable through the carrier data network. If the host is reachable and the reachability - flags do not include kSCNetworkReachabilityFlagsIsWWAN, it is reachable through the WiFi network. - */ - - SCNetworkReachabilityRef reachabilityRef = nil; - if (self.hostName) { - reachabilityRef = [self reachabilityRefForHostName:self.hostName]; - - } else if (self.address) { - reachabilityRef = [self reachabilityRefForAddress:self.address]; - - } else { - NSAssert(self.hostName != nil && self.address != nil, @"No hostName or address specified. Cannot determine reachability."); - return NotReachable; - } - - if (!reachabilityRef) { - return NotReachable; - } - - SCNetworkReachabilityFlags reachabilityFlags; - BOOL gotFlags = SCNetworkReachabilityGetFlags(reachabilityRef, &reachabilityFlags); - if (!gotFlags) { - return NotReachable; - } - - BOOL reachable = [self isReachableWithoutRequiringConnection:reachabilityFlags]; - - if (!reachable) { - return NotReachable; - } - if (reachabilityFlags & ReachableViaCarrierDataNetwork) { - return ReachableViaCarrierDataNetwork; - } - - return ReachableViaWiFiNetwork; -} - -- (NetworkStatus)internetConnectionStatus -{ - /* - To determine if the device has an Internet connection, query the address - 0.0.0.0. If it's reachable without requiring a connection, first check - for the kSCNetworkReachabilityFlagsIsDirect flag, which tell us if the connection - is to an ad-hoc WiFi network. If it is not, the device can access the Internet. - The next thing to determine is how the device can access the Internet, which - can either be through the carrier data network (EDGE or other service) or through - a WiFi connection. - - Note: Knowing that the device has an Internet connection is not the same as - knowing if the device can reach a particular host. To know that, use - -[Reachability remoteHostStatus]. - */ - - SCNetworkReachabilityFlags defaultRouteFlags; - BOOL defaultRouteIsAvailable = [self isNetworkAvailableFlags:&defaultRouteFlags]; - if (defaultRouteIsAvailable) { - - if (defaultRouteFlags & kSCNetworkReachabilityFlagsIsDirect) { - - // The connection is to an ad-hoc WiFi network, so Internet access is not available. - return NotReachable; - } - else if (defaultRouteFlags & ReachableViaCarrierDataNetwork) { - return ReachableViaCarrierDataNetwork; - } - - return ReachableViaWiFiNetwork; - } - - return NotReachable; -} - -- (NetworkStatus)localWiFiConnectionStatus -{ - SCNetworkReachabilityFlags selfAssignedAddressFlags; - - /* - To determine if the WiFi connection is to a local ad-hoc network, - check the availability of the address 169.254.x.x. That's an address - in the self-assigned range, and the device will have a self-assigned IP - when it's connected to a ad-hoc WiFi network. So to test if the device - has a self-assigned IP, look for the kSCNetworkReachabilityFlagsIsDirect flag - in the address query. If it's present, we know that the WiFi connection - is to an ad-hoc network. - */ - // This returns YES if the address 169.254.0.0 is reachable without requiring a connection. - BOOL hasLinkLocalNetworkAccess = [self isAdHocWiFiNetworkAvailableFlags:&selfAssignedAddressFlags]; - - if (hasLinkLocalNetworkAccess && (selfAssignedAddressFlags & kSCNetworkReachabilityFlagsIsDirect)) { - return ReachableViaWiFiNetwork; - } - - return NotReachable; -} - -// Convert an IP address from an NSString to a sockaddr_in * that can be used to create -// the reachability request. -- (BOOL)addressFromString:(NSString *)IPAddress address:(struct sockaddr_in *)address -{ - if (!IPAddress || ![IPAddress length]) { - return NO; - } - - memset((char *) address, sizeof(struct sockaddr_in), 0); - address->sin_family = AF_INET; - address->sin_len = sizeof(struct sockaddr_in); - - int conversionResult = inet_aton([IPAddress UTF8String], &address->sin_addr); - if (conversionResult == 0) { - NSAssert1(conversionResult != 1, @"Failed to convert the IP address string into a sockaddr_in: %@", IPAddress); - return NO; - } - - return YES; -} - -@end - -@interface ReachabilityQuery () -- (CFRunLoopRef)startListeningForReachabilityChanges:(SCNetworkReachabilityRef)reachability onRunLoop:(CFRunLoopRef)runLoop; -@end - -@implementation ReachabilityQuery - -@synthesize reachabilityRef = _reachabilityRef; -@synthesize runLoops = _runLoops; -@synthesize hostNameOrAddress = _hostNameOrAddress; - -- (id)init -{ - self = [super init]; - if (self != nil) { - self.runLoops = CFArrayCreateMutable(kCFAllocatorDefault, 0, NULL); - } - return self; -} - -- (void)dealloc -{ - CFRelease(self.runLoops); - [super dealloc]; -} - -- (BOOL)isScheduledOnRunLoop:(CFRunLoopRef)runLoop -{ - NSUInteger runLoopCounter, maxRunLoops = CFArrayGetCount(self.runLoops); - - for (runLoopCounter = 0; runLoopCounter < maxRunLoops; runLoopCounter++) { - CFRunLoopRef nextRunLoop = (CFRunLoopRef)CFArrayGetValueAtIndex(self.runLoops, runLoopCounter); - - if (nextRunLoop == runLoop) { - return YES; - } - } - - return NO; -} - -- (void)scheduleOnRunLoop:(NSRunLoop *)inRunLoop -{ - // Only register for network state changes if the client has specifically enabled them. - if ([[Reachability sharedReachability] networkStatusNotificationsEnabled] == NO) { - return; - } - - if (!inRunLoop) { - return; - } - - CFRunLoopRef runLoop = [inRunLoop getCFRunLoop]; - - // Notifications of status changes for each reachability query can be scheduled on multiple run loops. - // To support that, register for notifications for each runLoop. - // -isScheduledOnRunLoop: iterates over all of the run loops that have previously been used - // to register for notifications. If one is found that matches the passed in runLoop argument, there's - // no need to register for notifications again. If one is not found, register for notifications - // using the current runLoop. - if (![self isScheduledOnRunLoop:runLoop]) { - - CFRunLoopRef notificationRunLoop = [self startListeningForReachabilityChanges:self.reachabilityRef onRunLoop:runLoop]; - if (notificationRunLoop) { - CFArrayAppendValue(self.runLoops, notificationRunLoop); - } - } -} - -// Register to receive changes to the 'reachability' query so that we can update the -// user interface when the network state changes. -- (CFRunLoopRef)startListeningForReachabilityChanges:(SCNetworkReachabilityRef)reachability onRunLoop:(CFRunLoopRef)runLoop -{ - if (!reachability) { - return NULL; - } - - if (!runLoop) { - return NULL; - } - - SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL}; - SCNetworkReachabilitySetCallback(reachability, ReachabilityCallback, &context); - SCNetworkReachabilityScheduleWithRunLoop(reachability, runLoop, kCFRunLoopDefaultMode); - - return runLoop; -} - - -@end diff --git a/iphone/Classes/Sound.h b/iphone/Classes/Sound.h deleted file mode 100755 index 93202b7c..00000000 --- a/iphone/Classes/Sound.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Sound.h - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import -#import -#import "PhoneGapCommand.h" - -@interface Sound : PhoneGapCommand { -} - -- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iphone/Classes/Sound.m b/iphone/Classes/Sound.m deleted file mode 100755 index 2bf6cd99..00000000 --- a/iphone/Classes/Sound.m +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Sound.m - * - * Created by Nitobi on 12/12/08. - * Copyright 2008 Nitobi. All rights reserved. - * - */ - -#import "Sound.h" - -@implementation Sound - -- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSBundle * mainBundle = [NSBundle mainBundle]; - NSMutableArray *directoryParts = [NSMutableArray arrayWithArray:[(NSString*)[arguments objectAtIndex:0] componentsSeparatedByString:@"/"]]; - NSString *filename = [directoryParts lastObject]; - [directoryParts removeLastObject]; - - NSMutableArray *filenameParts = [NSMutableArray arrayWithArray:[filename componentsSeparatedByString:@"."]]; - NSString *directoryStr = [directoryParts componentsJoinedByString:@"/"]; - - NSString *filePath = [mainBundle pathForResource:(NSString*)[filenameParts objectAtIndex:0] - ofType:(NSString*)[filenameParts objectAtIndex:1] - inDirectory:directoryStr]; - if (filePath == nil) { - NSLog(@"Can't find filename %@ in the app bundle", [arguments objectAtIndex:0]); - return; - } - SystemSoundID soundID; - NSURL *fileURL = [NSURL fileURLWithPath:filePath]; - - // TODO Create a system facilitating handling callback responses in JavaScript easily, and no - // longer in an ad-hoc fashion. Getting error results of whether or not the sound played, or - // other errors occurring in the system is important. - OSStatus error; - error = AudioServicesCreateSystemSoundID((CFURLRef)fileURL, &soundID); - if (error != 0) - NSLog(@"Sound error %d", error); - - AudioServicesPlaySystemSound(soundID); -} - -@end diff --git a/iphone/Classes/UIControls.h b/iphone/Classes/UIControls.h deleted file mode 100644 index c31119e8..00000000 --- a/iphone/Classes/UIControls.h +++ /dev/null @@ -1,49 +0,0 @@ -// -// UIControls.h -// PhoneGap -// -// Created by Michael Nachbaur on 13/04/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import -#import -#import -#import - -#import "PhoneGapCommand.h" - -@interface UIControls : PhoneGapCommand { - UITabBar* tabBar; - NSMutableDictionary* tabBarItems; - - UIToolbar* toolBar; - UIBarButtonItem* toolBarTitle; - NSMutableDictionary* toolBarItems; -} - -/* Tab Bar methods - */ -- (void)createTabBar:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)showTabBar:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)hideTabBar:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)showTabBarItems:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)createTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)updateTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)selectTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options; - -/* Tool Bar methods - */ -- (void)createToolBar:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)setToolBarTitle:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)toolBarTitleClicked; - -/* -- (void)createToolBarButton:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)createToolBarTitle:(NSArray*)arguments withDict:(NSDictionary*)options; -*/ - -//- (void)setToolBarTitle:(NSArray*)arguments withDict:(NSDictionary*)options; -//- (void)setToolBarButtons:(NSArray*)arguments withDict:(NSDictionary*)options; - -@end diff --git a/iphone/Classes/UIControls.m b/iphone/Classes/UIControls.m deleted file mode 100644 index c40d3952..00000000 --- a/iphone/Classes/UIControls.m +++ /dev/null @@ -1,442 +0,0 @@ -// -// UIControls.m -// PhoneGap -// -// Created by Michael Nachbaur on 13/04/09. -// Copyright 2009 Decaf Ninja Software. All rights reserved. -// - -#import "UIControls.h" - -@implementation UIControls -#ifndef __IPHONE_3_0 -@synthesize webView; -#endif - --(PhoneGapCommand*) initWithWebView:(UIWebView*)theWebView -{ - self = (UIControls*)[super initWithWebView:theWebView]; - if (self) { - tabBarItems = [[NSMutableDictionary alloc] initWithCapacity:5]; - } - return self; -} - -/** - * Create a native tab bar at either the top or the bottom of the display. - * @brief creates a tab bar - * @param arguments unused - * @param options unused - */ -- (void)createTabBar:(NSArray*)arguments withDict:(NSDictionary*)options -{ - tabBar = [UITabBar new]; - [tabBar sizeToFit]; - tabBar.delegate = self; - tabBar.multipleTouchEnabled = NO; - tabBar.autoresizesSubviews = YES; - tabBar.hidden = YES; - tabBar.userInteractionEnabled = YES; - - [self.webView.superview addSubview:tabBar]; -} - -/** - * Show the tab bar after its been created. - * @brief show the tab bar - * @param arguments unused - * @param options used to indicate options for where and how the tab bar should be placed - * - \c height integer indicating the height of the tab bar (default: \c 49) - * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom) - */ -- (void)showTabBar:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self createTabBar:nil withDict:nil]; - - CGFloat height = 49.0f; - BOOL atBottom = YES; - - NSDictionary* tabSettings = [settings objectForKey:@"TabBarSettings"]; - if (tabSettings) { - height = [[tabSettings objectForKey:@"height"] floatValue]; - atBottom = [[tabSettings objectForKey:@"position"] isEqualToString:@"bottom"]; - } - tabBar.hidden = NO; - - CGRect webViewBounds = webView.bounds; - CGRect tabBarBounds; - if (atBottom) { - tabBarBounds = CGRectMake( - webViewBounds.origin.x, - webViewBounds.origin.y + webViewBounds.size.height - height, - webViewBounds.size.width, - height - ); - webViewBounds = CGRectMake( - webViewBounds.origin.x, - webViewBounds.origin.y, - webViewBounds.size.width, - webViewBounds.size.height - height - ); - } else { - tabBarBounds = CGRectMake( - webViewBounds.origin.x, - webViewBounds.origin.y, - webViewBounds.size.width, - height - ); - webViewBounds = CGRectMake( - webViewBounds.origin.x, - webViewBounds.origin.y + height, - webViewBounds.size.width, - webViewBounds.size.height - height - ); - } - - [tabBar setFrame:tabBarBounds]; - [webView setFrame:webViewBounds]; -} - -/** - * Hide the tab bar - * @brief hide the tab bar - * @param arguments unused - * @param options unused - */ -- (void)hideTabBar:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self createTabBar:nil withDict:nil]; - tabBar.hidden = YES; -} - -/** - * Create a new tab bar item for use on a previously created tab bar. Use ::showTabBarItems to show the new item on the tab bar. - * - * If the supplied image name is one of the labels listed below, then this method will construct a tab button - * using the standard system buttons. Note that if you use one of the system images, that the \c title you supply will be ignored. - * - Tab Buttons - * - tabButton:More - * - tabButton:Favorites - * - tabButton:Featured - * - tabButton:TopRated - * - tabButton:Recents - * - tabButton:Contacts - * - tabButton:History - * - tabButton:Bookmarks - * - tabButton:Search - * - tabButton:Downloads - * - tabButton:MostRecent - * - tabButton:MostViewed - * @brief create a tab bar item - * @param arguments Parameters used to create the tab bar - * -# \c name internal name to refer to this tab by - * -# \c title title text to show on the tab, or null if no text should be shown - * -# \c image image filename or internal identifier to show, or null if now image should be shown - * -# \c tag unique number to be used as an internal reference to this button - * @param options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if nil or unspecified, the badge will be hidden - */ -- (void)createTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self createTabBar:nil withDict:nil]; - - NSString *name = [arguments objectAtIndex:0]; - NSString *title = [arguments objectAtIndex:1]; - NSString *imageName = [arguments objectAtIndex:2]; - int tag = [[arguments objectAtIndex:3] intValue]; - - UITabBarItem *item = nil; - if ([imageName length] > 0) { - UIBarButtonSystemItem systemItem = -1; - if ([imageName isEqualToString:@"tabButton:More"]) systemItem = UITabBarSystemItemMore; - if ([imageName isEqualToString:@"tabButton:Favorites"]) systemItem = UITabBarSystemItemFavorites; - if ([imageName isEqualToString:@"tabButton:Featured"]) systemItem = UITabBarSystemItemFeatured; - if ([imageName isEqualToString:@"tabButton:TopRated"]) systemItem = UITabBarSystemItemTopRated; - if ([imageName isEqualToString:@"tabButton:Recents"]) systemItem = UITabBarSystemItemRecents; - if ([imageName isEqualToString:@"tabButton:Contacts"]) systemItem = UITabBarSystemItemContacts; - if ([imageName isEqualToString:@"tabButton:History"]) systemItem = UITabBarSystemItemHistory; - if ([imageName isEqualToString:@"tabButton:Bookmarks"]) systemItem = UITabBarSystemItemBookmarks; - if ([imageName isEqualToString:@"tabButton:Search"]) systemItem = UITabBarSystemItemSearch; - if ([imageName isEqualToString:@"tabButton:Downloads"]) systemItem = UITabBarSystemItemDownloads; - if ([imageName isEqualToString:@"tabButton:MostRecent"]) systemItem = UITabBarSystemItemMostRecent; - if ([imageName isEqualToString:@"tabButton:MostViewed"]) systemItem = UITabBarSystemItemMostViewed; - if (systemItem != -1) - item = [[UITabBarItem alloc] initWithTabBarSystemItem:systemItem tag:tag]; - } - - if (item == nil) { - NSLog(@"Creating with custom image and title"); - item = [[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:imageName] tag:tag]; - } - - if ([options objectForKey:@"badge"]) - item.badgeValue = [options objectForKey:@"badge"]; - - [tabBarItems setObject:item forKey:name]; - [item release]; -} - -/** - * Update an existing tab bar item to change its badge value. - * @brief update the badge value on an existing tab bar item - * @param arguments Parameters used to identify the tab bar item to update - * -# \c name internal name used to represent this item when it was created - * @param options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if nil or unspecified, the badge will be hidden - */ -- (void)updateTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self createTabBar:nil withDict:nil]; - - NSString *name = [arguments objectAtIndex:0]; - UITabBarItem *item = [tabBarItems objectForKey:name]; - if (item) - item.badgeValue = [options objectForKey:@"badge"]; -} - -/** - * Show previously created items on the tab bar - * @brief show a list of tab bar items - * @param arguments the item names to be shown - * @param options dictionary of options, notable options including: - * - \c animate indicates that the items should animate onto the tab bar - * @see createTabBarItem - * @see createTabBar - */ -- (void)showTabBarItems:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self createTabBar:nil withDict:nil]; - - int i, count = [arguments count]; - NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:count]; - for (i = 0; i < count; i++) { - NSString *itemName = [arguments objectAtIndex:i]; - UITabBarItem *item = [tabBarItems objectForKey:itemName]; - if (item) - [items addObject:item]; - } - - BOOL animateItems = YES; - if ([options objectForKey:@"animate"]) - animateItems = [(NSString*)[options objectForKey:@"animate"] boolValue]; - [tabBar setItems:items animated:animateItems]; - [items release]; -} - -/** - * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item. - * @brief manually select a tab bar item - * @param arguments the name of the tab bar item to select - * @see createTabBarItem - * @see showTabBarItems - */ -- (void)selectTabBarItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self createTabBar:nil withDict:nil]; - - NSString *itemName = [arguments objectAtIndex:0]; - UITabBarItem *item = [tabBarItems objectForKey:itemName]; - if (item) - tabBar.selectedItem = item; - else - tabBar.selectedItem = nil; -} - -/* - * - Tool Buttons - * - toolButton:Done - * - toolButton:Cancel - * - toolButton:Edit - * - toolButton:Save - * - toolButton:Add - * - toolButton:FlexibleSpace - * - toolButton:FixedSpace - * - toolButton:Compose - * - toolButton:Reply - * - toolButton:Action - * - toolButton:Organize - * - toolButton:Bookmarks - * - toolButton:Search - * - toolButton:Refresh - * - toolButton:Stop - * - toolButton:Camera - * - toolButton:Trash - * - toolButton:Play - * - toolButton:Pause - * - toolButton:Rewind - * - toolButton:FastForward - */ -/* --(UIBarButtonSystemItem) getSystemItemFromString:(NSString*)imageName -{ - if ([[imageName substringWithRange:NSMakeRange(0, 10)] isEqualTo:@"tabButton:"]) { - NSLog(@"Tab button!!"); - if ([imageName isEqualTo:@"tabButton:More"]) return UITabBarSystemItemMore; - if ([imageName isEqualTo:@"tabButton:Favorites"]) return UITabBarSystemItemFavorites; - if ([imageName isEqualTo:@"tabButton:Featured"]) return UITabBarSystemItemFeatured; - if ([imageName isEqualTo:@"tabButton:TopRated"]) return UITabBarSystemItemTopRated; - if ([imageName isEqualTo:@"tabButton:Recents"]) return UITabBarSystemItemRecents; - if ([imageName isEqualTo:@"tabButton:Contacts"]) return UITabBarSystemItemContacts; - if ([imageName isEqualTo:@"tabButton:History"]) return UITabBarSystemItemHistory; - if ([imageName isEqualTo:@"tabButton:Bookmarks"]) return UITabBarSystemItemBookmarks; - if ([imageName isEqualTo:@"tabButton:Search"]) return UITabBarSystemItemSearch; - if ([imageName isEqualTo:@"tabButton:Downloads"]) return UITabBarSystemItemDownloads; - if ([imageName isEqualTo:@"tabButton:MostRecent"]) return UITabBarSystemItemMostRecent; - if ([imageName isEqualTo:@"tabButton:MostViewed"]) return UITabBarSystemItemMostViewed; - NSLog(@"Couldn't figure out what it was"); - return -1; - } - else if ([[imageName substringWithRange:NSMakeRange(0, 11)] isEqualTo:@"toolButton:"]) { - NSLog(@"Tool button!!"); - if ([imageName isEqualTo:@"toolButton:Done"]) return UIBarButtonSystemItemDone; - if ([imageName isEqualTo:@"toolButton:Cancel"]) return UIBarButtonSystemItemCancel; - if ([imageName isEqualTo:@"toolButton:Edit"]) return UIBarButtonSystemItemEdit; - if ([imageName isEqualTo:@"toolButton:Save"]) return UIBarButtonSystemItemSave; - if ([imageName isEqualTo:@"toolButton:Add"]) return UIBarButtonSystemItemAdd; - if ([imageName isEqualTo:@"toolButton:FlexibleSpace"]) return UIBarButtonSystemItemFlexibleSpace; - if ([imageName isEqualTo:@"toolButton:FixedSpace"]) return UIBarButtonSystemItemFixedSpace; - if ([imageName isEqualTo:@"toolButton:Compose"]) return UIBarButtonSystemItemCompose; - if ([imageName isEqualTo:@"toolButton:Reply"]) return UIBarButtonSystemItemReply; - if ([imageName isEqualTo:@"toolButton:Action"]) return UIBarButtonSystemItemAction; - if ([imageName isEqualTo:@"toolButton:Organize"]) return UIBarButtonSystemItemOrganize; - if ([imageName isEqualTo:@"toolButton:Bookmarks"]) return UIBarButtonSystemItemBookmarks; - if ([imageName isEqualTo:@"toolButton:Search"]) return UIBarButtonSystemItemSearch; - if ([imageName isEqualTo:@"toolButton:Refresh"]) return UIBarButtonSystemItemRefresh; - if ([imageName isEqualTo:@"toolButton:Stop"]) return UIBarButtonSystemItemStop; - if ([imageName isEqualTo:@"toolButton:Camera"]) return UIBarButtonSystemItemCamera; - if ([imageName isEqualTo:@"toolButton:Trash"]) return UIBarButtonSystemItemTrash; - if ([imageName isEqualTo:@"toolButton:Play"]) return UIBarButtonSystemItemPlay; - if ([imageName isEqualTo:@"toolButton:Pause"]) return UIBarButtonSystemItemPause; - if ([imageName isEqualTo:@"toolButton:Rewind"]) return UIBarButtonSystemItemRewind; - if ([imageName isEqualTo:@"toolButton:FastForward"]) return UIBarButtonSystemItemFastForward; - return -1; - } else { - return -1; - } -} -*/ - -- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item -{ - NSString * jsCallBack = [NSString stringWithFormat:@"uicontrols.tabBarItemSelected(%d);", item.tag]; - [webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - -/*********************************************************************************/ -- (void)createToolBar:(NSArray*)arguments withDict:(NSDictionary*)options -{ - CGFloat height = 39.0f; - BOOL atTop = YES; - UIBarStyle style = UIBarStyleDefault; - - NSDictionary* toolBarSettings = [settings objectForKey:@"ToolBarSettings"]; - if (toolBarSettings) { - if ([toolBarSettings objectForKey:@"height"]) - height = [[toolBarSettings objectForKey:@"height"] floatValue]; - if ([toolBarSettings objectForKey:@"position"]) - atTop = [[toolBarSettings objectForKey:@"position"] isEqualToString:@"top"]; - - NSString *styleStr = [toolBarSettings objectForKey:@"style"]; - if ([styleStr isEqualToString:@"Default"]) - style = UIBarStyleDefault; - else if ([styleStr isEqualToString:@"BlackOpaque"]) - style = UIBarStyleBlackOpaque; - else if ([styleStr isEqualToString:@"BlackTranslucent"]) - style = UIBarStyleBlackTranslucent; - } - - CGRect webViewBounds = webView.bounds; - CGRect toolBarBounds = CGRectMake( - webViewBounds.origin.x, - webViewBounds.origin.y, - webViewBounds.size.width, - height - ); - webViewBounds = CGRectMake( - webViewBounds.origin.x, - webViewBounds.origin.y + height, - webViewBounds.size.width, - webViewBounds.size.height - height - ); - toolBar = [[UIToolbar alloc] initWithFrame:toolBarBounds]; - [toolBar sizeToFit]; - toolBar.hidden = NO; - toolBar.multipleTouchEnabled = NO; - toolBar.autoresizesSubviews = YES; - toolBar.userInteractionEnabled = YES; - toolBar.barStyle = style; - - [toolBar setFrame:toolBarBounds]; - [webView setFrame:webViewBounds]; - - [self.webView.superview addSubview:toolBar]; -} - -/* -- (void)createToolBarButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ -} - */ -/* -- (void)createToolBarItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!toolBar) - [self createToolBar:nil options:nil]; - - NSString *name = [arguments objectAtIndex:0]; - NSString *title = [arguments objectAtIndex:1]; - NSString *style = [arguments objectAtIndex:2]; - UIBarButtonItemStyle styleRef = UIBarButtonItemStylePlain; - if ([style isEqualTo:@"plain"]) - styleRef = UIBarButtonItemStylePlain; - else if ([style isEqualTo:@"border"]) - styleRef = UIBarButtonItemStyleBordered; - else if ([style isEqualTo: - - - UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:title style:styleRef target:self action:@selector(clickedToolBarTitle)]; - [toolBarItems setObject:item forKey:name]; -} -*/ - -- (void)setToolBarTitle:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!toolBar) - [self createToolBar:nil withDict:nil]; - - NSString *title = [arguments objectAtIndex:0]; - if (!toolBarTitle) { - toolBarTitle = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:self action:@selector(toolBarTitleClicked)]; - } else { - toolBarTitle.title = title; - } - - UIBarButtonItem *space1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; - UIBarButtonItem *space2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; - NSArray *items = [[NSArray alloc] initWithObjects:space1, toolBarTitle, space2, nil]; - [space1 release]; - [space2 release]; - - [toolBar setItems:items]; - [items release]; -} - -- (void)toolBarTitleClicked -{ - NSLog(@"Toolbar clicked"); -} - -- (void)dealloc -{ - if (tabBar) - [tabBar release]; - [super dealloc]; -} - -@end diff --git a/iphone/Default.png b/iphone/Default.png deleted file mode 100755 index aa3cbc51..00000000 Binary files a/iphone/Default.png and /dev/null differ diff --git a/iphone/Frameworks/JSON/iphoneos.sdk/SDKSettings.plist b/iphone/Frameworks/JSON/iphoneos.sdk/SDKSettings.plist deleted file mode 100644 index 4307f277..00000000 --- a/iphone/Frameworks/JSON/iphoneos.sdk/SDKSettings.plist +++ /dev/null @@ -1,49 +0,0 @@ - - - - - AlternateSDK - jsoniphonesimulator2.0 - CanonicalName - jsoniphoneos2.0 - CustomProperties - - DefaultProperties - - AD_HOC_CODE_SIGNING_ALLOWED - NO - CODE_SIGN_ENTITLEMENTS - - CODE_SIGN_RESOURCE_RULES_PATH - $(SDKROOT)/ResourceRules.plist - DEAD_CODE_STRIPPING - YES - ENTITLEMENTS_REQUIRED - YES - GCC_THUMB_SUPPORT - YES - IPHONEOS_DEPLOYMENT_TARGET - 2.0 - MACOSX_DEPLOYMENT_TARGET - 10.5 - PLATFORM_NAME - iphoneos - - DisplayName - Device - iPhone OS 2.0 - FamilyIdentifier - iphoneos - FamilyName - iPhone OS - IsBaseSDK - NO - MaximumOSDeploymentTarget - 10.5 - MinimalDisplayName - Device - MinimumSupportedToolsVersion - 3.1 - Version - 2.0 - - diff --git a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/JSON.h b/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/JSON.h deleted file mode 100644 index 54b26f82..00000000 --- a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/JSON.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright (c) 2007, Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** -@mainpage A strict JSON parser and generator for Objective-C - -JSON (JavaScript Object Notation) is a lightweight data-interchange -format. This framework provides two apis for parsing and generating -JSON. One standard object-based and a higher level api consisting of -categories added to existing Objective-C classes. - -Learn more on the http://code.google.com/p/json-framework project site. -*/ - -#import -#import -#import - diff --git a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/NSObject+SBJSON.h b/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/NSObject+SBJSON.h deleted file mode 100644 index 038ea8e3..00000000 --- a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/NSObject+SBJSON.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 2007 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - - -/// Adds JSON generation to NSObject subclasses -@interface NSObject (NSObject_SBJSON) - -/** - @brief Returns a string containing the receiver encoded as a JSON fragment. - - This method is added as a category on NSObject but is only actually - supported for the following objects: - @li NSDictionary - @li NSArray - @li NSString - @li NSNumber (also used for booleans) - @li NSNull - */ -- (NSString *)JSONFragment; - -/** - @brief Returns a string containing the receiver encoded in JSON. - - This method is added as a category on NSObject but is only actually - supported for the following objects: - @li NSDictionary - @li NSArray - */ -- (NSString *)JSONRepresentation; - -@end - diff --git a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/NSString+SBJSON.h b/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/NSString+SBJSON.h deleted file mode 100644 index 69cfa4fd..00000000 --- a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/NSString+SBJSON.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright (C) 2007 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - -/// Adds JSON parsing to NSString -@interface NSString (NSString_SBJSON) - -/// Returns the object represented in the receiver, or nil on error. -- (id)JSONFragmentValue; - -/// Returns the dictionary or array represented in the receiver, or nil on error. -- (id)JSONValue; - -@end diff --git a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/SBJSON.h b/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/SBJSON.h deleted file mode 100644 index c931d464..00000000 --- a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/include/JSON/SBJSON.h +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright (C) 2008 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - -extern NSString * SBJSONErrorDomain; - -enum { - EUNSUPPORTED = 1, - EPARSENUM, - EPARSE, - EFRAGMENT, - ECTRL, - EUNICODE, - EDEPTH, - EESCAPE, - ETRAILCOMMA, - ETRAILGARBAGE, - EEOF, - EINPUT -}; - -/** -@brief A strict JSON parser and generator - -This is the parser and generator underlying the categories added to -NSString and various other objects. - -Objective-C types are mapped to JSON types and back in the following way: - -@li NSNull -> Null -> NSNull -@li NSString -> String -> NSMutableString -@li NSArray -> Array -> NSMutableArray -@li NSDictionary -> Object -> NSMutableDictionary -@li NSNumber (-initWithBool:) -> Boolean -> NSNumber -initWithBool: -@li NSNumber -> Number -> NSDecimalNumber - -In JSON the keys of an object must be strings. NSDictionary keys need -not be, but attempting to convert an NSDictionary with non-string keys -into JSON will throw an exception. - -NSNumber instances created with the +numberWithBool: method are -converted into the JSON boolean "true" and "false" values, and vice -versa. Any other NSNumber instances are converted to a JSON number the -way you would expect. JSON numbers turn into NSDecimalNumber instances, -as we can thus avoid any loss of precision. - -Strictly speaking correctly formed JSON text must have exactly -one top-level container. (Either an Array or an Object.) Scalars, -i.e. nulls, numbers, booleans and strings, are not valid JSON on their own. -It can be quite convenient to pretend that such fragments are valid -JSON however, and this class lets you do so. - -This class does its best to be as strict as possible, both in what it -accepts and what it generates. (Other than the above mentioned support -for JSON fragments.) For example, it does not support trailing commas -in arrays or objects. Nor does it support embedded comments, or -anything else not in the JSON specification. - -*/ -@interface SBJSON : NSObject { - BOOL humanReadable; - BOOL sortKeys; - NSUInteger maxDepth; - -@private - // Used temporarily during scanning/generation - NSUInteger depth; - const char *c; -} - -/// Whether we are generating human-readable (multiline) JSON -/** - Set whether or not to generate human-readable JSON. The default is NO, which produces - JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable - JSON with linebreaks after each array value and dictionary key/value pair, indented two - spaces per nesting level. - */ -@property BOOL humanReadable; - -/// Whether or not to sort the dictionary keys in the output -/** The default is to not sort the keys. */ -@property BOOL sortKeys; - -/// The maximum depth the parser will go to -/** Defaults to 512. */ -@property NSUInteger maxDepth; - -/// Return JSON representation of an array or dictionary -- (NSString*)stringWithObject:(id)value error:(NSError**)error; - -/// Return JSON representation of any legal JSON value -- (NSString*)stringWithFragment:(id)value error:(NSError**)error; - -/// Return the object represented by the given string -- (id)objectWithString:(NSString*)jsonrep error:(NSError**)error; - -/// Return the fragment represented by the given string -- (id)fragmentWithString:(NSString*)jsonrep error:(NSError**)error; - -/// Return JSON representation (or fragment) for the given object -- (NSString*)stringWithObject:(id)value - allowScalar:(BOOL)x - error:(NSError**)error; - -/// Parse the string and return the represented object (or scalar) -- (id)objectWithString:(id)value - allowScalar:(BOOL)x - error:(NSError**)error; - -@end diff --git a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/lib/libjson.a b/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/lib/libjson.a deleted file mode 100644 index 9f8c01fa..00000000 Binary files a/iphone/Frameworks/JSON/iphoneos.sdk/usr/local/lib/libjson.a and /dev/null differ diff --git a/iphone/Frameworks/JSON/iphonesimulator.sdk/SDKSettings.plist b/iphone/Frameworks/JSON/iphonesimulator.sdk/SDKSettings.plist deleted file mode 100644 index 73581f56..00000000 --- a/iphone/Frameworks/JSON/iphonesimulator.sdk/SDKSettings.plist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - CanonicalName - jsoniphonesimulator2.0 - CustomProperties - - DefaultProperties - - GCC_PRODUCT_TYPE_PREPROCESSOR_DEFINITIONS - __IPHONE_OS_VERSION_MIN_REQUIRED=20000 - MACOSX_DEPLOYMENT_TARGET - 10.5 - PLATFORM_NAME - iphonesimulator - - DisplayName - Simulator - iPhone OS 2.0 - FamilyIdentifier - iphoneos - FamilyName - iPhone OS - MaximumDeploymentTarget - 10.5 - MinimalDisplayName - Simulator - MinimumSupportedToolsVersion - 3.1 - Version - 2.0 - isBaseSDK - NO - - diff --git a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/JSON.h b/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/JSON.h deleted file mode 100644 index 54b26f82..00000000 --- a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/JSON.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright (c) 2007, Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** -@mainpage A strict JSON parser and generator for Objective-C - -JSON (JavaScript Object Notation) is a lightweight data-interchange -format. This framework provides two apis for parsing and generating -JSON. One standard object-based and a higher level api consisting of -categories added to existing Objective-C classes. - -Learn more on the http://code.google.com/p/json-framework project site. -*/ - -#import -#import -#import - diff --git a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/NSObject+SBJSON.h b/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/NSObject+SBJSON.h deleted file mode 100644 index 038ea8e3..00000000 --- a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/NSObject+SBJSON.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 2007 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - - -/// Adds JSON generation to NSObject subclasses -@interface NSObject (NSObject_SBJSON) - -/** - @brief Returns a string containing the receiver encoded as a JSON fragment. - - This method is added as a category on NSObject but is only actually - supported for the following objects: - @li NSDictionary - @li NSArray - @li NSString - @li NSNumber (also used for booleans) - @li NSNull - */ -- (NSString *)JSONFragment; - -/** - @brief Returns a string containing the receiver encoded in JSON. - - This method is added as a category on NSObject but is only actually - supported for the following objects: - @li NSDictionary - @li NSArray - */ -- (NSString *)JSONRepresentation; - -@end - diff --git a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/NSString+SBJSON.h b/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/NSString+SBJSON.h deleted file mode 100644 index 69cfa4fd..00000000 --- a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/NSString+SBJSON.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright (C) 2007 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - -/// Adds JSON parsing to NSString -@interface NSString (NSString_SBJSON) - -/// Returns the object represented in the receiver, or nil on error. -- (id)JSONFragmentValue; - -/// Returns the dictionary or array represented in the receiver, or nil on error. -- (id)JSONValue; - -@end diff --git a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/SBJSON.h b/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/SBJSON.h deleted file mode 100644 index c931d464..00000000 --- a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/include/JSON/SBJSON.h +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright (C) 2008 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - -extern NSString * SBJSONErrorDomain; - -enum { - EUNSUPPORTED = 1, - EPARSENUM, - EPARSE, - EFRAGMENT, - ECTRL, - EUNICODE, - EDEPTH, - EESCAPE, - ETRAILCOMMA, - ETRAILGARBAGE, - EEOF, - EINPUT -}; - -/** -@brief A strict JSON parser and generator - -This is the parser and generator underlying the categories added to -NSString and various other objects. - -Objective-C types are mapped to JSON types and back in the following way: - -@li NSNull -> Null -> NSNull -@li NSString -> String -> NSMutableString -@li NSArray -> Array -> NSMutableArray -@li NSDictionary -> Object -> NSMutableDictionary -@li NSNumber (-initWithBool:) -> Boolean -> NSNumber -initWithBool: -@li NSNumber -> Number -> NSDecimalNumber - -In JSON the keys of an object must be strings. NSDictionary keys need -not be, but attempting to convert an NSDictionary with non-string keys -into JSON will throw an exception. - -NSNumber instances created with the +numberWithBool: method are -converted into the JSON boolean "true" and "false" values, and vice -versa. Any other NSNumber instances are converted to a JSON number the -way you would expect. JSON numbers turn into NSDecimalNumber instances, -as we can thus avoid any loss of precision. - -Strictly speaking correctly formed JSON text must have exactly -one top-level container. (Either an Array or an Object.) Scalars, -i.e. nulls, numbers, booleans and strings, are not valid JSON on their own. -It can be quite convenient to pretend that such fragments are valid -JSON however, and this class lets you do so. - -This class does its best to be as strict as possible, both in what it -accepts and what it generates. (Other than the above mentioned support -for JSON fragments.) For example, it does not support trailing commas -in arrays or objects. Nor does it support embedded comments, or -anything else not in the JSON specification. - -*/ -@interface SBJSON : NSObject { - BOOL humanReadable; - BOOL sortKeys; - NSUInteger maxDepth; - -@private - // Used temporarily during scanning/generation - NSUInteger depth; - const char *c; -} - -/// Whether we are generating human-readable (multiline) JSON -/** - Set whether or not to generate human-readable JSON. The default is NO, which produces - JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable - JSON with linebreaks after each array value and dictionary key/value pair, indented two - spaces per nesting level. - */ -@property BOOL humanReadable; - -/// Whether or not to sort the dictionary keys in the output -/** The default is to not sort the keys. */ -@property BOOL sortKeys; - -/// The maximum depth the parser will go to -/** Defaults to 512. */ -@property NSUInteger maxDepth; - -/// Return JSON representation of an array or dictionary -- (NSString*)stringWithObject:(id)value error:(NSError**)error; - -/// Return JSON representation of any legal JSON value -- (NSString*)stringWithFragment:(id)value error:(NSError**)error; - -/// Return the object represented by the given string -- (id)objectWithString:(NSString*)jsonrep error:(NSError**)error; - -/// Return the fragment represented by the given string -- (id)fragmentWithString:(NSString*)jsonrep error:(NSError**)error; - -/// Return JSON representation (or fragment) for the given object -- (NSString*)stringWithObject:(id)value - allowScalar:(BOOL)x - error:(NSError**)error; - -/// Parse the string and return the represented object (or scalar) -- (id)objectWithString:(id)value - allowScalar:(BOOL)x - error:(NSError**)error; - -@end diff --git a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/lib/libjson.a b/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/lib/libjson.a deleted file mode 100644 index d127448f..00000000 Binary files a/iphone/Frameworks/JSON/iphonesimulator.sdk/usr/local/lib/libjson.a and /dev/null differ diff --git a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/JSON.h b/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/JSON.h deleted file mode 100644 index 54b26f82..00000000 --- a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/JSON.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright (c) 2007, Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** -@mainpage A strict JSON parser and generator for Objective-C - -JSON (JavaScript Object Notation) is a lightweight data-interchange -format. This framework provides two apis for parsing and generating -JSON. One standard object-based and a higher level api consisting of -categories added to existing Objective-C classes. - -Learn more on the http://code.google.com/p/json-framework project site. -*/ - -#import -#import -#import - diff --git a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/NSObject+SBJSON.h b/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/NSObject+SBJSON.h deleted file mode 100644 index 038ea8e3..00000000 --- a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/NSObject+SBJSON.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -Copyright (C) 2007 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - - -/// Adds JSON generation to NSObject subclasses -@interface NSObject (NSObject_SBJSON) - -/** - @brief Returns a string containing the receiver encoded as a JSON fragment. - - This method is added as a category on NSObject but is only actually - supported for the following objects: - @li NSDictionary - @li NSArray - @li NSString - @li NSNumber (also used for booleans) - @li NSNull - */ -- (NSString *)JSONFragment; - -/** - @brief Returns a string containing the receiver encoded in JSON. - - This method is added as a category on NSObject but is only actually - supported for the following objects: - @li NSDictionary - @li NSArray - */ -- (NSString *)JSONRepresentation; - -@end - diff --git a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/NSString+SBJSON.h b/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/NSString+SBJSON.h deleted file mode 100644 index 69cfa4fd..00000000 --- a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/NSString+SBJSON.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -Copyright (C) 2007 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - -/// Adds JSON parsing to NSString -@interface NSString (NSString_SBJSON) - -/// Returns the object represented in the receiver, or nil on error. -- (id)JSONFragmentValue; - -/// Returns the dictionary or array represented in the receiver, or nil on error. -- (id)JSONValue; - -@end diff --git a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/SBJSON.h b/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/SBJSON.h deleted file mode 100644 index c931d464..00000000 --- a/iphone/Frameworks/JSON/macosx.sdk/usr/local/include/JSON/SBJSON.h +++ /dev/null @@ -1,137 +0,0 @@ -/* -Copyright (C) 2008 Stig Brautaset. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - Neither the name of the author nor the names of its contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -#import - -extern NSString * SBJSONErrorDomain; - -enum { - EUNSUPPORTED = 1, - EPARSENUM, - EPARSE, - EFRAGMENT, - ECTRL, - EUNICODE, - EDEPTH, - EESCAPE, - ETRAILCOMMA, - ETRAILGARBAGE, - EEOF, - EINPUT -}; - -/** -@brief A strict JSON parser and generator - -This is the parser and generator underlying the categories added to -NSString and various other objects. - -Objective-C types are mapped to JSON types and back in the following way: - -@li NSNull -> Null -> NSNull -@li NSString -> String -> NSMutableString -@li NSArray -> Array -> NSMutableArray -@li NSDictionary -> Object -> NSMutableDictionary -@li NSNumber (-initWithBool:) -> Boolean -> NSNumber -initWithBool: -@li NSNumber -> Number -> NSDecimalNumber - -In JSON the keys of an object must be strings. NSDictionary keys need -not be, but attempting to convert an NSDictionary with non-string keys -into JSON will throw an exception. - -NSNumber instances created with the +numberWithBool: method are -converted into the JSON boolean "true" and "false" values, and vice -versa. Any other NSNumber instances are converted to a JSON number the -way you would expect. JSON numbers turn into NSDecimalNumber instances, -as we can thus avoid any loss of precision. - -Strictly speaking correctly formed JSON text must have exactly -one top-level container. (Either an Array or an Object.) Scalars, -i.e. nulls, numbers, booleans and strings, are not valid JSON on their own. -It can be quite convenient to pretend that such fragments are valid -JSON however, and this class lets you do so. - -This class does its best to be as strict as possible, both in what it -accepts and what it generates. (Other than the above mentioned support -for JSON fragments.) For example, it does not support trailing commas -in arrays or objects. Nor does it support embedded comments, or -anything else not in the JSON specification. - -*/ -@interface SBJSON : NSObject { - BOOL humanReadable; - BOOL sortKeys; - NSUInteger maxDepth; - -@private - // Used temporarily during scanning/generation - NSUInteger depth; - const char *c; -} - -/// Whether we are generating human-readable (multiline) JSON -/** - Set whether or not to generate human-readable JSON. The default is NO, which produces - JSON without any whitespace. (Except inside strings.) If set to YES, generates human-readable - JSON with linebreaks after each array value and dictionary key/value pair, indented two - spaces per nesting level. - */ -@property BOOL humanReadable; - -/// Whether or not to sort the dictionary keys in the output -/** The default is to not sort the keys. */ -@property BOOL sortKeys; - -/// The maximum depth the parser will go to -/** Defaults to 512. */ -@property NSUInteger maxDepth; - -/// Return JSON representation of an array or dictionary -- (NSString*)stringWithObject:(id)value error:(NSError**)error; - -/// Return JSON representation of any legal JSON value -- (NSString*)stringWithFragment:(id)value error:(NSError**)error; - -/// Return the object represented by the given string -- (id)objectWithString:(NSString*)jsonrep error:(NSError**)error; - -/// Return the fragment represented by the given string -- (id)fragmentWithString:(NSString*)jsonrep error:(NSError**)error; - -/// Return JSON representation (or fragment) for the given object -- (NSString*)stringWithObject:(id)value - allowScalar:(BOOL)x - error:(NSError**)error; - -/// Parse the string and return the represented object (or scalar) -- (id)objectWithString:(id)value - allowScalar:(BOOL)x - error:(NSError**)error; - -@end diff --git a/iphone/Frameworks/JSON/macosx.sdk/usr/local/lib/libjson.a b/iphone/Frameworks/JSON/macosx.sdk/usr/local/lib/libjson.a deleted file mode 100644 index 3072d81a..00000000 Binary files a/iphone/Frameworks/JSON/macosx.sdk/usr/local/lib/libjson.a and /dev/null differ diff --git a/iphone/Info.plist b/iphone/Info.plist deleted file mode 100755 index e3800d7f..00000000 --- a/iphone/Info.plist +++ /dev/null @@ -1,34 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleDisplayName - PhoneGap - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - icon.png - CFBundleIdentifier - com.sintaxi.phonegapdemo - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.0.1 - LSRequiresIPhoneOS - - NSMainNibFile - MainWindow - UIStatusBarHidden - - UIStatusBarStyle - UIStatusBarStyleDefault - - diff --git a/iphone/MainWindow.xib b/iphone/MainWindow.xib deleted file mode 100755 index e51eef7c..00000000 --- a/iphone/MainWindow.xib +++ /dev/null @@ -1,334 +0,0 @@ - - - - 512 - 9G55 - 677 - 949.43 - 353.00 - - YES - - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - YES - - YES - - - YES - - - - YES - - IBFilesOwner - - - IBFirstResponder - - - - - 1316 - - {320, 480} - - 1 - MSAxIDEAA - - NO - NO - - YES - - - - - 274 - - YES - - - 274 - {320, 480} - - - 1 - MSAwLjUgMAA - - YES - YES - - - {320, 480} - - - 1 - MC4wNDQzNTc5NzggMC4wNDQzNTc5NzggMC4wNDQzNTc5NzgAA - - NO - - - - - - YES - - - window - - - - 5 - - - - viewController - - - - 11 - - - - delegate - - - - 19 - - - - webView - - - - 20 - - - - webView - - - - 29 - - - - - YES - - 0 - - YES - - - - - - 2 - - - YES - - - - - -1 - - - RmlsZSdzIE93bmVyA - - - 3 - - - Phone Gap App Delegate - - - -2 - - - - - 10 - - - YES - - - - - - 12 - - - YES - - - - - - 13 - - - My WebView - - - - - YES - - YES - -1.CustomClassName - -2.CustomClassName - 10.CustomClassName - 10.IBEditorWindowLastContentRect - 10.IBPluginDependency - 12.IBPluginDependency - 13.IBPluginDependency - 2.IBAttributePlaceholdersKey - 2.IBEditorWindowLastContentRect - 2.IBPluginDependency - 3.CustomClassName - 3.IBPluginDependency - - - YES - UIApplication - UIResponder - PhoneGapViewController - {{23, 161}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - YES - - YES - - - YES - - - {{439, 171}, {320, 480}} - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - PhoneGapDelegate - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - YES - - - YES - - - - - YES - - YES - - - YES - - - - 29 - - - - YES - - PhoneGapDelegate - NSObject - - YES - - YES - activityView - imageView - viewController - webView - window - - - YES - UIActivityIndicatorView - UIImageView - PhoneGapViewController - UIWebView - UIWindow - - - - IBProjectSource - Classes/PhoneGapDelegate.h - - - - PhoneGapDelegate - NSObject - - IBUserSource - - - - - PhoneGapViewController - UIViewController - - webView - UIWebView - - - IBProjectSource - Classes/PhoneGapViewController.h - - - - PhoneGapViewController - UIViewController - - YES - - YES - loadView - pushBack - pushHome - - - YES - id - id - id - - - - IBUserSource - - - - - UIActivityIndicatorView - UIView - - IBUserSource - - - - - - 0 - PhoneGap.xcodeproj - 3 - - diff --git a/iphone/PhoneGap.plist b/iphone/PhoneGap.plist deleted file mode 100755 index 475e1f20..00000000 --- a/iphone/PhoneGap.plist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - DetectPhoneNumber - - TopActivityIndicator - gray - EnableLocation - - EnableAcceleration - - AutoRotate - - StartOrientation - portrait - RotateOrientation - portrait - UIControls - - TabBarSettings - - height - 49 - position - bottom - - ToolBarSettings - - style - Default - - - - diff --git a/iphone/PhoneGap.xcodeproj/project.pbxproj b/iphone/PhoneGap.xcodeproj/project.pbxproj deleted file mode 100755 index a7787ed6..00000000 --- a/iphone/PhoneGap.xcodeproj/project.pbxproj +++ /dev/null @@ -1,549 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 45; - objects = { - -/* Begin PBXBuildFile section */ - 079B0A0A0E45734600755F37 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 079B0A090E45734600755F37 /* CoreLocation.framework */; }; - 1B1B4E6B0F938A0500ECD4E6 /* UIControls.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B1B4E6A0F938A0500ECD4E6 /* UIControls.m */; }; - 1B1B4FBE0F94571B00ECD4E6 /* PhoneGapCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B1B4FBD0F94571B00ECD4E6 /* PhoneGapCommand.m */; }; - 1B1B53830F98070D00ECD4E6 /* Notification.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B1B53820F98070D00ECD4E6 /* Notification.m */; }; - 1B64D89A0F6C73C700D12F7F /* DebugConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 1B64D8990F6C73C700D12F7F /* DebugConsole.m */; }; - 1BB1F7D20F9E1BE2002A28DA /* Settings.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1BB1F7D10F9E1BE2002A28DA /* Settings.plist */; }; - 1D3623260D0F684500981E51 /* PhoneGapDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* PhoneGapDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; - 303554C1100E56B7002C5EC0 /* Camera.m in Sources */ = {isa = PBXBuildFile; fileRef = 303554C0100E56B7002C5EC0 /* Camera.m */; }; - 30355582100E7477002C5EC0 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 30355581100E7477002C5EC0 /* NSData+Base64.m */; }; - 30C531981020E3B20017260B /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C531971020E3B20017260B /* Reachability.m */; }; - 30C5319B1020E3CF0017260B /* Network.m in Sources */ = {isa = PBXBuildFile; fileRef = 30C5319A1020E3CF0017260B /* Network.m */; }; - 30C531A01020E4310017260B /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30C5319F1020E4310017260B /* SystemConfiguration.framework */; }; - 30CD0F0F0FCBED3F00AA6748 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3023AB3D0FCB6FC40012AC33 /* AddressBookUI.framework */; }; - 30EC9AEC0FCDF4DD00A52C71 /* LoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 30EC9AEB0FCDF4DD00A52C71 /* LoadingView.m */; }; - 30EC9B110FCDFC9900A52C71 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30EC9B100FCDFC9900A52C71 /* CoreGraphics.framework */; }; - 30EC9B220FCDFCC500A52C71 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30EC9B210FCDFCC500A52C71 /* QuartzCore.framework */; }; - 30EF07C20FCFBED8009B3930 /* OCCFObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 30EF07C10FCFBED8009B3930 /* OCCFObject.m */; }; - 30EF07CB0FCFC111009B3930 /* OCABRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = 30EF07CA0FCFC111009B3930 /* OCABRecord.m */; }; - 30EF08140FCFC8E0009B3930 /* OCABMutableMultiValue.m in Sources */ = {isa = PBXBuildFile; fileRef = 30EF08130FCFC8E0009B3930 /* OCABMutableMultiValue.m */; }; - 30F95CB00FCC8DBF0069E3FF /* Categories.m in Sources */ = {isa = PBXBuildFile; fileRef = 30F95CAF0FCC8DBF0069E3FF /* Categories.m */; }; - 47DC5AEE0F4BDEDB00FB54CE /* beep.wav in Resources */ = {isa = PBXBuildFile; fileRef = 47DC5AED0F4BDEDB00FB54CE /* beep.wav */; }; - 47DC7FB30EFADF9E00D0B526 /* PhoneGap.plist in Resources */ = {isa = PBXBuildFile; fileRef = 47DC7FB20EFADF9E00D0B526 /* PhoneGap.plist */; }; - 47F565210F3AC95D001DFBDB /* Image.m in Sources */ = {isa = PBXBuildFile; fileRef = 47F565200F3AC95D001DFBDB /* Image.m */; }; - 47FAB6A90EF751E2005F55AB /* PhoneGapViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 47FAB6A80EF751E2005F55AB /* PhoneGapViewController.m */; }; - 47FAB72A0EF7A663005F55AB /* Sound.m in Sources */ = {isa = PBXBuildFile; fileRef = 47FAB7290EF7A663005F55AB /* Sound.m */; }; - 47FAB72E0EF7A6C6005F55AB /* Contacts.m in Sources */ = {isa = PBXBuildFile; fileRef = 47FAB72D0EF7A6C6005F55AB /* Contacts.m */; }; - 47FAB7500EF82576005F55AB /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47FAB74F0EF82576005F55AB /* AddressBook.framework */; }; - 8204F3D30E5CB4DC00F2DAA1 /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 8204F3D20E5CB4DC00F2DAA1 /* icon.png */; }; - 8205CB7D0E68A701006CBEEF /* Device.m in Sources */ = {isa = PBXBuildFile; fileRef = 8205CB7C0E68A701006CBEEF /* Device.m */; }; - 824041C10E942F0E002F3376 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 824041C00E942F0E002F3376 /* Default.png */; }; - 825DFB5E0E464E6C000D0A5D /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 825DFB5D0E464E6C000D0A5D /* README.md */; }; - 828B59CE0E520C7F0096DE8B /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 828B59CD0E520C7F0096DE8B /* AudioToolbox.framework */; }; - AA13D3420F202D0400B18061 /* www in Resources */ = {isa = PBXBuildFile; fileRef = AA13D33F0F202D0400B18061 /* www */; }; - BB8FC5C30F5B3EC4007C7DCE /* Bonjour.m in Sources */ = {isa = PBXBuildFile; fileRef = BB8FC5C20F5B3EC4007C7DCE /* Bonjour.m */; }; - BB8FC69F0F5BB58D007C7DCE /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BB8FC69E0F5BB58D007C7DCE /* CFNetwork.framework */; }; - BB8FCC5E0F5F00FF007C7DCE /* Map.m in Sources */ = {isa = PBXBuildFile; fileRef = BB8FCC5D0F5F00FF007C7DCE /* Map.m */; }; - BB8FCE250F5F2CF3007C7DCE /* Location.m in Sources */ = {isa = PBXBuildFile; fileRef = 8254F8800E650500002FDA36 /* Location.m */; }; - E94AEB79101A70B60091C5ED /* Movie.m in Sources */ = {isa = PBXBuildFile; fileRef = E94AEB78101A70B60091C5ED /* Movie.m */; }; - E94AEBB1101A71BA0091C5ED /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E94AEBB0101A71BA0091C5ED /* MediaPlayer.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 079B0A090E45734600755F37 /* CoreLocation.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; - 1B1B4E690F938A0500ECD4E6 /* UIControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIControls.h; sourceTree = ""; }; - 1B1B4E6A0F938A0500ECD4E6 /* UIControls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIControls.m; sourceTree = ""; }; - 1B1B4FBC0F94571B00ECD4E6 /* PhoneGapCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneGapCommand.h; sourceTree = ""; }; - 1B1B4FBD0F94571B00ECD4E6 /* PhoneGapCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneGapCommand.m; sourceTree = ""; }; - 1B1B53810F98070D00ECD4E6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Notification.h; sourceTree = ""; }; - 1B1B53820F98070D00ECD4E6 /* Notification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Notification.m; sourceTree = ""; }; - 1B64D8980F6C73C700D12F7F /* DebugConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugConsole.h; sourceTree = ""; }; - 1B64D8990F6C73C700D12F7F /* DebugConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugConsole.m; sourceTree = ""; }; - 1BB1F7D10F9E1BE2002A28DA /* Settings.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Settings.plist; sourceTree = ""; }; - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* PhoneGapDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneGapDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* PhoneGapDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneGapDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* PhoneGap.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PhoneGap.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ../main.m; sourceTree = ""; }; - 3023AB3D0FCB6FC40012AC33 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; - 303554BF100E56B7002C5EC0 /* Camera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Camera.h; sourceTree = ""; }; - 303554C0100E56B7002C5EC0 /* Camera.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Camera.m; sourceTree = ""; }; - 30355580100E7477002C5EC0 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = ""; }; - 30355581100E7477002C5EC0 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = ""; }; - 30C531961020E3B20017260B /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; - 30C531971020E3B20017260B /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; - 30C531991020E3CF0017260B /* Network.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Network.h; sourceTree = ""; }; - 30C5319A1020E3CF0017260B /* Network.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Network.m; sourceTree = ""; }; - 30C5319F1020E4310017260B /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 30EC9AEA0FCDF4DD00A52C71 /* LoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadingView.h; sourceTree = ""; }; - 30EC9AEB0FCDF4DD00A52C71 /* LoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoadingView.m; sourceTree = ""; }; - 30EC9B100FCDFC9900A52C71 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 30EC9B210FCDFCC500A52C71 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 30EF07C00FCFBED8009B3930 /* OCCFObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCCFObject.h; sourceTree = ""; }; - 30EF07C10FCFBED8009B3930 /* OCCFObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCCFObject.m; sourceTree = ""; }; - 30EF07C90FCFC111009B3930 /* OCABRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCABRecord.h; sourceTree = ""; }; - 30EF07CA0FCFC111009B3930 /* OCABRecord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCABRecord.m; sourceTree = ""; }; - 30EF08120FCFC8E0009B3930 /* OCABMutableMultiValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCABMutableMultiValue.h; sourceTree = ""; }; - 30EF08130FCFC8E0009B3930 /* OCABMutableMultiValue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCABMutableMultiValue.m; sourceTree = ""; }; - 30F95CAE0FCC8DBF0069E3FF /* Categories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Categories.h; sourceTree = ""; }; - 30F95CAF0FCC8DBF0069E3FF /* Categories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Categories.m; sourceTree = ""; }; - 474A7F820EFAD6580020DD7F /* PhoneGap_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneGap_Prefix.pch; sourceTree = ""; }; - 47DC5AED0F4BDEDB00FB54CE /* beep.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = beep.wav; sourceTree = ""; }; - 47DC7FB20EFADF9E00D0B526 /* PhoneGap.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = PhoneGap.plist; sourceTree = ""; }; - 47F5651F0F3AC95D001DFBDB /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; - 47F565200F3AC95D001DFBDB /* Image.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Image.m; sourceTree = ""; }; - 47FAB6A70EF751E2005F55AB /* PhoneGapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PhoneGapViewController.h; sourceTree = ""; }; - 47FAB6A80EF751E2005F55AB /* PhoneGapViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneGapViewController.m; sourceTree = ""; }; - 47FAB7280EF7A663005F55AB /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = ""; }; - 47FAB7290EF7A663005F55AB /* Sound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Sound.m; sourceTree = ""; }; - 47FAB72C0EF7A6C6005F55AB /* Contacts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Contacts.h; sourceTree = ""; }; - 47FAB72D0EF7A6C6005F55AB /* Contacts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Contacts.m; sourceTree = ""; }; - 47FAB74F0EF82576005F55AB /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; - 8204F3D20E5CB4DC00F2DAA1 /* icon.png */ = {isa = PBXFileReference; explicitFileType = image.png; path = icon.png; sourceTree = ""; }; - 8205CB7B0E68A701006CBEEF /* Device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Device.h; sourceTree = ""; }; - 8205CB7C0E68A701006CBEEF /* Device.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Device.m; sourceTree = ""; }; - 824041C00E942F0E002F3376 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; - 8254F87F0E650500002FDA36 /* Location.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Location.h; sourceTree = ""; }; - 8254F8800E650500002FDA36 /* Location.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Location.m; sourceTree = ""; }; - 825DFB5D0E464E6C000D0A5D /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; - 828B59CD0E520C7F0096DE8B /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AA13D33F0F202D0400B18061 /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = ""; }; - BB8FC5C10F5B3EC4007C7DCE /* Bonjour.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bonjour.h; sourceTree = ""; }; - BB8FC5C20F5B3EC4007C7DCE /* Bonjour.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Bonjour.m; sourceTree = ""; }; - BB8FC69E0F5BB58D007C7DCE /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; - BB8FCC5C0F5F00FF007C7DCE /* Map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Map.h; sourceTree = ""; }; - BB8FCC5D0F5F00FF007C7DCE /* Map.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Map.m; sourceTree = ""; }; - E94AEB77101A70B60091C5ED /* Movie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Movie.h; sourceTree = ""; }; - E94AEB78101A70B60091C5ED /* Movie.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Movie.m; sourceTree = ""; }; - E94AEBB0101A71BA0091C5ED /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 30CD0F0F0FCBED3F00AA6748 /* AddressBookUI.framework in Frameworks */, - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - 079B0A0A0E45734600755F37 /* CoreLocation.framework in Frameworks */, - 828B59CE0E520C7F0096DE8B /* AudioToolbox.framework in Frameworks */, - 47FAB7500EF82576005F55AB /* AddressBook.framework in Frameworks */, - BB8FC69F0F5BB58D007C7DCE /* CFNetwork.framework in Frameworks */, - 30EC9B110FCDFC9900A52C71 /* CoreGraphics.framework in Frameworks */, - 30EC9B220FCDFCC500A52C71 /* QuartzCore.framework in Frameworks */, - E94AEBB1101A71BA0091C5ED /* MediaPlayer.framework in Frameworks */, - 30C531A01020E4310017260B /* SystemConfiguration.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - 29B97316FDCFA39411CA2CEA /* main.m */, - 1D3623240D0F684500981E51 /* PhoneGapDelegate.h */, - 1D3623250D0F684500981E51 /* PhoneGapDelegate.m */, - 47FAB6A70EF751E2005F55AB /* PhoneGapViewController.h */, - 47FAB6A80EF751E2005F55AB /* PhoneGapViewController.m */, - 1B1B4FBC0F94571B00ECD4E6 /* PhoneGapCommand.h */, - 1B1B4FBD0F94571B00ECD4E6 /* PhoneGapCommand.m */, - 30F95CAE0FCC8DBF0069E3FF /* Categories.h */, - 30F95CAF0FCC8DBF0069E3FF /* Categories.m */, - 30EC9AEA0FCDF4DD00A52C71 /* LoadingView.h */, - 30EC9AEB0FCDF4DD00A52C71 /* LoadingView.m */, - 30EF088D0FCFDA4B009B3930 /* Proxies */, - 1B1B50FB0F95000A00ECD4E6 /* Commands */, - ); - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* PhoneGap.app */, - ); - name = Products; - sourceTree = ""; - }; - 1B1B50FB0F95000A00ECD4E6 /* Commands */ = { - isa = PBXGroup; - children = ( - 30C531961020E3B20017260B /* Reachability.h */, - 30C531971020E3B20017260B /* Reachability.m */, - 30355580100E7477002C5EC0 /* NSData+Base64.h */, - 30355581100E7477002C5EC0 /* NSData+Base64.m */, - BB8FC5C10F5B3EC4007C7DCE /* Bonjour.h */, - E94AEB77101A70B60091C5ED /* Movie.h */, - E94AEB78101A70B60091C5ED /* Movie.m */, - BB8FC5C20F5B3EC4007C7DCE /* Bonjour.m */, - 47FAB72C0EF7A6C6005F55AB /* Contacts.h */, - 47FAB72D0EF7A6C6005F55AB /* Contacts.m */, - 1B64D8980F6C73C700D12F7F /* DebugConsole.h */, - 1B64D8990F6C73C700D12F7F /* DebugConsole.m */, - 8205CB7B0E68A701006CBEEF /* Device.h */, - 8205CB7C0E68A701006CBEEF /* Device.m */, - 47F5651F0F3AC95D001DFBDB /* Image.h */, - 47F565200F3AC95D001DFBDB /* Image.m */, - 8254F87F0E650500002FDA36 /* Location.h */, - 8254F8800E650500002FDA36 /* Location.m */, - BB8FCC5C0F5F00FF007C7DCE /* Map.h */, - BB8FCC5D0F5F00FF007C7DCE /* Map.m */, - 1B1B53810F98070D00ECD4E6 /* Notification.h */, - 1B1B53820F98070D00ECD4E6 /* Notification.m */, - 47FAB7280EF7A663005F55AB /* Sound.h */, - 47FAB7290EF7A663005F55AB /* Sound.m */, - 1B1B4E690F938A0500ECD4E6 /* UIControls.h */, - 1B1B4E6A0F938A0500ECD4E6 /* UIControls.m */, - 303554BF100E56B7002C5EC0 /* Camera.h */, - 303554C0100E56B7002C5EC0 /* Camera.m */, - 30C531991020E3CF0017260B /* Network.h */, - 30C5319A1020E3CF0017260B /* Network.m */, - ); - name = Commands; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - AA13D33F0F202D0400B18061 /* www */, - AA13D3080F20286200B18061 /* Config */, - 824041C00E942F0E002F3376 /* Default.png */, - 8204F3D20E5CB4DC00F2DAA1 /* icon.png */, - 825DFB5D0E464E6C000D0A5D /* README.md */, - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - E94AEBB0101A71BA0091C5ED /* MediaPlayer.framework */, - ); - name = CustomTemplate; - sourceTree = ""; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 474A7F820EFAD6580020DD7F /* PhoneGap_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 47DC5AED0F4BDEDB00FB54CE /* beep.wav */, - 28AD733E0D9D9553002E5188 /* MainWindow.xib */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 30C5319F1020E4310017260B /* SystemConfiguration.framework */, - 30EC9B210FCDFCC500A52C71 /* QuartzCore.framework */, - 30EC9B100FCDFC9900A52C71 /* CoreGraphics.framework */, - 079B0A090E45734600755F37 /* CoreLocation.framework */, - 3023AB3D0FCB6FC40012AC33 /* AddressBookUI.framework */, - BB8FC69E0F5BB58D007C7DCE /* CFNetwork.framework */, - 47FAB74F0EF82576005F55AB /* AddressBook.framework */, - 828B59CD0E520C7F0096DE8B /* AudioToolbox.framework */, - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - 30EF088D0FCFDA4B009B3930 /* Proxies */ = { - isa = PBXGroup; - children = ( - 30EF07C00FCFBED8009B3930 /* OCCFObject.h */, - 30EF07C10FCFBED8009B3930 /* OCCFObject.m */, - 30EF07C90FCFC111009B3930 /* OCABRecord.h */, - 30EF07CA0FCFC111009B3930 /* OCABRecord.m */, - 30EF08120FCFC8E0009B3930 /* OCABMutableMultiValue.h */, - 30EF08130FCFC8E0009B3930 /* OCABMutableMultiValue.m */, - ); - name = Proxies; - sourceTree = ""; - }; - AA13D3080F20286200B18061 /* Config */ = { - isa = PBXGroup; - children = ( - 1BB1F7D10F9E1BE2002A28DA /* Settings.plist */, - 47DC7FB20EFADF9E00D0B526 /* PhoneGap.plist */, - 8D1107310486CEB800E47090 /* Info.plist */, - ); - name = Config; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* PhoneGap */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "PhoneGap" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - D28B9B700FB212EF00420033 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = PhoneGap; - productName = PhoneGap; - productReference = 1D6058910D05DD3D006BFB54 /* PhoneGap.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "PhoneGap" */; - compatibilityVersion = "Xcode 3.1"; - hasScannedForEncodings = 1; - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* PhoneGap */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, - 825DFB5E0E464E6C000D0A5D /* README.md in Resources */, - 8204F3D30E5CB4DC00F2DAA1 /* icon.png in Resources */, - 824041C10E942F0E002F3376 /* Default.png in Resources */, - 47DC7FB30EFADF9E00D0B526 /* PhoneGap.plist in Resources */, - AA13D3420F202D0400B18061 /* www in Resources */, - 47DC5AEE0F4BDEDB00FB54CE /* beep.wav in Resources */, - 1BB1F7D20F9E1BE2002A28DA /* Settings.plist in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - D28B9B700FB212EF00420033 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "sh -c ./build-phonegap.sh"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* PhoneGapDelegate.m in Sources */, - 8205CB7D0E68A701006CBEEF /* Device.m in Sources */, - 47FAB6A90EF751E2005F55AB /* PhoneGapViewController.m in Sources */, - 47FAB72A0EF7A663005F55AB /* Sound.m in Sources */, - 47FAB72E0EF7A6C6005F55AB /* Contacts.m in Sources */, - 47F565210F3AC95D001DFBDB /* Image.m in Sources */, - BB8FC5C30F5B3EC4007C7DCE /* Bonjour.m in Sources */, - BB8FCC5E0F5F00FF007C7DCE /* Map.m in Sources */, - BB8FCE250F5F2CF3007C7DCE /* Location.m in Sources */, - 1B64D89A0F6C73C700D12F7F /* DebugConsole.m in Sources */, - 1B1B4E6B0F938A0500ECD4E6 /* UIControls.m in Sources */, - 1B1B4FBE0F94571B00ECD4E6 /* PhoneGapCommand.m in Sources */, - 1B1B53830F98070D00ECD4E6 /* Notification.m in Sources */, - 30F95CB00FCC8DBF0069E3FF /* Categories.m in Sources */, - 30EC9AEC0FCDF4DD00A52C71 /* LoadingView.m in Sources */, - 30EF07C20FCFBED8009B3930 /* OCCFObject.m in Sources */, - 30EF07CB0FCFC111009B3930 /* OCABRecord.m in Sources */, - 30EF08140FCFC8E0009B3930 /* OCABMutableMultiValue.m in Sources */, - E94AEB79101A70B60091C5ED /* Movie.m in Sources */, - 303554C1100E56B7002C5EC0 /* Camera.m in Sources */, - 30355582100E7477002C5EC0 /* NSData+Base64.m in Sources */, - 30C531981020E3B20017260B /* Reachability.m in Sources */, - 30C5319B1020E3CF0017260B /* Network.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ADDITIONAL_SDKS = "\"$(SRCROOT)/Frameworks/JSON/$(PLATFORM_NAME).sdk\""; - ALWAYS_SEARCH_USER_PATHS = NO; - CODE_SIGN_IDENTITY = "Don't Code Sign"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = PhoneGap_Prefix.pch; - INFOPLIST_FILE = Info.plist; - OTHER_LDFLAGS = ( - "-ObjC", - "-ljson", - ); - PRODUCT_NAME = PhoneGap; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ADDITIONAL_SDKS = "\"$(SRCROOT)/Frameworks/JSON/$(PLATFORM_NAME).sdk\""; - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = PhoneGap_Prefix.pch; - INFOPLIST_FILE = Info.plist; - PRODUCT_NAME = PhoneGap; - }; - name = Release; - }; - B74E58180EC6C9AC00215614 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ADDITIONAL_SDKS = "\"$(SRCROOT)/Frameworks/JSON/$(PLATFORM_NAME).sdk\""; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist"; - CURRENT_PROJECT_VERSION = 1.0.1; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos3.0; - }; - name = Distribution; - }; - B74E58190EC6C9AC00215614 /* Distribution */ = { - isa = XCBuildConfiguration; - buildSettings = { - ADDITIONAL_SDKS = "\"$(SRCROOT)/Frameworks/JSON/$(PLATFORM_NAME).sdk\""; - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(SRCROOT)\"", - ); - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = PhoneGap_Prefix.pch; - INFOPLIST_FILE = Info.plist; - OTHER_LDFLAGS = ( - "-ObjC", - "-ljson", - ); - PRODUCT_NAME = PhoneGap; - }; - name = Distribution; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ADDITIONAL_SDKS = "\"$(SRCROOT)/Frameworks/JSON/$(PLATFORM_NAME).sdk\""; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 2.2.1; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; - SDKROOT = iphoneos3.0; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ADDITIONAL_SDKS = "\"$(SRCROOT)/Frameworks/JSON/$(PLATFORM_NAME).sdk\""; - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - CODE_SIGN_IDENTITY = "Don't Code Sign"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Don't Code Sign"; - CODE_SIGN_RESOURCE_RULES_PATH = "$(SDKROOT)/ResourceRules.plist"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - OTHER_LDFLAGS = ( - "-ObjC", - "-ljson", - ); - PREBINDING = NO; - SDKROOT = iphoneos3.0; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "PhoneGap" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - B74E58190EC6C9AC00215614 /* Distribution */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "PhoneGap" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - B74E58180EC6C9AC00215614 /* Distribution */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/iphone/PhoneGap_Prefix.pch b/iphone/PhoneGap_Prefix.pch deleted file mode 100755 index 9dc99427..00000000 --- a/iphone/PhoneGap_Prefix.pch +++ /dev/null @@ -1,13 +0,0 @@ -// -// Prefix header for all source files of the 'PhoneGap' target in the 'PhoneGap' project -// - -#ifdef __OBJC__ -#import -#import -#ifndef __OPTIMIZE__ -# define NSLog(...) NSLog(@"%@", [NSString stringWithFormat:__VA_ARGS__]) -#else -# define NSLog(...) /* */ -#endif -#endif diff --git a/iphone/README.md b/iphone/README.md deleted file mode 100755 index 11a4bf22..00000000 --- a/iphone/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# PhoneGap - -### iPhone \ No newline at end of file diff --git a/iphone/Settings.plist b/iphone/Settings.plist deleted file mode 100644 index d3fceafc..00000000 --- a/iphone/Settings.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - version - 1 - - diff --git a/iphone/beep.wav b/iphone/beep.wav deleted file mode 100644 index 05f5997f..00000000 Binary files a/iphone/beep.wav and /dev/null differ diff --git a/iphone/build-phonegap.sh b/iphone/build-phonegap.sh deleted file mode 100755 index 9668226d..00000000 --- a/iphone/build-phonegap.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -x -PHONEGAP_LIB=$TARGET_BUILD_DIR/$CONTENTS_FOLDER_PATH/www/phonegap.js - -cd $PROJECT_DIR/.. -[ -f Makefile ] || ./configure -make iphone -cp lib/iphone/phonegap-min.js "$PHONEGAP_LIB" diff --git a/iphone/doxygen.cfg b/iphone/doxygen.cfg deleted file mode 100644 index 8d925253..00000000 --- a/iphone/doxygen.cfg +++ /dev/null @@ -1,1541 +0,0 @@ -# Doxyfile 1.5.8 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = PhoneGap - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = docs/iphone - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, -# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, -# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, -# Spanish, Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = iphone/Classes/ - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = iphone/Classes - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.vhd \ - *.vhdl - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "PhoneGap iPhone Docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.phonegap.PhoneGap - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to FRAME, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. Other possible values -# for this tag are: HIERARCHIES, which will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list; -# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which -# disables this behavior completely. For backwards compatibility with previous -# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE -# respectively. - -GENERATE_TREEVIEW = ALL - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Options related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/iphone/icon.png b/iphone/icon.png deleted file mode 100755 index 0c248ae3..00000000 Binary files a/iphone/icon.png and /dev/null differ diff --git a/iphone/main.m b/iphone/main.m deleted file mode 100755 index 38ccaf0f..00000000 --- a/iphone/main.m +++ /dev/null @@ -1,9 +0,0 @@ - -#import - -int main(int argc, char *argv[]) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, @"PhoneGapDelegate"); - [pool release]; - return retVal; -} diff --git a/iphone/www/index.html b/iphone/www/index.html deleted file mode 100755 index a54ea4d2..00000000 --- a/iphone/www/index.html +++ /dev/null @@ -1,293 +0,0 @@ - - - - - - PhoneGap - - - - - - -
-

this file is located at iphone/www/index.html

-
- - - - - - - - - - - -
-

Platform:  

-
-

Version:  

-
-

Device Name:  

-
-

UUID:  

-
-
-
-
X:
 
-
Y:
 
-
Z:
 
-
- Watch Accelerometer - Get Location - Call 411 - Custom Alert - Beep - Vibrate -
- - - diff --git a/iphone/www/master.css b/iphone/www/master.css deleted file mode 100755 index 2c49b0b1..00000000 --- a/iphone/www/master.css +++ /dev/null @@ -1,97 +0,0 @@ - -body { - background:#222 none repeat scroll 0 0; - color:#666; - font-family:Helvetica; - font-size:72%; - line-height:1.5em; - margin:0; - border-top:1px solid #393939; -} - -#info{ - background:#ffa; - border: 1px solid #ffd324; - -webkit-border-radius: 5px; - border-radius: 5px; - clear:both; - margin:15px 6px 0; - width:295px; - padding:4px 0px 2px 10px; -} - -#info h4{ - font-size:.95em; - margin:0; - padding:0; -} - -#stage.theme{ - padding-top:3px; -} - -/* Definition List */ -#Page1 > dl{ - padding-top:10px; - clear:both; - margin:0; - list-style-type:none; - padding-left:10px; - overflow:auto; -} - -#Page1 > dl > dt{ - font-weight:bold; - float:left; - margin-left:5px; -} - -#Page1 > dl > dd{ - width:45px; - float:left; - color:#a87; - font-weight:bold; -} - -/* Content Styling */ -h1, h2, p{ - margin:1em 0 .5em 13px; -} - -h1{ - color:#eee; - font-size:1.6em; - text-align:center; - margin:0; - margin-top:15px; - padding:0; -} - -h2{ - clear:both; - margin:0; - padding:3px; - font-size:1em; - text-align:center; -} - -/* Stage Buttons */ -#stage.theme a.btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:left; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; -} -#stage.theme a.btn.large{ - width:308px; - padding:1.2em 0; -} diff --git a/javascripts/.gitignore b/javascripts/.gitignore deleted file mode 100644 index e69de29b..00000000 diff --git a/javascripts/acceleration.js b/javascripts/acceleration.js deleted file mode 100644 index 30d90bed..00000000 --- a/javascripts/acceleration.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * This class contains acceleration information - * @constructor - * @param {Number} x The force applied by the device in the x-axis. - * @param {Number} y The force applied by the device in the y-axis. - * @param {Number} z The force applied by the device in the z-axis. - */ -function Acceleration(x, y, z) { - /** - * The force applied by the device in the x-axis. - */ - this.x = x; - /** - * The force applied by the device in the y-axis. - */ - this.y = y; - /** - * The force applied by the device in the z-axis. - */ - this.z = z; - /** - * The time that the acceleration was obtained. - */ - this.timestamp = new Date().getTime(); -} - -/** - * This class specifies the options for requesting acceleration data. - * @constructor - */ -function AccelerationOptions() { - /** - * The timeout after which if acceleration data cannot be obtained the errorCallback - * is called. - */ - this.timeout = 10000; -} diff --git a/javascripts/accelerometer.js b/javascripts/accelerometer.js deleted file mode 100644 index 8d4375cd..00000000 --- a/javascripts/accelerometer.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * This class provides access to device accelerometer data. - * @constructor - */ -function Accelerometer() { - /** - * The last known acceleration. - */ - this.lastAcceleration = null; -} - -/** - * Asynchronously aquires the current acceleration. - * @param {Function} successCallback The function to call when the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ -Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) { - // If the acceleration is available then call success - // If the acceleration is not available then call error - - // Created for iPhone, Iphone passes back _accel obj litteral - if (typeof successCallback == "function") { - var accel = new Acceleration(_accel.x,_accel.y,_accel.z); - Accelerometer.lastAcceleration = accel; - successCallback(accel); - } -} - -/** - * Asynchronously aquires the acceleration repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ - -Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) { - this.getCurrentAcceleration(successCallback, errorCallback, options); - // TODO: add the interval id to a list so we can clear all watches - var frequency = (options != undefined)? options.frequency : 10000; - return setInterval(function() { - navigator.accelerometer.getCurrentAcceleration(successCallback, errorCallback, options); - }, frequency); -} - -/** - * Clears the specified accelerometer watch. - * @param {String} watchId The ID of the watch returned from #watchAcceleration. - */ -Accelerometer.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer(); -}); diff --git a/javascripts/android/accelerometer.js b/javascripts/android/accelerometer.js deleted file mode 100644 index 4d89ced1..00000000 --- a/javascripts/android/accelerometer.js +++ /dev/null @@ -1,77 +0,0 @@ -// Need to define these for android -_accel = {} -_accel.x = 0; -_accel.y = 0; -_accel.z = 0; - -function gotAccel(x, y, z) -{ - _accel.x = x; - _accel.y = y; - _accel.z = z; -} - -/** - * This class provides access to device accelerometer data. - * @constructor - */ -function Accelerometer() { - /** - * The last known acceleration. - */ - this.lastAcceleration = null; -} - -/** - * Asynchronously aquires the current acceleration. - * @param {Function} successCallback The function to call when the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ -Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) { - // If the acceleration is available then call success - // If the acceleration is not available then call error - - // Created for iPhone, Iphone passes back _accel obj litteral - if (typeof successCallback == "function") { - var accel = new Acceleration(_accel.x,_accel.y,_accel.z); - Accelerometer.lastAcceleration = accel; - successCallback(accel); - } -} - -/** - * Asynchronously aquires the acceleration repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the acceleration - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the acceleration data. - * @param {AccelerationOptions} options The options for getting the accelerometer data - * such as timeout. - */ - -Accelerometer.prototype.watchAcceleration = function(successCallback, errorCallback, options) { - // TODO: add the interval id to a list so we can clear all watches - var frequency = (options != undefined)? options.frequency : 10000; - - Accel.start(frequency); - return setInterval(function() { - navigator.accelerometer.getCurrentAcceleration(successCallback, errorCallback, options); - }, frequency); -} - -/** - * Clears the specified accelerometer watch. - * @param {String} watchId The ID of the watch returned from #watchAcceleration. - */ -Accelerometer.prototype.clearWatch = function(watchId) { - Accel.stop(); - clearInterval(watchId); -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.accelerometer == "undefined") navigator.accelerometer = new Accelerometer(); -}); diff --git a/javascripts/android/device.js b/javascripts/android/device.js deleted file mode 100644 index e69de29b..00000000 diff --git a/javascripts/android/geolocation.js b/javascripts/android/geolocation.js deleted file mode 100644 index eb885783..00000000 --- a/javascripts/android/geolocation.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Since we can't guarantee that we will have the most recent, we just try our best! - * - * Also, the API doesn't specify which version is the best version of the API - */ - -Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) -{ - var position = Geo.getCurrentLocation(); - this.global_success = successCallback; - this.fail = errorCallback; -} - - -// Run the global callback -Geolocation.prototype.gotCurrentPosition = function(lat, lng, alt, altacc, head, vel, stamp) -{ - if (lat == "undefined" || lng == "undefined") - { - this.fail(); - } - else - { - coords = new Coordinates(lat, lng, alt, altacc, head, vel); - loc = new Position(coords, stamp); - this.global_success(loc); - } -} - -/* - * This turns on the GeoLocator class, which has two listeners. - * The listeners have their own timeouts, and run independently of this process - * In this case, we return the key to the watch hash - */ - -Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) -{ - var frequency = (options != undefined)? options.frequency : 10000; - - if (!this.listeners) - { - this.listeners = []; - } - - var key = this.listeners.push( {"success" : successCallback, "fail" : failCallback }) - 1; - - // TO-DO: Get the names of the method and pass them as strings to the Java. - return Geolocation.start(frequency, key); -} - -/* - * Retrieve and stop this listener from listening to the GPS - * - */ -Geolocation.prototype.success = function(key, lat, lng, alt, altacc, head, vel, stamp) -{ - var coords = new Coordinates(lat, lng, alt, altacc, head, vel); - var loc = new Position(coords, stamp); - this.listeners[key].success(loc); -} - -Geolocation.prototype.fail = function(key) -{ - this.listeners[key].fail(); -} - -Geolocation.prototype.clearWatch = function(watchId) -{ - Geo.stop(watchId); -} - - diff --git a/javascripts/android/notification.js b/javascripts/android/notification.js deleted file mode 100644 index f8b5cd4e..00000000 --- a/javascripts/android/notification.js +++ /dev/null @@ -1,15 +0,0 @@ -Notification.prototype.vibrate = function(mills) -{ - DroidGap.vibrate(mills); -} - -/* - * On the Android, we don't beep, we notify you with your - * notification! We shouldn't keep hammering on this, and should - * review what we want beep to do. - */ - -Notification.prototype.beep = function(count, volume) -{ - DroidGap.beep(count); -} diff --git a/javascripts/android/position.js b/javascripts/android/position.js deleted file mode 100644 index 48013e96..00000000 --- a/javascripts/android/position.js +++ /dev/null @@ -1,5 +0,0 @@ -function Position(coords, timestamp) -{ - this.coords = coords; - this.timestamp = timestamp; -} diff --git a/javascripts/blackberry/file.js b/javascripts/blackberry/file.js deleted file mode 100644 index 22eef30b..00000000 --- a/javascripts/blackberry/file.js +++ /dev/null @@ -1,32 +0,0 @@ -File.prototype.read = function(fileName, successCallback, errorCallback) { - document.cookie = 'bb_command={command:8,args:{name:"'+fileName+'"}}'; - navigator.file.successCallback = successCallback; - navigator.file.errorCallback = errorCallback; - navigator.file.readTimeout = window.setInterval('navigator.file._readReady()', 1000); -} - -File.prototype._readReady = function() { - var cookies = document.cookie.split(';'); - for (var i=0; i 0) - { - successCallback(file); - } - } - } - } -} - -File.prototype.write = function(fileName, data) { - document.cookie = 'bb_command={command:9,args:{name:"'+fileName+'",data:"'+data+'"}}'; -} diff --git a/javascripts/blackberry/geolocation.js b/javascripts/blackberry/geolocation.js deleted file mode 100644 index 399ef9d6..00000000 --- a/javascripts/blackberry/geolocation.js +++ /dev/null @@ -1,35 +0,0 @@ -Geolocation.prototype.getCurrentPosition = function(successCallback, errorCallback, options) { - document.cookie = 'bb_command={command:'+phonegap.LOCATION+'}'; - // Blackberry 4.5 does not let you use function pointers in setInterval. idiots. - geoSuccessCallback = successCallback; - geoErrorCallback = errorCallback; - geoOptions = options; - locationTimeout = window.setInterval('navigator.geolocation._getCurrentPosition()', 1000); -} - -Geolocation.prototype._getCurrentPosition = function(successCallback, errorCallback, options) { - var cookies = document.cookie.split(';'); - for (var i=0; i referenceTime) { - successCallback(dis.lastPosition); - clearInterval(timer); - } else if (delay >= timeout) { - errorCallback(); - clearInterval(timer); - } - }, interval); -}; - -/** - * Asynchronously aquires the position repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the position - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the position data. - * @param {PositionOptions} options The options for getting the position data - * such as timeout and the frequency of the watch. - */ -Geolocation.prototype.watchPosition = function(successCallback, errorCallback, options) { - // Invoke the appropriate callback with a new Position object every time the implementation - // determines that the position of the hosting device has changed. - - this.getCurrentPosition(successCallback, errorCallback, options); - var frequency = 10000; - if (typeof(options) == 'object' && options.frequency) - frequency = options.frequency; - - var that = this; - return setInterval(function() { - that.getCurrentPosition(successCallback, errorCallback, options); - }, frequency); -}; - - -/** - * Clears the specified position watch. - * @param {String} watchId The ID of the watch returned from #watchPosition. - */ -Geolocation.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -}; - -/** - * Called by the geolocation framework when the current location is found. - * @param {PositionOptions} position The current position. - */ -Geolocation.prototype.setLocation = function(position) { - this.lastPosition = position; - for (var i = 0; i < this.callbacks.onLocationChanged.length; i++) { - var f = this.callbacks.onLocationChanged.shift(); - f(position); - } -}; - -/** - * Called by the geolocation framework when an error occurs while looking up the current position. - * @param {String} message The text of the error message. - */ -Geolocation.prototype.setError = function(message) { - this.lastError = message; - for (var i = 0; i < this.callbacks.onError.length; i++) { - var f = this.callbacks.onError.shift(); - f(message); - } -}; - -PhoneGap.addConstructor(function() { - if (typeof navigator.geolocation == "undefined") navigator.geolocation = new Geolocation(); -}); diff --git a/javascripts/iphone/accelerometer.js b/javascripts/iphone/accelerometer.js deleted file mode 100644 index c0ab276b..00000000 --- a/javascripts/iphone/accelerometer.js +++ /dev/null @@ -1,7 +0,0 @@ -Accelerometer.prototype.getCurrentAcceleration = function(successCallback, errorCallback, options) { - if (typeof successCallback == "function") { - var accel = new Acceleration(_accel.x,_accel.y,_accel.z); - Accelerometer.lastAcceleration = accel; - successCallback(accel); - } -} diff --git a/javascripts/iphone/bonjour.js b/javascripts/iphone/bonjour.js deleted file mode 100644 index 37d67a5c..00000000 --- a/javascripts/iphone/bonjour.js +++ /dev/null @@ -1,12 +0,0 @@ -// --- BjV Additions for 360/iDev -Bonjour = function() { -} - -Bonjour.prototype.port = 0; -Bonjour.prototype.start = function(name) { - PhoneGap.exec("Bonjour.start"); -} -Bonjour.prototype.stop = function() { - PhoneGap.exec("Bonjour.stop"); -} -Bonjour.prototype.delegate = null; diff --git a/javascripts/iphone/camera.js b/javascripts/iphone/camera.js deleted file mode 100644 index 57224d37..00000000 --- a/javascripts/iphone/camera.js +++ /dev/null @@ -1,19 +0,0 @@ -// Gets the function name of a Function object, else uses "alert" if anonymous -function GetFunctionName(fn) -{ - if (fn) { - var m = fn.toString().match(/^\s*function\s+([^\s\(]+)/); - return m ? m[1] : "alert"; - } else { - return null; - } -} -/** - * - * @param {Function} successCallback - * @param {Function} errorCallback - * @param {Object} options - */ -Camera.prototype.getPicture = function(successCallback, errorCallback, options) { - PhoneGap.exec("Camera.getPicture", GetFunctionName(successCallback), GetFunctionName(errorCallback), options); -} \ No newline at end of file diff --git a/javascripts/iphone/compass.js b/javascripts/iphone/compass.js deleted file mode 100644 index 637f3537..00000000 --- a/javascripts/iphone/compass.js +++ /dev/null @@ -1,8 +0,0 @@ -Compass.prototype.start = function(args) { - PhoneGap.exec("Location.startHeading", args); -}; - -Compass.prototype.stop = function() { - PhoneGap.exec("Location.stopHeading"); -}; - diff --git a/javascripts/iphone/contact.js b/javascripts/iphone/contact.js deleted file mode 100644 index b6952db7..00000000 --- a/javascripts/iphone/contact.js +++ /dev/null @@ -1,40 +0,0 @@ -// Gets the function name of a Function object, else uses "alert" if anonymous -function GetFunctionName(fn) -{ - if (fn) { - var m = fn.toString().match(/^\s*function\s+([^\s\(]+)/); - return m ? m[1] : "alert"; - } else { - return null; - } -} - -ContactManager.prototype.getAllContacts = function(successCallback, errorCallback, options) { - PhoneGap.exec("Contacts.allContacts", GetFunctionName(successCallback), options); -} - -// THE FUNCTIONS BELOW ARE iPHONE ONLY FOR NOW - -ContactManager.prototype.newContact = function(contact, successCallback, options) { - if (!options) options = {}; - options.successCallback = GetFunctionName(successCallback); - - PhoneGap.exec("Contacts.newContact", contact.firstName, contact.lastName, contact.phoneNumber, - options); -} - -ContactManager.prototype.chooseContact = function(successCallback, options) { - PhoneGap.exec("Contacts.chooseContact", GetFunctionName(successCallback), options); -} - -ContactManager.prototype.displayContact = function(contactID, errorCallback, options) { - PhoneGap.exec("Contacts.displayContact", contactID, GetFunctionName(errorCallback), options); -} - -ContactManager.prototype.removeContact = function(contactID, successCallback, options) { - PhoneGap.exec("Contacts.removeContact", contactID, GetFunctionName(successCallback), options); -} - -ContactManager.prototype.contactsCount = function(successCallback, errorCallback) { - PhoneGap.exec("Contacts.contactsCount", GetFunctionName(successCallback)); -} diff --git a/javascripts/iphone/debugconsole.js b/javascripts/iphone/debugconsole.js deleted file mode 100644 index 5dc8e5be..00000000 --- a/javascripts/iphone/debugconsole.js +++ /dev/null @@ -1,28 +0,0 @@ - -DebugConsole.prototype.log = function(message) { - if (PhoneGap.available) - PhoneGap.exec('DebugConsole.log', - this.processMessage(message), - { logLevel: 'INFO' } - ); - else - console.log(message); -}; -DebugConsole.prototype.warn = function(message) { - if (PhoneGap.available) - PhoneGap.exec('DebugConsole.log', - this.processMessage(message), - { logLevel: 'WARN' } - ); - else - console.error(message); -}; -DebugConsole.prototype.error = function(message) { - if (PhoneGap.available) - PhoneGap.exec('DebugConsole.log', - this.processMessage(message), - { logLevel: 'ERROR' } - ); - else - console.error(message); -}; diff --git a/javascripts/iphone/device.js b/javascripts/iphone/device.js deleted file mode 100644 index e69de29b..00000000 diff --git a/javascripts/iphone/geolocation.js b/javascripts/iphone/geolocation.js deleted file mode 100644 index 7c97cf3f..00000000 --- a/javascripts/iphone/geolocation.js +++ /dev/null @@ -1,7 +0,0 @@ -Geolocation.prototype.start = function(args) { - PhoneGap.exec("Location.startLocation", args); -}; - -Geolocation.prototype.stop = function() { - PhoneGap.exec("Location.stopLocation"); -}; \ No newline at end of file diff --git a/javascripts/iphone/media.js b/javascripts/iphone/media.js deleted file mode 100644 index e28260e5..00000000 --- a/javascripts/iphone/media.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Media/Audio override. - * - */ - -Media.prototype.play = function() { - if (this.src != null) { - PhoneGap.exec("Sound.play", this.src); - } -} diff --git a/javascripts/iphone/network.js b/javascripts/iphone/network.js deleted file mode 100644 index 893bd70a..00000000 --- a/javascripts/iphone/network.js +++ /dev/null @@ -1,20 +0,0 @@ -// Gets the function name of a Function object, else uses "alert" if anonymous -function GetFunctionName(fn) -{ - if (fn) { - var m = fn.toString().match(/^\s*function\s+([^\s\(]+)/); - return m ? m[1] : "alert"; - } else { - return null; - } -} - -/** - * - * @param {Function} successCallback - * @param {Function} errorCallback - * @param {Object} options (isIpAddress:boolean) - */ -Network.prototype.isReachable = function(hostName, successCallback, options) { - PhoneGap.exec("Network.isReachable", hostName, GetFunctionName(successCallback), options); -} \ No newline at end of file diff --git a/javascripts/iphone/notification.js b/javascripts/iphone/notification.js deleted file mode 100644 index 27609d62..00000000 --- a/javascripts/iphone/notification.js +++ /dev/null @@ -1,34 +0,0 @@ -Notification.prototype.vibrate = function(mills) { - PhoneGap.exec("Notification.vibrate"); -}; - -Notification.prototype.beep = function(count, volume) { - // No Volume yet for the iphone interface - // We can use a canned beep sound and call that - new Media('beep.wav').play(); -}; - -Notification.prototype.alert = function(message, title, buttonLabel) { - var options = {}; - if (title) options.title = title; - if (buttonLabel) options.buttonLabel = buttonLabel; - - if (PhoneGap.available) - PhoneGap.exec('Notification.alert', message, options); - else - alert(message); -}; - -Notification.prototype.activityStart = function() { - PhoneGap.exec("Notification.activityStart"); -}; -Notification.prototype.activityStop = function() { - PhoneGap.exec("Notification.activityStop"); -}; - -Notification.prototype.loadingStart = function(options) { - PhoneGap.exec("Notification.loadingStart", options); -}; -Notification.prototype.loadingStop = function() { - PhoneGap.exec("Notification.loadingStop"); -}; diff --git a/javascripts/iphone/orientation.js b/javascripts/iphone/orientation.js deleted file mode 100644 index 10051c76..00000000 --- a/javascripts/iphone/orientation.js +++ /dev/null @@ -1 +0,0 @@ -// Placeholder diff --git a/javascripts/iphone/phonegap.js b/javascripts/iphone/phonegap.js deleted file mode 100644 index ad734bf4..00000000 --- a/javascripts/iphone/phonegap.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Internal function used to dispatch the request to PhoneGap. It processes the - * command queue and executes the next command on the list. If one of the - * arguments is a JavaScript object, it will be passed on the QueryString of the - * url, which will be turned into a dictionary on the other end. - * @private - */ -PhoneGap.run_command = function() { - if (!PhoneGap.available || !PhoneGap.queue.ready) - return; - - PhoneGap.queue.ready = false; - - var args = PhoneGap.queue.commands.shift(); - if (PhoneGap.queue.commands.length == 0) { - clearInterval(PhoneGap.queue.timer); - PhoneGap.queue.timer = null; - } - - var uri = []; - var dict = null; - for (var i = 1; i < args.length; i++) { - var arg = args[i]; - if (arg == undefined || arg == null) - arg = ''; - if (typeof(arg) == 'object') - dict = arg; - else - uri.push(encodeURIComponent(arg)); - } - var url = "gap://" + args[0] + "/" + uri.join("/"); - if (dict != null) { - var query_args = []; - for (var name in dict) { - if (typeof(name) != 'string') - continue; - query_args.push(encodeURIComponent(name) + "=" + encodeURIComponent(dict[name])); - } - if (query_args.length > 0) - url += "?" + query_args.join("&"); - } - document.location = url; - -}; diff --git a/javascripts/iphone/uicontrols.js b/javascripts/iphone/uicontrols.js deleted file mode 100644 index 133a93de..00000000 --- a/javascripts/iphone/uicontrols.js +++ /dev/null @@ -1,48 +0,0 @@ -UIControls.prototype.createTabBar = function() { - PhoneGap.exec("UIControls.createTabBar"); -}; - -UIControls.prototype.showTabBar = function(options) { - if (!options) options = {}; - PhoneGap.exec("UIControls.showTabBar", options); -}; - -UIControls.prototype.hideTabBar = function(animate) { - if (animate == undefined || animate == null) - animate = true; - PhoneGap.exec("UIControls.hideTabBar", { animate: animate }); -}; - -UIControls.prototype.createTabBarItem = function(name, label, image, options) { - var tag = this.tabBarTag++; - if (options && 'onSelect' in options && typeof(options['onSelect']) == 'function') { - this.tabBarCallbacks[tag] = options.onSelect; - delete options.onSelect; - } - PhoneGap.exec("UIControls.createTabBarItem", name, label, image, tag, options); -}; - -UIControls.prototype.updateTabBarItem = function(name, options) { - if (!options) options = {}; - PhoneGap.exec("UIControls.updateTabBarItem", name, options); -}; - -UIControls.prototype.showTabBarItems = function() { - var parameters = [ "UIControls.showTabBarItems" ]; - for (var i = 0; i < arguments.length; i++) { - parameters.push(arguments[i]); - } - PhoneGap.exec.apply(this, parameters); -}; - -UIControls.prototype.selectTabBarItem = function(tab) { - PhoneGap.exec("UIControls.selectTabBarItem", tab); -}; - -UIControls.prototype.createToolBar = function() { - PhoneGap.exec("UIControls.createToolBar"); -}; - -UIControls.prototype.setToolBarTitle = function(title) { - PhoneGap.exec("UIControls.setToolBarTitle", title); -}; diff --git a/javascripts/map.js b/javascripts/map.js deleted file mode 100644 index 515c9eb6..00000000 --- a/javascripts/map.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This class provides access to native mapping applications on the device. - */ -function Map() { - -} - -/** - * Shows a native map on the device with pins at the given positions. - * @param {Array} positions - */ -Map.prototype.show = function(positions) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.map == "undefined") navigator.map = new Map(); -}); diff --git a/javascripts/media.js b/javascripts/media.js deleted file mode 100644 index d3e06604..00000000 --- a/javascripts/media.js +++ /dev/null @@ -1,35 +0,0 @@ - -/** - * This class provides access to the device media, interfaces to both sound and video - * @constructor - */ -function Media(src) { - this.src = src; -} - -Media.prototype.play = function() { -} - -Media.prototype.pause = function() { -} - -Media.prototype.stop = function() { -} - - -/** - * This class contains information about any Media errors. - * @constructor - */ -function MediaError() { - this.code = null, - this.message = ""; -} - -MediaError.MEDIA_ERR_ABORTED = 1; -MediaError.MEDIA_ERR_NETWORK = 2; -MediaError.MEDIA_ERR_DECODE = 3; -MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; - - -//if (typeof navigator.audio == "undefined") navigator.audio = new Media(src); diff --git a/javascripts/network.js b/javascripts/network.js deleted file mode 100644 index 00803619..00000000 --- a/javascripts/network.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This class contains information about any NetworkStatus. - * @constructor - */ -function NetworkStatus() { - this.code = null; - this.message = ""; -} - -NetworkStatus.NOT_REACHABLE = 0; -NetworkStatus.REACHABLE_VIA_CARRIER_DATA_NETWORK = 1; -NetworkStatus.REACHABLE_VIA_WIFI_NETWORK = 2; - -/** - * This class provides access to device Network data (reachability). - * @constructor - */ -function Network() { - /** - * The last known Network status. - * { hostName: string, ipAddress: string, - remoteHostStatus: int(0/1/2), internetConnectionStatus: int(0/1/2), localWiFiConnectionStatus: int (0/2) } - */ - this.lastReachability = null; -}; - -/** - * - * @param {Function} successCallback - * @param {Function} errorCallback - * @param {Object} options (isIpAddress:boolean) - */ -Network.prototype.isReachable = function(hostName, successCallback, options) { -} - -/** - * Called by the geolocation framework when the reachability status has changed. - * @param {Reachibility} reachability The current reachability status. - */ -Network.prototype.updateReachability = function(reachability) { - this.lastReachability = reachability; -}; - -PhoneGap.addConstructor(function() { - if (typeof navigator.network == "undefined") navigator.network = new Network(); -}); diff --git a/javascripts/notification.js b/javascripts/notification.js deleted file mode 100644 index 294f660d..00000000 --- a/javascripts/notification.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * This class provides access to notifications on the device. - */ -function Notification() { - -} - -/** - * Open a native alert dialog, with a customizable title and button text. - * @param {String} message Message to print in the body of the alert - * @param {String} [title="Alert"] Title of the alert dialog (default: Alert) - * @param {String} [buttonLabel="OK"] Label of the close button (default: OK) - */ -Notification.prototype.alert = function(message, title, buttonLabel) { - // Default is to use a browser alert; this will use "index.html" as the title though - alert(message); -}; - -/** - * Start spinning the activity indicator on the statusbar - */ -Notification.prototype.activityStart = function() { -}; - -/** - * Stop spinning the activity indicator on the statusbar, if it's currently spinning - */ -Notification.prototype.activityStop = function() { -}; - -/** - * Causes the device to blink a status LED. - * @param {Integer} count The number of blinks. - * @param {String} colour The colour of the light. - */ -Notification.prototype.blink = function(count, colour) { - -}; - -/** - * Causes the device to vibrate. - * @param {Integer} mills The number of milliseconds to vibrate for. - */ -Notification.prototype.vibrate = function(mills) { - -}; - -/** - * Causes the device to beep. - * @param {Integer} count The number of beeps. - * @param {Integer} volume The volume of the beep. - */ -Notification.prototype.beep = function(count, volume) { - -}; - -// TODO: of course on Blackberry and Android there notifications in the UI as well - -PhoneGap.addConstructor(function() { - if (typeof navigator.notification == "undefined") navigator.notification = new Notification(); -}); - diff --git a/javascripts/orientation.js b/javascripts/orientation.js deleted file mode 100644 index f21d475b..00000000 --- a/javascripts/orientation.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * This class provides access to the device orientation. - * @constructor - */ -function Orientation() { - /** - * The current orientation, or null if the orientation hasn't changed yet. - */ - this.currentOrientation = null; -} - -/** - * Set the current orientation of the phone. This is called from the device automatically. - * - * When the orientation is changed, the DOMEvent \c orientationChanged is dispatched against - * the document element. The event has the property \c orientation which can be used to retrieve - * the device's current orientation, in addition to the \c Orientation.currentOrientation class property. - * - * @param {Number} orientation The orientation to be set - */ -Orientation.prototype.setOrientation = function(orientation) { - Orientation.currentOrientation = orientation; - var e = document.createEvent('Events'); - e.initEvent('orientationChanged', 'false', 'false'); - e.orientation = orientation; - document.dispatchEvent(e); -}; - -/** - * Asynchronously aquires the current orientation. - * @param {Function} successCallback The function to call when the orientation - * is known. - * @param {Function} errorCallback The function to call when there is an error - * getting the orientation. - */ -Orientation.prototype.getCurrentOrientation = function(successCallback, errorCallback) { - // If the position is available then call success - // If the position is not available then call error -}; - -/** - * Asynchronously aquires the orientation repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the orientation - * data is available. - * @param {Function} errorCallback The function to call when there is an error - * getting the orientation data. - */ -Orientation.prototype.watchOrientation = function(successCallback, errorCallback) { - // Invoke the appropriate callback with a new Position object every time the implementation - // determines that the position of the hosting device has changed. - this.getCurrentPosition(successCallback, errorCallback); - return setInterval(function() { - navigator.orientation.getCurrentOrientation(successCallback, errorCallback); - }, 10000); -}; - -/** - * Clears the specified orientation watch. - * @param {String} watchId The ID of the watch returned from #watchOrientation. - */ -Orientation.prototype.clearWatch = function(watchId) { - clearInterval(watchId); -}; - -PhoneGap.addConstructor(function() { - if (typeof navigator.orientation == "undefined") navigator.orientation = new Orientation(); -}); diff --git a/javascripts/phonegap.js.base b/javascripts/phonegap.js.base deleted file mode 100644 index b64efcd9..00000000 --- a/javascripts/phonegap.js.base +++ /dev/null @@ -1,75 +0,0 @@ -if (typeof(DeviceInfo) != 'object') - DeviceInfo = {}; - -/** - * This represents the PhoneGap API itself, and provides a global namespace for accessing - * information about the state of PhoneGap. - * @class - */ -PhoneGap = { - queue: { - ready: true, - commands: [], - timer: null - }, - _constructors: [] -}; - -/** - * Boolean flag indicating if the PhoneGap API is available and initialized. - */ -PhoneGap.available = DeviceInfo.uuid != undefined; - -/** - * Add an initialization function to a queue that ensures it will run and initialize - * application constructors only once PhoneGap has been initialized. - * @param {Function} func The function callback you want run once PhoneGap is initialized - */ -PhoneGap.addConstructor = function(func) { - var state = document.readyState; - if (state != 'loaded' && state != 'complete') - PhoneGap._constructors.push(func); - else - func(); -}; -(function() { - var timer = setInterval(function() { - var state = document.readyState; - if (state != 'loaded' && state != 'complete') - return; - clearInterval(timer); - while (PhoneGap._constructors.length > 0) { - var constructor = PhoneGap._constructors.shift(); - try { - constructor(); - } catch(e) { - if (typeof(debug['log']) == 'function') - debug.log("Failed to run constructor: " + debug.processMessage(e)); - else - alert("Failed to run constructor: " + e.message); - } - } - }, 1); -})(); - - -/** - * Execute a PhoneGap command in a queued fashion, to ensure commands do not - * execute with any race conditions, and only run when PhoneGap is ready to - * recieve them. - * @param {String} command Command to be run in PhoneGap, e.g. "ClassName.method" - * @param {String[]} [args] Zero or more arguments to pass to the method - */ -PhoneGap.exec = function() { - PhoneGap.queue.commands.push(arguments); - if (PhoneGap.queue.timer == null) - PhoneGap.queue.timer = setInterval(PhoneGap.run_command, 10); -}; -/** - * Internal function used to dispatch the request to PhoneGap. This needs to be implemented per-platform to - * ensure that methods are called on the phone in a way appropriate for that device. - * @private - */ -PhoneGap.run_command = function() { -}; - diff --git a/javascripts/position.js b/javascripts/position.js deleted file mode 100644 index d6a983fe..00000000 --- a/javascripts/position.js +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This class contains position information. - * @param {Object} lat - * @param {Object} lng - * @param {Object} acc - * @param {Object} alt - * @param {Object} altacc - * @param {Object} head - * @param {Object} vel - * @constructor - */ -function Position(coords, timestamp) { - this.coords = coords; - this.timestamp = new Date().getTime(); -} - -function Coordinates(lat, lng, alt, acc, head, vel) { - /** - * The latitude of the position. - */ - this.latitude = lat; - /** - * The longitude of the position, - */ - this.longitude = lng; - /** - * The accuracy of the position. - */ - this.accuracy = acc; - /** - * The altitude of the position. - */ - this.altitude = alt; - /** - * The direction the device is moving at the position. - */ - this.heading = head; - /** - * The velocity with which the device is moving at the position. - */ - this.speed = vel; -} - -/** - * This class specifies the options for requesting position data. - * @constructor - */ -function PositionOptions() { - /** - * Specifies the desired position accuracy. - */ - this.enableHighAccuracy = true; - /** - * The timeout after which if position data cannot be obtained the errorCallback - * is called. - */ - this.timeout = 10000; -} - -/** - * This class contains information about any GSP errors. - * @constructor - */ -function PositionError() { - this.code = null; - this.message = ""; -} - -PositionError.UNKNOWN_ERROR = 0; -PositionError.PERMISSION_DENIED = 1; -PositionError.POSITION_UNAVAILABLE = 2; -PositionError.TIMEOUT = 3; diff --git a/javascripts/sms.js b/javascripts/sms.js deleted file mode 100644 index bca06dde..00000000 --- a/javascripts/sms.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This class provides access to the device SMS functionality. - * @constructor - */ -function Sms() { - -} - -/** - * Sends an SMS message. - * @param {Integer} number The phone number to send the message to. - * @param {String} message The contents of the SMS message to send. - * @param {Function} successCallback The function to call when the SMS message is sent. - * @param {Function} errorCallback The function to call when there is an error sending the SMS message. - * @param {PositionOptions} options The options for accessing the GPS location such as timeout and accuracy. - */ -Sms.prototype.send = function(number, message, successCallback, errorCallback, options) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.sms == "undefined") navigator.sms = new Sms(); -}); diff --git a/javascripts/telephony.js b/javascripts/telephony.js deleted file mode 100644 index 0448686d..00000000 --- a/javascripts/telephony.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This class provides access to the telephony features of the device. - * @constructor - */ -function Telephony() { - -} - -/** - * Calls the specifed number. - * @param {Integer} number The number to be called. - */ -Telephony.prototype.call = function(number) { - -} - -PhoneGap.addConstructor(function() { - if (typeof navigator.telephony == "undefined") navigator.telephony = new Telephony(); -}); diff --git a/javascripts/uicontrols.js b/javascripts/uicontrols.js deleted file mode 100644 index 2533198b..00000000 --- a/javascripts/uicontrols.js +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This class exposes mobile phone interface controls to JavaScript, such as - * native tab and tool bars, etc. - * @constructor - */ -function UIControls() { - this.tabBarTag = 0; - this.tabBarCallbacks = {}; -} - -/** - * Create a native tab bar that can have tab buttons added to it which can respond to events. - */ -UIControls.prototype.createTabBar = function() {}; - -/** - * Show a tab bar. The tab bar has to be created first. - * @param {Object} [options] Options indicating how the tab bar should be shown: - * - \c height integer indicating the height of the tab bar (default: \c 49) - * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom) - */ -UIControls.prototype.showTabBar = function(options) {}; - -/** - * Hide a tab bar. The tab bar has to be created first. - */ -UIControls.prototype.hideTabBar = function(animate) {}; - -/** - * Create a new tab bar item for use on a previously created tab bar. Use ::showTabBarItems to show the new item on the tab bar. - * - * If the supplied image name is one of the labels listed below, then this method will construct a tab button - * using the standard system buttons. Note that if you use one of the system images, that the \c title you supply will be ignored. - * - * Tab Buttons - * - tabButton:More - * - tabButton:Favorites - * - tabButton:Featured - * - tabButton:TopRated - * - tabButton:Recents - * - tabButton:Contacts - * - tabButton:History - * - tabButton:Bookmarks - * - tabButton:Search - * - tabButton:Downloads - * - tabButton:MostRecent - * - tabButton:MostViewed - * @param {String} name internal name to refer to this tab by - * @param {String} [title] title text to show on the tab, or null if no text should be shown - * @param {String} [image] image filename or internal identifier to show, or null if now image should be shown - * @param {Object} [options] Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden - */ -UIControls.prototype.createTabBarItem = function(name, label, image, options) {}; - -/** - * Update an existing tab bar item to change its badge value. - * @param {String} name internal name used to represent this item when it was created - * @param {Object} options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden - */ -UIControls.prototype.updateTabBarItem = function(name, options) {}; - -/** - * Show previously created items on the tab bar - * @param {String} arguments... the item names to be shown - * @param {Object} [options] dictionary of options, notable options including: - * - \c animate indicates that the items should animate onto the tab bar - * @see createTabBarItem - * @see createTabBar - */ -UIControls.prototype.showTabBarItems = function(tabs, options) {}; - -/** - * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item. - * @param {String} tabName the name of the tab to select, or null if all tabs should be deselected - * @see createTabBarItem - * @see showTabBarItems - */ -UIControls.prototype.selectTabBarItem = function(tab) {}; - -/** - * Function called when a tab bar item has been selected. - * @param {Number} tag the tag number for the item that has been selected - */ -UIControls.prototype.tabBarItemSelected = function(tag) { - if (typeof(this.tabBarCallbacks[tag]) == 'function') - this.tabBarCallbacks[tag](); -}; - -/** - * Create a toolbar. - */ -UIControls.prototype.createToolBar = function() {}; - -/** - * Function called when a tab bar item has been selected. - * @param {String} title the title to set within the toolbar - */ -UIControls.prototype.setToolBarTitle = function(title) {}; - -PhoneGap.addConstructor(function() { - window.uicontrols = new UIControls(); -}); diff --git a/util/jsdoc-toolkit/README.txt b/util/jsdoc-toolkit/README.txt deleted file mode 100644 index 76eba4f5..00000000 --- a/util/jsdoc-toolkit/README.txt +++ /dev/null @@ -1,146 +0,0 @@ -====================================================================== - -DESCRIPTION: - -This is the source code for JsDoc Toolkit, an automatic documentation -generation tool for JavaScript. It is written in JavaScript and is run -from a command line (or terminal) using the Java and Mozilla's Rhino -JavaScript runtime engine. - -Using this tool you can automatically turn JavaDoc-like comments in -your JavaScript source code into published output files, such as HTML -or XML. - -For more information, to report a bug, or to browse the technical -documentation for this tool please visit the official JsDoc Toolkit -project homepage at http://code.google.com/p/jsdoc-toolkit/ - -For the most up-to-date documentation on JsDoc Toolkit see the -official wiki at http://code.google.com/p/jsdoc-toolkit/w/list - -====================================================================== - -REQUIREMENTS: - -JsDoc Toolkit is known to work with: -java version "1.6.0_03" -Java(TM) SE Runtime Environment (build 1.6.0_03-b05) -on Windows XP, -and java version "1.5.0_13" -Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241) -on Mac OS X 10.4. - -Other versions of java may or may not work with JsDoc Toolkit. - -====================================================================== - -USAGE: - -Running JsDoc Toolkit requires you to have Java installed on your -computer. For more information see http://www.java.com/getjava/ - -Before running the JsDoc Toolkit app you should change your current -working directory to the jsdoc-toolkit folder. Then follow the -examples below, or as shown on the project wiki. - -On a computer running Windows a valid command line to run JsDoc -Toolkit might look like this: - -> java -jar jsrun.jar app\run.js -a -t=templates\jsdoc mycode.js - -On Mac OS X or Linux the same command would look like this: - -$ java -jar jsrun.jar app/run.js -a -t=templates/jsdoc mycode.js - -The above assumes your current working directory contains jsrun.jar, -the "app" and "templates" subdirectories from the standard JsDoc -Toolkit distribution and that the relative path to the code you wish -to document is "mycode.js". - -The output documentation files will be saved to a new directory named -"out" (by default) in the current directory, or if you specify a --d=somewhere_else option, to the somewhere_else directory. - -For help (usage notes) enter this on the command line: - -$ java -jar jsrun.jar app/run.js --help - -More information about the various command line options used by JsDoc -Toolkit are available on the project wiki. - -====================================================================== - -TESTING: - -To run the suite of unit tests included with JsDoc Toolkit enter this -on the command line: - -$ java -jar jsrun.jar app/run.js -T - -To see a dump of the internal data structure that JsDoc Toolkit has -built from your source files use this command: - -$ java -jar jsrun.jar app/run.js mycode.js -Z - -====================================================================== - -LICENSE: - -JSDoc.pm - -This project is based on the JSDoc.pm tool, created by Michael -Mathews and Gabriel Reid. More information on JsDoc.pm can -be found on the JSDoc.pm homepage: http://jsdoc.sourceforge.net/ - -Complete documentation on JsDoc Toolkit can be found on the project -wiki at http://code.google.com/p/jsdoc-toolkit/w/list - -Rhino - -Rhino (JavaScript in Java) is open source and licensed by Mozilla -under the MPL 1.1 or later/GPL 2.0 or later licenses, the text of -which is available at http://www.mozilla.org/MPL/ - -You can obtain the source code for Rhino from the Mozilla web site at -http://www.mozilla.org/rhino/download.html - -JsDoc Toolkit is a larger work that uses the Rhino JavaScript engine -but is not derived from it in any way. The Rhino library is used -without modification and without any claims whatsoever. - -The Rhino Debugger - -You can obtain more information about the Rhino Debugger from the -Mozilla web site at http://www.mozilla.org/rhino/debugger.html - -JsDoc Toolkit is a larger work that uses the Rhino Debugger but -is not derived from it in any way. The Rhino Debugger is used -without modification and without any claims whatsoever. - -JsDoc Toolkit - -All code specific to JsDoc Toolkit are free, open source and licensed -for use under the X11/MIT License. - -JsDoc Toolkit is Copyright (c)2009 Michael Mathews - -This program is free software; you can redistribute it and/or -modify it under the terms below. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: The above copyright notice and this -permission notice must be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/jsdoc-toolkit/app/frame.js b/util/jsdoc-toolkit/app/frame.js deleted file mode 100644 index 1beb4055..00000000 --- a/util/jsdoc-toolkit/app/frame.js +++ /dev/null @@ -1,33 +0,0 @@ -IO.include("frame/Opt.js"); -IO.include("frame/Chain.js"); -IO.include("frame/Link.js"); -IO.include("frame/String.js"); -IO.include("frame/Hash.js"); -IO.include("frame/Namespace.js"); -//IO.include("frame/Reflection.js"); - -/** A few helper functions to make life a little easier. */ - -function defined(o) { - return (o !== undefined); -} - -function copy(o) { // todo check for circular refs - if (o == null || typeof(o) != 'object') return o; - var c = new o.constructor(); - for(var p in o) c[p] = copy(o[p]); - return c; -} - -function isUnique(arr) { - var l = arr.length; - for(var i = 0; i < l; i++ ) { - if (arr.lastIndexOf(arr[i]) > i) return false; - } - return true; -} - -/** Returns the given string with all regex meta characters backslashed. */ -RegExp.escapeMeta = function(str) { - return str.replace(/([$^\\\/()|?+*\[\]{}.-])/g, "\\$1"); -} diff --git a/util/jsdoc-toolkit/app/frame/Chain.js b/util/jsdoc-toolkit/app/frame/Chain.js deleted file mode 100644 index 506469d1..00000000 --- a/util/jsdoc-toolkit/app/frame/Chain.js +++ /dev/null @@ -1,102 +0,0 @@ -/**@constructor*/ -function ChainNode(object, link) { - this.value = object; - this.link = link; // describes this node's relationship to the previous node -} - -/**@constructor*/ -function Chain(valueLinks) { - this.nodes = []; - this.cursor = -1; - - if (valueLinks && valueLinks.length > 0) { - this.push(valueLinks[0], "//"); - for (var i = 1, l = valueLinks.length; i < l; i+=2) { - this.push(valueLinks[i+1], valueLinks[i]); - } - } -} - -Chain.prototype.push = function(o, link) { - if (this.nodes.length > 0 && link) this.nodes.push(new ChainNode(o, link)); - else this.nodes.push(new ChainNode(o)); -} - -Chain.prototype.unshift = function(o, link) { - if (this.nodes.length > 0 && link) this.nodes[0].link = link; - this.nodes.unshift(new ChainNode(o)); - this.cursor++; -} - -Chain.prototype.get = function() { - if (this.cursor < 0 || this.cursor > this.nodes.length-1) return null; - return this.nodes[this.cursor]; -} - -Chain.prototype.first = function() { - this.cursor = 0; - return this.get(); -} - -Chain.prototype.last = function() { - this.cursor = this.nodes.length-1; - return this.get(); -} - -Chain.prototype.next = function() { - this.cursor++; - return this.get(); -} - -Chain.prototype.prev = function() { - this.cursor--; - return this.get(); -} - -Chain.prototype.toString = function() { - var string = ""; - for (var i = 0, l = this.nodes.length; i < l; i++) { - if (this.nodes[i].link) string += " -("+this.nodes[i].link+")-> "; - string += this.nodes[i].value.toString(); - } - return string; -} - -Chain.prototype.joinLeft = function() { - var result = ""; - for (var i = 0, l = this.cursor; i < l; i++) { - if (result && this.nodes[i].link) result += this.nodes[i].link; - result += this.nodes[i].value.toString(); - } - return result; -} - - -/* USAGE: - -var path = "one/two/three.four/five-six"; -var pathChain = new Chain(path.split(/([\/.-])/)); -print(pathChain); - -var lineage = new Chain(); -lineage.push("Port"); -lineage.push("Les", "son"); -lineage.push("Dawn", "daughter"); -lineage.unshift("Purdie", "son"); - -print(lineage); - -// walk left -for (var node = lineage.last(); node !== null; node = lineage.prev()) { - print("< "+node.value); -} - -// walk right -var node = lineage.first() -while (node !== null) { - print(node.value); - node = lineage.next(); - if (node && node.link) print("had a "+node.link+" named"); -} - -*/ \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/frame/Dumper.js b/util/jsdoc-toolkit/app/frame/Dumper.js deleted file mode 100644 index d8b007b1..00000000 --- a/util/jsdoc-toolkit/app/frame/Dumper.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - * @class -
-This is a lightly modified version of Kevin Jones' JavaScript
-library Data.Dump. To download the original visit:
-    http://openjsan.org/doc/k/ke/kevinj/Data/Dump/
-
-AUTHORS
-
-The Data.Dump JavaScript module is written by Kevin Jones 
-(kevinj@cpan.org), based on Data::Dump by Gisle Aas (gisle@aas.no),
-based on Data::Dumper by Gurusamy Sarathy (gsar@umich.edu).
-
-COPYRIGHT
-
-Copyright 2007 Kevin Jones. Copyright 1998-2000,2003-2004 Gisle Aas.
-Copyright 1996-1998 Gurusamy Sarathy.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the Perl Artistic License
-
-See http://www.perl.com/perl/misc/Artistic.html
-
- * @static - */ -Dumper = { - /** @param [...] The objects to dump. */ - dump: function () { - if (arguments.length > 1) - return this._dump(arguments); - else if (arguments.length == 1) - return this._dump(arguments[0]); - else - return "()"; - }, - - _dump: function (obj) { - if (typeof obj == 'undefined') return 'undefined'; - var out; - if (obj.serialize) { return obj.serialize(); } - var type = this._typeof(obj); - if (obj.circularReference) obj.circularReference++; - switch (type) { - case 'circular': - out = "{ //circularReference\n}"; - break; - case 'object': - var pairs = new Array; - - for (var prop in obj) { - if (prop != "circularReference" && obj.hasOwnProperty(prop)) { //hide inherited properties - pairs.push(prop + ': ' + this._dump(obj[prop])); - } - } - - out = '{' + this._format_list(pairs) + '}'; - break; - - case 'string': - for (var prop in Dumper.ESC) { - if (Dumper.ESC.hasOwnProperty(prop)) { - obj = obj.replace(prop, Dumper.ESC[prop]); - } - } - - // Escape UTF-8 Strings - if (obj.match(/^[\x00-\x7f]*$/)) { - out = '"' + obj.replace(/\"/g, "\\\"").replace(/([\n\r]+)/g, "\\$1") + '"'; - } - else { - out = "unescape('"+escape(obj)+"')"; - } - break; - - case 'array': - var elems = new Array; - - for (var i=0; i 60 ? '\n' : ' '; - return nl + list.join(',' + nl) + nl; - }, - - _typeof: function (obj) { - if (obj && obj.circularReference && obj.circularReference > 1) return 'circular'; - if (Array.prototype.isPrototypeOf(obj)) return 'array'; - if (Date.prototype.isPrototypeOf(obj)) return 'date'; - if (typeof obj.nodeType != 'undefined') return 'element'; - return typeof(obj); - }, - - _dump_dom: function (obj) { - return '"' + Dumper.nodeTypes[obj.nodeType] + '"'; - } -}; - -Dumper.ESC = { - "\t": "\\t", - "\n": "\\n", - "\f": "\\f" -}; - -Dumper.nodeTypes = { - 1: "ELEMENT_NODE", - 2: "ATTRIBUTE_NODE", - 3: "TEXT_NODE", - 4: "CDATA_SECTION_NODE", - 5: "ENTITY_REFERENCE_NODE", - 6: "ENTITY_NODE", - 7: "PROCESSING_INSTRUCTION_NODE", - 8: "COMMENT_NODE", - 9: "DOCUMENT_NODE", - 10: "DOCUMENT_TYPE_NODE", - 11: "DOCUMENT_FRAGMENT_NODE", - 12: "NOTATION_NODE" -}; \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/frame/Hash.js b/util/jsdoc-toolkit/app/frame/Hash.js deleted file mode 100644 index 62cfad64..00000000 --- a/util/jsdoc-toolkit/app/frame/Hash.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - @constructor - @example - var _index = new Hash(); - _index.set("a", "apple"); - _index.set("b", "blue"); - _index.set("c", "coffee"); - - for (var p = _index.first(); p; p = _index.next()) { - print(p.key+" is for "+p.value); - } - - */ -var Hash = function() { - this._map = {}; - this._keys = []; - this._vals = []; - this.reset(); -} - -Hash.prototype.set = function(k, v) { - if (k != "") { - this._keys.push(k); - this._map["="+k] = this._vals.length; - this._vals.push(v); - } -} - -Hash.prototype.replace = function(k, k2, v) { - if (k == k2) return; - - var offset = this._map["="+k]; - this._keys[offset] = k2; - if (typeof v != "undefined") this._vals[offset] = v; - this._map["="+k2] = offset; - delete(this._map["="+k]); -} - -Hash.prototype.drop = function(k) { - if (k != "") { - var offset = this._map["="+k]; - this._keys.splice(offset, 1); - this._vals.splice(offset, 1); - delete(this._map["="+k]); - for (var p in this._map) { - if (this._map[p] >= offset) this._map[p]--; - } - if (this._cursor >= offset && this._cursor > 0) this._cursor--; - } -} - -Hash.prototype.get = function(k) { - if (k != "") { - return this._vals[this._map["="+k]]; - } -} - -Hash.prototype.keys = function() { - return this._keys; -} - -Hash.prototype.hasKey = function(k) { - if (k != "") { - return (typeof this._map["="+k] != "undefined"); - } -} - -Hash.prototype.values = function() { - return this._vals; -} - -Hash.prototype.reset = function() { - this._cursor = 0; -} - -Hash.prototype.first = function() { - this.reset(); - return this.next(); -} - -Hash.prototype.next = function() { - if (this._cursor++ < this._keys.length) - return {key: this._keys[this._cursor-1], value: this._vals[this._cursor-1]}; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/frame/Link.js b/util/jsdoc-toolkit/app/frame/Link.js deleted file mode 100644 index 5e6295e7..00000000 --- a/util/jsdoc-toolkit/app/frame/Link.js +++ /dev/null @@ -1,148 +0,0 @@ -/** Handle the creation of HTML links to documented symbols. - @constructor -*/ -function Link() { - this.alias = ""; - this.src = ""; - this.file = ""; - this.text = ""; - this.innerName = ""; - this.classLink = false; - this.targetName = ""; - - this.target = function(targetName) { - if (defined(targetName)) this.targetName = targetName; - return this; - } - this.inner = function(inner) { - if (defined(inner)) this.innerName = inner; - return this; - } - this.withText = function(text) { - if (defined(text)) this.text = text; - return this; - } - this.toSrc = function(filename) { - if (defined(filename)) this.src = filename; - return this; - } - this.toSymbol = function(alias) { - if (defined(alias)) this.alias = new String(alias); - return this; - } - this.toClass = function(alias) { - this.classLink = true; - return this.toSymbol(alias); - } - this.toFile = function(file) { - if (defined(file)) this.file = file; - return this; - } - - this.toString = function() { - var linkString; - var thisLink = this; - - if (this.alias) { - linkString = this.alias.replace(/(^|[^a-z$0-9_#.:^-])([|a-z$0-9_#.:^-]+)($|[^a-z$0-9_#.:^-])/i, - function(match, prematch, symbolName, postmatch) { - var symbolNames = symbolName.split("|"); - var links = []; - for (var i = 0, l = symbolNames.length; i < l; i++) { - thisLink.alias = symbolNames[i]; - links.push(thisLink._makeSymbolLink(symbolNames[i])); - } - return prematch+links.join("|")+postmatch; - } - ); - } - else if (this.src) { - linkString = thisLink._makeSrcLink(this.src); - } - else if (this.file) { - linkString = thisLink._makeFileLink(this.file); - } - - return linkString; - } -} - -/** prefixed for hashes */ -Link.hashPrefix = ""; - -/** Appended to the front of relative link paths. */ -Link.base = ""; - -Link.symbolNameToLinkName = function(symbol) { - var linker = ""; - if (symbol.isStatic) linker = "."; - else if (symbol.isInner) linker = "-"; - - return Link.hashPrefix+linker+symbol.name; -} - -/** Create a link to a snother symbol. */ -Link.prototype._makeSymbolLink = function(alias) { - var linkBase = Link.base+publish.conf.symbolsDir; - var linkTo = Link.symbolSet.getSymbol(alias); - var linkPath; - var target = (this.targetName)? " target=\""+this.targetName+"\"" : ""; - - // is it an internal link? - if (alias.charAt(0) == "#") var linkPath = alias; - - // if there is no symbol by that name just return the name unaltered - else if (!linkTo) return this.text || alias; - - // it's a symbol in another file - else { - - if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property - if (linkTo.isEvent) { - linkPath = escape(linkTo.memberOf) || "_global_"; - linkPath += publish.conf.ext + "#event:" + Link.symbolNameToLinkName(linkTo); - } - else { - linkPath = escape(linkTo.memberOf) || "_global_"; - linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo); - } - } - else { - linkPath = escape(linkTo.alias); - linkPath += publish.conf.ext;// + (this.classLink? "":"#" + Link.hashPrefix + "constructor"); - } - linkPath = linkBase + linkPath - } - - var linkText = this.text || alias; - - var link = {linkPath: linkPath, linkText: linkText}; - - if (typeof JSDOC.PluginManager != "undefined") { - JSDOC.PluginManager.run("onSymbolLink", link); - } - - return ""+link.linkText+""; -} - -/** Create a link to a source file. */ -Link.prototype._makeSrcLink = function(srcFilePath) { - var target = (this.targetName)? " target=\""+this.targetName+"\"" : ""; - - // transform filepath into a filename - var srcFile = srcFilePath.replace(/\.\.?[\\\/]/g, "").replace(/[:\\\/]/g, "_"); - var outFilePath = Link.base + publish.conf.srcDir + srcFile + publish.conf.ext; - - if (!this.text) this.text = FilePath.fileName(srcFilePath); - return ""+this.text+""; -} - -/** Create a link to a source file. */ -Link.prototype._makeFileLink = function(filePath) { - var target = (this.targetName)? " target=\""+this.targetName+"\"" : ""; - - var outFilePath = Link.base + filePath; - - if (!this.text) this.text = filePath; - return ""+this.text+""; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/frame/Namespace.js b/util/jsdoc-toolkit/app/frame/Namespace.js deleted file mode 100644 index fa1e41d1..00000000 --- a/util/jsdoc-toolkit/app/frame/Namespace.js +++ /dev/null @@ -1,10 +0,0 @@ -_global_ = this; - -function Namespace(name, f) { - var n = name.split("."); - for (var o = _global_, i = 0, l = n.length; i < l; i++) { - o = o[n[i]] = o[n[i]] || {}; - } - - if (f) f(); -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/frame/Opt.js b/util/jsdoc-toolkit/app/frame/Opt.js deleted file mode 100644 index 352f1590..00000000 --- a/util/jsdoc-toolkit/app/frame/Opt.js +++ /dev/null @@ -1,134 +0,0 @@ -/** @namespace */ -Opt = { - /** - * Get commandline option values. - * @param {Array} args Commandline arguments. Like ["-a=xml", "-b", "--class=new", "--debug"] - * @param {object} optNames Map short names to long names. Like {a:"accept", b:"backtrace", c:"class", d:"debug"}. - * @return {object} Short names and values. Like {a:"xml", b:true, c:"new", d:true} - */ - get: function(args, optNames) { - var opt = {"_": []}; // the unnamed option allows multiple values - for (var i = 0; i < args.length; i++) { - var arg = new String(args[i]); - var name; - var value; - if (arg.charAt(0) == "-") { - if (arg.charAt(1) == "-") { // it's a longname like --foo - arg = arg.substring(2); - var m = arg.split("="); - name = m.shift(); - value = m.shift(); - if (typeof value == "undefined") value = true; - - for (var n in optNames) { // convert it to a shortname - if (name == optNames[n]) { - name = n; - } - } - } - else { // it's a shortname like -f - arg = arg.substring(1); - var m = arg.split("="); - name = m.shift(); - value = m.shift(); - if (typeof value == "undefined") value = true; - - for (var n in optNames) { // find the matching key - if (name == n || name+'[]' == n) { - name = n; - break; - } - } - } - if (name.match(/(.+)\[\]$/)) { // it's an array type like n[] - name = RegExp.$1; - if (!opt[name]) opt[name] = []; - } - - if (opt[name] && opt[name].push) { - opt[name].push(value); - } - else { - opt[name] = value; - } - } - else { // not associated with any optname - opt._.push(args[i]); - } - } - return opt; - } -} - -/*t: - plan(11, "Testing Opt."); - - is( - typeof Opt, - "object", - "Opt is an object." - ); - - is( - typeof Opt.get, - "function", - "Opt.get is a function." - ); - - var optNames = {a:"accept", b:"backtrace", c:"class", d:"debug", "e[]":"exceptions"}; - var t_options = Opt.get(["-a=xml", "-b", "--class=new", "--debug", "-e=one", "-e=two", "foo", "bar"], optNames); - - is( - t_options.a, - "xml", - "an option defined with a short name can be accessed by its short name." - ); - - is( - t_options.b, - true, - "an option defined with a short name and no value are true." - ); - - is( - t_options.c, - "new", - "an option defined with a long name can be accessed by its short name." - ); - - is( - t_options.d, - true, - "an option defined with a long name and no value are true." - ); - - is( - typeof t_options.e, - "object", - "an option that can accept multiple values is defined." - ); - - is( - t_options.e.length, - 2, - "an option that can accept multiple values can have more than one value." - ); - - is( - t_options.e[1], - "two", - "an option that can accept multiple values can be accessed as an array." - ); - - is( - typeof t_options._, - "object", - "the property '_' is defined for unnamed options." - ); - - is( - t_options._[0], - "foo", - "the property '_' can be accessed as an array." - ); - */ \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/frame/Reflection.js b/util/jsdoc-toolkit/app/frame/Reflection.js deleted file mode 100644 index 0968f1c6..00000000 --- a/util/jsdoc-toolkit/app/frame/Reflection.js +++ /dev/null @@ -1,26 +0,0 @@ -/**@constructor*/ -function Reflection(obj) { - this.obj = obj; -} - -Reflection.prototype.getConstructorName = function() { - if (this.obj.constructor.name) return this.obj.constructor.name; - var src = this.obj.constructor.toSource(); - var name = src.substring(name.indexOf("function")+8, src.indexOf('(')).replace(/ /g,''); - return name; -} - -Reflection.prototype.getMethod = function(name) { - for (var p in this.obj) { - if (p == name && typeof(this.obj[p]) == "function") return this.obj[p]; - } - return null; -} - -Reflection.prototype.getParameterNames = function() { - var src = this.obj.toSource(); - src = src.substring( - src.indexOf("(", 8)+1, src.indexOf(")") - ); - return src.split(/, ?/); -} diff --git a/util/jsdoc-toolkit/app/frame/String.js b/util/jsdoc-toolkit/app/frame/String.js deleted file mode 100644 index c183c27d..00000000 --- a/util/jsdoc-toolkit/app/frame/String.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - @name String - @class Additions to the core string object. -*/ - -/** @author Steven Levithan, released as public domain. */ -String.prototype.trim = function() { - var str = this.replace(/^\s+/, ''); - for (var i = str.length - 1; i >= 0; i--) { - if (/\S/.test(str.charAt(i))) { - str = str.substring(0, i + 1); - break; - } - } - return str; -} -/*t: - plan(6, "Testing String.prototype.trim."); - - var s = " a bc ".trim(); - is(s, "a bc", "multiple spaces front and back are trimmed."); - - s = "a bc\n\n".trim(); - is(s, "a bc", "newlines only in back are trimmed."); - - s = "\ta bc".trim(); - is(s, "a bc", "tabs only in front are trimmed."); - - s = "\n \t".trim(); - is(s, "", "an all-space string is trimmed to empty."); - - s = "a b\nc".trim(); - is(s, "a b\nc", "a string with no spaces in front or back is trimmed to itself."); - - s = "".trim(); - is(s, "", "an empty string is trimmed to empty."); - -*/ - -String.prototype.balance = function(open, close) { - var i = 0; - while (this.charAt(i) != open) { - if (i == this.length) return [-1, -1]; - i++; - } - - var j = i+1; - var balance = 1; - while (j < this.length) { - if (this.charAt(j) == open) balance++; - if (this.charAt(j) == close) balance--; - if (balance == 0) break; - j++; - if (j == this.length) return [-1, -1]; - } - - return [i, j]; -} -/*t: - plan(16, "Testing String.prototype.balance."); - - var s = "{abc}".balance("{","}"); - is(s[0], 0, "opener in first is found."); - is(s[1], 4, "closer in last is found."); - - s = "ab{c}de".balance("{","}"); - is(s[0], 2, "opener in middle is found."); - is(s[1], 4, "closer in middle is found."); - - s = "a{b{c}de}f".balance("{","}"); - is(s[0], 1, "nested opener is found."); - is(s[1], 8, "nested closer is found."); - - s = "{}".balance("{","}"); - is(s[0], 0, "opener with no content is found."); - is(s[1], 1, "closer with no content is found."); - - s = "".balance("{","}"); - is(s[0], -1, "empty string opener is -1."); - is(s[1], -1, "empty string closer is -1."); - - s = "{abc".balance("{","}"); - is(s[0], -1, "opener with no closer returns -1."); - is(s[1], -1, "no closer returns -1."); - - s = "abc".balance("{","}"); - is(s[0], -1, "no opener or closer returns -1 for opener."); - is(s[1], -1, "no opener or closer returns -1 for closer."); - - s = "aX11/MIT License - * (See the accompanying README file for full details.) - */ - -/** - Yet another unit testing tool for JavaScript. - @author Michael Mathews micmath@gmail.com - @param {object} testCases Properties are testcase names, values are functions to execute as tests. -*/ -function testrun(testCases) { - var ran = 0; - for (t in testCases) { - var result = testCases[t](); - ran++; - } - - return testrun.reportOut+"-------------------------------\n"+((testrun.fails>0)? ":( Failed "+testrun.fails+"/" : ":) Passed all ")+testrun.count+" test"+((testrun.count == 1)? "":"s")+".\n"; -} - - -testrun.count = 0; -testrun.current = null; -testrun.passes = 0; -testrun.fails = 0; -testrun.reportOut = ""; - -/** @private */ -testrun.report = function(text) { - testrun.reportOut += text+"\n"; -} - -/** - Check if test evaluates to true. - @param {string} test To be evaluated. - @param {string} message Optional. To be displayed in the report. - @return {boolean} True if the string test evaluates to true. -*/ -ok = function(test, message) { - testrun.count++; - - var result; - try { - result = eval(test); - - if (result) { - testrun.passes++; - testrun.report(" OK "+testrun.count+" - "+((message != null)? message : "")); - } - else { - testrun.fails++; - testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); - } - } - catch(e) { - testrun.fails++ - testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); - - } -} - -/** - Check if test is same as expected. - @param {string} test To be evaluated. - @param {string} expected - @param {string} message Optional. To be displayed in the report. - @return {boolean} True if (test == expected). Note that the comparison is not a strict equality check. -*/ -is = function(test, expected, message) { - testrun.count++; - - var result; - try { - result = eval(test); - - if (result == expected) { - testrun.passes++ - testrun.report(" OK "+testrun.count+" - "+((message != null)? message : "")); - } - else { - testrun.fails++ - testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); - testrun.report("expected: "+expected); - testrun.report(" got: "+result); - } - } - catch(e) { - testrun.fails++ - testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); - testrun.report("expected: "+expected); - testrun.report(" got: "+result);} -} - -/** - Check if test matches pattern. - @param {string} test To be evaluated. - @param {string} pattern Used to create a RegExp. - @param {string} message Optional. To be displayed in the report. - @return {boolean} True if test matches pattern. -*/ -like = function(test, pattern, message) { - testrun.count++; - - var result; - try { - result = eval(test); - var rgx = new RegExp(pattern); - - if (rgx.test(result)) { - testrun.passes++ - testrun.report(" OK "+testrun.count+" - "+((message != null)? message : "")); - } - else { - testrun.fails++ - testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); - testrun.report(" this: "+result); - testrun.report("is not like: "+pattern); - } - } - catch(e) { - testrun.fails++ - testrun.report("NOT OK "+testrun.count+" - "+((message != null)? message : "")); - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/handlers/FOODOC.js b/util/jsdoc-toolkit/app/handlers/FOODOC.js deleted file mode 100644 index b208f55b..00000000 --- a/util/jsdoc-toolkit/app/handlers/FOODOC.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - This is the main container for the FOODOC handler. - @namespace -*/ -FOODOC = { -}; - -/** The current version string of this application. */ -FOODOC.VERSION = "1.0"; - -FOODOC.handle = function(srcFile, src) { - LOG.inform("Handling file '" + srcFile + "'"); - - return [ - new JSDOC.Symbol( - "foo", - [], - "VIRTUAL", - new JSDOC.DocComment("/** This is a foo. */") - ) - ]; -}; - -FOODOC.publish = function(symbolgroup) { - LOG.inform("Publishing symbolgroup."); -}; diff --git a/util/jsdoc-toolkit/app/handlers/XMLDOC.js b/util/jsdoc-toolkit/app/handlers/XMLDOC.js deleted file mode 100755 index 40f87b35..00000000 --- a/util/jsdoc-toolkit/app/handlers/XMLDOC.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * This is the main container for the XMLDOC handler. - * @namespace - * @author Brett Fattori (bfattori@fry.com) - * @version $Revision: 498 $ - */ -XMLDOC = { - -}; - -/** The current version string of this application. */ -XMLDOC.VERSION = "1.0"; - -/** Include the library necessary to handle XML files */ -IO.includeDir("handlers/XMLDOC/"); - -/** - * @type Symbol[] - */ -XMLDOC.handle = function(srcFile, src) { - -}; - -XMLDOC.publish = function(symbolgroup) { - -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js b/util/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js deleted file mode 100755 index 240563da..00000000 --- a/util/jsdoc-toolkit/app/handlers/XMLDOC/DomReader.js +++ /dev/null @@ -1,159 +0,0 @@ -LOG.inform("XMLDOC.DomReader loaded"); - -XMLDOC.DomReader = function(root) { - - this.dom = root; - - /** - * The current node the reader is on - */ - this.node = root; - - /** - * Get the current node the reader is on - * @type XMLDOC.Parser.node - */ - XMLDOC.DomReader.prototype.getNode = function() { - return this.node; - }; - - /** - * Set the node the reader should be positioned on. - * @param node {XMLDOC.Parser.node} - */ - XMLDOC.DomReader.prototype.setNode = function(node) { - this.node = node; - }; - - /** - * A helper method to make sure the current node will - * never return null, unless null is passed as the root. - * @param step {String} An expression to evaluate - should return a node or null - */ - XMLDOC.DomReader.prototype.navigate = function(step) { - var n; - if ((n = step) != null) - { - this.node = n; - return this.node; - } - return null; - }; - - /** - * Get the root node of the current node's document. - */ - XMLDOC.DomReader.prototype.root = function() { - this.navigate(this.dom); - }; - - /** - * Get the parent of the current node. - */ - XMLDOC.DomReader.prototype.parent = function() { - return this.navigate(this.node.parentNode()); - }; - - /** - * Get the first child of the current node. - */ - XMLDOC.DomReader.prototype.firstChild = function() { - return this.navigate(this.node.firstChild()); - }; - - /** - * Get the last child of the current node. - */ - XMLDOC.DomReader.prototype.lastChild = function() { - return this.navigate(this.node.lastChild()); - }; - - /** - * Get the next sibling of the current node. - */ - XMLDOC.DomReader.prototype.nextSibling = function() { - return this.navigate(this.node.nextSibling()); - }; - - /** - * Get the previous sibling of the current node. - */ - XMLDOC.DomReader.prototype.prevSibling = function() { - return this.navigate(this.node.prevSibling()); - }; - - //=============================================================================================== - // Support methods - - /** - * Walk the tree starting with the current node, calling the plug-in for - * each node visited. Each time the plug-in is called, the DomReader - * is passed as the only parameter. Use the {@link XMLDOC.DomReader#getNode} method - * to access the current node. This method uses a depth first traversal pattern. - * - * @param srcFile {String} The source file being evaluated - */ - XMLDOC.DomReader.prototype.getSymbols = function(srcFile) - { - XMLDOC.DomReader.symbols = []; - XMLDOC.DomReader.currentFile = srcFile; - JSDOC.Symbol.srcFile = (srcFile || ""); - - if (defined(JSDOC.PluginManager)) { - JSDOC.PluginManager.run("onDomGetSymbols", this); - } - - return XMLDOC.DomReader.symbols; - }; - - /** - * Find the node with the given name using a depth first traversal. - * Does not modify the DomReader's current node. - * - * @param name {String} The name of the node to find - * @return the node that was found, or null if not found - */ - XMLDOC.DomReader.prototype.findNode = function(name) - { - var findNode = null; - - // Start at the current node and move into the subtree, - // looking for the node with the given name - function deeper(node, find) - { - var look = null; - - if (node) { - if (node.name == find) - { - return node; - } - - if (node.firstChild()) - { - look = deeper(node.firstChild(), find); - } - - if (!look && node.nextSibling()) - { - look = deeper(node.nextSibling(), find); - } - } - - return look; - } - - return deeper(this.getNode().firstChild(), name); - }; - - /** - * Find the next node with the given name using a depth first traversal. - * - * @param name {String} The name of the node to find - */ - XMLDOC.DomReader.prototype.findPreviousNode = function(name) - { - }; - -}; - diff --git a/util/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js b/util/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js deleted file mode 100755 index e9b3e3ce..00000000 --- a/util/jsdoc-toolkit/app/handlers/XMLDOC/XMLDoc.js +++ /dev/null @@ -1,16 +0,0 @@ -LOG.inform("XMLDOC.symbolize loaded"); - -/** - * Convert the source file to a set of symbols - */ -XMLDOC.symbolize = function(srcFile, src) { - - LOG.inform("Symbolizing file '" + srcFile + "'"); - - // XML files already have a defined structure, so we don't need to - // do anything but parse them. The DOM reader can create a symbol - // table from the parsed XML. - var dr = new XMLDOC.DomReader(XMLDOC.Parser.parse(src)); - return dr.getSymbols(srcFile); - -}; diff --git a/util/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js b/util/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js deleted file mode 100755 index 78e8f455..00000000 --- a/util/jsdoc-toolkit/app/handlers/XMLDOC/XMLParse.js +++ /dev/null @@ -1,292 +0,0 @@ -LOG.inform("XMLDOC.Parser loaded"); - -/** - * XML Parser object. Returns an {@link #XMLDOC.Parser.node} which is - * the root element of the parsed document. - *

- * By default, this parser will only handle well formed XML. To - * allow the parser to handle HTML, set the XMLDOC.Parser.strictMode - * variable to false before calling XMLDOC.Parser.parse(). - *

- * Note: If you pass poorly formed XML, it will cause the parser to throw - * an exception. - * - * @author Brett Fattori (bfattori@fry.com) - * @author $Author: micmath $ - * @version $Revision: 497 $ - */ -XMLDOC.Parser = {}; - -/** - * Strict mode setting. Setting this to false allows HTML-style source to - * be parsed. Normally, well formed XML has defined end tags, or empty tags - * are properly formed. Default: true - * @type Boolean - */ -XMLDOC.Parser.strictMode = true; - -/** - * A node in an XML Document. Node types are ROOT, ELEMENT, COMMENT, PI, and TEXT. - * @param parent {XMLDOC.Parser.node} The parent node - * @param name {String} The node name - * @param type {String} One of the types - */ -XMLDOC.Parser.node = function(parent, name, type) -{ - this.name = name; - this.type = type || "ELEMENT"; - this.parent = parent; - this.charData = ""; - this.attrs = {}; - this.nodes = []; - this.cPtr = 0; - - XMLDOC.Parser.node.prototype.getAttributeNames = function() { - var a = []; - for (var o in this.attrs) - { - a.push(o); - } - - return a; - }; - - XMLDOC.Parser.node.prototype.getAttribute = function(attr) { - return this.attrs[attr]; - }; - - XMLDOC.Parser.node.prototype.setAttribute = function(attr, val) { - this.attrs[attr] = val; - }; - - XMLDOC.Parser.node.prototype.getChild = function(idx) { - return this.nodes[idx]; - }; - - XMLDOC.Parser.node.prototype.parentNode = function() { - return this.parent; - }; - - XMLDOC.Parser.node.prototype.firstChild = function() { - return this.nodes[0]; - }; - - XMLDOC.Parser.node.prototype.lastChild = function() { - return this.nodes[this.nodes.length - 1]; - }; - - XMLDOC.Parser.node.prototype.nextSibling = function() { - var p = this.parent; - if (p && (p.nodes.indexOf(this) + 1 != p.nodes.length)) - { - return p.getChild(p.nodes.indexOf(this) + 1); - } - return null; - }; - - XMLDOC.Parser.node.prototype.prevSibling = function() { - var p = this.parent; - if (p && (p.nodes.indexOf(this) - 1 >= 0)) - { - return p.getChild(p.nodes.indexOf(this) - 1); - } - return null; - }; -}; - -/** - * Parse an XML Document from the specified source. The XML should be - * well formed, unless strict mode is disabled, then the parser will - * handle HTML-style XML documents. - * @param src {String} The source to parse - */ -XMLDOC.Parser.parse = function(src) -{ - var A = []; - - // Normailize whitespace - A = src.split("\r\n"); - src = A.join("\n"); - A = src.split("\r"); - src = A.join("\n"); - - // Remove XML and DOCTYPE specifier - src.replace(/<\?XML .*\?>/i, ""); - src.replace(//i, ""); - - // The document is the root node and cannot be modified or removed - var doc = new XMLDOC.Parser.node(null, "ROOT", "DOCUMENT"); - - // Let's break it down - XMLDOC.Parser.eat(doc, src); - - return doc; -}; - -/** - * The XML fragment processing routine. This method is private and should not be called - * directly. - * @param parentNode {XMLDOC.Parser.node} The node which is the parent of this fragment - * @param src {String} The source within the fragment to process - * @private - */ -XMLDOC.Parser.eat = function(parentNode, src) -{ - // A simple tag def - var reTag = new RegExp("<(!|)(\\?|--|)((.|\\s)*?)\\2>","g"); - - // Special tag types - var reCommentTag = //; - var rePITag = /<\?((.|\s)*?)\?>/; - - // A start tag (with potential empty marker) - var reStartTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*(\/)?>/; - - // An empty HTML style tag (not proper XML, but we'll accept it so we can process HTML) - var reHTMLEmptyTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*)\4)*>/; - - // Fully enclosing tag with nested tags - var reEnclosingTag = /<(.*?)( +([\w_\-]*)=(\"|')(.*?)\4)*>((.|\s)*?)<\/\1>/; - - // Breaks down attributes - var reAttributes = new RegExp(" +([\\w_\\-]*)=(\"|')(.*?)\\2","g"); - - // Find us a tag - var tag; - while ((tag = reTag.exec(src)) != null) - { - if (tag.index > 0) - { - // The next tag has some text before it - var text = src.substring(0, tag.index).replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1"); - - if (text.length > 0 && (text != "\n")) - { - var txtnode = new XMLDOC.Parser.node(parentNode, "", "TEXT"); - txtnode.charData = text; - - // Append the new text node - parentNode.nodes.push(txtnode); - } - - // Reset the lastIndex of reTag - reTag.lastIndex -= src.substring(0, tag.index).length; - - // Eat the text - src = src.substring(tag.index); - } - - if (reCommentTag.test(tag[0])) - { - // Is this a comment? - var comment = new XMLDOC.Parser.node(parentNode, "", "COMMENT"); - comment.charData = reCommentTag.exec(tag[0])[1]; - - // Append the comment - parentNode.nodes.push(comment); - - // Move the lastIndex of reTag - reTag.lastIndex -= tag[0].length; - - // Eat the tag - src = src.replace(reCommentTag, ""); - } - else if (rePITag.test(tag[0])) - { - // Is this a processing instruction? - var pi = new XMLDOC.Parser.node(parentNode, "", "PI"); - pi.charData = rePITag.exec(tag[0])[1]; - - // Append the processing instruction - parentNode.nodes.push(pi); - - // Move the lastIndex of reTag - reTag.lastIndex -= tag[0].length; - - // Eat the tag - src = src.replace(rePITag, ""); - } - else if (reStartTag.test(tag[0])) - { - // Break it down - var e = reStartTag.exec(tag[0]); - var elem = new XMLDOC.Parser.node(parentNode, e[1], "ELEMENT"); - - // Get attributes from the tag - var a; - while ((a = reAttributes.exec(e[2])) != null ) - { - elem.attrs[a[1]] = a[3]; - } - - // Is this an empty XML-style tag? - if (e[6] == "/") - { - // Append the empty element - parentNode.nodes.push(elem); - - // Move the lastIndex of reTag (include the start tag length) - reTag.lastIndex -= e[0].length; - - // Eat the tag - src = src.replace(reStartTag, ""); - } - else - { - // Check for malformed XML tags - var htmlParsed = false; - var htmlStartTag = reHTMLEmptyTag.exec(src); - - // See if there isn't an end tag within this block - var reHTMLEndTag = new RegExp(""); - var htmlEndTag = reHTMLEndTag.exec(src); - - if (XMLDOC.Parser.strictMode && htmlEndTag == null) - { - // Poorly formed XML fails in strict mode - var err = new Error("Malformed XML passed to XMLDOC.Parser... Error contains malformed 'src'"); - err.src = src; - throw err; - } - else if (htmlEndTag == null) - { - // This is an HTML-style empty tag, store the element for it in non-strict mode - parentNode.nodes.push(elem); - - // Eat the tag - src = src.replace(reHTMLEmptyTag, ""); - htmlParsed = true; - } - - // If we didn't parse HTML-style, it must be an enclosing tag - if (!htmlParsed) - { - var enc = reEnclosingTag.exec(src); - - // Go deeper into the document - XMLDOC.Parser.eat(elem, enc[6]); - - // Append the new element node - parentNode.nodes.push(elem); - - // Eat the tag - src = src.replace(reEnclosingTag, ""); - } - } - - // Reset the lastIndex of reTag - reTag.lastIndex = 0; - } - } - - // No tag was found... append the text if there is any - src = src.replace(/^[ \t\n]+((.|\n)*?)[ \t\n]+$/, "$1"); - if (src.length > 0 && (src != "\n")) - { - var txtNode = new XMLDOC.Parser.node(parentNode, "", "TEXT"); - txtNode.charData = src; - - // Append the new text node - parentNode.nodes.push(txtNode); - } -}; diff --git a/util/jsdoc-toolkit/app/lib/JSDOC.js b/util/jsdoc-toolkit/app/lib/JSDOC.js deleted file mode 100644 index f1d5dc9d..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC.js +++ /dev/null @@ -1,101 +0,0 @@ -/** - @overview - @date $Date: 2009-01-21 22:53:36 +0000 (Wed, 21 Jan 2009) $ - @version $Revision: 771 $ - @location $HeadURL: https://jsdoc-toolkit.googlecode.com/svn/tags/jsdoc_toolkit-2.1.0/jsdoc-toolkit/app/lib/JSDOC.js $ - @name whateverFilename.js - */ - -/** - This is the main container for the JSDOC application. - @namespace -*/ -JSDOC = { -}; - -/** - @requires Opt - */ -if (typeof arguments == "undefined") arguments = []; -JSDOC.opt = Opt.get( - arguments, - { - d: "directory", - c: "conf", - t: "template", - r: "recurse", - x: "ext", - p: "private", - a: "allfunctions", - e: "encoding", - n: "nocode", - o: "out", - s: "suppress", - q: "quiet", - T: "testmode", - h: "help", - v: "verbose", - "D[]": "define", - "E[]": "exclude", - "H[]": "handler" - } -); - -/** The current version string of this application. */ -JSDOC.VERSION = "2.1.0"; - -/** Print out usage information and quit. */ -JSDOC.usage = function() { - print("USAGE: java -jar jsrun.jar app/run.js [OPTIONS] ..."); - print(""); - print("OPTIONS:"); - print(" -a or --allfunctions\n Include all functions, even undocumented ones.\n"); - print(" -c or --conf\n Load a configuration file.\n"); - print(" -d= or --directory=\n Output to this directory (defaults to \"out\").\n"); - print(" -D=\"myVar:My value\" or --define=\"myVar:My value\"\n Multiple. Define a variable, available in JsDoc as JSDOC.opt.D.myVar.\n"); - print(" -e= or --encoding=\n Use this encoding to read and write files.\n"); - print(" -E=\"REGEX\" or --exclude=\"REGEX\"\n Multiple. Exclude files based on the supplied regex.\n"); - print(" -h or --help\n Show this message and exit.\n"); - print(" -n or --nocode\n Ignore all code, only document comments with @name tags.\n"); - print(" -o= or --out=\n Print log messages to a file (defaults to stdout).\n"); - print(" -p or --private\n Include symbols tagged as private, underscored and inner symbols.\n"); - print(" -q or --quiet\n Do not output any messages, not even warnings.\n"); - print(" -r= or --recurse=\n Descend into src directories.\n"); - print(" -s or --suppress\n Suppress source code output.\n"); - print(" -t= or --template=\n Required. Use this template to format the output.\n"); - print(" -T or --test\n Run all unit tests and exit.\n"); - print(" -v or --verbose\n Provide verbose feedback about what is happening.\n"); - print(" -x=[,EXT]... or --ext=[,EXT]...\n Scan source files with the given extension/s (defaults to js).\n"); - - quit(); -} - -/*t: - plan(4, "Testing JSDOC namespace."); - - is( - typeof JSDOC, - "object", - "JSDOC.usage is a function." - ); - - is( - typeof JSDOC.VERSION, - "string", - "JSDOC.VERSION is a string." - ); - - is( - typeof JSDOC.usage, - "function", - "JSDOC.usage is a function." - ); - - is( - typeof JSDOC.opt, - "object", - "JSDOC.opt is a object." - ); - */ - -if (this.IO) IO.includeDir("lib/JSDOC/"); diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/DocComment.js b/util/jsdoc-toolkit/app/lib/JSDOC/DocComment.js deleted file mode 100644 index c6c8d7d4..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/DocComment.js +++ /dev/null @@ -1,200 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - Create a new DocComment. This takes a raw documentation comment, - and wraps it in useful accessors. - @class Represents a documentation comment object. - */ -JSDOC.DocComment = function(/**String*/comment) { - this.init(); - if (typeof comment != "undefined") { - this.parse(comment); - } -} - -JSDOC.DocComment.prototype.init = function() { - this.isUserComment = true; - this.src = ""; - this.meta = ""; - this.tagTexts = []; - this.tags = []; -} - -/** - @requires JSDOC.DocTag - */ -JSDOC.DocComment.prototype.parse = function(/**String*/comment) { - if (comment == "") { - comment = "/** @desc */"; - this.isUserComment = false; - } - - this.src = JSDOC.DocComment.unwrapComment(comment); - - this.meta = ""; - if (this.src.indexOf("#") == 0) { - this.src.match(/#(.+[+-])([\s\S]*)$/); - if (RegExp.$1) this.meta = RegExp.$1; - if (RegExp.$2) this.src = RegExp.$2; - } - - if (typeof JSDOC.PluginManager != "undefined") { - JSDOC.PluginManager.run("onDocCommentSrc", this); - } - - this.fixDesc(); - - this.src = JSDOC.DocComment.shared+"\n"+this.src; - - this.tagTexts = - this.src - .split(/(^|[\r\n])\s*@/) - .filter(function($){return $.match(/\S/)}); - - /** - The tags found in the comment. - @type JSDOC.DocTag[] - */ - this.tags = this.tagTexts.map(function($){return new JSDOC.DocTag($)}); - - if (typeof JSDOC.PluginManager != "undefined") { - JSDOC.PluginManager.run("onDocCommentTags", this); - } -} - -/*t: - plan(5, "testing JSDOC.DocComment"); - requires("../frame/String.js"); - requires("../lib/JSDOC/DocTag.js"); - - var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/"); - is(com.tagTexts[0], "foo some\ncomment here", "first tag text is found."); - is(com.tags[0].title, "foo", "the title is found in a comment with one tag."); - - var com = new JSDOC.DocComment("/** @foo first\n* @bar second*"+"/"); - is(com.getTag("bar").length, 1, "getTag() returns one tag by that title."); - - JSDOC.DocComment.shared = "@author John Smith"; - var com = new JSDOC.DocComment("/**@foo some\n* comment here*"+"/"); - is(com.tags[0].title, "author", "shared comment is added."); - is(com.tags[1].title, "foo", "shared comment is added to existing tag."); -*/ - -/** - If no @desc tag is provided, this function will add it. - */ -JSDOC.DocComment.prototype.fixDesc = function() { - if (this.meta && this.meta != "@+") return; - if (/^\s*[^@\s]/.test(this.src)) { - this.src = "@desc "+this.src; - } -} - -/*t: - plan(5, "testing JSDOC.DocComment#fixDesc"); - - var com = new JSDOC.DocComment(); - - com.src = "this is a desc\n@author foo"; - com.fixDesc(); - is(com.src, "@desc this is a desc\n@author foo", "if no @desc tag is provided one is added."); - - com.src = "x"; - com.fixDesc(); - is(com.src, "@desc x", "if no @desc tag is provided one is added to a single character."); - - com.src = "\nx"; - com.fixDesc(); - is(com.src, "@desc \nx", "if no @desc tag is provided one is added to return and character."); - - com.src = " "; - com.fixDesc(); - is(com.src, " ", "if no @desc tag is provided one is not added to just whitespace."); - - com.src = ""; - com.fixDesc(); - is(com.src, "", "if no @desc tag is provided one is not added to empty."); -*/ - -/** - Remove slash-star comment wrapper from a raw comment string. - @type String - */ -JSDOC.DocComment.unwrapComment = function(/**String*/comment) { - if (!comment) return ""; - var unwrapped = comment.replace(/(^\/\*\*|\*\/$)/g, "").replace(/^\s*\* ?/gm, ""); - return unwrapped; -} - -/*t: - plan(5, "testing JSDOC.DocComment.unwrapComment"); - - var com = "/**x*"+"/"; - var unwrapped = JSDOC.DocComment.unwrapComment(com); - is(unwrapped, "x", "a single character jsdoc is found."); - - com = "/***x*"+"/"; - unwrapped = JSDOC.DocComment.unwrapComment(com); - is(unwrapped, "x", "three stars are allowed in the opener."); - - com = "/****x*"+"/"; - unwrapped = JSDOC.DocComment.unwrapComment(com); - is(unwrapped, "*x", "fourth star in the opener is kept."); - - com = "/**x\n * y\n*"+"/"; - unwrapped = JSDOC.DocComment.unwrapComment(com); - is(unwrapped, "x\ny\n", "leading stars and spaces are trimmed."); - - com = "/**x\n * y\n*"+"/"; - unwrapped = JSDOC.DocComment.unwrapComment(com); - is(unwrapped, "x\n y\n", "only first space after leading stars are trimmed."); -*/ - -/** - Provides a printable version of the comment. - @type String - */ -JSDOC.DocComment.prototype.toString = function() { - return this.src; -} - -/*t: - plan(1, "testing JSDOC.DocComment#fixDesc"); - var com = new JSDOC.DocComment(); - com.src = "foo"; - is(""+com, "foo", "stringifying a comment returns the unwrapped src."); -*/ - -/** - Given the title of a tag, returns all tags that have that title. - @type JSDOC.DocTag[] - */ -JSDOC.DocComment.prototype.getTag = function(/**String*/tagTitle) { - return this.tags.filter(function($){return $.title == tagTitle}); -} - -/*t: - plan(1, "testing JSDOC.DocComment#getTag"); - requires("../frame/String.js"); - requires("../lib/JSDOC/DocTag.js"); - - var com = new JSDOC.DocComment("/**@foo some\n* @bar\n* @bar*"+"/"); - is(com.getTag("bar").length, 2, "getTag returns expected number of tags."); -*/ - -/** - Used to store the currently shared tag text. -*/ -JSDOC.DocComment.shared = ""; - -/*t: - plan(2, "testing JSDOC.DocComment.shared"); - requires("../frame/String.js"); - requires("../lib/JSDOC/DocTag.js"); - - JSDOC.DocComment.shared = "@author Michael"; - - var com = new JSDOC.DocComment("/**@foo\n* @foo*"+"/"); - is(com.getTag("author").length, 1, "getTag returns shared tag."); - is(com.getTag("foo").length, 2, "getTag returns unshared tags too."); -*/ \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/DocTag.js b/util/jsdoc-toolkit/app/lib/JSDOC/DocTag.js deleted file mode 100644 index 77ec07ca..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/DocTag.js +++ /dev/null @@ -1,294 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - @constructor - */ -JSDOC.DocTag = function(src) { - this.init(); - if (typeof src != "undefined") { - this.parse(src); - } -} - -/** - Create and initialize the properties of this. - */ -JSDOC.DocTag.prototype.init = function() { - this.title = ""; - this.type = ""; - this.name = ""; - this.isOptional = false; - this.defaultValue = ""; - this.desc = ""; - - return this; -} - -/** - Populate the properties of this from the given tag src. - @param {string} src - */ -JSDOC.DocTag.prototype.parse = function(src) { - if (typeof src != "string") throw "src must be a string not "+(typeof src); - - try { - src = this.nibbleTitle(src); - if (JSDOC.PluginManager) { - JSDOC.PluginManager.run("onDocTagSynonym", this); - } - - src = this.nibbleType(src); - - // only some tags are allowed to have names. - if (this.title == "param" || this.title == "property" || this.title == "config") { // @config is deprecated - src = this.nibbleName(src); - } - } - catch(e) { - if (LOG) LOG.warn(e); - else throw e; - } - this.desc = src; // whatever is left - - // example tags need to have whitespace preserved - if (this.title != "example") this.desc = this.desc.trim(); - - if (JSDOC.PluginManager) { - JSDOC.PluginManager.run("onDocTag", this); - } -} - -/** - Automatically called when this is stringified. - */ -JSDOC.DocTag.prototype.toString = function() { - return this.desc; -} - -/*t: - plan(1, "testing JSDOC.DocTag#toString"); - - var tag = new JSDOC.DocTag("param {object} date A valid date."); - is(""+tag, "A valid date.", "stringifying a tag returns the desc."); - */ - -/** - Find and shift off the title of a tag. - @param {string} src - @return src - */ -JSDOC.DocTag.prototype.nibbleTitle = function(src) { - if (typeof src != "string") throw "src must be a string not "+(typeof src); - - var parts = src.match(/^\s*(\S+)(?:\s([\s\S]*))?$/); - - if (parts && parts[1]) this.title = parts[1]; - if (parts && parts[2]) src = parts[2]; - else src = ""; - - return src; -} - -/*t: - plan(8, "testing JSDOC.DocTag#nibbleTitle"); - - var tag = new JSDOC.DocTag(); - - tag.init().nibbleTitle("aTitleGoesHere"); - is(tag.title, "aTitleGoesHere", "a title can be found in a single-word string."); - - var src = tag.init().nibbleTitle("aTitleGoesHere and the rest"); - is(tag.title, "aTitleGoesHere", "a title can be found in a multi-word string."); - is(src, "and the rest", "the rest is returned when the title is nibbled off."); - - src = tag.init().nibbleTitle(""); - is(tag.title, "", "given an empty string the title is empty."); - is(src, "", "the rest is empty when the tag is empty."); - - var src = tag.init().nibbleTitle(" aTitleGoesHere\n a description"); - is(tag.title, "aTitleGoesHere", "leading and trailing spaces are not part of the title."); - is(src, " a description", "leading spaces (less one) are part of the description."); - - tag.init().nibbleTitle("a.Title::Goes_Here foo"); - is(tag.title, "a.Title::Goes_Here", "titles with punctuation are allowed."); - */ - -/** - Find and shift off the type of a tag. - @requires frame/String.js - @param {string} src - @return src - */ -JSDOC.DocTag.prototype.nibbleType = function(src) { - if (typeof src != "string") throw "src must be a string not "+(typeof src); - - if (src.match(/^\s*\{/)) { - var typeRange = src.balance("{", "}"); - if (typeRange[1] == -1) { - throw "Malformed comment tag ignored. Tag type requires an opening { and a closing }: "+src; - } - this.type = src.substring(typeRange[0]+1, typeRange[1]).trim(); - this.type = this.type.replace(/\s*,\s*/g, "|"); // multiples can be separated by , or | - src = src.substring(typeRange[1]+1); - } - - return src; -} - -/*t: - plan(5, "testing JSDOC.DocTag.parser.nibbleType"); - requires("../frame/String.js"); - - var tag = new JSDOC.DocTag(); - - tag.init().nibbleType("{String[]} aliases"); - is(tag.type, "String[]", "type can have non-alpha characters."); - - tag.init().nibbleType("{ aTypeGoesHere } etc etc"); - is(tag.type, "aTypeGoesHere", "type is trimmed."); - - tag.init().nibbleType("{ oneType, twoType ,\n threeType } etc etc"); - is(tag.type, "oneType|twoType|threeType", "multiple types can be separated by commas."); - - var error; - try { tag.init().nibbleType("{widget foo"); } - catch(e) { error = e; } - is(typeof error, "string", "malformed tag type throws error."); - isnt(error.indexOf("Malformed"), -1, "error message tells tag is malformed."); - */ - -/** - Find and shift off the name of a tag. - @requires frame/String.js - @param {string} src - @return src - */ -JSDOC.DocTag.prototype.nibbleName = function(src) { - if (typeof src != "string") throw "src must be a string not "+(typeof src); - - src = src.trim(); - - // is optional? - if (src.charAt(0) == "[") { - var nameRange = src.balance("[", "]"); - if (nameRange[1] == -1) { - throw "Malformed comment tag ignored. Tag optional name requires an opening [ and a closing ]: "+src; - } - this.name = src.substring(nameRange[0]+1, nameRange[1]).trim(); - this.isOptional = true; - - src = src.substring(nameRange[1]+1); - - // has default value? - var nameAndValue = this.name.split("="); - if (nameAndValue.length) { - this.name = nameAndValue.shift().trim(); - this.defaultValue = nameAndValue.join("="); - } - } - else { - var parts = src.match(/^(\S+)(?:\s([\s\S]*))?$/); - if (parts) { - if (parts[1]) this.name = parts[1]; - if (parts[2]) src = parts[2].trim(); - else src = ""; - } - } - - return src; -} - -/*t: - requires("../frame/String.js"); - plan(9, "testing JSDOC.DocTag.parser.nibbleName"); - - var tag = new JSDOC.DocTag(); - - tag.init().nibbleName("[foo] This is a description."); - is(tag.isOptional, true, "isOptional syntax is detected."); - is(tag.name, "foo", "optional param name is found."); - - tag.init().nibbleName("[foo] This is a description."); - is(tag.isOptional, true, "isOptional syntax is detected when no type."); - is(tag.name, "foo", "optional param name is found when no type."); - - tag.init().nibbleName("[foo=7] This is a description."); - is(tag.name, "foo", "optional param name is found when default value."); - is(tag.defaultValue, 7, "optional param default value is found when default value."); - - //tag.init().nibbleName("[foo= a value] This is a description."); - //is(tag.defaultValue, " a value", "optional param default value is found when default value has spaces (issue #112)."); - - tag.init().nibbleName("[foo=[]] This is a description."); - is(tag.defaultValue, "[]", "optional param default value is found when default value is [] (issue #95)."); - - tag.init().nibbleName("[foo=a=b] This is a description."); - is(tag.name, "foo", "optional param name is found when default value is a=b."); - is(tag.defaultValue, "a=b", "optional param default value is found when default value is a=b.") - */ - -/*t: - plan(32, "Testing JSDOC.DocTag.parser."); - requires("../frame/String.js"); - - var tag = new JSDOC.DocTag(); - - is(typeof tag, "object", "JSDOC.DocTag.parser with an empty string returns an object."); - is(typeof tag.title, "string", "returned object has a string property 'title'."); - is(typeof tag.type, "string", "returned object has a string property 'type'."); - is(typeof tag.name, "string", "returned object has a string property 'name'."); - is(typeof tag.defaultValue, "string", "returned object has a string property 'defaultValue'."); - is(typeof tag.isOptional, "boolean", "returned object has a boolean property 'isOptional'."); - is(typeof tag.desc, "string", "returned object has a string property 'desc'."); - - tag = new JSDOC.DocTag("param {widget} foo"); - is(tag.title, "param", "param title is found."); - is(tag.name, "foo", "param name is found when desc is missing."); - is(tag.desc, "", "param desc is empty when missing."); - - tag = new JSDOC.DocTag("param {object} date A valid date."); - is(tag.name, "date", "param name is found with a type."); - is(tag.type, "object", "param type is found."); - is(tag.desc, "A valid date.", "param desc is found with a type."); - - tag = new JSDOC.DocTag("param aName a description goes\n here."); - is(tag.name, "aName", "param name is found without a type."); - is(tag.desc, "a description goes\n here.", "param desc is found without a type."); - - tag = new JSDOC.DocTag("param {widget}"); - is(tag.name, "", "param name is empty when it is not given."); - - tag = new JSDOC.DocTag("param {widget} [foo] This is a description."); - is(tag.name, "foo", "optional param name is found."); - - tag = new JSDOC.DocTag("return {aType} This is a description."); - is(tag.type, "aType", "when return tag has no name, type is found."); - is(tag.desc, "This is a description.", "when return tag has no name, desc is found."); - - tag = new JSDOC.DocTag("author Joe Coder "); - is(tag.title, "author", "author tag has a title."); - is(tag.type, "", "the author tag has no type."); - is(tag.name, "", "the author tag has no name."); - is(tag.desc, "Joe Coder ", "author tag has desc."); - - tag = new JSDOC.DocTag("private \t\n "); - is(tag.title, "private", "private tag has a title."); - is(tag.type, "", "the private tag has no type."); - is(tag.name, "", "the private tag has no name."); - is(tag.desc, "", "private tag has no desc."); - - tag = new JSDOC.DocTag("example\n example(code);\n more();"); - is(tag.desc, " example(code);\n more();", "leading whitespace (less one) in examples code is preserved."); - - tag = new JSDOC.DocTag("param theName \n"); - is(tag.name, "theName", "name only is found."); - - tag = new JSDOC.DocTag("type theDesc \n"); - is(tag.desc, "theDesc", "desc only is found."); - - tag = new JSDOC.DocTag("type {theType} \n"); - is(tag.type, "theType", "type only is found."); - - tag = new JSDOC.DocTag(""); - is(tag.title, "", "title is empty when tag is empty."); - */ \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js b/util/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js deleted file mode 100644 index 9de967f5..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/JsDoc.js +++ /dev/null @@ -1,126 +0,0 @@ -/** - @constructor - @param [opt] Used to override the commandline options. Useful for testing. - @version $Id: JsDoc.js 769 2009-01-11 12:13:00Z micmath $ -*/ -JSDOC.JsDoc = function(/**object*/ opt) { - if (opt) { - JSDOC.opt = opt; - } - - if (JSDOC.opt.h) { - JSDOC.usage(); - quit(); - } - - // defend against options that are not sane - if (JSDOC.opt._.length == 0) { - LOG.warn("No source files to work on. Nothing to do."); - quit(); - } - if (JSDOC.opt.t === true || JSDOC.opt.d === true) { - JSDOC.usage(); - } - - if (typeof JSDOC.opt.d == "string") { - if (!JSDOC.opt.d.charAt(JSDOC.opt.d.length-1).match(/[\\\/]/)) { - JSDOC.opt.d = JSDOC.opt.d+"/"; - } - LOG.inform("Output directory set to '"+JSDOC.opt.d+"'."); - IO.mkPath(JSDOC.opt.d); - } - if (JSDOC.opt.e) IO.setEncoding(JSDOC.opt.e); - - // the -r option: scan source directories recursively - if (typeof JSDOC.opt.r == "boolean") JSDOC.opt.r = 10; - else if (!isNaN(parseInt(JSDOC.opt.r))) JSDOC.opt.r = parseInt(JSDOC.opt.r); - else JSDOC.opt.r = 1; - - // the -D option: define user variables - var D = {}; - if (JSDOC.opt.D) { - for (var i = 0; i < JSDOC.opt.D.length; i++) { - var defineParts = JSDOC.opt.D[i].split(":", 2); - if (defineParts) D[defineParts[0]] = defineParts[1]; - } - } - JSDOC.opt.D = D; - // combine any conf file D options with the commandline D options - if (defined(JSDOC.conf)) for (var c in JSDOC.conf.D) { - if (!defined(JSDOC.opt.D[c])) { - JSDOC.opt.D[c] = JSDOC.conf.D[c]; - } - } - - // Give plugins a chance to initialize - if (defined(JSDOC.PluginManager)) { - JSDOC.PluginManager.run("onInit", JSDOC.opt); - } - - JSDOC.opt.srcFiles = JSDOC.JsDoc._getSrcFiles(); - JSDOC.JsDoc._parseSrcFiles(); - JSDOC.JsDoc.symbolSet = JSDOC.Parser.symbols; -} - -/** - Retrieve source file list. - @returns {String[]} The pathnames of the files to be parsed. - */ -JSDOC.JsDoc._getSrcFiles = function() { - JSDOC.JsDoc.srcFiles = []; - - var ext = ["js"]; - if (JSDOC.opt.x) { - ext = JSDOC.opt.x.split(",").map(function($) {return $.toLowerCase()}); - } - - for (var i = 0; i < JSDOC.opt._.length; i++) { - JSDOC.JsDoc.srcFiles = JSDOC.JsDoc.srcFiles.concat( - IO.ls(JSDOC.opt._[i], JSDOC.opt.r).filter( - function($) { - var thisExt = $.split(".").pop().toLowerCase(); - - if (JSDOC.opt.E) { - for(var n = 0; n < JSDOC.opt.E.length; n++) { - if ($.match(new RegExp(JSDOC.opt.E[n]))) { - LOG.inform("Excluding " + $); - return false; // if the file matches the regex then it's excluded. - } - } - } - - return (ext.indexOf(thisExt) > -1 || thisExt in JSDOC.handlers); // we're only interested in files with certain extensions - } - ) - ); - } - - return JSDOC.JsDoc.srcFiles; -} - -JSDOC.JsDoc._parseSrcFiles = function() { - JSDOC.Parser.init(); - for (var i = 0, l = JSDOC.JsDoc.srcFiles.length; i < l; i++) { - var srcFile = JSDOC.JsDoc.srcFiles[i]; - - if (JSDOC.opt.v) LOG.inform("Parsing file: " + srcFile); - - try { - var src = IO.readFile(srcFile); - } - catch(e) { - LOG.warn("Can't read source file '"+srcFile+"': "+e.message); - } - - var tr = new JSDOC.TokenReader(); - var ts = new JSDOC.TokenStream(tr.tokenize(new JSDOC.TextStream(src))); - - JSDOC.Parser.parse(ts, srcFile); - - } - JSDOC.Parser.finish(); - - if (JSDOC.PluginManager) { - JSDOC.PluginManager.run("onFinishedParsing", JSDOC.Parser.symbols); - } -} diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js b/util/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js deleted file mode 100644 index 79ac61f0..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/JsPlate.js +++ /dev/null @@ -1,109 +0,0 @@ -/** - @constructor -*/ -JSDOC.JsPlate = function(templateFile) { - if (templateFile) this.template = IO.readFile(templateFile); - - this.templateFile = templateFile; - this.code = ""; - this.parse(); -} - -JSDOC.JsPlate.prototype.parse = function() { - this.template = this.template.replace(/\{#[\s\S]+?#\}/gi, ""); - this.code = "var output=``"+this.template; - - this.code = this.code.replace( - //gi, - function (match, eachName, inName) { - return "``;\rvar $"+eachName+"_keys = keys("+inName+");\rfor(var $"+eachName+"_i = 0; $"+eachName+"_i < $"+eachName+"_keys.length; $"+eachName+"_i++) {\rvar $"+eachName+"_last = ($"+eachName+"_i == $"+eachName+"_keys.length-1);\rvar $"+eachName+"_key = $"+eachName+"_keys[$"+eachName+"_i];\rvar "+eachName+" = "+inName+"[$"+eachName+"_key];\routput+=``"; - } - ); - this.code = this.code.replace(//g, "``;\rif ($1) { output+=``"); - this.code = this.code.replace(//g, "``;}\relse if ($1) { output+=``"); - this.code = this.code.replace(//g, "``;}\relse { output+=``"); - this.code = this.code.replace(/<\/(if|for)>/g, "``;\r};\routput+=``"); - this.code = this.code.replace( - /\{\+\s*([\s\S]+?)\s*\+\}/gi, - function (match, code) { - code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code - code = code.replace(/(\r?\n)/g, " "); - return "``+ ("+code+") +``"; - } - ); - this.code = this.code.replace( - /\{!\s*([\s\S]+?)\s*!\}/gi, - function (match, code) { - code = code.replace(/"/g, "``"); // prevent qoute-escaping of inline code - code = code.replace(/(\n)/g, " "); - return "``; "+code+";\routput+=``"; - } - ); - this.code = this.code+"``;"; - - this.code = this.code.replace(/(\r?\n)/g, "\\n"); - this.code = this.code.replace(/"/g, "\\\""); - this.code = this.code.replace(/``/g, "\""); -} - -JSDOC.JsPlate.prototype.toCode = function() { - return this.code; -} - -JSDOC.JsPlate.keys = function(obj) { - var keys = []; - if (obj.constructor.toString().indexOf("Array") > -1) { - for (var i = 0; i < obj.length; i++) { - keys.push(i); - } - } - else { - for (var i in obj) { - keys.push(i); - } - } - return keys; -}; - -JSDOC.JsPlate.values = function(obj) { - var values = []; - if (obj.constructor.toString().indexOf("Array") > -1) { - for (var i = 0; i < obj.length; i++) { - values.push(obj[i]); - } - } - else { - for (var i in obj) { - values.push(obj[i]); - } - } - return values; -}; - -JSDOC.JsPlate.prototype.process = function(data, compact) { - var keys = JSDOC.JsPlate.keys; - var values = JSDOC.JsPlate.values; - - try { - eval(this.code); - } - catch (e) { - print(">> There was an error evaluating the compiled code from template: "+this.templateFile); - print(" The error was on line "+e.lineNumber+" "+e.name+": "+e.message); - var lines = this.code.split("\r"); - if (e.lineNumber-2 >= 0) print("line "+(e.lineNumber-1)+": "+lines[e.lineNumber-2]); - print("line "+e.lineNumber+": "+lines[e.lineNumber-1]); - print(""); - } - - if (compact) { // patch by mcbain.asm - // Remove lines that contain only space-characters, usually left by lines in the template - // which originally only contained JSPlate tags or code. This makes it easier to write - // non-tricky templates which still put out nice code (not bloated with extra lines). - // Lines purposely left blank (just a line ending) are left alone. - output = output.replace(/\s+?(\r?)\n/g, "$1\n"); - } - - /*debug*///print(this.code); - return output; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/Lang.js b/util/jsdoc-toolkit/app/lib/JSDOC/Lang.js deleted file mode 100644 index 62919d7d..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/Lang.js +++ /dev/null @@ -1,144 +0,0 @@ -/** - @namespace -*/ -JSDOC.Lang = { -} - -JSDOC.Lang.isBuiltin = function(name) { - return (JSDOC.Lang.isBuiltin.coreObjects.indexOf(name) > -1); -} -JSDOC.Lang.isBuiltin.coreObjects = ['_global_', 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String']; - -JSDOC.Lang.whitespace = function(ch) { - return JSDOC.Lang.whitespace.names[ch]; -} -JSDOC.Lang.whitespace.names = { - " ": "SPACE", - "\f": "FORMFEED", - "\t": "TAB", - "\u0009": "UNICODE_TAB", - "\u000A": "UNICODE_NBR", - "\u0008": "VERTICAL_TAB" -}; - -JSDOC.Lang.newline = function(ch) { - return JSDOC.Lang.newline.names[ch]; -} -JSDOC.Lang.newline.names = { - "\n": "NEWLINE", - "\r": "RETURN", - "\u000A": "UNICODE_LF", - "\u000D": "UNICODE_CR", - "\u2029": "UNICODE_PS", - "\u2028": "UNICODE_LS" -}; - -JSDOC.Lang.keyword = function(word) { - return JSDOC.Lang.keyword.names["="+word]; -} -JSDOC.Lang.keyword.names = { - "=break": "BREAK", - "=case": "CASE", - "=catch": "CATCH", - "=const": "VAR", - "=continue": "CONTINUE", - "=default": "DEFAULT", - "=delete": "DELETE", - "=do": "DO", - "=else": "ELSE", - "=false": "FALSE", - "=finally": "FINALLY", - "=for": "FOR", - "=function": "FUNCTION", - "=if": "IF", - "=in": "IN", - "=instanceof": "INSTANCEOF", - "=new": "NEW", - "=null": "NULL", - "=return": "RETURN", - "=switch": "SWITCH", - "=this": "THIS", - "=throw": "THROW", - "=true": "TRUE", - "=try": "TRY", - "=typeof": "TYPEOF", - "=void": "VOID", - "=while": "WHILE", - "=with": "WITH", - "=var": "VAR" -}; - -JSDOC.Lang.punc = function(ch) { - return JSDOC.Lang.punc.names[ch]; -} -JSDOC.Lang.punc.names = { - ";": "SEMICOLON", - ",": "COMMA", - "?": "HOOK", - ":": "COLON", - "||": "OR", - "&&": "AND", - "|": "BITWISE_OR", - "^": "BITWISE_XOR", - "&": "BITWISE_AND", - "===": "STRICT_EQ", - "==": "EQ", - "=": "ASSIGN", - "!==": "STRICT_NE", - "!=": "NE", - "<<": "LSH", - "<=": "LE", - "<": "LT", - ">>>": "URSH", - ">>": "RSH", - ">=": "GE", - ">": "GT", - "++": "INCREMENT", - "--": "DECREMENT", - "+": "PLUS", - "-": "MINUS", - "*": "MUL", - "/": "DIV", - "%": "MOD", - "!": "NOT", - "~": "BITWISE_NOT", - ".": "DOT", - "[": "LEFT_BRACKET", - "]": "RIGHT_BRACKET", - "{": "LEFT_CURLY", - "}": "RIGHT_CURLY", - "(": "LEFT_PAREN", - ")": "RIGHT_PAREN" -}; - -JSDOC.Lang.matching = function(name) { - return JSDOC.Lang.matching.names[name]; -} -JSDOC.Lang.matching.names = { - "LEFT_PAREN": "RIGHT_PAREN", - "RIGHT_PAREN": "LEFT_PAREN", - "LEFT_CURLY": "RIGHT_CURLY", - "RIGHT_CURLY": "LEFT_CURLY", - "LEFT_BRACE": "RIGHT_BRACE", - "RIGHT_BRACE": "LEFT_BRACE" -} - -JSDOC.Lang.isNumber = function(str) { - return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str); -} - -JSDOC.Lang.isHexDec = function(str) { - return /^0x[0-9A-F]+$/i.test(str); -} - -JSDOC.Lang.isWordChar = function(str) { - return /^[a-zA-Z0-9$_.]+$/.test(str); -} - -JSDOC.Lang.isSpace = function(str) { - return (typeof JSDOC.Lang.whitespace(str) != "undefined"); -} - -JSDOC.Lang.isNewline = function(str) { - return (typeof JSDOC.Lang.newline(str) != "undefined"); -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/Parser.js b/util/jsdoc-toolkit/app/lib/JSDOC/Parser.js deleted file mode 100644 index 3fdbd1c0..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/Parser.js +++ /dev/null @@ -1,107 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - @namespace - @requires JSDOC.Walker - @requires JSDOC.Symbol - @requires JSDOC.DocComment -*/ -JSDOC.Parser = { - conf: { - ignoreCode: JSDOC.opt.n, - ignoreAnonymous: true, // factory: true - treatUnderscoredAsPrivate: true, // factory: true - explain: false // factory: false - }, - - addSymbol: function(symbol) { - // if a symbol alias is documented more than once the last one with the user docs wins - if (JSDOC.Parser.symbols.hasSymbol(symbol.alias)) { - var oldSymbol = JSDOC.Parser.symbols.getSymbol(symbol.alias); - if (oldSymbol.comment.isUserComment) { - if (symbol.comment.isUserComment) { // old and new are both documented - LOG.warn("The symbol '"+symbol.alias+"' is documented more than once."); - } - else { // old is documented but new isn't - return; - } - } - } - - // we don't document anonymous things - if (JSDOC.Parser.conf.ignoreAnonymous && symbol.name.match(/\$anonymous\b/)) return; - - // uderscored things may be treated as if they were marked private, this cascades - if (JSDOC.Parser.conf.treatUnderscoredAsPrivate && symbol.name.match(/[.#-]_[^.#-]+$/)) { - if (!symbol.comment.getTag("public").length > 0) symbol.isPrivate = true; - } - - // -p flag is required to document private things - if (!JSDOC.opt.p && symbol.isPrivate) return; // issue #161 fixed by mcbain.asm - - // ignored things are not documented, this doesn't cascade - if (symbol.isIgnored) return; - JSDOC.Parser.symbols.addSymbol(symbol); - }, - - addBuiltin: function(name) { - var builtin = new JSDOC.Symbol(name, [], "CONSTRUCTOR", new JSDOC.DocComment("")); - builtin.isNamespace = true; - builtin.srcFile = ""; - builtin.isPrivate = false; - JSDOC.Parser.addSymbol(builtin); - return builtin; - }, - - init: function() { - JSDOC.Parser.symbols = new JSDOC.SymbolSet(); - JSDOC.Parser.walker = new JSDOC.Walker(); - }, - - finish: function() { - JSDOC.Parser.symbols.relate(); - - // make a litle report about what was found - if (JSDOC.Parser.conf.explain) { - var symbols = JSDOC.Parser.symbols.toArray(); - var srcFile = ""; - for (var i = 0, l = symbols.length; i < l; i++) { - var symbol = symbols[i]; - if (srcFile != symbol.srcFile) { - srcFile = symbol.srcFile; - print("\n"+srcFile+"\n-------------------"); - } - print(i+":\n alias => "+symbol.alias + "\n name => "+symbol.name+ "\n isa => "+symbol.isa + "\n memberOf => " + symbol.memberOf + "\n isStatic => " + symbol.isStatic + ", isInner => " + symbol.isInner+ ", isPrivate => " + symbol.isPrivate); - } - print("-------------------\n"); - } - } -} - -JSDOC.Parser.parse = function(/**JSDOC.TokenStream*/ts, /**String*/srcFile) { - JSDOC.Symbol.srcFile = (srcFile || ""); - JSDOC.DocComment.shared = ""; // shared comments don't cross file boundaries - - if (!JSDOC.Parser.walker) JSDOC.Parser.init(); - JSDOC.Parser.walker.walk(ts); // adds to our symbols - - // filter symbols by option - for (var p = JSDOC.Parser.symbols._index.first(); p; p = JSDOC.Parser.symbols._index.next()) { - var symbol = p.value; - - if (!symbol) continue; - - if (symbol.is("FILE") || symbol.is("GLOBAL")) { - continue; - } - else if (!JSDOC.opt.a && !symbol.comment.isUserComment) { - JSDOC.Parser.symbols.deleteSymbol(symbol.alias); - } - - if (/#$/.test(symbol.alias)) { // we don't document prototypes - JSDOC.Parser.symbols.deleteSymbol(symbol.alias); - } - } - - return JSDOC.Parser.symbols.toArray(); -} diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js b/util/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js deleted file mode 100644 index 9c911931..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/PluginManager.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - @namespace Holds functionality related to running plugins. -*/ -JSDOC.PluginManager = { -} - -/** - @param name A unique name that identifies that plugin. - @param handlers A collection of named functions. The names correspond to hooks in the core code. -*/ -JSDOC.PluginManager.registerPlugin = function(/**String*/name, /**Object*/handlers) { - if (!defined(JSDOC.PluginManager.plugins)) - /** The collection of all plugins. Requires a unique name for each. - */ - JSDOC.PluginManager.plugins = {}; - - - JSDOC.PluginManager.plugins[name] = handlers; -} - -/** - @param hook The name of the hook that is being caught. - @param target Any object. This will be passed as the only argument to the handler whose - name matches the hook name. Handlers cannot return a value, so must modify the target - object to have an effect. -*/ -JSDOC.PluginManager.run = function(/**String*/hook, /**Mixed*/target) { - for (var name in JSDOC.PluginManager.plugins) { - if (defined(JSDOC.PluginManager.plugins[name][hook])) { - JSDOC.PluginManager.plugins[name][hook](target); - } - } -} diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/Symbol.js b/util/jsdoc-toolkit/app/lib/JSDOC/Symbol.js deleted file mode 100644 index 35e34cc0..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/Symbol.js +++ /dev/null @@ -1,643 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - Create a new Symbol. - @class Represents a symbol in the source code. - */ -JSDOC.Symbol = function() { - this.init(); - if (arguments.length) this.populate.apply(this, arguments); -} - -JSDOC.Symbol.prototype.init = function() { - this.$args = []; - this.addOn = ""; - this.alias = ""; - this.augments = []; - this.author = ""; - this.classDesc = ""; - this.comment = {}; - this.defaultValue = undefined; - this.deprecated = ""; - this.desc = ""; - this.fires = []; - this.example = []; - this.exceptions = []; - this.inherits = []; - this.inheritsFrom = []; - this.isa = "OBJECT"; - this.isEvent = false; - this.isConstant = false; - this.isIgnored = false; - this.isInner = false; - this.isEvent = false; - this.isNamespace = false; - this.isPrivate = false; - this.isStatic = false; - this.memberOf = ""; - this.methods = []; - this._name = ""; - this._params = []; - this.properties = []; - this.requires = []; - this.returns = []; - this.see = []; - this.since = ""; - this.srcFile = {}; - this.type = ""; - this.version = ""; -} - -JSDOC.Symbol.prototype.serialize = function() { - var keys = []; - for (var p in this) { - keys.push (p); - } - keys = keys.sort(); - - var out = ""; - for (var i in keys) { - if (typeof this[keys[i]] == "function") continue; - out += keys[i]+" => "+Dumper.dump(this[keys[i]])+",\n"; - } - return "\n{\n" + out + "}\n"; -} - -JSDOC.Symbol.prototype.clone = function() { - var clone = new JSDOC.Symbol(); - clone.populate.apply(clone, this.$args); // repopulate using the original arguments - clone.srcFile = this.srcFile; // not the current srcFile, the one when the original was made - return clone; -} - -JSDOC.Symbol.prototype.__defineSetter__("name", - function(n) { n = n.replace(/^_global_[.#-]/, ""); n = n.replace(/\.prototype\.?/g, '#'); this._name = n; } -); -JSDOC.Symbol.prototype.__defineGetter__("name", - function() { return this._name; } -); -JSDOC.Symbol.prototype.__defineSetter__("params", - function(v) { - for (var i = 0, l = v.length; i < l; i++) { - if (v[i].constructor != JSDOC.DocTag) { // may be a generic object parsed from signature, like {type:..., name:...} - this._params[i] = new JSDOC.DocTag("param"+((v[i].type)?" {"+v[i].type+"}":"")+" "+v[i].name); - } - else { - this._params[i] = v[i]; - } - } - } -); -JSDOC.Symbol.prototype.__defineGetter__("params", - function() { return this._params; } -); - -JSDOC.Symbol.prototype.getEvents = function() { - var events = []; - for (var i = 0, l = this.methods.length; i < l; i++) { - if (this.methods[i].isEvent) { - this.methods[i].name = this.methods[i].name.replace("event:", ""); - events.push(this.methods[i]); - } - } - return events; -} - -JSDOC.Symbol.prototype.getMethods = function() { - var nonEvents = []; - for (var i = 0, l = this.methods.length; i < l; i++) { - if (!this.methods[i].isEvent) { - nonEvents.push(this.methods[i]); - } - } - return nonEvents; -} - - -JSDOC.Symbol.prototype.populate = function( - /** String */ name, - /** Object[] */ params, - /** String */ isa, - /** JSDOC.DocComment */ comment -) { - this.$args = arguments; - - this.name = name; - this.alias = this.name; - - this.params = params; - this.isa = (isa == "VIRTUAL")? "OBJECT":isa; - this.comment = comment || new JSDOC.DocComment(""); - this.srcFile = JSDOC.Symbol.srcFile; - - if (this.is("FILE") && !this.alias) this.alias = this.srcFile; - - this.setTags(); - - if (typeof JSDOC.PluginManager != "undefined") { - JSDOC.PluginManager.run("onSymbol", this); - } -} - -JSDOC.Symbol.prototype.setTags = function() { - // @author - var authors = this.comment.getTag("author"); - if (authors.length) { - this.author = authors.map(function($){return $.desc;}).join(", "); - } - - /*t: - plan(34, "testing JSDOC.Symbol"); - - requires("../lib/JSDOC/DocComment.js"); - requires("../frame/String.js"); - requires("../lib/JSDOC/DocTag.js"); - - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@author Joe Smith*"+"/")); - is(sym.author, "Joe Smith", "@author tag, author is found."); - */ - - // @desc - var descs = this.comment.getTag("desc"); - if (descs.length) { - this.desc = descs.map(function($){return $.desc;}).join("\n"); // multiple descriptions are concatenated into one - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@desc This is a description.*"+"/")); - is(sym.desc, "This is a description.", "@desc tag, description is found."); - */ - - // @overview - if (this.is("FILE")) { - if (!this.alias) this.alias = this.srcFile; - - var overviews = this.comment.getTag("overview"); - if (overviews.length) { - this.desc = [this.desc].concat(overviews.map(function($){return $.desc;})).join("\n"); - } - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@overview This is an overview.*"+"/")); - is(sym.desc, "\nThis is an overview.", "@overview tag, description is found."); - */ - - // @since - var sinces = this.comment.getTag("since"); - if (sinces.length) { - this.since = sinces.map(function($){return $.desc;}).join(", "); - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@since 1.01*"+"/")); - is(sym.since, "1.01", "@since tag, description is found."); - */ - - // @constant - if (this.comment.getTag("constant").length) { - this.isConstant = true; - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@constant*"+"/")); - is(sym.isConstant, true, "@constant tag, isConstant set."); - */ - - // @version - var versions = this.comment.getTag("version"); - if (versions.length) { - this.version = versions.map(function($){return $.desc;}).join(", "); - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@version 2.0x*"+"/")); - is(sym.version, "2.0x", "@version tag, version is found."); - */ - - // @deprecated - var deprecateds = this.comment.getTag("deprecated"); - if (deprecateds.length) { - this.deprecated = deprecateds.map(function($){return $.desc;}).join("\n"); - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@deprecated Use other method.*"+"/")); - is(sym.deprecated, "Use other method.", "@deprecated tag, desc is found."); - */ - - // @example - var examples = this.comment.getTag("example"); - if (examples.length) { - this.example = examples.map( - // trim trailing whitespace - function($) { - $.desc = $.desc.replace(/\s+$/, ""); - return $; - } - ); - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@example This\n is an example. \n*"+"/")); - isnt(typeof sym.example[0], "undefined", "@example tag, creates sym.example array."); - is(sym.example[0], "This\n is an example.", "@example tag, desc is found."); - */ - - // @see - var sees = this.comment.getTag("see"); - if (sees.length) { - var thisSee = this.see; - sees.map(function($){thisSee.push($.desc);}); - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FILE", new JSDOC.DocComment("/**@see The other thing.*"+"/")); - is(sym.see, "The other thing.", "@see tag, desc is found."); - */ - - // @class - var classes = this.comment.getTag("class"); - if (classes.length) { - this.isa = "CONSTRUCTOR"; - this.classDesc = classes[0].desc; // desc can't apply to the constructor as there is none. - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@class This describes the class.*"+"/")); - is(sym.isa, "CONSTRUCTOR", "@class tag, makes symbol a constructor."); - is(sym.classDesc, "This describes the class.", "@class tag, class description is found."); - */ - - // @namespace - var namespaces = this.comment.getTag("namespace"); - if (namespaces.length) { - this.classDesc = namespaces[0].desc; - this.isNamespace = true; - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@namespace This describes the namespace.*"+"/")); - is(sym.classDesc, "This describes the namespace.", "@namespace tag, class description is found."); - */ - - // @param - var params = this.comment.getTag("param"); - if (params.length) { - // user-defined params overwrite those with same name defined by the parser - var thisParams = this.params; - - if (thisParams.length == 0) { // none exist yet, so just bung all these user-defined params straight in - this.params = params; - } - else { // need to overlay these user-defined params on to existing parser-defined params - for (var i = 0, l = params.length; i < l; i++) { - if (thisParams[i]) { - if (params[i].type) thisParams[i].type = params[i].type; - thisParams[i].name = params[i].name; - thisParams[i].desc = params[i].desc; - thisParams[i].isOptional = params[i].isOptional; - thisParams[i].defaultValue = params[i].defaultValue; - } - else thisParams[i] = params[i]; - } - } - } - - /*t: - var sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.*"+"/")); - is(sym.params.length, 1, "parser defined param is found."); - - sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages*"+"/")); - is(sym.params.length, 1, "user defined param is found."); - is(sym.params[0].type, "array", "user defined param type is found."); - is(sym.params[0].name, "pages", "user defined param name is found."); - - sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/")); - is(sym.params.length, 1, "user defined param overwrites parser defined param."); - is(sym.params[0].type, "string", "user defined param type overwrites parser defined param type."); - is(sym.params[0].name, "uid", "user defined param name overwrites parser defined param name."); - - sym = new JSDOC.Symbol("foo", [{type: "array", name: "pages"}, {type: "number", name: "count"}], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {string} uid*"+"/")); - is(sym.params.length, 2, "user defined params overlay parser defined params."); - is(sym.params[1].type, "number", "user defined param type overlays parser defined param type."); - is(sym.params[1].name, "count", "user defined param name overlays parser defined param name."); - - sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**Description.\n@param {array} pages The pages description.*"+"/")); - is(sym.params.length, 1, "user defined param with description is found."); - is(sym.params[0].desc, "The pages description.", "user defined param description is found."); - */ - - // @constructor - if (this.comment.getTag("constructor").length) { - this.isa = "CONSTRUCTOR"; - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@constructor*"+"/")); - is(sym.isa, "CONSTRUCTOR", "@constructor tag, makes symbol a constructor."); - */ - - // @static - if (this.comment.getTag("static").length) { - this.isStatic = true; - if (this.isa == "CONSTRUCTOR") { - this.isNamespace = true; - } - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@static\n@constructor*"+"/")); - is(sym.isStatic, true, "@static tag, makes isStatic true."); - is(sym.isNamespace, true, "@static and @constructor tag, makes isNamespace true."); - */ - - // @inner - if (this.comment.getTag("inner").length) { - this.isInner = true; - this.isStatic = false; - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@inner*"+"/")); - is(sym.isStatic, false, "@inner tag, makes isStatic false."); - is(sym.isInner, true, "@inner makes isInner true."); - */ - - // @name - var names = this.comment.getTag("name"); - if (names.length) { - this.name = names[0].desc; - } - - /*t: - // todo - */ - - // @field - if (this.comment.getTag("field").length) { - this.isa = "OBJECT"; - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "FUNCTION", new JSDOC.DocComment("/**@field*"+"/")); - is(sym.isa, "OBJECT", "@field tag, makes symbol an object."); - */ - - // @function - if (this.comment.getTag("function").length) { - this.isa = "FUNCTION"; - if (/event:/.test(this.alias)) this.isEvent = true; - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@function*"+"/")); - is(sym.isa, "FUNCTION", "@function tag, makes symbol a function."); - */ - - // @event - var events = this.comment.getTag("event"); - if (events.length) { - this.isa = "FUNCTION"; - this.isEvent = true; - if (!/event:/.test(this.alias)) - this.alias = this.alias.replace(/^(.*[.#-])([^.#-]+)$/, "$1event:$2"); - } - - /*t: - var sym = new JSDOC.Symbol("foo", [], "OBJECT", new JSDOC.DocComment("/**@event*"+"/")); - is(sym.isa, "FUNCTION", "@event tag, makes symbol a function."); - is(sym.isEvent, true, "@event makes isEvent true."); - */ - - // @fires - var fires = this.comment.getTag("fires"); - if (fires.length) { - for (var i = 0; i < fires.length; i++) { - this.fires.push(fires[i].desc); - } - } - - /*t: - // todo - */ - - // @property - var properties = this.comment.getTag("property"); - if (properties.length) { - thisProperties = this.properties; - for (var i = 0; i < properties.length; i++) { - var property = new JSDOC.Symbol(this.alias+"#"+properties[i].name, [], "OBJECT", new JSDOC.DocComment("/**"+properties[i].desc+"\n@name "+properties[i].name+"\n@memberOf "+this.alias+"#*/")); - // TODO: shouldn't the following happen in the addProperty method of Symbol? - property.name = properties[i].name; - property.memberOf = this.alias; - if (properties[i].type) property.type = properties[i].type; - if (properties[i].defaultValue) property.defaultValue = properties[i].defaultValue; - this.addProperty(property); - JSDOC.Parser.addSymbol(property); - } - } - - /*t: - // todo - */ - - // @return - var returns = this.comment.getTag("return"); - if (returns.length) { // there can be many return tags in a single doclet - this.returns = returns; - this.type = returns.map(function($){return $.type}).join(", "); - } - - /*t: - // todo - */ - - // @exception - this.exceptions = this.comment.getTag("throws"); - - /*t: - // todo - */ - - // @requires - var requires = this.comment.getTag("requires"); - if (requires.length) { - this.requires = requires.map(function($){return $.desc}); - } - - /*t: - // todo - */ - - // @type - var types = this.comment.getTag("type"); - if (types.length) { - this.type = types[0].desc; //multiple type tags are ignored - } - - /*t: - // todo - */ - - // @private - if (this.comment.getTag("private").length || this.isInner) { - this.isPrivate = true; - } - - // @ignore - if (this.comment.getTag("ignore").length) { - this.isIgnored = true; - } - - /*t: - // todo - */ - - // @inherits ... as ... - var inherits = this.comment.getTag("inherits"); - if (inherits.length) { - for (var i = 0; i < inherits.length; i++) { - if (/^\s*([a-z$0-9_.#:-]+)(?:\s+as\s+([a-z$0-9_.#:-]+))?/i.test(inherits[i].desc)) { - var inAlias = RegExp.$1; - var inAs = RegExp.$2 || inAlias; - - if (inAlias) inAlias = inAlias.replace(/\.prototype\.?/g, "#"); - - if (inAs) { - inAs = inAs.replace(/\.prototype\.?/g, "#"); - inAs = inAs.replace(/^this\.?/, "#"); - } - - if (inAs.indexOf(inAlias) != 0) { //not a full namepath - var joiner = "."; - if (this.alias.charAt(this.alias.length-1) == "#" || inAs.charAt(0) == "#") { - joiner = ""; - } - inAs = this.alias + joiner + inAs; - } - } - this.inherits.push({alias: inAlias, as: inAs}); - } - } - - /*t: - // todo - */ - - // @augments - this.augments = this.comment.getTag("augments"); - - // @default - var defaults = this.comment.getTag("default"); - if (defaults.length) { - if (this.is("OBJECT")) { - this.defaultValue = defaults[0].desc; - } - } - - /*t: - // todo - */ - - // @memberOf - var memberOfs = this.comment.getTag("memberOf"); - if (memberOfs.length) { - this.memberOf = memberOfs[0].desc; - this.memberOf = this.memberOf.replace(/\.prototype\.?/g, "#"); - } - - /*t: - // todo - */ - - // @public - if (this.comment.getTag("public").length) { - this.isPrivate = false; - } - - /*t: - // todo - */ - - if (JSDOC.PluginManager) { - JSDOC.PluginManager.run("onSetTags", this); - } -} - -JSDOC.Symbol.prototype.is = function(what) { - return this.isa === what; -} - -JSDOC.Symbol.prototype.isBuiltin = function() { - return JSDOC.Lang.isBuiltin(this.alias); -} - -JSDOC.Symbol.prototype.setType = function(/**String*/comment, /**Boolean*/overwrite) { - if (!overwrite && this.type) return; - var typeComment = JSDOC.DocComment.unwrapComment(comment); - this.type = typeComment; -} - -JSDOC.Symbol.prototype.inherit = function(symbol) { - if (!this.hasMember(symbol.name) && !symbol.isInner) { - if (symbol.is("FUNCTION")) - this.methods.push(symbol); - else if (symbol.is("OBJECT")) - this.properties.push(symbol); - } -} - -JSDOC.Symbol.prototype.hasMember = function(name) { - return (this.hasMethod(name) || this.hasProperty(name)); -} - -JSDOC.Symbol.prototype.addMember = function(symbol) { - if (symbol.is("FUNCTION")) { this.addMethod(symbol); } - else if (symbol.is("OBJECT")) { this.addProperty(symbol); } -} - -JSDOC.Symbol.prototype.hasMethod = function(name) { - var thisMethods = this.methods; - for (var i = 0, l = thisMethods.length; i < l; i++) { - if (thisMethods[i].name == name) return true; - if (thisMethods[i].alias == name) return true; - } - return false; -} - -JSDOC.Symbol.prototype.addMethod = function(symbol) { - var methodAlias = symbol.alias; - var thisMethods = this.methods; - for (var i = 0, l = thisMethods.length; i < l; i++) { - if (thisMethods[i].alias == methodAlias) { - thisMethods[i] = symbol; // overwriting previous method - return; - } - } - thisMethods.push(symbol); // new method with this alias -} - -JSDOC.Symbol.prototype.hasProperty = function(name) { - var thisProperties = this.properties; - for (var i = 0, l = thisProperties.length; i < l; i++) { - if (thisProperties[i].name == name) return true; - if (thisProperties[i].alias == name) return true; - } - return false; -} - -JSDOC.Symbol.prototype.addProperty = function(symbol) { - var propertyAlias = symbol.alias; - var thisProperties = this.properties; - for (var i = 0, l = thisProperties.length; i < l; i++) { - if (thisProperties[i].alias == propertyAlias) { - thisProperties[i] = symbol; // overwriting previous property - return; - } - } - - thisProperties.push(symbol); // new property with this alias -} - -JSDOC.Symbol.srcFile = ""; //running reference to the current file being parsed diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js b/util/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js deleted file mode 100644 index 1ea23e29..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/SymbolSet.js +++ /dev/null @@ -1,229 +0,0 @@ -/** @constructor */ -JSDOC.SymbolSet = function() { - this.init(); -} - -JSDOC.SymbolSet.prototype.init = function() { - this._index = new Hash(); -} - -JSDOC.SymbolSet.prototype.keys = function() { - return this._index.keys(); -} - -JSDOC.SymbolSet.prototype.hasSymbol = function(alias) { - return this._index.hasKey(alias); -} - -JSDOC.SymbolSet.prototype.addSymbol = function(symbol) { - if (this.hasSymbol(symbol.alias)) { - LOG.warn("Overwriting symbol documentation for: "+symbol.alias + "."); - } - this._index.set(symbol.alias, symbol); -} - -JSDOC.SymbolSet.prototype.getSymbol = function(alias) { - if (this.hasSymbol(alias)) return this._index.get(alias); -} - -JSDOC.SymbolSet.prototype.getSymbolByName = function(name) { - for (var p = this._index.first(); p; p = this._index.next()) { - var symbol = p.value; - if (symbol.name == name) return symbol; - } -} - -JSDOC.SymbolSet.prototype.toArray = function() { - return this._index.values(); -} - -JSDOC.SymbolSet.prototype.deleteSymbol = function(alias) { - if (!this.hasSymbol(alias)) return; - this._index.drop(alias); -} - -JSDOC.SymbolSet.prototype.renameSymbol = function(oldName, newName) { - // todo: should check if oldname or newname already exist - this._index.replace(oldName, newName); - this._index.get(newName).alias = newName; - return newName; -} - -JSDOC.SymbolSet.prototype.relate = function() { - this.resolveBorrows(); - this.resolveMemberOf(); - this.resolveAugments(); -} - -JSDOC.SymbolSet.prototype.resolveBorrows = function() { - for (var p = this._index.first(); p; p = this._index.next()) { - var symbol = p.value; - if (symbol.is("FILE") || symbol.is("GLOBAL")) continue; - - var borrows = symbol.inherits; - for (var i = 0; i < borrows.length; i++) { - var borrowed = this.getSymbol(borrows[i].alias); - if (!borrowed) { - LOG.warn("Can't borrow undocumented "+borrows[i].alias+"."); - continue; - } - - var borrowAsName = borrows[i].as; - var borrowAsAlias = borrowAsName; - if (!borrowAsName) { - LOG.warn("Malformed @borrow, 'as' is required."); - continue; - } - - if (borrowAsName.length > symbol.alias.length && borrowAsName.indexOf(symbol.alias) == 0) { - borrowAsName = borrowAsName.replace(borrowed.alias, "") - } - else { - var joiner = ""; - if (borrowAsName.charAt(0) != "#") joiner = "."; - borrowAsAlias = borrowed.alias + joiner + borrowAsName; - } - - borrowAsName = borrowAsName.replace(/^[#.]/, ""); - - if (this.hasSymbol(borrowAsAlias)) continue; - - var clone = borrowed.clone(); - clone.name = borrowAsName; - clone.alias = borrowAsAlias; - this.addSymbol(clone); - } - } -} - -JSDOC.SymbolSet.prototype.resolveMemberOf = function() { - for (var p = this._index.first(); p; p = this._index.next()) { - var symbol = p.value; - if (symbol.is("FILE") || symbol.is("GLOBAL")) continue; - - // the memberOf value was provided in the @memberOf tag - else if (symbol.memberOf) { - - // like foo.bar is a memberOf foo - if (symbol.alias.indexOf(symbol.memberOf) == 0) { - var memberMatch = new RegExp("^("+symbol.memberOf+")[.#-]?(.+)$"); - var aliasParts = symbol.alias.match(memberMatch); - - if (aliasParts) { - symbol.memberOf = aliasParts[1]; - symbol.name = aliasParts[2]; - } - - var nameParts = symbol.name.match(memberMatch); - - if (nameParts) { - symbol.name = nameParts[2]; - } - } - // like bar is a memberOf foo - else { - var joiner = symbol.memberOf.charAt(symbol.memberOf.length-1); - if (!/[.#-]/.test(joiner)) symbol.memberOf += "."; - this.renameSymbol(symbol.alias, symbol.memberOf + symbol.name); - } - } - // the memberOf must be calculated - else { - var parts = symbol.alias.match(/^(.*[.#-])([^.#-]+)$/); - if (parts) { - symbol.memberOf = parts[1]; - symbol.name = parts[2]; - } - } - - // set isStatic, isInner - if (symbol.memberOf) { - switch (symbol.memberOf.charAt(symbol.memberOf.length-1)) { - case '#' : - symbol.isStatic = false; - symbol.isInner = false; - break; - case '.' : - symbol.isStatic = true; - symbol.isInner = false; - break; - case '-' : - symbol.isStatic = false; - symbol.isInner = true; - break; - default: // memberOf ends in none of the above - symbol.isStatic = true; - break; - } - } - - // unowned methods and fields belong to the global object - if (!symbol.is("CONSTRUCTOR") && !symbol.isNamespace && symbol.memberOf == "") { - symbol.memberOf = "_global_"; - } - - // clean up - if (symbol.memberOf.match(/[.#-]$/)) { - symbol.memberOf = symbol.memberOf.substr(0, symbol.memberOf.length-1); - } - // add to parent's methods or properties list - if (symbol.memberOf) { - - var container = this.getSymbol(symbol.memberOf); - if (!container) { - if (JSDOC.Lang.isBuiltin(symbol.memberOf)) container = JSDOC.Parser.addBuiltin(symbol.memberOf); - else { - LOG.warn("Trying to document "+symbol.name +" as a member of undocumented symbol "+symbol.memberOf+"."); - } - } - - if (container) container.addMember(symbol); - } - } -} - -JSDOC.SymbolSet.prototype.resolveAugments = function() { - for (var p = this._index.first(); p; p = this._index.next()) { - var symbol = p.value; - - if (symbol.alias == "_global_" || symbol.is("FILE")) continue; - JSDOC.SymbolSet.prototype.walk.apply(this, [symbol]); - } -} - -JSDOC.SymbolSet.prototype.walk = function(symbol) { - var augments = symbol.augments; - for(var i = 0; i < augments.length; i++) { - var contributer = this.getSymbol(augments[i]); - if (!contributer && JSDOC.Lang.isBuiltin(''+augments[i])) { - contributer = new JSDOC.Symbol("_global_."+augments[i], [], augments[i], new JSDOC.DocComment("Built in.")); - contributer.isNamespace = true; - contributer.srcFile = ""; - contributer.isPrivate = false; - JSDOC.Parser.addSymbol(contributer); - } - - if (contributer) { - if (contributer.augments.length) { - JSDOC.SymbolSet.prototype.walk.apply(this, [contributer]); - } - - symbol.inheritsFrom.push(contributer.alias); - //if (!isUnique(symbol.inheritsFrom)) { - // LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once."); - //} - //else { - var cmethods = contributer.methods; - var cproperties = contributer.properties; - - for (var ci = 0, cl = cmethods.length; ci < cl; ci++) { - if (!cmethods[ci].isStatic) symbol.inherit(cmethods[ci]); - } - for (var ci = 0, cl = cproperties.length; ci < cl; ci++) { - if (!cproperties[ci].isStatic) symbol.inherit(cproperties[ci]); - } - //} - } - else LOG.warn("Can't augment contributer: "+augments[i]+", not found."); - } -} diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/TextStream.js b/util/jsdoc-toolkit/app/lib/JSDOC/TextStream.js deleted file mode 100644 index ccc48a87..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/TextStream.js +++ /dev/null @@ -1,41 +0,0 @@ - -/** - @constructor -*/ -JSDOC.TextStream = function(text) { - if (typeof(text) == "undefined") text = ""; - text = ""+text; - this.text = text; - this.cursor = 0; -} - -JSDOC.TextStream.prototype.look = function(n) { - if (typeof n == "undefined") n = 0; - - if (this.cursor+n < 0 || this.cursor+n >= this.text.length) { - var result = new String(""); - result.eof = true; - return result; - } - return this.text.charAt(this.cursor+n); -} - -JSDOC.TextStream.prototype.next = function(n) { - if (typeof n == "undefined") n = 1; - if (n < 1) return null; - - var pulled = ""; - for (var i = 0; i < n; i++) { - if (this.cursor+i < this.text.length) { - pulled += this.text.charAt(this.cursor+i); - } - else { - var result = new String(""); - result.eof = true; - return result; - } - } - - this.cursor += n; - return pulled; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/Token.js b/util/jsdoc-toolkit/app/lib/JSDOC/Token.js deleted file mode 100644 index fb7f9d94..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/Token.js +++ /dev/null @@ -1,18 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - @constructor -*/ -JSDOC.Token = function(data, type, name) { - this.data = data; - this.type = type; - this.name = name; -} - -JSDOC.Token.prototype.toString = function() { - return "<"+this.type+" name=\""+this.name+"\">"+this.data+""; -} - -JSDOC.Token.prototype.is = function(what) { - return this.name === what || this.type === what; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js b/util/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js deleted file mode 100644 index 9f658fb9..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/TokenReader.js +++ /dev/null @@ -1,332 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - @class Search a {@link JSDOC.TextStream} for language tokens. -*/ -JSDOC.TokenReader = function() { - this.keepDocs = true; - this.keepWhite = false; - this.keepComments = false; -} - -/** - @type {JSDOC.Token[]} - */ -JSDOC.TokenReader.prototype.tokenize = function(/**JSDOC.TextStream*/stream) { - var tokens = []; - /**@ignore*/ tokens.last = function() { return tokens[tokens.length-1]; } - /**@ignore*/ tokens.lastSym = function() { - for (var i = tokens.length-1; i >= 0; i--) { - if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i]; - } - } - - while (!stream.look().eof) { - if (this.read_mlcomment(stream, tokens)) continue; - if (this.read_slcomment(stream, tokens)) continue; - if (this.read_dbquote(stream, tokens)) continue; - if (this.read_snquote(stream, tokens)) continue; - if (this.read_regx(stream, tokens)) continue; - if (this.read_numb(stream, tokens)) continue; - if (this.read_punc(stream, tokens)) continue; - if (this.read_newline(stream, tokens)) continue; - if (this.read_space(stream, tokens)) continue; - if (this.read_word(stream, tokens)) continue; - - // if execution reaches here then an error has happened - tokens.push(new JSDOC.Token(stream.next(), "TOKN", "UNKNOWN_TOKEN")); - } - return tokens; -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_word = function(/**JSDOC.TokenStream*/stream, tokens) { - var found = ""; - while (!stream.look().eof && JSDOC.Lang.isWordChar(stream.look())) { - found += stream.next(); - } - - if (found === "") { - return false; - } - else { - var name; - if ((name = JSDOC.Lang.keyword(found))) tokens.push(new JSDOC.Token(found, "KEYW", name)); - else tokens.push(new JSDOC.Token(found, "NAME", "NAME")); - return true; - } -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_punc = function(/**JSDOC.TokenStream*/stream, tokens) { - var found = ""; - var name; - while (!stream.look().eof && JSDOC.Lang.punc(found+stream.look())) { - found += stream.next(); - } - - if (found === "") { - return false; - } - else { - tokens.push(new JSDOC.Token(found, "PUNC", JSDOC.Lang.punc(found))); - return true; - } -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_space = function(/**JSDOC.TokenStream*/stream, tokens) { - var found = ""; - - while (!stream.look().eof && JSDOC.Lang.isSpace(stream.look())) { - found += stream.next(); - } - - if (found === "") { - return false; - } - else { - if (this.collapseWhite) found = " "; - if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "SPACE")); - return true; - } -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_newline = function(/**JSDOC.TokenStream*/stream, tokens) { - var found = ""; - - while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look())) { - found += stream.next(); - } - - if (found === "") { - return false; - } - else { - if (this.collapseWhite) found = "\n"; - if (this.keepWhite) tokens.push(new JSDOC.Token(found, "WHIT", "NEWLINE")); - return true; - } -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_mlcomment = function(/**JSDOC.TokenStream*/stream, tokens) { - if (stream.look() == "/" && stream.look(1) == "*") { - var found = stream.next(2); - - while (!stream.look().eof && !(stream.look(-1) == "/" && stream.look(-2) == "*")) { - found += stream.next(); - } - - // to start doclet we allow /** or /*** but not /**/ or /**** - if (/^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) tokens.push(new JSDOC.Token(found, "COMM", "JSDOC")); - else if (this.keepComments) tokens.push(new JSDOC.Token(found, "COMM", "MULTI_LINE_COMM")); - return true; - } - return false; -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_slcomment = function(/**JSDOC.TokenStream*/stream, tokens) { - var found; - if ( - (stream.look() == "/" && stream.look(1) == "/" && (found=stream.next(2))) - || - (stream.look() == "<" && stream.look(1) == "!" && stream.look(2) == "-" && stream.look(3) == "-" && (found=stream.next(4))) - ) { - - while (!stream.look().eof && !JSDOC.Lang.isNewline(stream.look())) { - found += stream.next(); - } - - if (this.keepComments) { - tokens.push(new JSDOC.Token(found, "COMM", "SINGLE_LINE_COMM")); - } - return true; - } - return false; -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_dbquote = function(/**JSDOC.TokenStream*/stream, tokens) { - if (stream.look() == "\"") { - // find terminator - var string = stream.next(); - - while (!stream.look().eof) { - if (stream.look() == "\\") { - if (JSDOC.Lang.isNewline(stream.look(1))) { - do { - stream.next(); - } while (!stream.look().eof && JSDOC.Lang.isNewline(stream.look())); - string += "\\\n"; - } - else { - string += stream.next(2); - } - } - else if (stream.look() == "\"") { - string += stream.next(); - tokens.push(new JSDOC.Token(string, "STRN", "DOUBLE_QUOTE")); - return true; - } - else { - string += stream.next(); - } - } - } - return false; // error! unterminated string -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_snquote = function(/**JSDOC.TokenStream*/stream, tokens) { - if (stream.look() == "'") { - // find terminator - var string = stream.next(); - - while (!stream.look().eof) { - if (stream.look() == "\\") { // escape sequence - string += stream.next(2); - } - else if (stream.look() == "'") { - string += stream.next(); - tokens.push(new JSDOC.Token(string, "STRN", "SINGLE_QUOTE")); - return true; - } - else { - string += stream.next(); - } - } - } - return false; // error! unterminated string -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_numb = function(/**JSDOC.TokenStream*/stream, tokens) { - if (stream.look() === "0" && stream.look(1) == "x") { - return this.read_hex(stream, tokens); - } - - var found = ""; - - while (!stream.look().eof && JSDOC.Lang.isNumber(found+stream.look())){ - found += stream.next(); - } - - if (found === "") { - return false; - } - else { - if (/^0[0-7]/.test(found)) tokens.push(new JSDOC.Token(found, "NUMB", "OCTAL")); - else tokens.push(new JSDOC.Token(found, "NUMB", "DECIMAL")); - return true; - } -} -/*t: - requires("../lib/JSDOC/TextStream.js"); - requires("../lib/JSDOC/Token.js"); - requires("../lib/JSDOC/Lang.js"); - - plan(3, "testing JSDOC.TokenReader.prototype.read_numb"); - - //// setup - var src = "function foo(num){while (num+8.0 >= 0x20 && num < 0777){}}"; - var tr = new JSDOC.TokenReader(); - var tokens = tr.tokenize(new JSDOC.TextStream(src)); - - var hexToken, octToken, decToken; - for (var i = 0; i < tokens.length; i++) { - if (tokens[i].name == "HEX_DEC") hexToken = tokens[i]; - if (tokens[i].name == "OCTAL") octToken = tokens[i]; - if (tokens[i].name == "DECIMAL") decToken = tokens[i]; - } - //// - - is(decToken.data, "8.0", "decimal number is found in source."); - is(hexToken.data, "0x20", "hexdec number is found in source (issue #99)."); - is(octToken.data, "0777", "octal number is found in source."); -*/ - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_hex = function(/**JSDOC.TokenStream*/stream, tokens) { - var found = stream.next(2); - - while (!stream.look().eof) { - if (JSDOC.Lang.isHexDec(found) && !JSDOC.Lang.isHexDec(found+stream.look())) { // done - tokens.push(new JSDOC.Token(found, "NUMB", "HEX_DEC")); - return true; - } - else { - found += stream.next(); - } - } - return false; -} - -/** - @returns {Boolean} Was the token found? - */ -JSDOC.TokenReader.prototype.read_regx = function(/**JSDOC.TokenStream*/stream, tokens) { - var last; - if ( - stream.look() == "/" - && - ( - - ( - !(last = tokens.lastSym()) // there is no last, the regex is the first symbol - || - ( - !last.is("NUMB") - && !last.is("NAME") - && !last.is("RIGHT_PAREN") - && !last.is("RIGHT_BRACKET") - ) - ) - ) - ) { - var regex = stream.next(); - - while (!stream.look().eof) { - if (stream.look() == "\\") { // escape sequence - regex += stream.next(2); - } - else if (stream.look() == "/") { - regex += stream.next(); - - while (/[gmi]/.test(stream.look())) { - regex += stream.next(); - } - - tokens.push(new JSDOC.Token(regex, "REGX", "REGX")); - return true; - } - else { - regex += stream.next(); - } - } - // error: unterminated regex - } - return false; -} diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js b/util/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js deleted file mode 100644 index 1eeb44cb..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/TokenStream.js +++ /dev/null @@ -1,133 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** - @constructor -*/ -JSDOC.TokenStream = function(tokens) { - this.tokens = (tokens || []); - this.rewind(); -} - -/** - @constructor - @private -*/ -function VoidToken(/**String*/type) { - this.toString = function() {return ""}; - this.is = function(){return false;} -} - -JSDOC.TokenStream.prototype.rewind = function() { - this.cursor = -1; -} - -/** - @type JSDOC.Token -*/ -JSDOC.TokenStream.prototype.look = function(/**Number*/n, /**Boolean*/considerWhitespace) { - if (typeof n == "undefined") n = 0; - - if (considerWhitespace == true) { - if (this.cursor+n < 0 || this.cursor+n > this.tokens.length) return {}; - return this.tokens[this.cursor+n]; - } - else { - var count = 0; - var i = this.cursor; - - while (true) { - if (i < 0) return new JSDOC.Token("", "VOID", "START_OF_STREAM"); - else if (i > this.tokens.length) return new JSDOC.Token("", "VOID", "END_OF_STREAM"); - - if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT"))) { - if (n < 0) i--; else i++; - continue; - } - - if (count == Math.abs(n)) { - return this.tokens[i]; - } - count++; - (n < 0)? i-- : i++; - } - - return new JSDOC.Token("", "VOID", "STREAM_ERROR"); // because null isn't an object and caller always expects an object - } -} - -/** - @type JSDOC.Token|JSDOC.Token[] -*/ -JSDOC.TokenStream.prototype.next = function(/**Number*/howMany) { - if (typeof howMany == "undefined") howMany = 1; - if (howMany < 1) return null; - var got = []; - - for (var i = 1; i <= howMany; i++) { - if (this.cursor+i >= this.tokens.length) { - return null; - } - got.push(this.tokens[this.cursor+i]); - } - this.cursor += howMany; - - if (howMany == 1) { - return got[0]; - } - else return got; -} - -/** - @type JSDOC.Token[] -*/ -JSDOC.TokenStream.prototype.balance = function(/**String*/start, /**String*/stop) { - if (!stop) stop = JSDOC.Lang.matching(start); - - var depth = 0; - var got = []; - var started = false; - - while ((token = this.look())) { - if (token.is(start)) { - depth++; - started = true; - } - - if (started) { - got.push(token); - } - - if (token.is(stop)) { - depth--; - if (depth == 0) return got; - } - if (!this.next()) break; - } -} - -JSDOC.TokenStream.prototype.getMatchingToken = function(/**String*/start, /**String*/stop) { - var depth = 0; - var cursor = this.cursor; - - if (!start) { - start = JSDOC.Lang.matching(stop); - depth = 1; - } - if (!stop) stop = JSDOC.Lang.matching(start); - - while ((token = this.tokens[cursor])) { - if (token.is(start)) { - depth++; - } - - if (token.is(stop) && cursor) { - depth--; - if (depth == 0) return this.tokens[cursor]; - } - cursor++; - } -} - -JSDOC.TokenStream.prototype.insertAhead = function(/**JSDOC.Token*/token) { - this.tokens.splice(this.cursor+1, 0, token); -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/Util.js b/util/jsdoc-toolkit/app/lib/JSDOC/Util.js deleted file mode 100644 index 6d7edb36..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/Util.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @namespace - * @deprecated Use {@link FilePath} instead. - */ -JSDOC.Util = { -} - -/** - * @deprecated Use {@link FilePath.fileName} instead. - */ -JSDOC.Util.fileName = function(path) { - LOG.warn("JSDOC.Util.fileName is deprecated. Use FilePath.fileName instead."); - var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); - return path.substring(nameStart); -} - -/** - * @deprecated Use {@link FilePath.fileExtension} instead. - */ -JSDOC.Util.fileExtension = function(filename) { - LOG.warn("JSDOC.Util.fileExtension is deprecated. Use FilePath.fileExtension instead."); - return filename.split(".").pop().toLowerCase(); -}; - -/** - * @deprecated Use {@link FilePath.dir} instead. - */ -JSDOC.Util.dir = function(path) { - LOG.warn("JSDOC.Util.dir is deprecated. Use FilePath.dir instead."); - var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); - return path.substring(0, nameStart-1); -} diff --git a/util/jsdoc-toolkit/app/lib/JSDOC/Walker.js b/util/jsdoc-toolkit/app/lib/JSDOC/Walker.js deleted file mode 100644 index 803aba21..00000000 --- a/util/jsdoc-toolkit/app/lib/JSDOC/Walker.js +++ /dev/null @@ -1,459 +0,0 @@ -if (typeof JSDOC == "undefined") JSDOC = {}; - -/** @constructor */ -JSDOC.Walker = function(/**JSDOC.TokenStream*/ts) { - this.init(); - if (typeof ts != "undefined") { - this.walk(ts); - } -} - -JSDOC.Walker.prototype.init = function() { - this.ts = null; - - var globalSymbol = new JSDOC.Symbol("_global_", [], "GLOBAL", new JSDOC.DocComment("")); - globalSymbol.isNamespace = true; - globalSymbol.srcFile = ""; - globalSymbol.isPrivate = false; - JSDOC.Parser.addSymbol(globalSymbol); - this.lastDoc = null; - this.token = null; - - /** - The chain of symbols under which we are currently nested. - @type Array - */ - this.namescope = [globalSymbol]; - this.namescope.last = function(n){ if (!n) n = 0; return this[this.length-(1+n)] || "" }; -} - -JSDOC.Walker.prototype.walk = function(/**JSDOC.TokenStream*/ts) { - this.ts = ts; - while (this.token = this.ts.look()) { - if (this.token.popNamescope) { - - var symbol = this.namescope.pop(); - if (symbol.is("FUNCTION")) { - if (this.ts.look(1).is("LEFT_PAREN") && symbol.comment.getTag("function").length == 0) { - symbol.isa = "OBJECT"; - } - } - } - this.step(); - if (!this.ts.next()) break; - } -} - -JSDOC.Walker.prototype.step = function() { - if (this.token.is("JSDOC")) { // it's a doc comment - - var doc = new JSDOC.DocComment(this.token.data); - - if (doc.getTag("lends").length > 0) { - var lends = doc.getTag("lends")[0]; - - var name = lends.desc - if (!name) throw "@lends tag requires a value."; - - var symbol = new JSDOC.Symbol(name, [], "OBJECT", doc); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - - this.lastDoc = null; - return true; - } - else if (doc.getTag("name").length > 0 && doc.getTag("overview").length == 0) { // it's a virtual symbol - var virtualName = doc.getTag("name")[0].desc; - if (!virtualName) throw "@name tag requires a value."; - - var symbol = new JSDOC.Symbol(virtualName, [], "VIRTUAL", doc); - - JSDOC.Parser.addSymbol(symbol); - - this.lastDoc = null; - return true; - } - else if (doc.meta) { // it's a meta doclet - if (doc.meta == "@+") JSDOC.DocComment.shared = doc.src; - else if (doc.meta == "@-") JSDOC.DocComment.shared = ""; - else if (doc.meta == "nocode+") JSDOC.Parser.conf.ignoreCode = true; - else if (doc.meta == "nocode-") JSDOC.Parser.conf.ignoreCode = JSDOC.opt.n; - else throw "Unrecognized meta comment: "+doc.meta; - - this.lastDoc = null; - return true; - } - else if (doc.getTag("overview").length > 0) { // it's a file overview - symbol = new JSDOC.Symbol("", [], "FILE", doc); - - JSDOC.Parser.addSymbol(symbol); - - this.lastDoc = null; - return true; - } - else { - this.lastDoc = doc; - return false; - } - } - else if (!JSDOC.Parser.conf.ignoreCode) { // it's code - if (this.token.is("NAME")) { - var symbol; - var name = this.token.data; - var doc = null; if (this.lastDoc) doc = this.lastDoc; - var params = []; - - // it's inside an anonymous object - if (this.ts.look(1).is("COLON") && this.ts.look(-1).is("LEFT_CURLY") && !(this.ts.look(-2).is("JSDOC") || this.namescope.last().comment.getTag("lends").length || this.ts.look(-2).is("ASSIGN") || this.ts.look(-2).is("COLON"))) { - name = "$anonymous"; - name = this.namescope.last().alias+"-"+name - - params = []; - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - - JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken(null, "RIGHT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // function foo() {} - else if (this.ts.look(-1).is("FUNCTION") && this.ts.look(1).is("LEFT_PAREN")) { - var isInner; - - if (this.lastDoc) doc = this.lastDoc; - name = this.namescope.last().alias+"-"+name; - if (!this.namescope.last().is("GLOBAL")) isInner = true; - - params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN")); - - symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc); - if (isInner) symbol.isInner = true; - - if (this.ts.look(1).is("JSDOC")) { - var inlineReturn = ""+this.ts.look(1).data; - inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, ""); - symbol.type = inlineReturn; - } - - JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // foo = function() {} - else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("FUNCTION")) { - var isInner; - if (this.ts.look(-1).is("VAR") || this.isInner) { - name = this.namescope.last().alias+"-"+name - if (!this.namescope.last().is("GLOBAL")) isInner = true; - } - else if (name.indexOf("this.") == 0) { - name = this.resolveThis(name); - } - - if (this.lastDoc) doc = this.lastDoc; - params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN")); - - symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc); - if (isInner) symbol.isInner = true; - - if (this.ts.look(1).is("JSDOC")) { - var inlineReturn = ""+this.ts.look(1).data; - inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, ""); - symbol.type = inlineReturn; - } - - JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // foo = new function() {} - else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("NEW") && this.ts.look(3).is("FUNCTION")) { - var isInner; - if (this.ts.look(-1).is("VAR") || this.isInner) { - name = this.namescope.last().alias+"-"+name - if (!this.namescope.last().is("GLOBAL")) isInner = true; - } - else if (name.indexOf("this.") == 0) { - name = this.resolveThis(name); - } - - if (this.lastDoc) doc = this.lastDoc; - params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN")); - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - if (isInner) symbol.isInner = true; - - if (this.ts.look(1).is("JSDOC")) { - var inlineReturn = ""+this.ts.look(1).data; - inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, ""); - symbol.type = inlineReturn; - } - - JSDOC.Parser.addSymbol(symbol); - - symbol.scopeType = "INSTANCE"; - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // foo: function() {} - else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("FUNCTION")) { - name = (this.namescope.last().alias+"."+name).replace("#.", "#"); - - if (this.lastDoc) doc = this.lastDoc; - params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN")); - - if (doc && doc.getTag("constructs").length) { - name = name.replace(/\.prototype(\.|$)/, "#"); - - if (name.indexOf("#") > -1) name = name.match(/(^[^#]+)/)[0]; - else name = this.namescope.last().alias; - - symbol = new JSDOC.Symbol(name, params, "CONSTRUCTOR", doc); - } - else { - symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc); - } - - if (this.ts.look(1).is("JSDOC")) { - var inlineReturn = ""+this.ts.look(1).data; - inlineReturn = inlineReturn.replace(/(^\/\*\* *| *\*\/$)/g, ""); - symbol.type = inlineReturn; - } - - JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // foo = {} - else if (this.ts.look(1).is("ASSIGN") && this.ts.look(2).is("LEFT_CURLY")) { - var isInner; - if (this.ts.look(-1).is("VAR") || this.isInner) { - name = this.namescope.last().alias+"-"+name - if (!this.namescope.last().is("GLOBAL")) isInner = true; - } - else if (name.indexOf("this.") == 0) { - name = this.resolveThis(name); - } - - if (this.lastDoc) doc = this.lastDoc; - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - if (isInner) symbol.isInner = true; - - - if (doc) JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // var foo; - else if (this.ts.look(1).is("SEMICOLON")) { - var isInner; - if (this.ts.look(-1).is("VAR") || this.isInner) { - name = this.namescope.last().alias+"-"+name - if (!this.namescope.last().is("GLOBAL")) isInner = true; - - if (this.lastDoc) doc = this.lastDoc; - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - if (isInner) symbol.isInner = true; - - - if (doc) JSDOC.Parser.addSymbol(symbol); - } - } - // foo = x - else if (this.ts.look(1).is("ASSIGN")) { - - var isInner; - if (this.ts.look(-1).is("VAR") || this.isInner) { - name = this.namescope.last().alias+"-"+name - if (!this.namescope.last().is("GLOBAL")) isInner = true; - } - else if (name.indexOf("this.") == 0) { - name = this.resolveThis(name); - } - - if (this.lastDoc) doc = this.lastDoc; - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - if (isInner) symbol.isInner = true; - - - if (doc) JSDOC.Parser.addSymbol(symbol); - } - // foo: {} - else if (this.ts.look(1).is("COLON") && this.ts.look(2).is("LEFT_CURLY")) { - name = (this.namescope.last().alias+"."+name).replace("#.", "#"); - - if (this.lastDoc) doc = this.lastDoc; - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - - - if (doc) JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - // foo: x - else if (this.ts.look(1).is("COLON")) { - name = (this.namescope.last().alias+"."+name).replace("#.", "#");; - - if (this.lastDoc) doc = this.lastDoc; - - symbol = new JSDOC.Symbol(name, params, "OBJECT", doc); - - - if (doc) JSDOC.Parser.addSymbol(symbol); - } - // foo(...) - else if (this.ts.look(1).is("LEFT_PAREN")) { - if (typeof JSDOC.PluginManager != "undefined") { - var functionCall = {name: name}; - - var cursor = this.ts.cursor; - params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN")); - this.ts.cursor = cursor; - - for (var i = 0; i < params.length; i++) - functionCall["arg" + (i + 1)] = params[i].name; - - JSDOC.PluginManager.run("onFunctionCall", functionCall); - if (functionCall.doc) { - this.ts.insertAhead(new JSDOC.Token(functionCall.doc, "COMM", "JSDOC")); - } - } - } - this.lastDoc = null; - } - else if (this.token.is("FUNCTION")) { // it's an anonymous function - if ( - (!this.ts.look(-1).is("COLON") || !this.ts.look(-1).is("ASSIGN")) - && !this.ts.look(1).is("NAME") - ) { - if (this.lastDoc) doc = this.lastDoc; - - name = "$anonymous"; - name = this.namescope.last().alias+"-"+name - - params = JSDOC.Walker.onParamList(this.ts.balance("LEFT_PAREN")); - - symbol = new JSDOC.Symbol(name, params, "FUNCTION", doc); - - - JSDOC.Parser.addSymbol(symbol); - - this.namescope.push(symbol); - - var matching = this.ts.getMatchingToken("LEFT_CURLY"); - if (matching) matching.popNamescope = name; - else LOG.warn("Mismatched } character. Can't parse code in file " + symbol.srcFile + "."); - } - } - } - return true; -} - -/** - Resolves what "this." means when it appears in a name. - @param name The name that starts with "this.". - @returns The name with "this." resolved. - */ -JSDOC.Walker.prototype.resolveThis = function(name) { - name.match(/^this\.(.+)$/) - var nameFragment = RegExp.$1; - if (!nameFragment) return name; - - var symbol = this.namescope.last(); - var scopeType = symbol.scopeType || symbol.isa; - - // if we are in a constructor function, `this` means the instance - if (scopeType == "CONSTRUCTOR") { - name = symbol.alias+"#"+nameFragment; - } - - // if we are in an anonymous constructor function, `this` means the instance - else if (scopeType == "INSTANCE") { - name = symbol.alias+"."+nameFragment; - } - - // if we are in a function, `this` means the container (possibly the global) - else if (scopeType == "FUNCTION") { - // in a method of a prototype, so `this` means the constructor - if (symbol.alias.match(/(^.*)[#.-][^#.-]+/)) { - var parentName = RegExp.$1; - var parent = JSDOC.Parser.symbols.getSymbol(parentName); - - if (!parent) { - if (JSDOC.Lang.isBuiltin(parentName)) parent = JSDOC.Parser.addBuiltin(parentName); - else { - if (symbol.alias.indexOf("$anonymous") < 0) // these will be ignored eventually - LOG.warn("Trying to document "+symbol.alias+" without first documenting "+parentName+"."); - } - } - if (parent) name = parentName+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment; - } - else { - parent = this.namescope.last(1); - name = parent.alias+(parent.is("CONSTRUCTOR")?"#":".")+nameFragment; - } - } - // otherwise it means the global - else { - name = nameFragment; - } - - return name; -} - -JSDOC.Walker.onParamList = function(/**Array*/paramTokens) { - if (!paramTokens) { - LOG.warn("Malformed parameter list. Can't parse code."); - return []; - } - var params = []; - for (var i = 0, l = paramTokens.length; i < l; i++) { - if (paramTokens[i].is("JSDOC")) { - var paramType = paramTokens[i].data.replace(/(^\/\*\* *| *\*\/$)/g, ""); - - if (paramTokens[i+1] && paramTokens[i+1].is("NAME")) { - i++; - params.push({type: paramType, name: paramTokens[i].data}); - } - } - else if (paramTokens[i].is("NAME")) { - params.push({name: paramTokens[i].data}); - } - } - return params; -} diff --git a/util/jsdoc-toolkit/app/main.js b/util/jsdoc-toolkit/app/main.js deleted file mode 100644 index cf032eea..00000000 --- a/util/jsdoc-toolkit/app/main.js +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @version $Id: main.js 769 2009-01-11 12:13:00Z micmath $ - */ - -function main() { - IO.include("lib/JSDOC.js"); - IO.includeDir("plugins/"); - - // process the options - - // the -c option: options are defined in a configuration file - if (JSDOC.opt.c) { - eval("JSDOC.conf = " + IO.readFile(JSDOC.opt.c)); - - LOG.inform("Using configuration file at '"+JSDOC.opt.c+"'."); - - for (var c in JSDOC.conf) { - if (c !== "D" && !defined(JSDOC.opt[c])) { // commandline overrules config file - JSDOC.opt[c] = JSDOC.conf[c]; - } - } - - if (typeof JSDOC.conf["_"] != "undefined") { - JSDOC.opt["_"] = JSDOC.opt["_"].concat(JSDOC.conf["_"]); - } - - LOG.inform("With configuration: "); - for (var o in JSDOC.opt) { - LOG.inform(" "+o+": "+JSDOC.opt[o]); - } - } - - // be verbose - if (JSDOC.opt.v) LOG.verbose = true; - - // send log messages to a file - if (JSDOC.opt.o) LOG.out = IO.open(JSDOC.opt.o); - - // run the unit tests - if (JSDOC.opt.T) { - LOG.inform("JsDoc Toolkit running in test mode at "+new Date()+"."); - IO.include("frame/Testrun.js"); - IO.include("test.js"); - } - else { - // a template must be defined and must be a directory path - if (!JSDOC.opt.t && System.getProperty("jsdoc.template.dir")) { - JSDOC.opt.t = System.getProperty("jsdoc.template.dir"); - } - if (JSDOC.opt.t && !JSDOC.opt.t.charAt(JSDOC.opt.t.length-1).match(/[\\\/]/)) { - JSDOC.opt.t += SYS.slash; - } - - // verbose messages about the options we were given - LOG.inform("JsDoc Toolkit main() running at "+new Date()+"."); - LOG.inform("With options: "); - for (var o in JSDOC.opt) { - LOG.inform(" "+o+": "+JSDOC.opt[o]); - } - - // initialize and build a symbolSet from your code - JSDOC.JsDoc(); - - // debugger's option: dump the entire symbolSet produced from your code - if (JSDOC.opt.Z) { - LOG.warn("So you want to see the data structure, eh? This might hang if you have circular refs..."); - IO.include("frame/Dumper.js"); - var symbols = JSDOC.JsDoc.symbolSet.toArray(); - for (var i = 0, l = symbols.length; i < l; i++) { - var symbol = symbols[i]; - print("// symbol: " + symbol.alias); - print(symbol.serialize()); - } - } - else { - if (typeof JSDOC.opt.t != "undefined") { - try { - // a file named "publish.js" must exist in the template directory - load(JSDOC.opt.t+"publish.js"); - - // and must define a function named "publish" - if (!publish) { - LOG.warn("No publish() function is defined in that template so nothing to do."); - } - else { - // which will be called with the symbolSet produced from your code - publish(JSDOC.JsDoc.symbolSet); - } - } - catch(e) { - LOG.warn("Sorry, that doesn't seem to be a valid template: "+JSDOC.opt.t+"publish.js : "+e); - } - } - else { - LOG.warn("No template or handlers given. Might as well read the usage notes."); - JSDOC.usage(); - } - } - } - - // notify of any warnings - if (!JSDOC.opt.q && LOG.warnings.length) { - print(LOG.warnings.length+" warning"+(LOG.warnings.length != 1? "s":"")+"."); - } - - // stop sending log messages to a file - if (LOG.out) { - LOG.out.flush(); - LOG.out.close(); - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/plugins/commentSrcJson.js b/util/jsdoc-toolkit/app/plugins/commentSrcJson.js deleted file mode 100644 index e826b572..00000000 --- a/util/jsdoc-toolkit/app/plugins/commentSrcJson.js +++ /dev/null @@ -1,20 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.commentSrcJson", - { - onDocCommentSrc: function(comment) { - var json; - if (/^\s*@json\b/.test(comment)) { - comment.src = new String(comment.src).replace("@json", ""); - - eval("json = "+comment.src); - var tagged = ""; - for (var i in json) { - var tag = json[i]; - // todo handle cases where tag is an object - tagged += "@"+i+" "+tag+"\n"; - } - comment.src = tagged; - } - } - } -); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/plugins/frameworkPrototype.js b/util/jsdoc-toolkit/app/plugins/frameworkPrototype.js deleted file mode 100644 index 9c417518..00000000 --- a/util/jsdoc-toolkit/app/plugins/frameworkPrototype.js +++ /dev/null @@ -1,16 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.frameworkPrototype", - { - onPrototypeClassCreate: function(classCreator) { - var desc = ""; - if (classCreator.comment) { - desc = classCreator.comment; - } - var insert = desc+"/** @name "+classCreator.name+"\n@constructor\n@scope "+classCreator.name+".prototype */" - - insert = insert.replace(/\*\/\/\*\*/g, "\n"); - /*DEBUG*///print("insert is "+insert); - classCreator.addComment.data = insert; - } - } -); diff --git a/util/jsdoc-toolkit/app/plugins/functionCall.js b/util/jsdoc-toolkit/app/plugins/functionCall.js deleted file mode 100644 index 6f87705e..00000000 --- a/util/jsdoc-toolkit/app/plugins/functionCall.js +++ /dev/null @@ -1,10 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.functionCall", - { - onFunctionCall: function(functionCall) { - if (functionCall.name == "dojo.define" && functionCall.arg1) { - functionCall.doc = "/** @lends "+eval(functionCall.arg1)+".prototype */"; - } - } - } -); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/plugins/publishSrcHilite.js b/util/jsdoc-toolkit/app/plugins/publishSrcHilite.js deleted file mode 100644 index 65514f2c..00000000 --- a/util/jsdoc-toolkit/app/plugins/publishSrcHilite.js +++ /dev/null @@ -1,62 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.publishSrcHilite", - { - onPublishSrc: function(src) { - if (src.path in JsHilite.cache) { - return; // already generated src code - } - else JsHilite.cache[src.path] = true; - - try { - var sourceCode = IO.readFile(src.path); - } - catch(e) { - print(e.message); - quit(); - } - - var hiliter = new JsHilite(sourceCode, src.charset); - src.hilited = hiliter.hilite(); - } - } -); - -function JsHilite(src, charset) { - - var tr = new JSDOC.TokenReader(); - - tr.keepComments = true; - tr.keepDocs = true; - tr.keepWhite = true; - - this.tokens = tr.tokenize(new JSDOC.TextStream(src)); - - // TODO is redefining toString() the best way? - JSDOC.Token.prototype.toString = function() { - return ""+this.data.replace(/"; - } - - if (!charset) charset = "utf-8"; - - this.header = ' '+ - "

";
-	this.footer = "
"; - this.showLinenumbers = true; -} - -JsHilite.cache = {}; - -JsHilite.prototype.hilite = function() { - var hilited = this.tokens.join(""); - var line = 1; - if (this.showLinenumbers) hilited = hilited.replace(/(^|\n)/g, function(m){return m+""+((line<10)? " ":"")+((line<100)? " ":"")+(line++)+" "}); - - return this.header+hilited+this.footer; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/plugins/symbolLink.js b/util/jsdoc-toolkit/app/plugins/symbolLink.js deleted file mode 100644 index 615a2813..00000000 --- a/util/jsdoc-toolkit/app/plugins/symbolLink.js +++ /dev/null @@ -1,9 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.symbolLink", - { - onSymbolLink: function(link) { - // modify link.linkPath - // or link.linkText here - } - } -); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/plugins/tagParamConfig.js b/util/jsdoc-toolkit/app/plugins/tagParamConfig.js deleted file mode 100644 index 3ea8a1be..00000000 --- a/util/jsdoc-toolkit/app/plugins/tagParamConfig.js +++ /dev/null @@ -1,31 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.tagParamConfig", - { - onDocCommentTags: function(comment) { - var currentParam = null; - var tags = comment.tags; - for (var i = 0, l = tags.length; i < l; i++) { - - if (tags[i].title == "param") { - if (tags[i].name.indexOf(".") == -1) { - currentParam = i; - } - } - else if (tags[i].title == "config") { - tags[i].title = "param"; - if (currentParam == null) { - tags[i].name = "arguments"+"."+tags[i].name; - } - else if (tags[i].name.indexOf(tags[currentParam].name+".") != 0) { - tags[i].name = tags[currentParam].name+"."+tags[i].name; - } - currentParam != null - //tags[currentParam].properties.push(tags[i]); - } - else { - currentParam = null; - } - } - } - } -); diff --git a/util/jsdoc-toolkit/app/plugins/tagSynonyms.js b/util/jsdoc-toolkit/app/plugins/tagSynonyms.js deleted file mode 100644 index 49a874f1..00000000 --- a/util/jsdoc-toolkit/app/plugins/tagSynonyms.js +++ /dev/null @@ -1,43 +0,0 @@ -JSDOC.PluginManager.registerPlugin( - "JSDOC.tagSynonyms", - { - onDocCommentSrc: function(comment) { - comment.src = comment.src.replace(/@methodOf\b/i, "@function\n@memberOf"); - comment.src = comment.src.replace(/@fieldOf\b/i, "@field\n@memberOf"); - }, - - onDocCommentTags: function(comment) { - for (var i = 0, l = comment.tags.length; i < l; i++) { - var title = comment.tags[i].title.toLowerCase(); - var syn; - if ((syn = JSDOC.tagSynonyms.synonyms["="+title])) { - comment.tags[i].title = syn; - } - } - } - } -); - -new Namespace( - "JSDOC.tagSynonyms", - function() { - JSDOC.tagSynonyms.synonyms = { - "=member": "memberOf", - "=memberof": "memberOf", - "=description": "desc", - "=exception": "throws", - "=argument": "param", - "=returns": "return", - "=classdescription": "class", - "=fileoverview": "overview", - "=extends": "augments", - "=base": "augments", - "=projectdescription": "overview", - "=classdescription": "class", - "=link": "see", - "=borrows": "inherits", - "=scope": "lends", - "=construct": "constructor" - } - } -); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/run.js b/util/jsdoc-toolkit/app/run.js deleted file mode 100644 index 1f875cdb..00000000 --- a/util/jsdoc-toolkit/app/run.js +++ /dev/null @@ -1,348 +0,0 @@ -/** - * @fileOverview - * A bootstrap script that creates some basic required objects - * for loading other scripts. - * @author Michael Mathews, micmath@gmail.com - * @version $Id: run.js 756 2009-01-07 21:32:58Z micmath $ - */ - -/** - * @namespace Keep track of any messages from the running script. - */ -LOG = { - warn: function(msg, e) { - if (JSDOC.opt.q) return; - if (e) msg = e.fileName+", line "+e.lineNumber+": "+msg; - - msg = ">> WARNING: "+msg; - LOG.warnings.push(msg); - if (LOG.out) LOG.out.write(msg+"\n"); - else print(msg); - }, - - inform: function(msg) { - if (JSDOC.opt.q) return; - msg = " > "+msg; - if (LOG.out) LOG.out.write(msg+"\n"); - else if (typeof LOG.verbose != "undefined" && LOG.verbose) print(msg); - } -}; -LOG.warnings = []; -LOG.verbose = false -LOG.out = undefined; - -/** - * @class Manipulate a filepath. - */ -function FilePath(absPath, separator) { - this.slash = separator || "/"; - this.root = this.slash; - this.path = []; - this.file = ""; - - var parts = absPath.split(/[\\\/]/); - if (parts) { - if (parts.length) this.root = parts.shift() + this.slash; - if (parts.length) this.file = parts.pop() - if (parts.length) this.path = parts; - } - - this.path = this.resolvePath(); -} - -/** Collapse any dot-dot or dot items in a filepath. */ -FilePath.prototype.resolvePath = function() { - var resolvedPath = []; - for (var i = 0; i < this.path.length; i++) { - if (this.path[i] == "..") resolvedPath.pop(); - else if (this.path[i] != ".") resolvedPath.push(this.path[i]); - } - return resolvedPath; -} - -/** Trim off the filename. */ -FilePath.prototype.toDir = function() { - if (this.file) this.file = ""; - return this; -} - -/** Go up a directory. */ -FilePath.prototype.upDir = function() { - this.toDir(); - if (this.path.length) this.path.pop(); - return this; -} - -FilePath.prototype.toString = function() { - return this.root - + this.path.join(this.slash) - + ((this.path.length > 0)? this.slash : "") - + this.file; -} - -/** - * Turn a path into just the name of the file. - */ -FilePath.fileName = function(path) { - var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); - return path.substring(nameStart); -} - -/** - * Get the extension of a filename - */ -FilePath.fileExtension = function(filename) { - return filename.split(".").pop().toLowerCase(); -}; - -/** - * Turn a path into just the directory part. - */ -FilePath.dir = function(path) { - var nameStart = Math.max(path.lastIndexOf("/")+1, path.lastIndexOf("\\")+1, 0); - return path.substring(0, nameStart-1); -} - - -importClass(java.lang.System); - -/** - * @namespace A collection of information about your system. - */ -SYS = { - /** - * Information about your operating system: arch, name, version. - * @type string - */ - os: [ - new String(System.getProperty("os.arch")), - new String(System.getProperty("os.name")), - new String(System.getProperty("os.version")) - ].join(", "), - - /** - * Which way does your slash lean. - * @type string - */ - slash: System.getProperty("file.separator")||"/", - - /** - * The path to the working directory where you ran java. - * @type string - */ - userDir: new String(System.getProperty("user.dir")), - - /** - * Where is Java's home folder. - * @type string - */ - javaHome: new String(System.getProperty("java.home")), - - /** - * The absolute path to the directory containing this script. - * @type string - */ - pwd: undefined -}; - -// jsrun appends an argument, with the path to here. -if (arguments[arguments.length-1].match(/^-j=(.+)/)) { - if (RegExp.$1.charAt(0) == SYS.slash || RegExp.$1.charAt(1) == ":") { // absolute path to here - SYS.pwd = new FilePath(RegExp.$1).toDir().toString(); - } - else { // relative path to here - SYS.pwd = new FilePath(SYS.userDir + SYS.slash + RegExp.$1).toDir().toString(); - } - arguments.pop(); -} -else { - print("The run.js script requires you use jsrun.jar."); - quit(); -} - -// shortcut -var File = Packages.java.io.File; - -/** - * @namespace A collection of functions that deal with reading a writing to disk. - */ -IO = { - - /** - * Create a new file in the given directory, with the given name and contents. - */ - saveFile: function(/**string*/ outDir, /**string*/ fileName, /**string*/ content) { - var out = new Packages.java.io.PrintWriter( - new Packages.java.io.OutputStreamWriter( - new Packages.java.io.FileOutputStream(outDir+SYS.slash+fileName), - IO.encoding - ) - ); - out.write(content); - out.flush(); - out.close(); - }, - - /** - * @type string - */ - readFile: function(/**string*/ path) { - if (!IO.exists(path)) { - throw "File doesn't exist there: "+path; - } - return readFile(path, IO.encoding); - }, - - /** - * @param inFile - * @param outDir - * @param [fileName=The original filename] - */ - copyFile: function(/**string*/ inFile, /**string*/ outDir, /**string*/ fileName) { - if (fileName == null) fileName = FilePath.fileName(inFile); - - var inFile = new File(inFile); - var outFile = new File(outDir+SYS.slash+fileName); - - var bis = new Packages.java.io.BufferedInputStream(new Packages.java.io.FileInputStream(inFile), 4096); - var bos = new Packages.java.io.BufferedOutputStream(new Packages.java.io.FileOutputStream(outFile), 4096); - var theChar; - while ((theChar = bis.read()) != -1) { - bos.write(theChar); - } - bos.close(); - bis.close(); - }, - - /** - * Creates a series of nested directories. - */ - mkPath: function(/**Array*/ path) { - if (path.constructor != Array) path = path.split(/[\\\/]/); - var make = ""; - for (var i = 0, l = path.length; i < l; i++) { - make += path[i] + SYS.slash; - if (! IO.exists(make)) { - IO.makeDir(make); - } - } - }, - - /** - * Creates a directory at the given path. - */ - makeDir: function(/**string*/ path) { - (new File(path)).mkdir(); - }, - - /** - * @type string[] - * @param dir The starting directory to look in. - * @param [recurse=1] How many levels deep to scan. - * @returns An array of all the paths to files in the given dir. - */ - ls: function(/**string*/ dir, /**number*/ recurse, _allFiles, _path) { - if (_path === undefined) { // initially - var _allFiles = []; - var _path = [dir]; - } - if (_path.length == 0) return _allFiles; - if (recurse === undefined) recurse = 1; - - dir = new File(dir); - if (!dir.directory) return [String(dir)]; - var files = dir.list(); - - for (var f = 0; f < files.length; f++) { - var file = String(files[f]); - if (file.match(/^\.[^\.\/\\]/)) continue; // skip dot files - - if ((new File(_path.join(SYS.slash)+SYS.slash+file)).list()) { // it's a directory - _path.push(file); - if (_path.length-1 < recurse) IO.ls(_path.join(SYS.slash), recurse, _allFiles, _path); - _path.pop(); - } - else { - _allFiles.push((_path.join(SYS.slash)+SYS.slash+file).replace(SYS.slash+SYS.slash, SYS.slash)); - } - } - - return _allFiles; - }, - - /** - * @type boolean - */ - exists: function(/**string*/ path) { - file = new File(path); - - if (file.isDirectory()){ - return true; - } - if (!file.exists()){ - return false; - } - if (!file.canRead()){ - return false; - } - return true; - }, - - /** - * - */ - open: function(/**string*/ path, /**string*/ append) { - var append = true; - var outFile = new File(path); - var out = new Packages.java.io.PrintWriter( - new Packages.java.io.OutputStreamWriter( - new Packages.java.io.FileOutputStream(outFile, append), - IO.encoding - ) - ); - return out; - }, - - /** - * Sets {@link IO.encoding}. - * Encoding is used when reading and writing text to files, - * and in the meta tags of HTML output. - */ - setEncoding: function(/**string*/ encoding) { - if (/ISO-8859-([0-9]+)/i.test(encoding)) { - IO.encoding = "ISO8859_"+RegExp.$1; - } - else { - IO.encoding = encoding; - } - }, - - /** - * @default "utf-8" - * @private - */ - encoding: "utf-8", - - /** - * Load the given script. - */ - include: function(relativePath) { - load(SYS.pwd+relativePath); - }, - - /** - * Loads all scripts from the given directory path. - */ - includeDir: function(path) { - if (!path) return; - - for (var lib = IO.ls(SYS.pwd+path), i = 0; i < lib.length; i++) - if (/\.js$/i.test(lib[i])) load(lib[i]); - } -} - -// now run the application -IO.include("frame.js"); -IO.include("main.js"); - -main(); diff --git a/util/jsdoc-toolkit/app/t/TestDoc.js b/util/jsdoc-toolkit/app/t/TestDoc.js deleted file mode 100644 index c0768b71..00000000 --- a/util/jsdoc-toolkit/app/t/TestDoc.js +++ /dev/null @@ -1,144 +0,0 @@ -var TestDoc = { - fails: 0, - plans: 0, - passes: 0, - results: [] -}; - -TestDoc.record = function(result) { - TestDoc.results.push(result); - if (typeof result.verdict == "boolean") { - if (result.verdict === false) TestDoc.fails++; - if (result.verdict === true) TestDoc.passes++; - } -} - -TestDoc.prove = function(filePath) { - if (typeof document != "undefined" && typeof document.write != "undefined") { - if (TestDoc.console) print = function(s) { TestDoc.console.appendChild(document.createTextNode(s+"\n")); } - else print = function(s) { document.write(s+"
"); } - } - TestDoc.run(TestDoc.readFile(filePath)); -} - -TestDoc.run = function(src) { - try { eval(src); } catch(e) { print("# ERROR! "+e); } - - var chunks = src.split(/\/\*t:/); - - var run = function(chunk) { - // local shortcuts - var is = TestDoc.assertEquals; - var isnt = TestDoc.assertNotEquals; - var plan = TestDoc.plan; - var requires = TestDoc.requires; - - try { eval(chunk); } catch(e) { print("# ERROR! "+e); } - } - for (var start = -1, end = 0; (start = src.indexOf("/*t:", end)) > end; start = end) { - run( - src.substring( - start+4, - (end = src.indexOf("*/", start)) - ) - ); - } -} - -TestDoc.Result = function(verdict, message) { - this.verdict = verdict; - this.message = message; -} - -TestDoc.Result.prototype.toString = function() { - if (typeof this.verdict == "boolean") { - return (this.verdict? "ok" : "not ok") + " " + (++TestDoc.report.counter) + " - " + this.message; - } - - return "# " + this.message; -} - -TestDoc.requires = function(file) { - if (!TestDoc.requires.loaded[file]) { - load(file); - TestDoc.requires.loaded[file] = true; - } -} -TestDoc.requires.loaded = {}; - -TestDoc.report = function() { - TestDoc.report.counter = 0; - print("1.."+TestDoc.plans); - for (var i = 0; i < TestDoc.results.length; i++) { - print(TestDoc.results[i]); - } - print("----------------------------------------"); - if (TestDoc.fails == 0 && TestDoc.passes == TestDoc.plans) { - print("All tests successful."); - } - else { - print("Failed " + TestDoc.fails + "/" + TestDoc.plans + " tests, "+((TestDoc.plans == 0)? 0 : Math.round(TestDoc.passes/(TestDoc.passes+TestDoc.fails)*10000)/100)+"% okay. Planned to run "+TestDoc.plans+", did run "+(TestDoc.passes+TestDoc.fails)+".") - } -} - -TestDoc.plan = function(n, message) { - TestDoc.plans += n; - TestDoc.record(new TestDoc.Result(null, message+" ("+n+" tests)")); -} - -TestDoc.assertEquals = function(a, b, message) { - var result = (a == b); - if (!result) message += "\n#\n# " + a + " does not equal " + b + "\n#"; - TestDoc.record(new TestDoc.Result(result, message)); -} - -TestDoc.assertNotEquals = function(a, b, message) { - var result = (a != b); - if (!result) message += "\n#\n# " + a + " equals " + b + "\n#"; - TestDoc.record(new TestDoc.Result(result, message)); -} - -TestDoc.readFile = (function(){ - // rhino - if (typeof readFile == "function") { - return function(url) { - var text = readFile(url); - return text || ""; - } - } - - // a web browser - else { - return function(url) { - var httpRequest; - - if (window.XMLHttpRequest) { // Mozilla, Safari, etc - httpRequest = new XMLHttpRequest(); - } - else if (window.ActiveXObject) { // IE - try { - httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) { - try { - httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); - } - catch (e) { - } - } - } - - if (!httpRequest) { throw "Cannot create HTTP Request."; } - - httpRequest.open('GET', url, false); - httpRequest.send(''); - if (httpRequest.readyState == 4) { - if (httpRequest.status >= 400) { - throw "The HTTP Request returned an error code: "+httpRequest.status; - } - } - - return httpRequest.responseText || ""; - } - } -})(); diff --git a/util/jsdoc-toolkit/app/t/runner.js b/util/jsdoc-toolkit/app/t/runner.js deleted file mode 100644 index 3f9fb4c9..00000000 --- a/util/jsdoc-toolkit/app/t/runner.js +++ /dev/null @@ -1,13 +0,0 @@ -// try: java -jar ../../jsrun.jar runner.js - -load("TestDoc.js"); - -TestDoc.prove("../frame/Opt.js"); -TestDoc.prove("../lib/JSDOC.js"); -TestDoc.prove("../frame/String.js"); -TestDoc.prove("../lib/JSDOC/DocTag.js"); -TestDoc.prove("../lib/JSDOC/DocComment.js"); -TestDoc.prove("../lib/JSDOC/TokenReader.js"); -TestDoc.prove("../lib/JSDOC/Symbol.js"); - -TestDoc.report(); diff --git a/util/jsdoc-toolkit/app/test.js b/util/jsdoc-toolkit/app/test.js deleted file mode 100644 index 2c74f624..00000000 --- a/util/jsdoc-toolkit/app/test.js +++ /dev/null @@ -1,307 +0,0 @@ -load("app/frame/Dumper.js"); -function symbolize(opt) { - symbols = null; - JSDOC.JsDoc(opt); - symbols = JSDOC.JsDoc.symbolSet; -} - -var testCases = [ - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/overview.js"]}); - //print(Dumper.dump(symbols)); - is('symbols.getSymbolByName("My Cool Library").name', 'My Cool Library', 'File overview can be found by alias.'); - } - , - function() { - symbolize({_: [SYS.pwd+"test/name.js"]}); - - is('symbols.getSymbol("Response").name', "Response", 'Virtual class name is found.'); - is('symbols.getSymbol("Response#text").alias', "Response#text", 'Virtual method name is found.'); - is('symbols.getSymbol("Response#text").memberOf', "Response", 'Virtual method parent name is found.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/prototype.js"]}); - - is('symbols.getSymbol("Article").name', "Article", 'Function set to constructor prototype with inner constructor name is found.'); - is('symbols.getSymbol("Article").hasMethod("init")', true, 'The initializer method name of prototype function is correct.'); - is('symbols.getSymbol("Article").hasMember("counter")', true, 'A static property set in the prototype definition is found.'); - is('symbols.getSymbol("Article").hasMember("title")', true, 'An instance property set in the prototype is found.'); - is('symbols.getSymbol("Article#title").isStatic', false, 'An instance property has isStatic set to false.'); - is('symbols.getSymbol("Article.counter").name', "counter", 'A static property set in the initializer has the name set correctly.'); - is('symbols.getSymbol("Article.counter").memberOf', "Article", 'A static property set in the initializer has the memberOf set correctly.'); - is('symbols.getSymbol("Article.counter").isStatic', true, 'A static property set in the initializer has isStatic set to true.'); - } - , - function() { - symbolize({a:true, _: [SYS.pwd+"test/prototype_oblit.js"]}); - - is('symbols.getSymbol("Article").name', "Article", 'Oblit set to constructor prototype name is found.'); - is('typeof symbols.getSymbol("Article.prototype")', "undefined", 'The prototype oblit is not a symbol.'); - is('symbols.getSymbol("Article#getTitle").name', "getTitle", 'The nonstatic method name of prototype oblit is correct.'); - is('symbols.getSymbol("Article#getTitle").alias', "Article#getTitle", 'The alias of non-static method of prototype oblit is correct.'); - is('symbols.getSymbol("Article#getTitle").isStatic', false, 'The isStatic of a nonstatic method of prototype oblit is correct.'); - is('symbols.getSymbol("Article.getTitle").name', "getTitle", 'The static method name of prototype oblit is correct.'); - is('symbols.getSymbol("Article.getTitle").isStatic', true, 'The isStatic of a static method of prototype oblit is correct.'); - is('symbols.getSymbol("Article#getTitle").isa', "FUNCTION", 'The isa of non-static method of prototype oblit is correct.'); - is('symbols.getSymbol("Article.getTitle").alias', "Article.getTitle", 'The alias of a static method of prototype oblit is correct.'); - is('symbols.getSymbol("Article.getTitle").isa', "FUNCTION", 'The isa of static method of prototype oblit is correct.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/prototype_oblit_constructor.js"]}); - - is('symbols.getSymbol("Article").name', "Article", 'Oblit set to constructor prototype with inner constructor name is found.'); - is('symbols.getSymbol("Article#init").name', "init", 'The initializer method name of prototype oblit is correct.'); - is('symbols.getSymbol("Article").hasMember("pages")', true, 'Property set by initializer method "this" is on the outer constructor.'); - is('symbols.getSymbol("Article#Title").name', "Title", 'Name of the inner constructor name is found.'); - is('symbols.getSymbol("Article#Title").memberOf', "Article", 'The memberOf of the inner constructor name is found.'); - is('symbols.getSymbol("Article#Title").isa', "CONSTRUCTOR", 'The isa of the inner constructor name is constructor.'); - is('symbols.getSymbol("Article#Title").hasMember("title")', true, 'A property set on the inner constructor "this" is on the inner constructor.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/inner.js"]}); - - is('symbols.getSymbol("Outer").name', "Outer", 'Outer constructor prototype name is found.'); - is('symbols.getSymbol("Outer").methods.length', 1, 'Inner function doesnt appear as a method of the outer.'); - is('symbols.getSymbol("Outer").hasMethod("open")', true, 'Outer constructors methods arent affected by inner function.'); - is('symbols.getSymbol("Outer-Inner").alias', "Outer-Inner", 'Alias of inner function is found.'); - is('symbols.getSymbol("Outer-Inner").isa', "CONSTRUCTOR", 'isa of inner function constructor is found.'); - is('symbols.getSymbol("Outer-Inner").memberOf', "Outer", 'The memberOf of inner function is found.'); - is('symbols.getSymbol("Outer-Inner").name', "Inner", 'The name of inner function is found.'); - is('symbols.getSymbol("Outer-Inner#name").name', "name", 'A member of the inner function constructor, attached to "this" is found on inner.'); - is('symbols.getSymbol("Outer-Inner#name").memberOf', "Outer-Inner", 'The memberOf of an inner function member is found.'); - } - , - function() { - symbolize({a:true, _: [SYS.pwd+"test/prototype_nested.js"]}); - - is('symbols.getSymbol("Word").name', "Word", 'Base constructor name is found.'); - is('symbols.getSymbol("Word").hasMethod("reverse")', true, 'Base constructor method is found.'); - is('symbols.getSymbol("Word").methods.length', 1, 'Base constructor has only one method.'); - is('symbols.getSymbol("Word").memberOf', "", 'Base constructor memberOf is empty.'); - is('symbols.getSymbol("Word#reverse").name', "reverse", 'Member of constructor prototype name is found.'); - is('symbols.getSymbol("Word#reverse").memberOf', "Word", 'Member of constructor prototype memberOf is found.'); - is('symbols.getSymbol("Word#reverse.utf8").name', "utf8", 'Member of constructor prototype method name is found.'); - is('symbols.getSymbol("Word#reverse.utf8").memberOf', "Word#reverse", 'Static nested member memberOf is found.'); - } - , - function() { - symbolize({a:true, _: [SYS.pwd+"test/namespace_nested.js"]}); - - is('symbols.getSymbol("ns1").name', "ns1", 'Base namespace name is found.'); - is('symbols.getSymbol("ns1").memberOf', "", 'Base namespace memberOf is empty (its a constructor).'); - is('symbols.getSymbol("ns1.ns2").name', "ns2", 'Nested namespace name is found.'); - is('symbols.getSymbol("ns1.ns2").alias', "ns1.ns2", 'Nested namespace alias is found.'); - is('symbols.getSymbol("ns1.ns2").memberOf', "ns1", 'Nested namespace memberOf is found.'); - is('symbols.getSymbol("ns1.ns2.Function1").name', "Function1", 'Method of nested namespace name is found.'); - is('symbols.getSymbol("ns1.ns2.Function1").memberOf', "ns1.ns2", 'Constructor of nested namespace memberOf is found.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/functions_nested.js"]}); - - is('symbols.getSymbol("Zop").name', "Zop", 'Any constructor name is found.'); - is('symbols.getSymbol("Zop").isa', "CONSTRUCTOR", 'It isa constructor.'); - is('symbols.getSymbol("Zop").hasMethod("zap")', true, 'Its method name, set later, is in methods array.'); - is('symbols.getSymbol("Foo").name', "Foo", 'The containing constructor name is found.'); - is('symbols.getSymbol("Foo").hasMethod("methodOne")', true, 'Its method name is found.'); - is('symbols.getSymbol("Foo").hasMethod("methodTwo")', true, 'Its second method name is found.'); - is('symbols.getSymbol("Foo#methodOne").alias', "Foo#methodOne", 'A methods alias is found.'); - is('symbols.getSymbol("Foo#methodOne").isStatic', false, 'A methods is not static.'); - is('symbols.getSymbol("Bar").name', "Bar", 'A global function declared inside another function is found.'); - is('symbols.getSymbol("Bar").isa', "FUNCTION", 'It isa function.'); - is('symbols.getSymbol("Bar").memberOf', "_global_", 'It is global.'); - is('symbols.getSymbol("Foo-inner").name', "inner", 'An inner functions name is found.'); - is('symbols.getSymbol("Foo-inner").memberOf', "Foo", 'It is member of the outer function.'); - is('symbols.getSymbol("Foo-inner").isInner', true, 'It is an inner function.'); - } - , - function() { - symbolize({a:true, _: [SYS.pwd+"test/memberof_constructor.js"]}); - - is('symbols.getSymbol("Circle#Tangent").name', "Tangent", 'Constructor set on prototype using @member has correct name.'); - is('symbols.getSymbol("Circle#Tangent").memberOf', "Circle", 'Constructor set on prototype using @member has correct memberOf.'); - is('symbols.getSymbol("Circle#Tangent").alias', "Circle#Tangent", 'Constructor set on prototype using @member has correct alias.'); - is('symbols.getSymbol("Circle#Tangent").isa', "CONSTRUCTOR", 'Constructor set on prototype using @member has correct isa.'); - is('symbols.getSymbol("Circle#Tangent").isStatic', false, 'Constructor set on prototype using @member is not static.'); - is('symbols.getSymbol("Circle#Tangent#getDiameter").name', "getDiameter", 'Method set on prototype using @member has correct name.'); - is('symbols.getSymbol("Circle#Tangent#getDiameter").memberOf', "Circle#Tangent", 'Method set on prototype using @member has correct memberOf.'); - is('symbols.getSymbol("Circle#Tangent#getDiameter").alias', "Circle#Tangent#getDiameter", 'Method set on prototype using @member has correct alias.'); - is('symbols.getSymbol("Circle#Tangent#getDiameter").isa', "FUNCTION", 'Method set on prototype using @member has correct isa.'); - is('symbols.getSymbol("Circle#Tangent#getDiameter").isStatic', false, 'Method set on prototype using @member is not static.'); - } - , - function() { - symbolize({a:true, p: true, _: [SYS.pwd+"test/memberof.js"]}); - - is('symbols.getSymbol("pack.install").alias', "pack.install", 'Using @memberOf sets alias, when parent name is in memberOf tag.'); - is('symbols.getSymbol("pack.install.overwrite").name', "install.overwrite", 'Using @memberOf sets name, even if the name is dotted.'); - is('symbols.getSymbol("pack.install.overwrite").memberOf', "pack", 'Using @memberOf sets memberOf.'); - is('symbols.getSymbol("pack.install.overwrite").isStatic', true, 'Using @memberOf with value not ending in octothorp sets isStatic to true.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/borrows.js"]}); - - is('symbols.getSymbol("Layout").name', "Layout", 'Constructor can be found.'); - is('symbols.getSymbol("Layout").hasMethod("init")', true, 'Constructor method name can be found.'); - is('symbols.getSymbol("Layout").hasMember("orientation")', true, 'Constructor property name can be found.'); - - is('symbols.getSymbol("Page").hasMethod("reset")', true, 'Second constructor method name can be found.'); - is('symbols.getSymbol("Page").hasMember("orientation")', true, 'Second constructor borrowed property name can be found in properties.'); - is('symbols.getSymbol("Page#orientation").memberOf', "Page", 'Second constructor borrowed property memberOf can be found.'); - is('symbols.getSymbol("Page").hasMethod("myGetInnerElements")', true, 'Can borrow an inner function, add it as a static function.'); - - is('symbols.getSymbol("ThreeColumnPage#init").alias', "ThreeColumnPage#init", 'Third constructor method can be found even though method with same name is borrowed.'); - is('symbols.getSymbol("ThreeColumnPage#reset").alias', "ThreeColumnPage#reset", 'Borrowed method can be found.'); - is('symbols.getSymbol("ThreeColumnPage#orientation").alias', "ThreeColumnPage#orientation", 'Twice borrowed method can be found.'); - - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/borrows2.js"]}); - - is('symbols.getSymbol("Foo").hasMethod("my_zop")', true, 'Borrowed method can be found.'); - is('symbols.getSymbol("Bar").hasMethod("my_zip")', true, 'Second borrowed method can be found.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/constructs.js"]}); - - is('symbols.getSymbol("Person").hasMethod("say")', true, 'The constructs tag creates a class that lends can add a method to.'); - } - , - function() { - symbolize({a: true, _: [SYS.pwd+"test/augments.js", SYS.pwd+"test/augments2.js"]}); - - is('symbols.getSymbol("Page").augments[0]', "Layout", 'An augmented class can be found.'); - is('symbols.getSymbol("Page#reset").alias', "Page#reset", 'Method of augmenter can be found.'); - is('symbols.getSymbol("Page").hasMethod("Layout#init")', true, 'Method from augmented can be found.'); - is('symbols.getSymbol("Page").hasMember("Layout#orientation")', true, 'Property from augmented can be found.'); - is('symbols.getSymbol("Page").methods.length', 3, 'Methods of augmented class are included in methods array.'); - - is('symbols.getSymbol("ThreeColumnPage").augments[0]', "Page", 'The extends tag is a synonym for augments.'); - is('symbols.getSymbol("ThreeColumnPage").hasMethod("ThreeColumnPage#init")', true, 'Local method overrides augmented method of same name.'); - is('symbols.getSymbol("ThreeColumnPage").methods.length', 3, 'Local method count is right.'); - - is('symbols.getSymbol("NewsletterPage").augments[0]', "ThreeColumnPage", 'Can augment across file boundaries.'); - is('symbols.getSymbol("NewsletterPage").augments.length', 2, 'Multiple augments are supported.'); - is('symbols.getSymbol("NewsletterPage").inherits[0].alias', "Junkmail#annoy", 'Inherited method with augments.'); - is('symbols.getSymbol("NewsletterPage").methods.length', 6, 'Methods of augmented class are included in methods array across files.'); - is('symbols.getSymbol("NewsletterPage").properties.length', 1, 'Properties of augmented class are included in properties array across files.'); - } - , - function() { - symbolize({a:true, _: [SYS.pwd+"test/static_this.js"]}); - - is('symbols.getSymbol("box.holder").name', "holder", 'Static namespace name can be found.'); - is('symbols.getSymbol("box.holder.foo").name', "foo", 'Static namespace method name can be found.'); - is('symbols.getSymbol("box.holder").isStatic', true, 'Static namespace method is static.'); - - is('symbols.getSymbol("box.holder.counter").name', "counter", 'Instance namespace property name set on "this" can be found.'); - is('symbols.getSymbol("box.holder.counter").alias', "box.holder.counter", 'Instance namespace property alias set on "this" can be found.'); - is('symbols.getSymbol("box.holder.counter").memberOf', "box.holder", 'Static namespace property memberOf set on "this" can be found.'); - } - , - function() { - symbolize({a:true, p: true, _: [SYS.pwd+"test/lend.js"]}); - - is('symbols.getSymbol("Person").name', "Person", 'Class defined in lend comment is found.'); - is('symbols.getSymbol("Person").hasMethod("initialize")', true, 'Lent instance method name can be found.'); - is('symbols.getSymbol("Person").hasMethod("say")', true, 'Second instance method can be found.'); - is('symbols.getSymbol("Person#sing").isStatic', false, 'Instance method is known to be not static.'); - - is('symbols.getSymbol("Person.getCount").name', "getCount", 'Static method name from second lend comment can be found.'); - is('symbols.getSymbol("Person.getCount").isStatic', true, 'Static method from second lend comment is known to be static.'); - - is('LOG.warnings.filter(function($){if($.indexOf("notok") > -1) return $}).length', 1, 'A warning is emitted when lending to an undocumented parent.'); - } - , - function() { - symbolize({a:true, _: [SYS.pwd+"test/param_inline.js"]}); - - is('symbols.getSymbol("Layout").params[0].type', "int", 'Inline param name is set.'); - is('symbols.getSymbol("Layout").params[0].desc', "The number of columns.", 'Inline param desc is set from comment.'); - is('symbols.getSymbol("Layout#getElement").params[0].name', "id", 'User defined param documentation takes precedence over parser defined.'); - is('symbols.getSymbol("Layout#getElement").params[0].isOptional', true, 'Default for param is to not be optional.'); - is('symbols.getSymbol("Layout#getElement").params[1].isOptional', false, 'Can mark a param as being optional.'); - is('symbols.getSymbol("Layout#getElement").params[1].type', "number|string", 'Type of inline param doc can have multiple values.'); - is('symbols.getSymbol("Layout#Canvas").params[0].type', "", 'Type can be not defined for some params.'); - is('symbols.getSymbol("Layout#Canvas").params[2].type', "int", 'Type can be defined inline for only some params.'); - is('symbols.getSymbol("Layout#rotate").params.length', 0, 'Docomments inside function sig is ignored without a param.'); - is('symbols.getSymbol("Layout#init").params[2].type', "zoppler", 'Doc comment type overrides inline type for param with same name.'); - } - , - function() { - symbolize({a: true, _: [SYS.pwd+"test/shared.js", SYS.pwd+"test/shared2.js"]}); - - is('symbols.getSymbol("Array#some").name', 'some', 'The name of a symbol in a shared section is found.'); - is('symbols.getSymbol("Array#some").alias', 'Array#some', 'The alias of a symbol in a shared section is found.'); - is('symbols.getSymbol("Array#some").desc', "Extension to builtin array.", 'A description can be shared.'); - is('symbols.getSymbol("Array#filter").desc', "Extension to builtin array.\nChange every element of an array.", 'A shared description is appended.'); - is('symbols.getSymbol("Queue").desc', "A first in, first out data structure.", 'A description is not shared when outside a shared section.'); - is('symbols.getSymbol("Queue.rewind").alias', "Queue.rewind", 'Second shared tag can be started.'); - is('symbols.getSymbol("startOver").alias', "startOver", 'Shared tag doesnt cross over files.'); - } - , - function() { - symbolize({a: true, _: [SYS.pwd+"test/config.js"]}); - is('symbols.getSymbol("Contact").params[0].name', 'person', 'The name of a param is found.'); - is('symbols.getSymbol("Contact").params[1].name', 'person.name', 'The name of a param set with a dot name is found.'); - is('symbols.getSymbol("Contact").params[2].name', 'person.age', 'The name of a second param set with a dot name is found.'); - is('symbols.getSymbol("Contact").params[4].name', 'connection', 'The name of a param after config is found.'); - - is('symbols.getSymbol("Family").params[0].name', 'persons', 'Another name of a param is found.'); - is('symbols.getSymbol("Family").params[1].name', 'persons.Father', 'The name of a param+config is found.'); - is('symbols.getSymbol("Family").params[2].name', 'persons.Mother', 'The name of a second param+config is found.'); - is('symbols.getSymbol("Family").params[3].name', 'persons.Children', 'The name of a third param+config is found.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/ignore.js"]}); - is('LOG.warnings.filter(function($){if($.indexOf("undocumented symbol Ignored") > -1) return $}).length', 1, 'A warning is emitted when documenting members of an ignored parent.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/functions_anon.js"]}); - is('symbols.getSymbol("a.b").alias', 'a.b', 'In anonymous constructor this is found to be the container object.'); - is('symbols.getSymbol("a.f").alias', 'a.f', 'In anonymous constructor this can have a method.'); - is('symbols.getSymbol("a.c").alias', 'a.c', 'In anonymous constructor method this is found to be the container object.'); - is('symbols.getSymbol("g").alias', 'g', 'In anonymous function executed inline this is the global.'); - is('symbols.getSymbol("bar2.p").alias', 'bar2.p', 'In named constructor executed inline this is the container object.'); - is('symbols.getSymbol("module.pub").alias', 'module.pub', 'In parenthesized anonymous function executed inline function scoped variables arent documented.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/oblit_anon.js"]}); - is('symbols.getSymbol("opt").name', 'opt', 'Anonymous object properties are created.'); - is('symbols.getSymbol("opt.conf.keep").alias', 'opt.conf.keep', 'Anonymous object first property is assigned to $anonymous.'); - is('symbols.getSymbol("opt.conf.base").alias', 'opt.conf.base', 'Anonymous object second property is assigned to $anonymous.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/params_optional.js"]}); - is('symbols.getSymbol("Document").params.length', 3, 'Correct number of params are found when optional param syntax is used.'); - is('symbols.getSymbol("Document").params[1].name', "id", 'Name of optional param is found.'); - is('symbols.getSymbol("Document").params[1].isOptional', true, 'Optional param is marked isOptional.'); - is('symbols.getSymbol("Document").params[2].name', "title", 'Name of optional param with default value is found.'); - is('symbols.getSymbol("Document").params[2].isOptional', true, 'Optional param with default value is marked isOptional.'); - is('symbols.getSymbol("Document").params[2].defaultValue', " This is untitled.", 'Optional param default value is found.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/synonyms.js"]}); - is('symbols.getSymbol("myObject.myFunc").type', 'function', 'Type can be set to function.'); - } - , - function() { - symbolize({a:true, p:true, _: [SYS.pwd+"test/event.js"]}); - is('symbols.getSymbol("Kitchen#event:cakeEaten").isEvent', true, 'Function with event prefix is an event.'); - is('symbols.getSymbol("Kitchen#cakeEaten").isa', "FUNCTION", 'Function with same name as event isa function.'); - } -]; - -//// run and print results -print(testrun(testCases)); diff --git a/util/jsdoc-toolkit/app/test/addon.js b/util/jsdoc-toolkit/app/test/addon.js deleted file mode 100644 index 88862053..00000000 --- a/util/jsdoc-toolkit/app/test/addon.js +++ /dev/null @@ -1,24 +0,0 @@ -String.prototype.reverse = function() { -} - -String.prototype.reverse.utf8 = function() { -} - -Function.count = function() { -} - -/** @memberOf Function */ -Function.count.reset = function() { -} - -/** @memberOf Function */ -count.getValue = function() { -} - -/** @memberOf Function.prototype */ -getSig = function() { -} - -/** @memberOf Function.prototype */ -Function.prototype.getProps = function() { -} diff --git a/util/jsdoc-toolkit/app/test/anon_inner.js b/util/jsdoc-toolkit/app/test/anon_inner.js deleted file mode 100644 index 227eeee5..00000000 --- a/util/jsdoc-toolkit/app/test/anon_inner.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @name bar - * @namespace - */ - -new function() { - /** - * @name bar-foo - * @function - * @param {number} x - */ - function foo(x) { - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/augments.js b/util/jsdoc-toolkit/app/test/augments.js deleted file mode 100644 index 12e706eb..00000000 --- a/util/jsdoc-toolkit/app/test/augments.js +++ /dev/null @@ -1,31 +0,0 @@ -/** -@constructor -*/ -function Layout(p) { - this.init = function(p) { - } - - this.getId = function() { - } - - /** @type Page */ - this.orientation = "landscape"; -} - -/** -@constructor -@augments Layout -*/ -function Page() { - this.reset = function(b) { - } -} - -/** -@extends Page -@constructor -*/ -function ThreeColumnPage() { - this.init = function(resetCode) { - } -} diff --git a/util/jsdoc-toolkit/app/test/augments2.js b/util/jsdoc-toolkit/app/test/augments2.js deleted file mode 100644 index e8388f0f..00000000 --- a/util/jsdoc-toolkit/app/test/augments2.js +++ /dev/null @@ -1,26 +0,0 @@ -/** -@constructor -*/ -function LibraryItem() { - this.reserve = function() { - } -} - -/** -@constructor -*/ -function Junkmail() { - this.annoy = function() { - } -} - -/** -@inherits Junkmail.prototype.annoy as pester -@augments ThreeColumnPage -@augments LibraryItem -@constructor -*/ -function NewsletterPage() { - this.getHeadline = function() { - } -} diff --git a/util/jsdoc-toolkit/app/test/borrows.js b/util/jsdoc-toolkit/app/test/borrows.js deleted file mode 100644 index 878add0d..00000000 --- a/util/jsdoc-toolkit/app/test/borrows.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -@constructor -*/ -function Layout(p) { - /** initilize 1 */ - this.init = function(p) { - } - - /** get the id */ - this.getId = function() { - } - - /** @type string */ - this.orientation = "landscape"; - - function getInnerElements(elementSecretId){ - } -} - -/** -@constructor -@borrows Layout#orientation as #orientation -@borrows Layout-getInnerElements as myGetInnerElements -*/ -function Page() { - /** reset the page */ - this.reset = function(b) { - } -} - -/** -@constructor -@borrows Layout.prototype.orientation as this.orientation -@borrows Layout.prototype.init as #init -@inherits Page.prototype.reset as #reset -*/ -function ThreeColumnPage() { - /** initilize 2 */ - this.init = function(p) { - } -} diff --git a/util/jsdoc-toolkit/app/test/borrows2.js b/util/jsdoc-toolkit/app/test/borrows2.js deleted file mode 100644 index c0d5ea21..00000000 --- a/util/jsdoc-toolkit/app/test/borrows2.js +++ /dev/null @@ -1,23 +0,0 @@ -// testing circular borrows - -/** - @class - @borrows Bar#zop as this.my_zop -*/ -function Foo() { - /** this is a zip. */ - this.zip = function() {} - - this.my_zop = new Bar().zop; -} - -/** - @class - @borrows Foo#zip as this.my_zip -*/ -function Bar() { - /** this is a zop. */ - this.zop = function() {} - - this.my_zip = new Foo().zip; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/config.js b/util/jsdoc-toolkit/app/test/config.js deleted file mode 100644 index 0748a210..00000000 --- a/util/jsdoc-toolkit/app/test/config.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @constructor - * @param person The person. - * @param {string} person.name The person's name. - * @config {integer} age The person's age. - * @config [id=1] Optional id number to use. - * @param connection - */ -function Contact(person, connection) { - -} - -/** - * @constructor - * @param persons - * @config {string} Father The paternal person. - * @config {string} Mother The maternal person. - * @config {string[]} Children And the rest. - */ -function Family(/**Object*/persons) { - -} diff --git a/util/jsdoc-toolkit/app/test/constructs.js b/util/jsdoc-toolkit/app/test/constructs.js deleted file mode 100644 index cca5dbd3..00000000 --- a/util/jsdoc-toolkit/app/test/constructs.js +++ /dev/null @@ -1,18 +0,0 @@ -var Person = makeClass( - /** - @scope Person - */ - { - /** - This is just another way to define a constructor. - @constructs - @param {string} name The name of the person. - */ - initialize: function(name) { - this.name = name; - }, - say: function(message) { - return this.name + " says: " + message; - } - } -); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/encoding.js b/util/jsdoc-toolkit/app/test/encoding.js deleted file mode 100644 index ba642193..00000000 --- a/util/jsdoc-toolkit/app/test/encoding.js +++ /dev/null @@ -1,10 +0,0 @@ - -/** - * @Constructor - * @desc é…置文件 - * @class 什么也ä¸è¿”回 - */ -function Test(conf) { - // do something; -} - diff --git a/util/jsdoc-toolkit/app/test/encoding_other.js b/util/jsdoc-toolkit/app/test/encoding_other.js deleted file mode 100644 index b144da4c..00000000 --- a/util/jsdoc-toolkit/app/test/encoding_other.js +++ /dev/null @@ -1,12 +0,0 @@ - -/** - * @Constructor - * @desc ðïîÛ - * @class ßàáâãäåæçèçìëêíîï °±²³´µ¡¶·¸¹ - */ -function Test(conf) { - // do something; -} - -// run with commanline option -e=iso-8859-5 - diff --git a/util/jsdoc-toolkit/app/test/event.js b/util/jsdoc-toolkit/app/test/event.js deleted file mode 100644 index 7e41d6f6..00000000 --- a/util/jsdoc-toolkit/app/test/event.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @name Kitchen - * @constructor - * @fires Bakery#event:donutOrdered - */ - -/** - * Fired when some cake is eaten. - * @name Kitchen#event:cakeEaten - * @function - * @param {Number} pieces The number of pieces eaten. - */ - -/** - * Find out if cake was eaten. - * @name Kitchen#cakeEaten - * @function - * @param {Boolean} wasEaten - */ - -/** - * @name getDesert - * @function - * @fires Kitchen#event:cakeEaten - */ - -/** - * @name Bakery - * @constructor - * @extends Kitchen - */ - -/** - * Fired when a donut order is made. - * @name Bakery#event:donutOrdered - * @event - * @param {Event} e The event object. - * @param {String} [e.topping] Optional sprinkles. - */ - -/** - * @constructor - * @borrows Bakery#event:donutOrdered as this.event:cakeOrdered - */ -function CakeShop() { -} - -/** @event */ -CakeShop.prototype.icingReady = function(isPink) { -} - -/** @event */ -function amHungry(/**Boolean*/enoughToEatAHorse) { -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/functions_anon.js b/util/jsdoc-toolkit/app/test/functions_anon.js deleted file mode 100644 index e9dd6c1b..00000000 --- a/util/jsdoc-toolkit/app/test/functions_anon.js +++ /dev/null @@ -1,39 +0,0 @@ -/** an anonymous constructor executed inline */ -a = new function() { - /** a.b*/ - this.b = 1; - /** a.f */ - this.f = function() { - /** a.c */ - this.c = 2; - } -} - - -/** - named function executed inline -*/ -bar1 = function Zoola1() { - /** property of global */ - this.g = 1; -}(); - -/** - named constructor executed inline -*/ -bar2 = new function Zoola2() { - /** property of bar */ - this.p = 1; -}; - -/** module pattern */ -module = (function () { - /** won't appear in documentation */ - var priv = 1; - - /** @scope module */ - return { - /** will appear as a property of module */ - pub: 1 - } -})(); diff --git a/util/jsdoc-toolkit/app/test/functions_nested.js b/util/jsdoc-toolkit/app/test/functions_nested.js deleted file mode 100644 index f044fafe..00000000 --- a/util/jsdoc-toolkit/app/test/functions_nested.js +++ /dev/null @@ -1,33 +0,0 @@ -/** @constructor */ -function Zop() { -} - -/** - @class -*/ -Foo = function(id) { - // this is a bit twisted, but if you call Foo() you will then - // modify Foo(). This is kinda, sorta non-insane, because you - // would have to call Foo() 100% of the time to use Foo's methods - Foo.prototype.methodOne = function(bar) { - alert(bar); - }; - - // same again - Foo.prototype.methodTwo = function(bar2) { - alert(bar2); - }; - - // and these are only executed if the enclosing function is actually called - // and who knows if that will ever happen? - Bar = function(pez) { - alert(pez); - }; - Zop.prototype.zap = function(p){ - alert(p); - }; - - // but this is only visible inside Foo - function inner() { - } -}; diff --git a/util/jsdoc-toolkit/app/test/global.js b/util/jsdoc-toolkit/app/test/global.js deleted file mode 100644 index 5ea48949..00000000 --- a/util/jsdoc-toolkit/app/test/global.js +++ /dev/null @@ -1,13 +0,0 @@ -/** ecks */ -var x = [1, 2, 4]; - -var y = { - foo: function(){ - } -} - -bar = function() { -} - -function zop() { -} diff --git a/util/jsdoc-toolkit/app/test/globals.js b/util/jsdoc-toolkit/app/test/globals.js deleted file mode 100644 index 3f83fb1f..00000000 --- a/util/jsdoc-toolkit/app/test/globals.js +++ /dev/null @@ -1,25 +0,0 @@ -function example(/**Circle*/a, b) { - /** a global defined in function */ - var number = a; - - var hideNumber = function(){ - } - - setNumber = function(){ - } - alert('You have chosen: ' + b); -} - -function initPage() { - var supported = document.createElement && document.getElementsByTagName; - if (!supported) return; - // start of DOM script - var x = document.getElementById('writeroot'); - // etc. -} - -/** an example var */ -var document = new Document(x, y); - -var getNumber = function(){ -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/ignore.js b/util/jsdoc-toolkit/app/test/ignore.js deleted file mode 100644 index d3fac9ed..00000000 --- a/util/jsdoc-toolkit/app/test/ignore.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * A test constructor. - * @constructor - * @ignore - */ -function Ignored() { - /** a method */ - this.bar = function() { - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/inner.js b/util/jsdoc-toolkit/app/test/inner.js deleted file mode 100644 index 37cfa9dc..00000000 --- a/util/jsdoc-toolkit/app/test/inner.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @constructor - */ -function Outer() { - /** - * @constructor - */ - function Inner(name) { - /** The name of this. */ - this.name = name; - } - - this.open = function(name) { - return (new Inner(name)); - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/jsdoc_test.js b/util/jsdoc-toolkit/app/test/jsdoc_test.js deleted file mode 100644 index ee969e0a..00000000 --- a/util/jsdoc-toolkit/app/test/jsdoc_test.js +++ /dev/null @@ -1,477 +0,0 @@ -/** - * @fileoverview This file is to be used for testing the JSDoc parser - * It is not intended to be an example of good JavaScript OO-programming, - * nor is it intended to fulfill any specific purpose apart from - * demonstrating the functionality of the - * JSDoc parser - * - * @author Gabriel Reid gab_reid@users.sourceforge.net - * @version 0.1 - */ - - -/** - * Construct a new Shape object. - * @class This is the basic Shape class. - * It can be considered an abstract class, even though no such thing - * really existing in JavaScript - * @constructor - * @throws MemoryException if there is no more memory - * @throws GeneralShapeException rarely (if ever) - * @return {Shape|Coordinate} A new shape. - */ -function Shape(){ - - /** - * This is an example of a function that is not given as a property - * of a prototype, but instead it is assigned within a constructor. - * For inner functions like this to be picked up by the parser, the - * function that acts as a constructor must be denoted with - * the @constructor tag in its comment. - * @type String - */ - this.getClassName = function(){ - return "Shape"; - } - - /** - * This is an inner method, just used here as an example - * @since version 0.5 - * @author Sue Smart - */ - function addReference(){ - // Do nothing... - } - -} - -/** - * Create a new Hexagon instance. - * @extends Shape - * @class Hexagon is a class that is a logical sublcass of - * {@link Shape} (thanks to the @extends tag), but in - * reality it is completely unrelated to Shape. - * @param {int} sideLength The length of one side for the new Hexagon - * @example - * var h = new Hexagon(2); - * @example - * if (hasHex) { - * hex = new Hexagon(5); - * color = hex.getColor(); - * } - */ -function Hexagon(sideLength) { -} - - -/** - * This is an unattached (static) function that adds two integers together. - * @param {int} One The first number to add - * @param {int} Two The second number to add - * @author Gabriel Reid - * @deprecated So you shouldn't use it anymore! - */ -function Add(One, Two){ - return One + Two; -} - - -/** - * The color of this shape - * @type Color - */ -Shape.prototype.color = null; - -/** - * The border of this shape. - * @field - * @type int - */ -Shape.prototype.border = function(){return border;}; - -/* - * These are all the instance method implementations for Shape - */ - -/** - * Get the coordinates of this shape. It is assumed that we're always talking - * about shapes in a 2D location here. - * @requires The {@link Shape} class - * @returns A Coordinate object representing the location of this Shape - * @type Coordinate[] - */ -Shape.prototype.getCoords = function(){ - return this.coords; -} - -/** - * Get the color of this shape. - * @see #setColor - * @see The Color library. - * @link Shape - * @type Color - */ -Shape.prototype.getColor = function(){ - return this.color; -} - -/** - * Set the coordinates for this Shape - * @param {Coordinate} coordinates The coordinates to set for this Shape - */ -Shape.prototype.setCoords = function(coordinates){ - this.coords = coordinates; -} - -/** - * Set the color for this Shape - * @param {Color} color The color to set for this Shape - * @param other There is no other param, but it can still be documented if - * optional parameters are used - * @throws NonExistantColorException (no, not really!) - * @see #getColor - */ -Shape.prototype.setColor = function(color){ - this.color = color; -} - -/** - * Clone this shape - * @returns A copy of this shape - * @type Shape - * @author Gabriel Reid - */ -Shape.prototype.clone = function(){ - return new Shape(); -} - -/** - * Create a new Rectangle instance. - * @class A basic rectangle class, inherits from Shape. - * This class could be considered a concrete implementation class - * @constructor - * @param {int} width The optional width for this Rectangle - * @param {int} height Thie optional height for this Rectangle - * @author Gabriel Reid - * @see Shape is the base class for this - * @augments Shape - * @hilited - */ -function Rectangle(width, // This is the width - height // This is the height - ){ - if (width){ - this.width = width; - if (height){ - this.height = height; - } - } -} - - -/* Inherit from Shape */ -Rectangle.prototype = new Shape(); - -/** - * Value to represent the width of the Rectangle. - *
Text in bold and italic and a - * link to SourceForge - * @private - * @type int - */ -Rectangle.prototype.width = 0; - -/** - * Value to represent the height of the Rectangle - * @private - * @type int - */ -Rectangle.prototype.height = 0; - -/** - * Get the type of this object. - * @type String - */ -Rectangle.prototype.getClassName= function(){ - return "Rectangle"; -} - -/** - * Get the value of the width for the Rectangle - * @type int - * @see Rectangle#setWidth - */ -Rectangle.prototype.getWidth = function(){ - return this.width; -} - -/** - * Get the value of the height for the Rectangle. - * Another getter is the {@link Shape#getColor} method in the - * {@link Shape} base class. - * @return The height of this Rectangle - * @type int - * @see Rectangle#setHeight - */ -Rectangle.prototype.getHeight = function(){ - return this.height; -} - -/** - * Set the width value for this Rectangle. - * @param {int} width The width value to be set - * @see #setWidth - */ -Rectangle.prototype.setWidth = function(width){ - this.width = width; -} - -/** - * Set the height value for this Rectangle. - * @param {int} height The height value to be set - * @see #getHeight - */ -Rectangle.prototype.setHeight = function(height){ - this.height = height; -} - -/** - * Get the value for the total area of this Rectangle - * @return total area of this Rectangle - * @type int - */ -Rectangle.prototype.getArea = function(){ - return width * height; -} - - -/** - * Create a new Square instance. - * @class A Square is a subclass of {@link Rectangle} - * @param {int} width The optional width for this Rectangle - * @param {int} height The optional height for this Rectangle - * @augments Rectangle - */ -function Square(width, height){ - if (width){ - this.width = width; - if (height){ - this.height = height; - } - } - -} - -/* Square is a subclass of Rectangle */ -Square.prototype = new Rectangle(); - -/** - * Set the width value for this Shape. - * @param {int} width The width value to be set - * @see #getWidth - */ -Square.prototype.setWidth = function(width){ - this.width = this.height = width; -} - -/** - * Set the height value for this Shape - * Sets the {@link Rectangle#height} attribute in the Rectangle. - * @param {int} height The height value to be set - */ -Square.prototype.setHeight = function(height){ - this.height = this.width = height; -} - - -/** - * Create a new Circle instance based on a radius. - * @class Circle class is another subclass of Shape - * @extends Shape - * @param {int} radius The optional radius of this {@link Circle } - * @mixin Square.prototype.setWidth as this.setDiameter - */ -function Circle(radius){ - if (radius) { - /** The radius of the this Circle. */ - this.radius = radius; - } -} - -/* Circle inherits from {@link Shape} */ -Circle.prototype = new Shape(); - -/** - * The radius value for this Circle - * @private - * @type int - */ -Circle.prototype.radius = 0; - -/** - * A very simple class (static) field that is also a constant - * @final - * @type float - */ -Circle.PI = 3.14; - -/** - * Get the radius value for this Circle - * @type int - * @see #setRadius - */ -Circle.prototype.getRadius = function(){ - return this.radius; -} - -/** - * Set the radius value for this Circle - * @param {int} radius The {@link Circle#radius} value to set - * @see #getRadius - */ -Circle.prototype.setRadius = function(radius){ - this.radius = radius; -} - -/** - * An example of a class (static) method that acts as a factory for Circle - * objects. Given a radius value, this method creates a new Circle. - * @param {int} radius The radius value to use for the new Circle. - * @type Circle - */ -Circle.createCircle = function(radius){ - return new Circle(radius); -} - - -/** - * Create a new Coordinate instance based on x and y grid data. - * @class Coordinate is a class that can encapsulate location information. - * @param {int} [x=0] The optional x portion of the Coordinate - * @param {int} [y=0] The optinal y portion of the Coordinate - */ -function Coordinate(x, y){ - if (x){ - this.x = x; - if (y){ - this.y = y; - } - } -} - -/** - * The x portion of the Coordinate - * @type int - * @see #getX - * @see #setX - */ -Coordinate.prototype.x = 0; - -/** - * The y portion of the Coordinate - * @type int - * @see #getY - * @see #setY - */ -Coordinate.prototype.y = 0; - -/** - * Gets the x portion of the Coordinate. - * @type int - * @see #setX - */ -Coordinate.prototype.getX = function(){ - return this.x; -} - -/** - * Get the y portion of the Coordinate. - * @type int - * @see #setY - */ -Coordinate.prototype.getY = function(){ - return this.y; -} - -/** - * Sets the x portion of the Coordinate. - * @param {int} x The x value to set - * @see #getX - */ -Coordinate.prototype.setX = function(x){ - this.x = x; -} - -/** - * Sets the y portion of the Coordinate. - * @param {int} y The y value to set - * @see #getY - */ -Coordinate.prototype.setY = function(y){ - this.y = y; -} - -/** - * @class This class exists to demonstrate the assignment of a class prototype - * as an anonymous block. - */ -function ShapeFactory(){ -} - -ShapeFactory.prototype = { - /** - * Creates a new {@link Shape} instance. - * @return A new {@link Shape} - * @type Shape - */ - createShape: function(){ - return new Shape(); - } -} - -/** - * An example of a singleton class - * @param ... Arguments represent {@link coordinate}s in the shape. - * @constructor - */ -MySingletonShapeFactory = function(){ - - /** - * Get the next {@link Shape} - * @type Shape - * @return A new {@link Shape} - */ - this.getShape = function(){ - return null; - } - -} - - -/** - * Create a new Foo instance. - * @class This is the Foo class. It exists to demonstrate 'nested' classes. - * @constructor - * @see Foo.Bar - */ -function Foo(){} - -/** - * Creates a new instance of Bar. - * @class This class exists to demonstrate 'nested' classes. - * @constructor - * @see Foo.Bar - */ -function Bar(){} - -/** - * Nested class - * @constructor - */ -Foo.Bar = function(){ - /** The x. */ this.x = 2; -} - -Foo.Bar.prototype = new Bar(); -/** The y. */ -Foo.Bar.prototype.y = '3'; diff --git a/util/jsdoc-toolkit/app/test/lend.js b/util/jsdoc-toolkit/app/test/lend.js deleted file mode 100644 index 92b15d5a..00000000 --- a/util/jsdoc-toolkit/app/test/lend.js +++ /dev/null @@ -1,33 +0,0 @@ - /** @class */ -var Person = Class.create( - /** - @lends Person.prototype - */ - { - initialize: function(name) { - this.name = name; - }, - say: function(message) { - return this.name + ': ' + message; - } - } - ); - -/** @lends Person.prototype */ -{ - /** like say but more musical */ - sing: function(song) { - } -} - -/** @lends Person */ -{ - getCount: function() { - } -} - -/** @lends Unknown.prototype */ -{ - notok: function() { - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/memberof.js b/util/jsdoc-toolkit/app/test/memberof.js deleted file mode 100644 index 883bbdeb..00000000 --- a/util/jsdoc-toolkit/app/test/memberof.js +++ /dev/null @@ -1,19 +0,0 @@ -/** @constructor */ -pack = function() { - this.init = function(){} - function config(){} -} - - pack.build = function(task) {}; - -/** @memberOf pack */ -pack.install = function() {} - -/** @memberOf pack */ -pack.install.overwrite = function() {} - -/** @memberOf pack */ -clean = function() {} - -/** @memberOf pack-config */ -install = function() {}; diff --git a/util/jsdoc-toolkit/app/test/memberof_constructor.js b/util/jsdoc-toolkit/app/test/memberof_constructor.js deleted file mode 100644 index 80fde735..00000000 --- a/util/jsdoc-toolkit/app/test/memberof_constructor.js +++ /dev/null @@ -1,17 +0,0 @@ -/** @constructor */ -function Circle(){} - -/** - @constructor - @memberOf Circle# - */ -Circle.prototype.Tangent = function(){}; - -// renaming Circle#Tangent to Circle#Circle#Tangent - -/** - @memberOf Circle#Tangent# - */ -Circle.prototype.Tangent.prototype.getDiameter = function(){}; - - diff --git a/util/jsdoc-toolkit/app/test/name.js b/util/jsdoc-toolkit/app/test/name.js deleted file mode 100644 index e88a51a7..00000000 --- a/util/jsdoc-toolkit/app/test/name.js +++ /dev/null @@ -1,19 +0,0 @@ -/** - @name Response - @class -*/ - -Response.prototype = { - /** - @name Response#text - @function - @description - Gets the body of the response as plain text - @returns {String} - Response as text - */ - - text: function() { - return this.nativeResponse.responseText; - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/namespace_nested.js b/util/jsdoc-toolkit/app/test/namespace_nested.js deleted file mode 100644 index 46cafa2f..00000000 --- a/util/jsdoc-toolkit/app/test/namespace_nested.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - @namespace This is the first namespace. -*/ -ns1 = {}; - -/** - This is the second namespace. - @namespace -*/ -ns1.ns2 = {}; - -/** - This part of ns1.ns2 - @constructor -*/ -ns1.ns2.Function1 = function() { -}; - -ns1.staticFunction = function() { -}; - -/** A static field in a namespace. */ -ns1.ns2.staticField = 1; diff --git a/util/jsdoc-toolkit/app/test/nocode.js b/util/jsdoc-toolkit/app/test/nocode.js deleted file mode 100644 index 1cf99bc9..00000000 --- a/util/jsdoc-toolkit/app/test/nocode.js +++ /dev/null @@ -1,13 +0,0 @@ -/**#nocode+*/ - /** - @name star - @function - */ - function blahblah() { - - } -/**#nocode-*/ - -function yaddayadda() { - -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/oblit_anon.js b/util/jsdoc-toolkit/app/test/oblit_anon.js deleted file mode 100644 index 8d9e9413..00000000 --- a/util/jsdoc-toolkit/app/test/oblit_anon.js +++ /dev/null @@ -1,20 +0,0 @@ -/** the options */ -opt = Opt.get( - arguments, - { - d: "directory", - c: "conf", - "D[]": "define" - } -); - -/** configuration */ -opt.conf = { - /** keep */ - keep: true, - /** base */ - base: getBase(this, {p: properties}) -} - - - diff --git a/util/jsdoc-toolkit/app/test/overview.js b/util/jsdoc-toolkit/app/test/overview.js deleted file mode 100644 index 1dfc09b1..00000000 --- a/util/jsdoc-toolkit/app/test/overview.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @overview This "library" contains a - * lot of classes and functions. - * @example -
-	var x (x < 1);
-	alert("This 'is' \"code\"");
- 
- * @name My Cool Library - * @author Joe Smith jsmith@company.com - * @version 0.1 - */ - -/** - * Gets the current foo - * @param {String} fooId The unique identifier for the foo. - * @return {Object} Returns the current foo. - */ -function getFoo(fooID){ -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/param_inline.js b/util/jsdoc-toolkit/app/test/param_inline.js deleted file mode 100644 index 09845b28..00000000 --- a/util/jsdoc-toolkit/app/test/param_inline.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - @constructor - @param columns The number of columns. -*/ -function Layout(/**int*/columns){ - /** - @param [id] The id of the element. - @param elName The name of the element. - */ - this.getElement = function( - /** string */ elName, - /** number|string */ id - ) { - }; - - /** - @constructor - */ - this.Canvas = function(top, left, /**int*/width, height) { - /** Is it initiated yet? */ - this.initiated = true; - } - - this.rotate = function(/**nothing*/) { - } - - /** - @param x - @param y - @param {zoppler} z*/ - this.init = function(x, y, /**abbler*/z) { - /** The xyz. */ - this.xyz = x+y+z; - this.getXyz = function() { - } - } -} diff --git a/util/jsdoc-toolkit/app/test/params_optional.js b/util/jsdoc-toolkit/app/test/params_optional.js deleted file mode 100644 index 18bf5982..00000000 --- a/util/jsdoc-toolkit/app/test/params_optional.js +++ /dev/null @@ -1,8 +0,0 @@ - -/** - * @param {Page[]} pages - * @param {number} [id] Specifies the id, if applicable. - * @param {String} [title = This is untitled.] Specifies the title. - */ -function Document(pages, id, title){ -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/prototype.js b/util/jsdoc-toolkit/app/test/prototype.js deleted file mode 100644 index 11470083..00000000 --- a/util/jsdoc-toolkit/app/test/prototype.js +++ /dev/null @@ -1,17 +0,0 @@ -/** @constructor */ -function Article() { -} - -Article.prototype.init = function(title) { - /** the instance title */ - this.title = title; - - /** the static counter */ - Article.counter = 1; -} - -a = new Article(); -a.Init("my title"); - -print(a.title); -print(Article.counter); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/prototype_nested.js b/util/jsdoc-toolkit/app/test/prototype_nested.js deleted file mode 100644 index e8ca1ced..00000000 --- a/util/jsdoc-toolkit/app/test/prototype_nested.js +++ /dev/null @@ -1,9 +0,0 @@ -/** @constructor */ -function Word() { -} - -Word.prototype.reverse = function() { -} - -Word.prototype.reverse.utf8 = function() { -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/prototype_oblit.js b/util/jsdoc-toolkit/app/test/prototype_oblit.js deleted file mode 100644 index 6cfc39ca..00000000 --- a/util/jsdoc-toolkit/app/test/prototype_oblit.js +++ /dev/null @@ -1,13 +0,0 @@ -/** @constructor */ -function Article() { -} - -Article.prototype = { - /** instance get title */ - getTitle: function(){ - } -} - -/** static get title */ -Article.getTitle = function(){ -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/prototype_oblit_constructor.js b/util/jsdoc-toolkit/app/test/prototype_oblit_constructor.js deleted file mode 100644 index 92482486..00000000 --- a/util/jsdoc-toolkit/app/test/prototype_oblit_constructor.js +++ /dev/null @@ -1,24 +0,0 @@ -/** @constructor */ -function Article() { -} - -Article.prototype = { - /** @constructor */ - Title: function(title) { - /** the value of the Title instance */ - this.title = title; - }, - - init: function(pages) { - /** the value of the pages of the Article instance */ - this.pages = pages; - } -} - -f = new Article(); -f.init("one two three"); - -t = new f.Title("my title"); - -print(f.pages); -print(t.title); \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/public.js b/util/jsdoc-toolkit/app/test/public.js deleted file mode 100644 index 35d34f6f..00000000 --- a/util/jsdoc-toolkit/app/test/public.js +++ /dev/null @@ -1,10 +0,0 @@ -/**@constructor*/ -function Foo() { - /** - @public - @static - @field - */ - var bar = function(x) { - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/shared.js b/util/jsdoc-toolkit/app/test/shared.js deleted file mode 100644 index e1c277a6..00000000 --- a/util/jsdoc-toolkit/app/test/shared.js +++ /dev/null @@ -1,42 +0,0 @@ - -/** - * Builtin object. - * @class - * @name Array - */ - -/**#@+ - * Extension to builtin array. - * @memberOf Array - * @method - */ - -/** - * @returns Boolen if some array members... - */ -Array.prototype.some = function(){}; - -/** - * Change every element of an array. - * @returns Filtered array copy. - */ -Array.prototype.filter = function(){}; - -/**#@-*/ - - -/** - * A first in, first out data structure. - * @constructor - */ -Queue = function(){}; - -/**#@+ - * Extension to Queue. - * @memberOf Queue - */ - -rewind = function(){ -} - -// should close automatically here. \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/shared2.js b/util/jsdoc-toolkit/app/test/shared2.js deleted file mode 100644 index 3f7736a7..00000000 --- a/util/jsdoc-toolkit/app/test/shared2.js +++ /dev/null @@ -1,2 +0,0 @@ -startOver = function(){ -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/shortcuts.js b/util/jsdoc-toolkit/app/test/shortcuts.js deleted file mode 100644 index f738f1e1..00000000 --- a/util/jsdoc-toolkit/app/test/shortcuts.js +++ /dev/null @@ -1,22 +0,0 @@ -// /**#=+ -// * { -// * 'D': 'Date.prototype', -// * '$N': 'Number' -// * } -// */ -// var D = Date.prototype, -// $N = Number; -// -// D.locale = function(){ -// }; -// -// /** -// @return {string} The cardinal number string. -// */ -// $N.nth = function(n){ -// }; -// -// LOAD.file = function(){ -// } -// -// /**#=-*/ \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/static_this.js b/util/jsdoc-toolkit/app/test/static_this.js deleted file mode 100644 index 9407b20f..00000000 --- a/util/jsdoc-toolkit/app/test/static_this.js +++ /dev/null @@ -1,13 +0,0 @@ -/** the parent */ -var box = {}; - -/** @namespace */ -box.holder = {} - -box.holder.foo = function() { - /** the counter */ - this.counter = 1; -} - -box.holder.foo(); -print(box.holder.counter); diff --git a/util/jsdoc-toolkit/app/test/synonyms.js b/util/jsdoc-toolkit/app/test/synonyms.js deleted file mode 100644 index 09066b98..00000000 --- a/util/jsdoc-toolkit/app/test/synonyms.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - @class - @inherits Bar#zop as #my_zop -*/ -function Foo() { - /** this is a zip. */ - this.zip = function() {} - - /** from Bar */ - this.my_zop = new Bar().zop; -} - -/** - @class - @borrows Foo#zip as this.my_zip -*/ -function Bar() { - /** this is a zop. */ - this.zop = function() {} - - /** from Foo */ - this.my_zip = new Foo().zip; -} - -/** @namespace */ -var myObject = { - /** - @type function - */ - myFunc: getFunction() -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/tosource.js b/util/jsdoc-toolkit/app/test/tosource.js deleted file mode 100644 index 706d4765..00000000 --- a/util/jsdoc-toolkit/app/test/tosource.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @param {Object} object - * @return {string} - */ -function valueOf(object) {} - -/** - * @param {Object} object - * @return {string} - */ -function toString(object) {} - -/** - * @param {Object} object - * @return {string} - */ -function toSource(object) {} - -/** - * @param {Object} object - * @return {string} - */ -function constructor(object) {} \ No newline at end of file diff --git a/util/jsdoc-toolkit/app/test/variable_redefine.js b/util/jsdoc-toolkit/app/test/variable_redefine.js deleted file mode 100644 index 2c07da09..00000000 --- a/util/jsdoc-toolkit/app/test/variable_redefine.js +++ /dev/null @@ -1,14 +0,0 @@ -/** @constructor */ -function Foo() { - var bar = 1; - bar = 2; // redefining a private - - this.baz = 1; - baz = 2; // global - - /** a private */ - var blap = { - /** in here */ - tada: 1 - } -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/changes.txt b/util/jsdoc-toolkit/changes.txt deleted file mode 100644 index 938feaa2..00000000 --- a/util/jsdoc-toolkit/changes.txt +++ /dev/null @@ -1,75 +0,0 @@ -== 2.1.0 == - - * Added support for the @event tag. - * Fixed bug that prevented the : character from appearing in symbol names. - * Fixed bug that prevented underscored symbols marked with @public being tagged as private. (issue #184 ) - * Fixed bug that randomly affected the @memberOf tag when the name of the symbol did not include the parent name. - * Fixed bug that prevented templates that were not in the jsdoc-toolkit folder from being found. ( issue #176 ) - * Added ability to check for trailing slash on template path. ( issue #177 ) - * Modified classDesc so that it no longer is appended with the constructor desc. - * Fixed call to plugin onDocCommentSrc. - * Added missing support for inline doc comments for function return types. ( issue #189 ) - * Added command line option -q, --quiet. - * Added command line option -E, --exclude. ( issue #143 ) - * Added 2 more hooks for plugins. ( issue #163 ) - * Added support for extending built-ins. ( issue #160 ) - * Added "compact" option to JSDOC.JsPlate.prototype.process. ( issue #159 ) - * @augments no longer documents static members as inherited. ( issue #138 ) - * @link to a class now goes to the page for that class, not the constructor. ( issue #178 ) - * Warnings of mismatched curly brace now include filename. ( issue #166 ) - * Fixed bug affecting template paths loaded via a configuration file when the trailing slash is missing. ( issue #191 ) - * Minor optimizations. - -== 2.0.2 == - - * Fixed bug that sometimes caused an example of division in the source code to be interpretted as a regex by the JsDoc Toolkit analyzer. ( issue #158 ) - * Fixed a bug that prevented private variables marked as @public from appearing in the documentation. ( issue #161 ) - * Fixed bug that prevented variable names with underscored properties from appearing in summaries. ( issue #173 ) - -== 2.0.1 == - - * Fixed bug that prevented @fileOverview tag from being recognized. - * Added support for @fieldOf as a synonym for @field plus @memberOf. - * Added support for @name tag in a @fileOverview comment to control the displayed name of the file. - * Added support for multiple @example tags. ( issue #152 ) - * Modified style sheet of jsdoc template to make more readable. ( issue #151 ) - * Fixed bug that prevented @since documentation from displaying correctly when it appeared in a class. ( issue #150 ) - * Fixed bug that caused inhertited properties to sometimes not resolve correctly. ( issue #144 ) - * Modified so that trailing whitespace in @example is always trimmed. ( issue #153 ) - * Added support for elseif to JsPlate. (hat tip to fredck) - * Added support for @location urls in the @overview comment to the jsdoc template. - -== Changes From Versions 1.4.0 to 2.0.0 == - - * Upgraded included version of Rhino from 1.6 to 1.7R1. - * Removed circular references in parsed documentation objects. - * Improved inheritance handling, now properties and events can be inherited same as methods. - * Improved handling of cross-file relationships, now having two related objects in separate files is not a problem. - * Improved ability to recognize membership of previously defined objects. - * Added ability to redefine parsing behavior with plugins. - * @methodOf is a synonym for @function and @memberOf. - * Added @default to document default values of members that are objects. - * Added ability to parse and refer to inner functions. - * Fixed bug that appeared when calling a method to set properties of the instance referred to by "this". - * Added ability to automatically create links to other symbols. - * New "jsdoc" template now produces fully W3C valid XHTML. - * Inline parameter type hint comments are now documented. - * Fixed error: Locally scoped variables (declared with var) no longer appear as global. - * It is now possible to run JsDoc Toolkit from any directory. - * Added support for inline {@link ...} tags. - * Added support for the -H command-line option to allow for custom content handlers. - * Tag names @inherits and @scope changed to @borrows and @lends. - ? Combining @constructor in a doclet with @lends now supported. - * Multiple @lend tags now supported. - * Added support for the @constructs tag, used inside a @lends block. - * Added support for the @constant tag. - * Fixed bug that prevented the use of [] as a default value. - * Added support for the @field tag. - * Added support for the @public tag (applied to inner functions). - * @namespace tag can now be applied to functions, not just object literals. - * Added support for the -s command line option to suppress source code output. - * Added new unit test framework. - * Underscored symbols are now treated as if they have a @private tag by default. - * Improved support for anonymous constructors. - * Added support for the nocode meta tag. - \ No newline at end of file diff --git a/util/jsdoc-toolkit/conf/sample.conf b/util/jsdoc-toolkit/conf/sample.conf deleted file mode 100644 index ad0f08e6..00000000 --- a/util/jsdoc-toolkit/conf/sample.conf +++ /dev/null @@ -1,31 +0,0 @@ -/* - This is an example of one way you could set up a configuration file to more - conveniently define some commandline options. You might like to do this if - you frequently reuse the same options. Note that you don't need to define - every option in this file, you can combine a configuration file with - additional options on the commandline if your wish. - - You would include this configuration file by running JsDoc Toolkit like so: - java -jar jsrun.jar app/run.js -c=conf/sample.conf - -*/ - -{ - // source files to use - _: ['app/test/jsdoc_test.js'], - - // document all functions, even uncommented ones - a: true, - - // including those marked @private - p: true, - - // some extra variables I want to include - D: {generatedBy: "Michael Mathews", copyright: "2008"}, - - // use this directory as the output directory - d: "docs", - - // use this template - t: "templates/jsdoc" -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/java/build.xml b/util/jsdoc-toolkit/java/build.xml deleted file mode 100644 index bb845ce3..00000000 --- a/util/jsdoc-toolkit/java/build.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/util/jsdoc-toolkit/java/build_1.4.xml b/util/jsdoc-toolkit/java/build_1.4.xml deleted file mode 100644 index ab408a4c..00000000 --- a/util/jsdoc-toolkit/java/build_1.4.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/util/jsdoc-toolkit/java/classes/js.jar b/util/jsdoc-toolkit/java/classes/js.jar deleted file mode 100644 index 0352cb18..00000000 Binary files a/util/jsdoc-toolkit/java/classes/js.jar and /dev/null differ diff --git a/util/jsdoc-toolkit/java/src/JsDebugRun.java b/util/jsdoc-toolkit/java/src/JsDebugRun.java deleted file mode 100755 index 319a5c67..00000000 --- a/util/jsdoc-toolkit/java/src/JsDebugRun.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A trivial bootstrap class that simply adds the path to the - * .js file as an argument to the Rhino call. This little hack - * allows the code in the .js file to have access to it's own - * path via the Rhino arguments object. This is necessary to - * allow the .js code to find resource files in a location - * relative to itself. - * - * USAGE: java -jar jsdebug.jar path/to/file.js - */ -public class JsDebugRun { - public static void main(String[] args) { - String[] jsargs = {"-j="+args[0]}; - - String[] allArgs = new String[jsargs.length + args.length]; - System.arraycopy(args, 0, allArgs, 0, args.length); - System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length); - - org.mozilla.javascript.tools.debugger.Main.main(allArgs); - } -} diff --git a/util/jsdoc-toolkit/java/src/JsRun.java b/util/jsdoc-toolkit/java/src/JsRun.java deleted file mode 100644 index 25f519a9..00000000 --- a/util/jsdoc-toolkit/java/src/JsRun.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * A trivial bootstrap class that simply adds the path to the - * .js file as an argument to the Rhino call. This little hack - * allows the code in the .js file to have access to it's own - * path via the Rhino arguments object. This is necessary to - * allow the .js code to find resource files in a location - * relative to itself. - * - * USAGE: java -jar jsrun.jar path/to/file.js - */ -public class JsRun { - public static void main(String[] args) { - String[] jsargs = {"-j="+args[0]}; - - String[] allArgs = new String[jsargs.length + args.length]; - System.arraycopy(args, 0, allArgs, 0, args.length); - System.arraycopy(jsargs, 0, allArgs, args.length ,jsargs.length); - - org.mozilla.javascript.tools.shell.Main.main(allArgs); - } -} diff --git a/util/jsdoc-toolkit/jsdebug.jar b/util/jsdoc-toolkit/jsdebug.jar deleted file mode 100644 index a0ac7daa..00000000 Binary files a/util/jsdoc-toolkit/jsdebug.jar and /dev/null differ diff --git a/util/jsdoc-toolkit/jsrun.jar b/util/jsdoc-toolkit/jsrun.jar deleted file mode 100644 index 49c03f4c..00000000 Binary files a/util/jsdoc-toolkit/jsrun.jar and /dev/null differ diff --git a/util/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl b/util/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl deleted file mode 100644 index 32f43582..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/allclasses.tmpl +++ /dev/null @@ -1,17 +0,0 @@ -
{+new Link().toFile("index.html").withText("Class Index")+} -| {+new Link().toFile("files.html").withText("File Index")+}
-
-

Classes

-
    - -
  • {! - if (thisClass.alias == "_global_") { - output += ""+new Link().toClass(thisClass.alias)+""; - } - else { - output += new Link().toClass(thisClass.alias); - } - !}
  • -
    -
-
\ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl b/util/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl deleted file mode 100644 index 37e9915a..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/allfiles.tmpl +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {! Link.base = ""; /* all generated links will be relative to this */ !} - JsDoc Reference - File Index - - - - - - - {+include("static/header.html")+} - -
- {+publish.classesIndex+} -
- -
-

File Index

- - -
-

{+new Link().toSrc(item.alias).withText(item.name)+}

- {+resolveLinks(summarize(item.desc))+} -
- -
Author:
-
{+item.author+}
-
- -
Version:
-
{+item.version+}
-
- {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !} - -
Location:
- -
{+location+}
-
-
-
-
-
-
- -
-
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - \ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/class.tmpl b/util/jsdoc-toolkit/templates/jsdoc/class.tmpl deleted file mode 100644 index f8debae0..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/class.tmpl +++ /dev/null @@ -1,646 +0,0 @@ - - - - - - {! Link.base = "../"; /* all generated links will be relative to this */ !} - JsDoc Reference - {+data.alias+} - - - - - - - - {+include("static/header.html")+} - - - -
- - {+publish.classesIndex+} - -
- -
- -

- {! - var classType = ""; - - if (data.isBuiltin()) { - classType += "Built-In "; - } - - if (data.isNamespace) { - if (data.is('FUNCTION')) { - classType += "Function "; - } - classType += "Namespace "; - } - else { - classType += "Class "; - } - !} - {+classType+}{+data.alias+} -

- - -

-
Extends - {+ - data.augments - .sort() - .map( - function($) { return new Link().toSymbol($); } - ) - .join(", ") - +}.
-
- - {+resolveLinks(data.classDesc)+} - - {# isn't defined in any file #} -
Defined in: {+new Link().toSrc(data.srcFile)+}. -
-

- - - - - - - - - - - - - - - - - -
{+classType+}Summary
Constructor AttributesConstructor Name and Description
{! - if (data.isPrivate) output += "<private> "; - if (data.isInner) output += "<inner> "; - !}  -
- {+ new Link().toSymbol(data.alias).inner('constructor')+}{+ makeSignature(data.params) +} -
-
{+resolveLinks(summarize(data.desc))+}
-
-
- - - - {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - - - - - - - - - - - - - - - - - -
Field Summary
Field AttributesField Name and Description
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - if (member.isConstant) output += "<constant> "; - !}  -
- {+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+} -
-
{+resolveLinks(summarize(member.desc))+}
-
-
- - -
- {! - var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias}); - - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Fields borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - !} -
-
-
- - - - {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - - - - - - - - - - - - - - - - - -
Method Summary
Method AttributesMethod Name and Description
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !}  -
{+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+}{+makeSignature(member.params)+} -
-
{+resolveLinks(summarize(member.desc))+}
-
-
- - -
- {! - var borrowedMembers = data.methods.filter(function($) {return $.memberOf != data.alias}); - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Methods borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - - !} -
-
-
- - - {! var ownEvents = data.events.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !} - - - - - - - - - - - - - - - - - -
Event Summary
Event AttributesEvent Name and Description
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !}  -
{+member.memberOf+}.{+new Link().toSymbol(member.alias).withText(member.name)+}{+makeSignature(member.params)+} -
-
{+resolveLinks(summarize(member.desc))+}
-
-
- - -
- {! - var borrowedMembers = data.events.filter(function($) {return $.memberOf != data.alias}); - var contributers = []; - borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)}); - for (var i = 0, l = contributers.length; i < l; i++) { - output += - "
Events borrowed from class "+new Link().toSymbol(contributers[i])+":
" - + - "
" + - borrowedMembers - .filter( - function($) { return $.memberOf == contributers[i] } - ) - .sort(makeSortby("name")) - .map( - function($) { return new Link().toSymbol($.alias).withText($.name) } - ) - .join(", ") - + - "
"; - } - - !} -
-
-
- - - -
-
- {+classType+}Detail -
- -
{! - if (data.isPrivate) output += "<private> "; - if (data.isInner) output += "<inner> "; - !} - {+ data.alias +}{+ makeSignature(data.params) +} -
- -
- {+resolveLinks(data.desc)+} -
Author: {+data.author+}.
-
- - - -
{+example+}
-
-
- - - -
-
Parameters:
- -
- {+((item.type)?""+("{"+(new Link().toSymbol(item.type)+"} ")) : "")+} {+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+resolveLinks(data.deprecated)+} -
-
-
- -
-
Since:
-
{+ data.since +}
-
-
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
- - - -
- Field Detail -
- - -
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - if (member.isConstant) output += "<constant> "; - !} - - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+} - -
-
- {+resolveLinks(member.desc)+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Deprecated:
-
- {+ member.deprecated +} -
-
-
- -
-
Since:
-
{+ member.since +}
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
Default Value:
-
- {+resolveLinks(member.defaultValue)+} -
-
-
- -
-
-
- - - -
- Method Detail -
- - -
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !} - - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+}{+makeSignature(member.params)+} - -
-
- {+resolveLinks(member.desc)+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Parameters:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+member.deprecated+} -
-
-
- -
-
Since:
-
{+ member.since +}
-
- -
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
-
- - - -
- Event Detail -
- - -
{! - if (member.isPrivate) output += "<private> "; - if (member.isInner) output += "<inner> "; - if (member.isStatic) output += "<static> "; - !} - - {{+new Link().toSymbol(member.type)+}} - {+member.memberOf+}.{+member.name+}{+makeSignature(member.params)+} - -
-
- {+resolveLinks(member.desc)+} - -
- Defined in: {+new Link().toSrc(member.srcFile)+}. -
-
Author: {+member.author+}.
-
- - - -
{+example+}
-
-
- - -
-
Parameters:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+item.name+} - Optional, Default: {+item.defaultValue+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Deprecated:
-
- {+member.deprecated+} -
-
-
- -
-
Since:
-
{+ member.since +}
-
- -
- -
-
Throws:
- -
- {+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+} {+item.name+} -
-
{+resolveLinks(item.desc)+}
-
-
-
- -
-
Returns:
- -
{+((item.type)?"{"+(new Link().toSymbol(item.type))+"} " : "")+}{+resolveLinks(item.desc)+}
-
-
-
- -
-
Requires:
- -
{+ resolveLinks(item) +}
-
-
-
- -
-
See:
- -
{+ new Link().toSymbol(item) +}
-
-
-
- -
-
-
- -
-
- - - -
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - diff --git a/util/jsdoc-toolkit/templates/jsdoc/index.tmpl b/util/jsdoc-toolkit/templates/jsdoc/index.tmpl deleted file mode 100644 index 61b93cf1..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/index.tmpl +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - JsDoc Reference - Index - - - - - - - {+include("static/header.html")+} - -
- {+publish.classesIndex+} -
- -
-

Class Index

- - -
-

{+(new Link().toSymbol(thisClass.alias))+}

- {+resolveLinks(summarize(thisClass.classDesc))+} -
-
-
- -
-
- ©{+JSDOC.opt.D.copyright+}
- Documentation generated by JsDoc Toolkit {+JSDOC.VERSION+} on {+new Date()+} -
- - \ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/publish.js b/util/jsdoc-toolkit/templates/jsdoc/publish.js deleted file mode 100644 index 7e1cbd79..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/publish.js +++ /dev/null @@ -1,184 +0,0 @@ -/** Called automatically by JsDoc Toolkit. */ -function publish(symbolSet) { - publish.conf = { // trailing slash expected for dirs - ext: ".html", - outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/", - templatesDir: JSDOC.opt.t || SYS.pwd+"../templates/jsdoc/", - symbolsDir: "symbols/", - srcDir: "symbols/src/" - }; - - // is source output is suppressed, just display the links to the source file - if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) { - Link.prototype._makeSrcLink = function(srcFilePath) { - return "<"+srcFilePath+">"; - } - } - - // create the folders and subfolders to hold the output - IO.mkPath((publish.conf.outDir+"symbols/src").split("/")); - - // used to allow Link to check the details of things being linked to - Link.symbolSet = symbolSet; - - // create the required templates - try { - var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl"); - var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl"); - } - catch(e) { - print("Couldn't create the required templates: "+e); - quit(); - } - - // some ustility filters - function hasNoParent($) {return ($.memberOf == "")} - function isaFile($) {return ($.is("FILE"))} - function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)} - - // get an array version of the symbolset, useful for filtering - var symbols = symbolSet.toArray(); - - // create the hilited source code files - var files = JSDOC.opt.srcFiles; - for (var i = 0, l = files.length; i < l; i++) { - var file = files[i]; - var srcDir = publish.conf.outDir + "symbols/src/"; - makeSrcFile(file, srcDir); - } - - // get a list of all the classes in the symbolset - var classes = symbols.filter(isaClass).sort(makeSortby("alias")); - - // create a class index, displayed in the left-hand column of every class page - Link.base = "../"; - publish.classesIndex = classesTemplate.process(classes); // kept in memory - - // create each of the class pages - for (var i = 0, l = classes.length; i < l; i++) { - var symbol = classes[i]; - - symbol.events = symbol.getEvents(); // 1 order matters - symbol.methods = symbol.getMethods(); // 2 - - var output = ""; - output = classTemplate.process(symbol); - - IO.saveFile(publish.conf.outDir+"symbols/", symbol.alias+publish.conf.ext, output); - } - - // regenerate the index with different relative links, used in the index pages - Link.base = ""; - publish.classesIndex = classesTemplate.process(classes); - - // create the class index page - try { - var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl"); - } - catch(e) { print(e.message); quit(); } - - var classesIndex = classesindexTemplate.process(classes); - IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex); - classesindexTemplate = classesIndex = classes = null; - - // create the file index page - try { - var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl"); - } - catch(e) { print(e.message); quit(); } - - var documentedFiles = symbols.filter(isaFile); // files that have file-level docs - var allFiles = []; // not all files have file-level docs, but we need to list every one - - for (var i = 0; i < files.length; i++) { - allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */"))); - } - - for (var i = 0; i < documentedFiles.length; i++) { - var offset = files.indexOf(documentedFiles[i].alias); - allFiles[offset] = documentedFiles[i]; - } - - allFiles = allFiles.sort(makeSortby("name")); - - // output the file index page - var filesIndex = fileindexTemplate.process(allFiles); - IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex); - fileindexTemplate = filesIndex = files = null; -} - - -/** Just the first sentence (up to a full stop). Should not break on dotted variable names. */ -function summarize(desc) { - if (typeof desc != "undefined") - return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc; -} - -/** Make a symbol sorter by some attribute. */ -function makeSortby(attribute) { - return function(a, b) { - if (a[attribute] != undefined && b[attribute] != undefined) { - a = a[attribute].toLowerCase(); - b = b[attribute].toLowerCase(); - if (a < b) return -1; - if (a > b) return 1; - return 0; - } - } -} - -/** Pull in the contents of an external file at the given path. */ -function include(path) { - var path = publish.conf.templatesDir+path; - return IO.readFile(path); -} - -/** Turn a raw source file into a code-hilited page in the docs. */ -function makeSrcFile(path, srcDir, name) { - if (JSDOC.opt.s) return; - - if (!name) { - name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_"); - name = name.replace(/\:/g, "_"); - } - - var src = {path: path, name:name, charset: IO.encoding, hilited: ""}; - - if (defined(JSDOC.PluginManager)) { - JSDOC.PluginManager.run("onPublishSrc", src); - } - - if (src.hilited) { - IO.saveFile(srcDir, name+publish.conf.ext, src.hilited); - } -} - -/** Build output for displaying function parameters. */ -function makeSignature(params) { - if (!params) return "()"; - var signature = "(" - + - params.filter( - function($) { - return $.name.indexOf(".") == -1; // don't show config params in signature - } - ).map( - function($) { - return $.name; - } - ).join(", ") - + - ")"; - return signature; -} - -/** Find symbol {@link ...} strings in text and turn into html links */ -function resolveLinks(str, from) { - str = str.replace(/\{@link ([^} ]+) ?\}/gi, - function(match, symbolName) { - return new Link().toSymbol(symbolName); - } - ); - - return str; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/static/default.css b/util/jsdoc-toolkit/templates/jsdoc/static/default.css deleted file mode 100644 index 97e021ef..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/static/default.css +++ /dev/null @@ -1,162 +0,0 @@ -/* default.css */ -body -{ - font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif; - width: 800px; -} - -.header -{ - clear: both; - background-color: #ccc; - padding: 8px; -} - -h1 -{ - font-size: 150%; - font-weight: bold; - padding: 0; - margin: 1em 0 0 .3em; -} - -hr -{ - border: none 0; - border-top: 1px solid #7F8FB1; - height: 1px; -} - -pre.code -{ - display: block; - padding: 8px; - border: 1px dashed #ccc; -} - -#index -{ - margin-top: 24px; - float: left; - width: 160px; - position: absolute; - left: 8px; - background-color: #F3F3F3; - padding: 8px; -} - -#content -{ - margin-left: 190px; - width: 600px; -} - -.classList -{ - list-style-type: none; - padding: 0; - margin: 0 0 0 8px; - font-family: arial, sans-serif; - font-size: 1em; - overflow: auto; -} - -.classList li -{ - padding: 0; - margin: 0 0 8px 0; -} - -.summaryTable { width: 100%; } - -h1.classTitle -{ - font-size:170%; - line-height:130%; -} - -h2 { font-size: 110%; } -caption, div.sectionTitle -{ - background-color: #7F8FB1; - color: #fff; - font-size:130%; - text-align: left; - padding: 2px 6px 2px 6px; - border: 1px #7F8FB1 solid; -} - -div.sectionTitle { margin-bottom: 8px; } -.summaryTable thead { display: none; } - -.summaryTable td -{ - vertical-align: top; - padding: 4px; - border-bottom: 1px #7F8FB1 solid; - border-right: 1px #7F8FB1 solid; -} - -/*col#summaryAttributes {}*/ -.summaryTable td.attributes -{ - border-left: 1px #7F8FB1 solid; - width: 140px; - text-align: right; -} - -td.attributes, .fixedFont -{ - line-height: 15px; - color: #002EBE; - font-family: "Courier New",Courier,monospace; - font-size: 13px; -} - -.summaryTable td.nameDescription -{ - text-align: left; - font-size: 13px; - line-height: 15px; -} - -.summaryTable td.nameDescription, .description -{ - line-height: 15px; - padding: 4px; - padding-left: 4px; -} - -.summaryTable { margin-bottom: 8px; } - -ul.inheritsList -{ - list-style: square; - margin-left: 20px; - padding-left: 0; -} - -.detailList { - margin-left: 20px; - line-height: 15px; -} -.detailList dt { margin-left: 20px; } - -.detailList .heading -{ - font-weight: bold; - padding-bottom: 6px; - margin-left: 0; -} - -.light, td.attributes, .light a:link, .light a:visited -{ - color: #777; - font-style: italic; -} - -.fineprint -{ - text-align: right; - font-size: 10px; -} \ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/static/header.html b/util/jsdoc-toolkit/templates/jsdoc/static/header.html deleted file mode 100644 index 353b735a..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/static/header.html +++ /dev/null @@ -1,2 +0,0 @@ - \ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/static/index.html b/util/jsdoc-toolkit/templates/jsdoc/static/index.html deleted file mode 100644 index 661f6f67..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/static/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - Generated Javascript Documentation - - - - - - <body> - <p> - This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. - </p> - </body> - - - \ No newline at end of file diff --git a/util/jsdoc-toolkit/templates/jsdoc/symbol.tmpl b/util/jsdoc-toolkit/templates/jsdoc/symbol.tmpl deleted file mode 100644 index f8f4bd1f..00000000 --- a/util/jsdoc-toolkit/templates/jsdoc/symbol.tmpl +++ /dev/null @@ -1,35 +0,0 @@ - - {+data.name+} - {+data.memberOf+} - {+data.isStatic+} - {+data.isa+} - {+data.desc+} - {+data.classDesc+} - - - - {+method.name+} - {+method.memberOf+} - {+method.isStatic+} - {+method.desc+} - - - {+param.type+} - {+param.name+} - {+param.desc+} - {+param.defaultValue+} - - - - - - - - {+property.name+} - {+property.memberOf+} - {+property.isStatic+} - {+property.desc+} - {+property.type+} - - - diff --git a/util/yuicompressor-2.4.2.jar b/util/yuicompressor-2.4.2.jar deleted file mode 100755 index c29470bd..00000000 Binary files a/util/yuicompressor-2.4.2.jar and /dev/null differ